/* imni · Coming soon — standalone teaser. All URLs relative (./assets/…). */
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(./assets/geist-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #070b14;
  --paper: #f6f7f2;
  --body: #9ba6b5;
  --lime: #c9e73e;
  --rim: rgba(201, 231, 62, .5);
  --rule: rgba(228, 236, 243, .12);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fade: 300ms;     /* line fade between acts (FADE_MS in app.js) */
  --act: 900ms;      /* Nia's light changing between acts */
  --arrive: 700ms;   /* each friend arriving in act 2 (staggered 260 ms) */
  --withdraw: 560ms; /* friends withdrawing in act 3 */
  --gutter: clamp(20px, 6vw, 64px);
  color-scheme: dark;
  color: var(--paper);
  background: var(--ink);
  font-family: Geist, system-ui, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html, body { margin: 0; }

/* One centred scene: no header or footer tracks. */
body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  padding: 24px var(--gutter);
  background:
    radial-gradient(40% 32% at 50% 44%, rgba(201, 231, 62, .045), transparent 70%),
    radial-gradient(80% 60% at 50% 100%, rgba(17, 27, 61, .7), transparent 70%),
    var(--ink);
}

[hidden] { display: none !important; }

/* Loading. The scene is hidden and a restrained numeric percentage is shown
   until app.js reports real readiness (html.cs-ready). If app.js never runs,
   the failsafe animations reveal the static scene after 10 s; app.js turns
   them off as soon as it starts (html.cs-js). <noscript> skips the loader. */
.loader {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  margin: 0;
  color: rgba(246, 247, 242, .5);
  font-size: 13px; line-height: 1; font-weight: 500;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  animation: cs-failsafe-hide 0s 10s forwards;
}
.stage { visibility: hidden; opacity: 0; animation: cs-failsafe-show 0s 10s forwards; }
html.cs-js .loader, html.cs-js .stage { animation: none; }
html.cs-ready .loader { opacity: 0; visibility: hidden; transition: opacity 180ms var(--ease), visibility 0s 180ms; }
html.cs-ready .stage { visibility: visible; opacity: 1; transition: opacity 220ms var(--ease); }
@keyframes cs-failsafe-hide { to { visibility: hidden; opacity: 0; } }
@keyframes cs-failsafe-show { to { visibility: visible; opacity: 1; } }

/* Switching acts behind the loader must not leave a transition in flight. */
.no-trans, .no-trans * { transition: none !important; }

/* Main: one line + one Nia anchor. The three acts (data-act on .frame:
   hello → together → soon) only change Nia's light and the friends around
   her; Nia herself never moves or swaps, so the story reads as one scene. */
.stage { position: relative; display: grid; place-items: center; min-width: 0; max-width: 100%; }
.frame {
  display: grid; justify-items: center; gap: clamp(22px, 4.5vh, 40px);
  margin: 0; min-width: 0; max-width: 100%;
}

/* Fixed square visual box: everything composes inside it (no CLS). */
.visual {
  --size: clamp(184px, 32vh, 260px);
  position: relative;
  display: grid; place-items: center;
  width: var(--size); height: var(--size);
}

/* Nia: same size and position in every act; only her light changes. */
.art {
  display: block;
  width: 64%; height: 64%;
  object-fit: contain;
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
  transition: filter var(--act) var(--ease);
}
/* Act 1 · Hello. — presence: Nia revealed with a lime rim. */
.frame[data-act="hello"] .art {
  filter: brightness(.66) saturate(.85) drop-shadow(0 0 1px rgba(201, 231, 62, .7)) drop-shadow(0 0 22px rgba(201, 231, 62, .16));
}
/* Act 2 · Together. — a touch quieter so the friends share the light. */
.frame[data-act="together"] .art {
  filter: brightness(.56) saturate(.8) drop-shadow(0 0 1px rgba(201, 231, 62, .6)) drop-shadow(0 0 18px rgba(201, 231, 62, .12));
}
/* Act 3 · Coming soon. — Nia dims into a restrained glow. */
.frame[data-act="soon"] .art {
  filter: brightness(.22) saturate(.4) drop-shadow(0 0 1px rgba(201, 231, 62, .5)) drop-shadow(0 0 28px rgba(201, 231, 62, .2));
}

/* Friends: three existing portraits in a low arc around Nia. Hidden (drawn
   in toward Nia) except in act 2, where they arrive one by one; in act 3
   they withdraw back toward her, faster and in reverse order. */
