/* Through These Doors — fixed 1920×1080 stage, scaled to the screen by show.js.
   Pixel sizes are real TV sizes: titles ≥ 90px, body ≥ 44px, nothing < 32px. */

:root {
  --navy: #1B2340;
  --navy-deep: #0F1530;
  --night: #0A0E21;
  --gold: #CBA43D;
  --gold-soft: #E3C774;
  --gold-deep: #A5822B;
  --cream: #F7F1E4;
  --muted: #B9BED6;
  --serif: 'Libre Caslon Display', Georgia, serif;
  --serif-text: 'Libre Caslon Text', Georgia, serif;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', Menlo, monospace;
  --fade: 1400ms;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; cursor: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Isolate the unscaled TV canvas from mobile viewport/overflow calculations. */
#viewer { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden; contain: strict; background: #000; }
#viewer:fullscreen { width: 100%; height: 100%; }
#viewer:-webkit-full-screen { width: 100%; height: 100%; }

#stage {
  position: absolute; left: 0; top: 0; width: 1920px; height: 1080px;
  transform-origin: 0 0; overflow: hidden;
  background: var(--night); color: var(--cream); font-family: var(--sans);
}
.layer { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fade) ease-in-out; }
.layer.is-on { opacity: 1; }
.slide { position: absolute; inset: 0; overflow: hidden; }

#toast {
  position: absolute; right: 40px; bottom: 116px; z-index: 20;
  font: 600 32px var(--mono); color: var(--night); background: var(--gold);
  padding: 10px 22px; border-radius: 40px; opacity: 0.92;
}
/* the sound button: bottom-right, on the first few slides of each loop,
   whenever the mouse moves, and always while the sound hasn't started */
#soundBtn {
  position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 21;
  font: 600 14px var(--mono); color: var(--cream); min-height: 44px;
  background: rgba(10, 14, 33, 0.92); border: 2px solid var(--gold);
  padding: 10px 14px; border-radius: 28px; cursor: pointer;
}
#fullscreenBtn { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 21;
  min-height: 44px; padding: 10px 16px; border: 2px solid var(--gold); border-radius: 28px;
  background: rgba(10, 14, 33, 0.92); color: var(--cream); font: 600 14px var(--sans); cursor: pointer; }
#viewer button { touch-action: manipulation; }
#viewer button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; }
#fullscreenHelp { margin: auto; width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto; padding: 24px; border: 1px solid var(--gold); border-radius: 16px;
  color: var(--cream); background: var(--night); font: 400 16px/1.5 var(--sans); cursor: default; }
#fullscreenHelp::backdrop { background: rgba(0, 0, 0, .8); }
#fullscreenHelp h2 { font: 600 24px/1.2 var(--sans); margin-bottom: 14px; }
#fullscreenHelp p, #fullscreenHelp ol { margin-bottom: 18px; }
#fullscreenHelp ol { padding-left: 24px; }
#fullscreenHelp li + li { margin-top: 12px; }
#fullscreenHelp .help-note { font-size: 14px; color: var(--muted); }
#fullscreenHelp button { min-height: 44px; padding: 10px 22px; border: 0; border-radius: 24px;
  background: var(--gold); color: var(--night); font: 600 16px var(--sans); cursor: pointer; }
#soundBtn.off { color: var(--night); background: var(--gold); }
#soundBtn:hover { filter: brightness(1.12); }
body.mouse { cursor: default; }

/* the play/pause and scrub bar: bottom-left, whenever the mouse moves or the
   show is paused. Dragging the slider jumps to that slide. */
#controls {
  position: absolute; left: max(12px, env(safe-area-inset-left)); right: 310px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 21;
  display: flex; align-items: center; gap: 12px; padding: 4px 14px 4px 6px; max-width: 900px;
  background: rgba(10, 14, 33, 0.92); border: 2px solid rgba(203, 164, 61, 0.65); border-radius: 32px;
}
#controls[hidden] { display: none; }
#playBtn { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  font: 700 18px/44px var(--sans); color: var(--night); background: var(--gold); text-align: center; padding: 0; }
#controls .scrub { position: relative; flex: 1; min-width: 0; }
#scrubLabel { position: absolute; bottom: 44px; left: 0; transform: translateX(-50%); white-space: nowrap;
  font: 600 13px var(--mono); color: var(--night); background: var(--gold-soft); padding: 6px 12px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#controls.dragging #scrubLabel { opacity: 1; }
