/* Look of the Games stand-ins: LA28's typefaces aren't public. Archivo = LA28 Sans, Libre Caslon
   Condensed = LA28 Serif, Fraunces Italic = LA28 Super (header bottom line only); LA28 Display is the real font. */
@font-face { font-family: Archivo; src: url(fonts/archivo.woff2) format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: 'Libre Caslon Condensed'; src: url(fonts/caslon-cond.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Fraunces; src: url(fonts/fraunces.woff2) format('woff2'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: Fraunces; src: url(fonts/fraunces-italic.woff2) format('woff2'); font-weight: 600 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'LA28 Display'; src: url(fonts/LA28Display-Black.ttf) format('truetype'); font-weight: 900; font-display: swap; }

:root {
  --bg: #f4f1ec; --ink: #000; --muted: #66625c; --line: #dcd7cf; --card: #fff;
  --poppy: #ff470f; --scarlet: #f5128d; --bluebell: #009cd2; --sagebrush: #44d62c; --sun: #f7d500;
  --accent: var(--scarlet);
  --sans: Archivo, system-ui, sans-serif;
  --cond: 'Libre Caslon Condensed', 'Times New Roman', serif;
  --serif: Fraunces, Georgia, serif;
  --ease: cubic-bezier(.7,0,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 15px/1.45 var(--sans); color: var(--ink); background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
.label { margin: 0 0 10px; font: 800 12px/1 var(--sans); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }

/* Page-load colour wipe, as on la28.org: a page-colour panel lifts off a bluebell panel, which lifts off the page. */
.wipe { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.wipe::before, .wipe::after { content: ""; position: absolute; inset: 0; animation: wipe .6s var(--ease) .15s forwards; }
.wipe::before { background: var(--bluebell); }
.wipe::after { background: var(--bg); animation-duration: .75s; animation-delay: 0s; }
@keyframes wipe { to { transform: translateY(-100%); } }
@media (prefers-reduced-motion: reduce) { .wipe { display: none; } }

/* ---------- Concept toggle ---------- */
#concepts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 40; display: inline-flex; align-items: center; }
/* Page header: TVGla mark top left, concept pill top centre, "Created for LA28" top right, all on the pill's 40px line. */
.brand { position: fixed; top: 16px; left: 24px; z-index: 40; height: 40px; }
.made-for { position: fixed; top: 12px; right: 24px; z-index: 40; height: 56px; margin: 0; display: flex; align-items: center; gap: 10px; font: 800 11px/1 var(--sans); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; }
.made-for img { height: 52px; }
@media (max-width: 720px) { .made-for span { display: none; } } /* phones: the emblem alone, so it clears the pill */
/* Segmented toggles (concept nav + Explore zoom): one fixed outline in the LOTG shape (square, one rounded corner)
   that the selected segment nests inside, so the silhouette never changes. White so it reads over the wave. */
#concepts, .zoom { gap: 2px; padding: 3px; background: #fff; box-shadow: 0 10px 24px -10px rgba(0,0,0,.35); }
#concepts button, .zoom button { border: 0; background: none; padding: 6px 14px; font-weight: 800; font-size: 14.5px; transition: background .25s, color .25s; }
#concepts button:not(.on):hover, .zoom button:not(.on):hover { background: var(--bg); }
#concepts button.on, .zoom button.on { background: var(--ink); color: #fff; }
#concepts button:focus-visible, .zoom button:focus-visible { outline: 3px solid var(--bluebell); outline-offset: 2px; }
.changes-pill { position: fixed; z-index: 35; bottom: 24px; left: 50%; transform: translateX(-50%); border: 0; padding: 12px 22px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14.5px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); }
.changes-pill { transition: opacity .3s, display .3s allow-discrete; }
.changes-pill[hidden] { display: none; opacity: 0; }
@starting-style { .changes-pill { opacity: 0; } }

/* ---------- Personas ---------- */
.personas { display: flex; gap: 10px; margin-bottom: 18px; }
.persona { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font-size: 13px; font-weight: 800; color: var(--muted); transition: color .2s; }
.persona img, .shuffle-ic { width: 52px; height: 52px; object-fit: cover; outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .3s, transform .3s var(--ease); }
.persona:hover img, .persona:hover .shuffle-ic { transform: translateY(-2px); }
.persona.on { color: var(--ink); }
.persona.on img { outline-color: var(--accent); }
.shuffle-ic { display: grid; place-items: center; background: var(--ink); color: #fff; }
.shuffle-ic svg { width: 24px; height: 24px; }
.shuffle:active .shuffle-ic { transform: rotate(180deg); }

/* ---------- Profile card (B, D) ---------- */
.pcard { background: var(--card); padding: 22px; box-shadow: 0 14px 34px -22px rgba(0,0,0,.35); }
.pcard-id { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.pcard-photo { width: 88px; height: 88px; object-fit: cover; flex: none; }
.pname { margin: 0; font: 900 32px/1 var(--sans); font-stretch: 125%; text-transform: uppercase; letter-spacing: -.01em; }
.pcity { margin: 4px 0 0; font: 400 17px var(--cond); }
.pblurb { margin: 4px 0 0; font-size: 14.5px; color: var(--muted); }

/* ---------- Timeline ---------- */

/* ---------- Layouts ---------- */
#stage { padding: 30px 24px 60px; }
.stage { min-width: 0; }
.email-wrap { position: relative; display: grid; max-width: 600px; margin: 0 auto; }
.email-wrap > .email { grid-area: 1 / 1; }
.email.leaving { pointer-events: none; }

.la { display: grid; grid-template-columns: 340px 1fr; gap: 40px; max-width: 1180px; margin: 0 auto; align-items: start; }
.sidebar { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; }
.sidebar .personas { margin: 0; }
.field .label { margin-bottom: 8px; }
[data-opt][hidden] { display: none; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.seg-grid { display: flex; flex-wrap: nowrap; gap: 6px; }
.seg-grid button { border: 2px solid var(--line); background: #fff; flex: 1 1 auto; white-space: nowrap; padding: 7px 8px; font-size: 14.5px; font-weight: 700; transition: background .2s, color .2s, border-color .2s; }
.seg-grid button.on { background: var(--ink); color: #fff; border-color: var(--ink); }


/* ---------- Concept 1: Explore (floating panel) ---------- */
body[data-concept="panel"] #stage { padding: 0; }
.la:has(> .rail) { display: block; max-width: none; margin: 0; }
.rail { position: fixed; top: 76px; left: max(16px, 50% - 530px); max-height: calc(100vh - 92px); width: 420px; background: var(--card); box-shadow: 0 24px 50px -24px rgba(0,0,0,.4); overflow: hidden auto; padding: 30px 24px 24px; display: flex; flex-direction: column; gap: 18px; z-index: 10; }
.rail-bloom { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--scarlet); }
.rail-head img { height: 36px; margin-bottom: 10px; }
.rail-head h1 { margin: 0; font: 900 21px/1 var(--sans); font-stretch: 125%; text-transform: uppercase; letter-spacing: -.01em; }
.rail-head p { margin: 4px 0 0; font: 400 15px var(--cond); color: var(--muted); }
.rail .personas { margin: 0; }
.rail .pcard { padding: 0; box-shadow: none; }
.rail .pcard-id { margin: 0; gap: 14px; }
.rail .pcard-photo { width: 76px; height: 76px; }
.rail .pname { font-size: 26px; }
.rail-traits { display: flex; flex-direction: column; gap: 14px; }
.la > .stage { margin-left: calc(max(16px, 50% - 530px) + 460px); max-width: 624px; padding: 76px 24px 60px 0; }
/* Explore zoom toggle: same pill as the concept nav, pinned above the email */
.zoom { position: sticky; top: 76px; z-index: 30; display: flex; width: max-content; margin: 0 auto 14px; } /* look: see #concepts, .zoom above */
.la .email-wrap { transform-origin: 50% 0; transition: transform .6s cubic-bezier(.65,0,.35,1), margin-bottom .6s cubic-bezier(.65,0,.35,1); }

/* ---------- Email ---------- */
.email { container-type: inline-size; width: 100%; }
.inbox { background: #fff; padding: 14px 18px; margin-bottom: 12px; box-shadow: 0 8px 24px -16px rgba(0,0,0,.3); }
.inbox-from { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.inbox-from img { width: 30px; height: 30px; object-fit: cover; }
.inbox-from span { margin-left: auto; color: var(--muted); font-size: 13px; }
.inbox-subject { font-weight: 800; font-size: 17px; margin-top: 8px; }
.inbox-pre { color: var(--muted); font-size: 14.5px; margin-top: 2px; }

.mail { background: none; }
.mail .wrap { width: 100% !important; table-layout: fixed; box-shadow: 0 30px 60px -30px rgba(0,0,0,.4); }
.mail a { pointer-events: none; }

/* Header: rendered live in the demo; build-images.mjs screenshots this exact box (600×460) into the email's header JPG. */
.hdr { position: relative; width: 600px; height: 460px; overflow: hidden; background: #111; transform-origin: 0 0; text-align: left; line-height: normal; }
.hdr-photo { width: 600px; height: 230px; display: grid; overflow: hidden; }
.hero-layer { grid-area: 1 / 1; position: relative; overflow: hidden; }
.hero-layer img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.hdr .m-headline { width: 600px; height: 230px; margin: 0; display: flex; flex-direction: column; }
.hl-line { flex: 1; display: flex; align-items: center; padding: 0 32px; overflow: hidden; white-space: nowrap; } /* no colour transition: a blend would pass through off-palette colours. Bands are whole rows: 2 rows each (3 lines), 3 rows each (2 lines) */
.hl-t { display: inline-block; color: #000; white-space: nowrap; line-height: .9; vertical-align: top; }
.v-wide { font-family: var(--sans); font-stretch: 125%; font-weight: 700; text-transform: uppercase; letter-spacing: -.015em; }
.v-cond { font-family: var(--cond); font-weight: 400; text-transform: uppercase; line-height: .82; }
.v-ital { font-family: var(--serif); font-style: italic; font-weight: 900; line-height: .95; }
.hdr-cell { overflow: hidden; }

/* Mirrors MOBILE_CSS in email.js (real inboxes use the media query; the demo uses the container width). */
@container (max-width: 520px) {
  .mail .pad { padding-left: 20px !important; padding-right: 20px !important; }
  .mail .nav { padding: 12px 16px !important; }
  .mail .nav-a { padding-left: 12px !important; font-size: 11px !important; }
  .mail .cd-num { font-size: 38px !important; }
}

/* Spotlight is Story-only; Explore stays full colour. */
[data-concept="story"] .email [data-slot] { transition: opacity .35s, filter .35s; }
/* Spotlight: while blocks are .changed, everything else in the email dims to black & white.
   Targets the largest subtrees that neither are nor contain a changed block, so nothing is dimmed twice. */
:where(.email *) { transition: filter .4s; }
[data-concept="story"] .email:has(.changed) > :not(.changed, :has(.changed)),
[data-concept="story"] .email :has(.changed) > :not(.changed, :has(.changed)) { filter: grayscale(1) contrast(.25) brightness(1.75); } /* dim + B&W, but opaque: an overlapping layer (headline over hero) must not show through */
[data-concept="story"] .email td.col.dimmed { filter: grayscale(1) contrast(.25) brightness(1.75); } /* story.csv `dim` */

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .rail { position: static; width: auto; margin: 76px 16px 0; }
  .la > .stage { margin-left: 0; max-width: none; padding: 24px 16px 60px; }
  #stage { padding: 64px 16px 60px; }
  .la { grid-template-columns: 1fr; gap: 24px; }
  .sidebar { position: static; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* ---------- Concept 3: story ---------- */
.story { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 48px; max-width: 1280px; margin: 0 auto; align-items: start; }
/* Back/Next sit at a fixed height (bottom of this column: 67vh, or 72px + 450px on short screens, so the tallest beat still clears the header);
   the dots, headline and caption stack upward from them, so beats of any length never move the buttons. `safe` keeps a too-tall beat below the header. */
.story-copy { position: sticky; top: 72px; height: max(calc(67vh - 72px), 450px); display: flex; flex-direction: column; justify-content: safe flex-end; }
.story-card { display: flex; flex-direction: column; gap: 22px; }
.story-title { margin: 0; font: 900 clamp(40px, 5vw, 72px)/.95 var(--sans); font-stretch: 125%; text-transform: uppercase; letter-spacing: -.02em; }
.story-caption { margin: 0; font: 500 20px/1.35 var(--sans); min-height: 3em; }
.story-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.story-nav button { border: 2px solid var(--ink); background: #fff; padding: 10px 20px; font-weight: 800; font-size: 15px; transition: transform .2s, background .2s, color .2s; }
.story-nav button:hover:not(:disabled) { transform: translateY(-2px); }
.story-nav button.primary { background: var(--ink); color: #fff; }
.story-nav button:disabled { opacity: .35; cursor: default; }
@media (max-width: 900px) { .story { grid-template-columns: 1fr; gap: 24px; } .story-copy { position: static; height: auto; } }

/* Story pre-amble: centered headline + arrow. Min-heights hold 2 title lines / 2 caption lines so the arrow doesn't jump between slides. */
.intro { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 24px 16px; text-align: center; }
.intro-title { margin: 0; max-width: 14ch; min-height: 1.84em; font: 900 clamp(48px, 7vw, 104px)/.92 var(--sans); font-stretch: 125%; text-transform: uppercase; letter-spacing: -.02em; }
.intro-sub { margin: 0; max-width: 32ch; min-height: 2.7em; font: 500 22px/1.35 var(--sans); }
.intro-next { width: 64px; height: 64px; margin-top: 12px; border: 0; background: var(--ink); color: #fff; font-size: 28px; transition: translate .2s var(--ease); }
.intro-next:hover { translate: 4px 0; } /* the 0.5s enter animates `translate` too, so the nudge waits for it to settle */

/* Story track: app.js drawTrack() paints the lanes on a canvas; only the canvas fades in here. */
.track { position: fixed; inset: 0; z-index: -1; pointer-events: none; animation: build-up 1.4s var(--ease) backwards; }
.track canvas { width: 100%; height: 100%; display: block; }
/* LA28 wave on every page: a shade darker than the page, top right, fading out diagonally by the middle of the screen.
   It sits under the story track (both are z -1; the track comes later in the DOM).
   Animated by wave.js (canvas.wave-bg); the static SVG below is the fallback until/unless WebGL runs. */
:root { --wave-ink: #e9e4dc; }
@property --wave-a { syntax: '<percentage>'; inherits: true; initial-value: 0%; }
@property --wave-b { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
.wave-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; transition: --wave-a 1.4s var(--ease), --wave-b 1.4s var(--ease);
  -webkit-mask: linear-gradient(to bottom left, #000 var(--wave-a), transparent var(--wave-b)); mask: linear-gradient(to bottom left, #000 var(--wave-a), transparent var(--wave-b)); }
body.wave-full .wave-bg { --wave-a: 100%; --wave-b: 100%; } /* story intro slides: whole screen */
@media (prefers-reduced-motion: reduce) { .wave-bg { transition: none; } }
html:not(.wave-on) body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: #e9e4dc;
  -webkit-mask: linear-gradient(to bottom left, #000, transparent 50%), url(assets/2028_WAVE.svg) right top / cover no-repeat; -webkit-mask-composite: source-in;
  mask: linear-gradient(to bottom left, #000, transparent 50%), url(assets/2028_WAVE.svg) right top / cover no-repeat; mask-composite: intersect; }
.track canvas { position: relative; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
.story { animation: build-up .6s .5s both; }
.story-card { background: var(--bg); box-shadow: 0 0 50px 34px var(--bg); } /* feathered patch hugs the copy (not the tall sticky column), keeps it legible over the lanes */
@keyframes build-up { from { clip-path: inset(100% 0 0 0); } }
.story .stage { padding: 88px 0 0; }
.story .email-wrap { max-width: 520px; transform-origin: 0 0; } /* app.js zoom() frames it per beat */
/* 3D only while the email flies in (app.js flyIn). Left on, Chrome keeps the email as a bitmap rastered at its
   pre-zoom size and stretches it on zoom, so text goes soft; flat, it re-rasters crisp at the zoomed scale. */
.story .stage.flying { perspective: 1100px; perspective-origin: 50% 300px; }
.story .stage.flying .email-wrap { transform-style: preserve-3d; }
@media (min-width: 901px) { body[data-concept="story"] { overflow: hidden; } } /* the camera moves, the page doesn't */
.story .email { background: #fff; box-shadow: 0 30px 60px -20px rgba(60, 20, 10, .45); }
@media (prefers-reduced-motion: reduce) { .track, .story { animation: none; } }
