/* The end of the page: the whole valley, lit job by job; fireworks; the plaque; the last line. */

/* the last frame: the whole screen, cut along its top like every frame, and along its foot like the first */
#finale { margin-top: var(--stop-gap); }
#finale > .top-edge { position: absolute; left: 0; right: 0; top: -1px; height: var(--edge); background: var(--night); -webkit-mask: url("../assets/img/edge/bottom.webp") top / auto 100% repeat-x; mask: url("../assets/img/edge/bottom.webp") top / auto 100% repeat-x; z-index: 5; pointer-events: none; }

/* The lit village lies on the dark one. js/finale.js shows it only round the jobs that are lit, then
   whole; without JavaScript it is simply there. */
#finale .layer.village picture + picture img { z-index: 1; }
#finale .line { z-index: 2; }
/* the fireworks' canvas lies in the sky layer, behind the village: nothing bursts in front of a house */
#finale canvas.fireworks { position: absolute; inset: auto; left: 0; top: 0; width: 100%; pointer-events: none; }
#finale canvas.smoke { position: absolute; inset: auto; pointer-events: none; z-index: 2; }
/* once the lit valley is whole the dark one under it is put away, so the two are never seen together */
#finale.lit .layer.village picture:first-of-type img { visibility: hidden; }
/* a line for a screen reader only: it says when the valley is lit */
#finale .said { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the closing words, placed like the first screen's (the same sky, the same buildings to keep off) */
.closing h2 { font-family: var(--display); font-weight: 500; font-size: var(--closing); line-height: 1.08; color: var(--filament); text-shadow: var(--glow), var(--text-shadow); text-wrap: balance; max-width: 14em; }

/* the plaque: the game's enamel plate, with its name and one line. It arrives when the last spark has gone. */
.plaque { margin-top: 1.1em; width: var(--plaque-w); max-width: 100%; aspect-ratio: 720 / 193; display: grid; align-content: center; justify-items: center; gap: 0.28em; padding: 0 9%; background: center / 100% 100% no-repeat; color: var(--enamel-ink); text-shadow: none; text-align: center; }
.plaque b { font-family: var(--display); font-weight: 700; font-size: var(--plaque-name); line-height: 1; letter-spacing: 0.2em; margin-right: -0.2em; text-transform: uppercase; }
/* (in plain letters, not small capitals: it is the one line that says where the game is coming, and must be read on a phone) */
.plaque span { font-family: var(--ui); font-weight: 600; font-size: var(--plaque-line); letter-spacing: 0.02em; white-space: nowrap; }
html.js .plaque:not(.arrive) { opacity: 0; }
/* its plate is asked for only as the last scene comes near (js/finale.js), not with the first screen */
html:not(.js) .plaque, #finale.near .plaque { background-image: url("../assets/img/board/plate.webp"); }

/* On the narrowest and the shortest screens the words and the plaque sit higher and smaller, to keep off the Bell Tower. */
@container (max-aspect-ratio: 3/5) { .closing { top: 6cqh; } .closing .plaque { margin-top: 0.8em; } }
@container (min-aspect-ratio: 11/10) and (max-height: 480px) { .closing { top: 5cqh; } .closing h2 { font-size: 20px; } .closing .plaque { width: 290px; margin-top: 0.5em; } .closing .plaque b { font-size: 20px; } .closing .plaque span { font-size: 11px; } }

/* the last line of the page */
/* (its sides keep clear of the sound bell in the corner) */
.colophon { padding: 5vh calc(var(--tap) + var(--gutter)) max(5vh, env(safe-area-inset-bottom)); text-align: center; font-family: var(--ui); font-weight: 600; font-size: var(--kind); letter-spacing: var(--kind-track); text-transform: uppercase; color: var(--haze); background: var(--night); }

@keyframes plaque-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .plaque.arrive { animation: plaque-rise var(--plaque-rise) cubic-bezier(0.16, 1, 0.3, 1) both; }
}