#scrubber { width: 100%; height: 40px; accent-color: var(--gold); cursor: pointer; background: transparent; }
#clock { font: 600 13px var(--mono); color: var(--cream); flex: none; text-align: right; }
@media (max-width: 650px) {
  /* One row: the sound button shrinks to a round icon the height of the bar,
     and the bar stops just short of it. */
  #controls { right: calc(max(12px, env(safe-area-inset-right)) + 64px); }
  #soundBtn { width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
  #soundBtn .snd-label { display: none; }
  #scrubLabel { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
}
/* paused: freeze every animation on screen */
#stage.paused *, #stage.paused *::before, #stage.paused *::after { animation-play-state: paused !important; }
#toast { bottom: auto; top: 54px; }

/* ---------- shared ---------- */
.kicker { font: 600 34px/1.2 var(--mono); letter-spacing: 6px; text-transform: uppercase; color: var(--gold); }
.credit { font: 500 32px/1.3 var(--sans); color: var(--gold-soft); }
.gold { color: var(--gold); }
.center { position: absolute; inset: 0; padding: 54px 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.glow { background: radial-gradient(ellipse at 50% 42%, rgba(203, 164, 61, 0.18), rgba(10, 14, 33, 0) 60%), var(--night); }
.serif-xl { font: 400 132px/1.04 var(--serif); }
.serif-l { font: 400 100px/1.08 var(--serif); }
.serif-m { font: 400 80px/1.12 var(--serif); }
.body-l { font: 500 52px/1.32 var(--sans); color: var(--muted); }
.rule { width: 180px; height: 4px; background: var(--gold); margin: 36px auto; border-radius: 2px; }
.crest { width: 300px; height: 300px; object-fit: contain; }
.bg-photo { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(14px) brightness(0.3) saturate(0.85); animation: drift var(--dur, 10s) ease-in-out both; }
.bg-photo.soft { filter: blur(3px) brightness(0.32) saturate(0.9); }
.over > :not(.bg-photo) { z-index: 1; text-shadow: 0 3px 18px rgba(0, 0, 0, 0.75); }   /* .typed / .center are already absolutely placed */
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1%, -1%); } }

