/* finale.css · owned by the finale builder (SPEC §6.5, §5.4). The page's one dark band, full bleed from its first
   pixel; the screen powering on is its one event. The footer is the band's sibling (contentinfo), night as well. */

.finale, .finale__foot { background: var(--night); color: var(--night-ink); }
.finale { position: relative; isolation: isolate; overflow: clip; display: flex; flex-direction: column; min-height: calc(100svh - 80px); }
.finale > .wrap { width: 100%; }

/* ≥ 1024: copy in the start column (6/12), vertically centred; the end column (5/12) holds the reading:
   label, the giant on its hairline, and under it the device it belongs to, standing on the footer rule.
   --sh: the screen height, fitted so band and footer are one screen at the last scroll. */
.finale__in {
  --sh: clamp(380px, calc(100svh - 360px), 520px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s5); align-items: center;
  flex: 1; padding-block: calc(var(--nav-h) + var(--s6)) 0;
}
.finale__copy { grid-column: 1 / span 6; padding-bottom: var(--s7); }
.finale__end { grid-column: 8 / span 5; align-self: end; display: flex; flex-direction: column; }

/* copy */
.finale__h { font-size: var(--t-h2-finale); color: var(--night-ink); }
.finale__line { margin-top: var(--s5); max-width: 34em; font-size: var(--t-line); line-height: 1.55; color: var(--night-ink-2); }
.finale__acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); margin-top: var(--s7); }
.finale__try { min-height: 44px; color: var(--night-ink); }

/* the reading: label over the giant, the giant standing on its hairline */
.finale__read { container-type: inline-size; min-width: 0; }
.finale__label { font-size: var(--t-line); line-height: 1.55; color: var(--night-ink-2); }
.finale__giantline { margin-top: var(--s2); line-height: 1; margin-bottom: -.2em; }  /* digits stand on the hairline */
.finale__giant {
  /* fit to the column: --em is #0044's width in em (finale.js measures it once the face is in) */
  font-size: calc(100cqi / var(--em, 6.0117)); color: var(--night-ink);
  opacity: .45; transition: opacity 400ms ease-out;   /* standby: 4.13 on night, large text only */
}
.finale.is-lit .finale__giant { opacity: 1; }
.finale__floor { height: 1px; background: var(--night-line); margin-bottom: var(--s6); }

/* the device: rim #1F2024, a 1:2 screen, off until it scrolls half into view */
.finale__device { position: relative; align-self: center; }
.finale__glow {
  position: absolute; inset: -30% -60%; z-index: -1; pointer-events: none;
  background: var(--glow); opacity: 0; transition: opacity 300ms ease-out;
}
.finale.is-lit .finale__glow { opacity: .55; transition-duration: 400ms; }
.finale.is-lit.is-on .finale__glow { opacity: 1; }       /* CTA hover / focus: a brightening, never the event */
.finale__rim { padding: 8px; border-radius: 31px 31px 0 0; background: #1F2024; box-shadow: inset 0 1px 0 #34363B; padding-bottom: 0; }
.finale__screen { position: relative; height: var(--sh); aspect-ratio: 1 / 2; border-radius: 23px 23px 0 0; overflow: clip; background: #16171A; isolation: isolate; }
.finale__screen::after {   /* one faint diagonal reflection while off; gone once the screen is on */
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; transition: opacity 400ms ease-out;
  background: linear-gradient(118deg, transparent 38%, rgb(255 255 255 / .045) 38%, rgb(255 255 255 / .015) 62%, transparent 62%);
}
.finale.is-lit .finale__screen::after { opacity: 0; }
.finale__on { position: absolute; inset: 0; opacity: 0; background: #F5F4F0; }
/* the rebuilt setup-1 lays out at 320 × 640 (as in the console) and is drawn at --k = screen width / 320 (finale.js) */
.finale__state { position: absolute; top: 0; inset-inline-start: 0; width: 320px; height: 640px; transform: scale(var(--k, .8125)); transform-origin: top right; }
html[dir="ltr"] .finale__state { transform-origin: top left; }

/* footer line (§5.4): the night continues under the band; a 1px rule above */
.finale__footline {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 0; row-gap: 0;
  padding-block: var(--s3) var(--s5); border-top: 1px solid var(--night-line);
  font-size: var(--t-small); line-height: 1.4; color: var(--night-ink-2);
}
.finale__footline > * { display: inline-flex; align-items: center; min-height: 44px; }
.finale__footline > * + *::before { content: "·"; display: inline-block; margin-inline: 8px; }
.finale__footline a { text-decoration: none; }
@media (hover: hover) { .finale__footline a:hover { color: var(--night-ink); text-decoration: underline; } }

/* < 1024: one column; the giant on the hairline, then the screen edge to edge, sized to the state */
@media (max-width: 1023.98px) {
  .finale { min-height: 0; }
  .finale__in { grid-template-columns: minmax(0, 1fr); padding-block: var(--s8) 0; }
  .finale__copy, .finale__end { grid-column: 1; }
  .finale__copy { padding-bottom: 0; }
  .finale__end { margin-top: var(--s8); }
  .finale__giant { font-size: min(22vw, 12svh); }
  .finale__floor { margin-bottom: 0; }
  .finale__device { align-self: stretch; }
  .finale__glow { inset: -10% -20% 20%; }
  .finale__rim { padding: 0; border-radius: 24px 24px 0 0; background: none; box-shadow: none; }
  .finale__screen { width: 100%; height: auto; aspect-ratio: auto; border-radius: 24px 24px 0 0; box-shadow: inset 0 0 0 1px var(--night-line); }
  /* the box takes the state's height down to the address line (finale.js sets --cut), so the field and caret show */
  .finale__on { position: relative; inset: auto; height: var(--cut, 440px); }
  .finale__state { width: 100%; height: 640px; transform: none; }
}
@media (max-width: 767.98px) {
  .finale__h { font-size: 30px; }
  .finale__acts { flex-direction: column; align-items: stretch; margin-top: var(--s6); gap: var(--s3); }
  .finale__cta { width: 100%; }
  .finale__try { white-space: normal; text-align: center; }
  .finale__label { font-size: 15px; }
  /* 390: the © on its own row, then the links spaced by gaps (a wrapped row never starts with a dot) */
  .finale__footline { column-gap: var(--s4); }
  .finale__footline > :first-child { flex-basis: 100%; min-height: 32px; }
  .finale__footline > * + *::before { display: none; }
}