.friends { position: absolute; inset: 0; pointer-events: none; }
.friends img {
  position: absolute;
  width: 24%; height: 24%;
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--ink);
  background: #141b2e;
  box-shadow: 0 0 0 1px rgba(201, 231, 62, .22);
  filter: brightness(.6) saturate(.7);
  opacity: 0;
  transform: translate(var(--dx), var(--dy)) scale(.72);
  transition: opacity var(--withdraw) var(--ease), transform var(--withdraw) var(--ease);
}
.friends img:nth-child(1) { left: 3%; top: 56%; --dx: 60%; --dy: -40%; transition-delay: 160ms; }
.friends img:nth-child(2) { left: 38%; top: 76%; --dx: 0%; --dy: -70%; transition-delay: 80ms; }
.friends img:nth-child(3) { right: 3%; top: 56%; --dx: -60%; --dy: -40%; transition-delay: 0ms; }
.frame[data-act="together"] .friends img {
  opacity: 1; transform: none;
  transition-duration: var(--arrive);
}
.frame[data-act="together"] .friends img:nth-child(1) { transition-delay: 0ms; }
.frame[data-act="together"] .friends img:nth-child(2) { transition-delay: 260ms; }
.frame[data-act="together"] .friends img:nth-child(3) { transition-delay: 520ms; }
.friends img.is-broken, .friends img:not([src]), .art.is-broken { display: none; }

/* The line: a stable slot sized by the (hidden) full word; the typed prefix
   is left-aligned over it, so the text never re-centres while typing and the
   caret sits right after the last typed character. */
.line {
  margin: 0; max-width: 100%;
  font-size: clamp(28px, 8.5vw, 56px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.02em;
  text-align: center;
  white-space: nowrap;
}
.slot { display: inline-grid; vertical-align: top; }
.ghost, .typed { grid-area: 1 / 1; white-space: pre; }
.ghost { visibility: hidden; padding-right: .16em; }
.typed { justify-self: start; }
/* Act changes: the complete word fades out (300 ms), then the next one is
   typed into a fully opaque line (no fade-in, so typing starts crisp). */
.frame.is-fading .line { opacity: 0; transition: opacity var(--fade) var(--ease); }
#lineTyped {
  background: linear-gradient(90deg, #fff, #b8bcc4);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.caret {
  display: inline-block;
  width: .07em; height: .9em;
  margin-left: .08em;
  vertical-align: -.08em;
  border-radius: 1px;
  background: var(--lime);
  opacity: .85;
}
.frame[data-phase="hold"] .caret { animation: caret-blink 1s steps(1, end) infinite; }
.frame[data-phase="reset"] .caret { opacity: 0; } /* the quiet beat before act 1 */
.frame.is-paused[data-phase="reset"] .caret { opacity: .85; } /* paused there: not an empty line */
.frame.is-paused .caret, .frame.is-static .caret { animation: none; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* Pause/play: the whole scene is the target, with no visible control. Only
   keyboard focus draws a quiet ring around the scene. */
.scene-toggle {
  position: absolute; inset: -12px;
  margin: 0; padding: 0;
  border: 0; border-radius: 28px;
  background: transparent;
  color: inherit; font: inherit;
  cursor: default;
  -webkit-appearance: none; appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.scene-toggle:focus { outline: none; }
.scene-toggle:focus-visible { outline: 2px solid var(--rim); outline-offset: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-height: 520px) { .visual { --size: 150px; } }

@media (prefers-reduced-motion: reduce) {
  .art, .friends img, .frame.is-fading .line, html.cs-ready .loader, html.cs-ready .stage { transition: none !important; }
  .caret, .frame[data-phase="hold"] .caret { animation: none; }
}

@media (forced-colors: active) {
  #lineTyped { -webkit-text-fill-color: currentColor; background: none; }
  .caret { background: CanvasText; }
  .scene-toggle:focus-visible { outline-color: Highlight; }
}

/* One-play ending: crop only the authentic text from the existing Figma
   lockup (320 x 112), preserving its original glyphs and lime dot. */
.wordmark {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  opacity: 1; visibility: visible; line-height: 0;
  transition: opacity 600ms var(--ease);
}
.wordmark-crop {
  position: relative; display: block; overflow: hidden;
  width: clamp(144px, 42vw, 208px); aspect-ratio: 25 / 11;
}
.wordmark-crop img {
  position: absolute; width: 160%; height: auto; max-width: none;
  left: -60%; top: -13.6364%;
}
.wordmark-fallback { display: none; }
.wordmark.is-broken .wordmark-crop { display: none; }
.wordmark.is-broken .wordmark-fallback {
  display: block; color: var(--paper); line-height: 1;
  font-size: clamp(64px, 18vw, 112px); font-weight: 700; letter-spacing: -.07em;
}
.frame {
  opacity: 0; visibility: hidden;
  transition: opacity 300ms var(--ease), visibility 0s 300ms;
}
html.cs-playing .frame { opacity: 1; visibility: visible; transition: none; }
html.cs-playing .wordmark { opacity: 0; visibility: hidden; transition: none; }
html.cs-finished .frame * { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .frame, .wordmark { transition: none !important; }
}