/* ---------- typed lines (the cold open) ---------- */
.typed { position: absolute; inset: 0; padding: 54px 160px; display: flex; flex-direction: column; justify-content: center; gap: 34px; }
.typed .line { font: 400 84px/1.15 var(--serif); color: var(--cream); min-height: 1.15em; }
.typed .line.big { font-size: 120px; color: var(--gold-soft); }
.typed .line .cursor { display: inline-block; width: 6px; height: 0.9em; background: var(--gold); margin-left: 8px; vertical-align: -0.08em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- photo ---------- */
.photo-bg { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(46px) brightness(0.38) saturate(1.1); }
.photo-frame { position: absolute; left: 96px; right: 96px; top: 54px; bottom: 300px; display: flex; align-items: center; justify-content: center; }
.photo-frame img { border: 6px solid rgba(247, 241, 228, 0.92); box-shadow: 0 22px 64px rgba(0, 0, 0, 0.6); animation: kb var(--dur, 8s) ease-in-out both; }
.photo-frame img.alt { animation-name: kb-alt; }
.photo-frame.doc img { border-color: transparent; background: #fff; }
@keyframes kb { from { transform: scale(1); } to { transform: scale(1.05) translate(-0.6%, -0.5%); } }
@keyframes kb-alt { from { transform: scale(1.05) translate(0.6%, 0.4%); } to { transform: scale(1); } }
.caption-band { position: absolute; left: 0; right: 0; bottom: 0; height: 290px; padding: 30px 96px 54px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; background: linear-gradient(to top, rgba(10, 14, 33, 0.97) 0%, rgba(10, 14, 33, 0.9) 82%, rgba(10, 14, 33, 0) 100%); }
.caption-band .caption { font: 600 48px/1.22 var(--sans); max-width: 1660px; }

/* ---------- growth: one frame, four eras, wiped in turn ---------- */
.growth { position: absolute; inset: 0; padding: 54px 96px; }
.growth h2 { font: 400 92px/1.05 var(--serif); text-align: center; }
.growth-frame { position: absolute; left: 160px; right: 160px; top: 190px; bottom: 210px; background: #000; border: 6px solid rgba(247, 241, 228, 0.92); box-shadow: 0 22px 64px rgba(0, 0, 0, 0.6); overflow: hidden; }
.growth-frame .era { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; clip-path: inset(0 0 0 100%); }
.growth-frame .era:first-child { clip-path: inset(0 0 0 0); }
.growth-frame .era.reveal { animation: wipe 1600ms cubic-bezier(.65, 0, .35, 1) both; }
.growth-frame .era img { max-width: 100%; max-height: 100%; }
@keyframes wipe { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
.growth-label { position: absolute; left: 0; right: 0; bottom: 110px; text-align: center; font: 600 54px/1.1 var(--sans); color: var(--cream); }
.growth-label .gold { font-family: var(--mono); }
.growth-credit { position: absolute; left: 0; right: 0; bottom: 54px; text-align: center; min-height: 42px; }

/* ---------- year counter ---------- */
.counter .digits { display: flex; gap: 14px; justify-content: center; }
.counter .digit { width: 190px; height: 270px; background: linear-gradient(#1c2447 0 49.6%, #141a36 50.4% 100%); border-radius: 14px; display: flex; align-items: center; justify-content: center; font: 400 230px/1 var(--serif); color: var(--gold-soft); box-shadow: inset 0 0 0 2px rgba(203, 164, 61, 0.25), 0 18px 40px rgba(0, 0, 0, 0.5); position: relative; }
.counter .digit::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; background: rgba(0, 0, 0, 0.55); }
.counter .then { opacity: 0; transform: translateY(16px); transition: all 900ms ease-out; }
.counter.landed .then { opacity: 1; transform: none; }

/* ---------- mosaic ---------- */
.mosaic { position: absolute; left: 0; right: 0; top: 0; bottom: 290px; display: grid; gap: 10px; padding: 10px; animation: mosaic-in var(--dur, 9s) ease-out both; }
.mosaic.g9 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.mosaic.g6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.mosaic.g4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.mosaic .tile { overflow: hidden; background: #111; opacity: 0; animation: tile-in 900ms ease-out both; }
.mosaic .tile img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.95); }
@keyframes tile-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes mosaic-in { from { transform: scale(1.0); } to { transform: scale(1.03); } }

/* ---------- quote ---------- */
.quote { max-width: 1560px; }
.quote .marks { font: 400 200px/0.6 var(--serif); color: var(--gold); height: 90px; }
.quote .words { font: italic 400 68px/1.3 var(--serif-text); color: var(--cream); }
.quote .who { font: 600 42px/1.3 var(--sans); color: var(--gold-soft); margin-top: 40px; }

/* ---------- poll answers (cards appear one by one) ---------- */
.poll-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 40px; width: 1500px; margin-top: 50px; }
.poll-grid.many { grid-template-columns: repeat(3, 1fr); width: 1680px; gap: 26px 30px; }
.poll-card { text-align: left; padding: 30px 38px; border-radius: 18px; background: rgba(10, 14, 33, 0.66);
  border: 2px solid rgba(203, 164, 61, 0.45); text-shadow: none; animation: tile-in .8s ease-out both; }
.poll-q { font: 600 24px/1.3 var(--mono); letter-spacing: 3px; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.poll-a { font: italic 400 54px/1.2 var(--serif-text); color: var(--cream); }
.poll-grid.many .poll-a { font-size: 44px; }
.poll-grid.small .poll-a { font-size: 34px; line-height: 1.28; }
.poll-who { font: 600 30px/1.3 var(--sans); color: var(--gold-soft); margin-top: 14px; }

/* ---------- the missing 2000s ---------- */
.frames { display: flex; gap: 40px; margin: 40px 0 46px; }
.frames .empty { width: 230px; height: 190px; border: 5px dashed rgba(203, 164, 61, 0.6); border-radius: 10px; display: flex; align-items: center; justify-content: center; font: 400 110px/1 var(--serif); color: rgba(203, 164, 61, 0.7); animation: pulse 2.4s ease-in-out infinite; }
.frames .empty:nth-child(2) { animation-delay: .3s; } .frames .empty:nth-child(3) { animation-delay: .6s; }
.frames .empty:nth-child(4) { animation-delay: .9s; } .frames .empty:nth-child(5) { animation-delay: 1.2s; }
@keyframes pulse { 50% { border-color: rgba(203, 164, 61, 1); color: var(--gold-soft); } }

/* ---------- principals marquee ---------- */
.hall h2 { position: absolute; left: 0; right: 0; top: 54px; text-align: center; font: 400 92px/1.05 var(--serif); }
.hall .track { position: absolute; top: 230px; left: 0; display: flex; gap: 46px; animation: march var(--march, 36s) linear both; will-change: transform; }
.hall .person { width: 380px; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }
.hall .pic { width: 380px; height: 520px; display: flex; align-items: flex-end; justify-content: center; }
.hall .pic img { border: 5px solid rgba(247, 241, 228, 0.92); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55); }
.hall .placeholder { width: 340px; height: 450px; border: 5px solid rgba(247, 241, 228, 0.92); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  background: radial-gradient(circle at 50% 38%, #26315f, var(--navy-deep)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.hall .placeholder .initials { font: 400 110px/1 var(--serif); color: var(--gold); }
.hall .name { font: 700 40px/1.15 var(--sans); margin-top: 22px; text-align: center; }
.hall .years { font: 600 34px/1.2 var(--mono); color: var(--gold); margin-top: 8px; }
.hall .credit { position: absolute; right: 96px; bottom: 54px; }
@keyframes march { from { transform: translateX(1920px); } to { transform: translateX(var(--end, -7000px)); } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 60px 80px; margin-top: 40px; width: 1600px; }
.stat .num { font: 400 150px/1 var(--serif); color: var(--gold-soft); }
.stat .label { font: 600 42px/1.25 var(--sans); color: var(--cream); margin-top: 12px; }

/* ---------- tonight ---------- */
.board { position: absolute; inset: 0; padding: 54px 150px; background: var(--cream); color: var(--navy); display: flex; flex-direction: column; justify-content: center; }
.board .kicker { color: var(--gold-deep); }
.board h2 { font: 400 110px/1.05 var(--serif); color: var(--navy); margin-top: 10px; }
.rows { margin-top: 40px; display: grid; gap: 22px; }
.row { display: grid; grid-template-columns: 340px 1fr; gap: 30px; }
.row .when { font: 600 42px/1.25 var(--mono); color: var(--gold-deep); padding-top: 8px; }
.row .what { font: 600 52px/1.25 var(--sans); }
.row .what span { font-weight: 500; color: rgba(27, 35, 64, 0.7); }
.times { margin-top: 30px; display: grid; gap: 8px; max-width: 1240px; }
.times .t { display: flex; justify-content: space-between; border-bottom: 3px solid rgba(165, 130, 43, 0.35); padding-bottom: 8px; }
.times .dec { font: 400 64px/1.1 var(--serif); }
.times .when { font: 600 50px/1.3 var(--mono); color: var(--gold-deep); }
.board .note { font: 600 46px/1.3 var(--sans); color: rgba(27, 35, 64, 0.8); margin-top: 34px; }
.qr { display: grid; grid-template-columns: 1fr 640px; gap: 80px; align-items: center; padding: 54px 140px 54px 120px; }
.qr .url { font: 700 96px/1.1 var(--sans); color: var(--gold); margin-top: 26px; }
.qr p { font: 500 46px/1.35 var(--sans); color: var(--muted); margin-top: 26px; }
.qr-box { width: 600px; height: 600px; background: #fff; padding: 40px; border-radius: 18px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 8px var(--gold); }
.qr-box img, .qr-box canvas { width: 520px !important; height: 520px !important; image-rendering: pixelated; }
.qr-fallback { font: 700 80px/1.1 var(--sans); color: var(--navy); }

/* ---------- Luisa Rocca: portrait left, words right ---------- */
.rocca-card { display: grid; grid-template-columns: 520px 1fr; gap: 100px; align-items: center; padding: 0 150px 0 170px; }
.rocca-pic { display: flex; justify-content: center; }
.rocca-pic img { width: 500px; height: auto; border: 6px solid rgba(247, 241, 228, 0.92); box-shadow: 0 22px 64px rgba(0, 0, 0, 0.6); }
.rocca-text { text-align: left; }
.rocca-text .rule { margin: 36px 0; }

/* ---------- film: the AI recreations, full screen ---------- */
/* 3px short of every edge: some browsers draw a video one pixel past the
   stage's clip, which showed as a thin bright line along the top and bottom. */
.film-media { position: absolute; top: 3px; left: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: cover; background: var(--night); }
.film-media.still { animation: kb var(--dur, 10s) ease-in-out both; }
.film-video { opacity: 0; transition: opacity 350ms ease-out; background: transparent; }
.film-intro.contain { object-fit: contain; }   /* a document (the labelled poster board), shown whole */
@keyframes film-out { from { opacity: 1; } to { opacity: 0; } }
.film-tag { transition: opacity 1.2s ease-in-out; }
.film.intro-on .film-tag { opacity: 0; }
.film-shade { position: absolute; left: -4px; right: -4px; bottom: -6px; height: 386px;   /* past the edges, so no unshaded sliver */ background: linear-gradient(to bottom, rgba(10, 14, 33, 0), rgba(10, 14, 33, .6) 45%, rgba(10, 14, 33, .9)); }
.film-text { position: absolute; left: 96px; right: 96px; bottom: 64px; text-shadow: 0 3px 18px rgba(0, 0, 0, .7); }
.film-caption { font: italic 400 56px/1.25 var(--serif-text); color: var(--cream); margin-top: 10px; }
.film-credit { font: 500 26px/1.3 var(--sans); color: rgba(247, 241, 228, .75); margin-top: 12px; }
.film-tag { position: absolute; top: 40px; right: 48px; font: 600 26px var(--mono); letter-spacing: 3px; text-transform: uppercase; color: rgba(247, 241, 228, .85); background: rgba(10, 14, 33, .55); padding: 8px 18px; border-radius: 6px; }

/* ---------- finale: the cake photo (cake.jpg) ---------- */
.cake-slide { position: absolute; inset: 0; overflow: hidden; background: #F4EEE6; }
.cake-photo { position: absolute; inset: 0; }   /* held still: a slow zoom made the fine gold detail shimmer */
.cake-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* a warm glow over each real flame, so the candles look lit */
.flicker { position: absolute; border-radius: 50%; mix-blend-mode: screen; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 236, 170, .85) 0%, rgba(255, 196, 80, .45) 32%, rgba(255, 160, 40, 0) 70%);
  animation: flame-glow 1s ease-in-out infinite alternate; }
@keyframes flame-glow { 0% { opacity: .35; transform: scale(.85) translateY(2px); } 40% { opacity: .9; transform: scale(1.08); } 70% { opacity: .55; transform: scale(.95) translateY(-2px); } 100% { opacity: 1; transform: scale(1.12); } }
/* Memory Wall snapshots fading in beside the cake */
.snaps { position: absolute; inset: 0; pointer-events: none; }
.snap { position: absolute; transform: translate(-50%, -50%) rotate(var(--r)); background: #FBF8F1; padding: 14px 14px 8px;
  box-shadow: 0 18px 40px rgba(20, 14, 6, 0.35); opacity: 0; }
.snap img { display: block; }
.snap-year { font: 600 26px/1.5 var(--mono); color: #4a3d28; text-align: center; letter-spacing: 2px; }
@keyframes snap-life {
  0% { opacity: 0; transform: translate(-50%, -46%) rotate(var(--r)); }
  16% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r)); }
  84% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r)); }
  100% { opacity: 0; transform: translate(-50%, -52%) rotate(var(--r)); } }
@keyframes snap-in {
  from { opacity: 0; transform: translate(-50%, -46%) rotate(var(--r)); }
  to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r)); } }
.cake-band { position: absolute; left: 0; right: 0; bottom: 0; height: 270px; padding-top: 70px; text-align: center;
  background: linear-gradient(to bottom, rgba(18, 25, 53, 0) 0%, rgba(18, 25, 53, .82) 38%, rgba(18, 25, 53, .94) 100%); }
.cake-band .kicker { font-size: 30px; }
.lyrics { margin-top: 8px; height: 100px; font: italic 400 76px/1.2 var(--serif-text); color: var(--gold-soft); }
.lyrics span { display: inline-block; animation: lyric-in 700ms ease-out both; }
@keyframes lyric-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.confetti { position: absolute; top: -40px; width: 16px; height: 26px; border-radius: 3px; animation: fall linear infinite; opacity: 0.9; }
@keyframes fall { to { transform: translateY(1200px) rotate(720deg); } }
