/* 11:59 teaser (cinematic).
   Palette: crushed black, hot magenta tube, toxic lime tube.
   Fonts are self-hosted, SIL OFL 1.1 (see /fonts/licenses). */

@font-face {
  font-family: "DSEG7";
  src: url("/fonts/dseg7-classic-bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: block;
}
@font-face {
  font-family: "Tilt Neon";
  src: url("/fonts/tilt-neon.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ink: #000;
  --magenta: #ff2bd6;
  --magenta-hot: #ff7eea;
  --lime: #b8ff2e;
  --lime-hot: #eaffb0;
  --vfd: #9dff3d;
  --ar: 1.7778;                 /* hero art aspect */
  --px: 0; --py: 0;             /* parallax, -1..1, set by JS */
  --shift: 7%;                  /* push the art down to make headroom */
  /* tube positions inside the art (percent of art box) */
  --m-x: 18.5%; --m-y: 27%;
  --g-x: 80.4%; --g-y: 29%;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
@media (max-aspect-ratio: 4/5) {
  :root {
    --ar: .5625; --shift: 6%;
    --m-x: 10%; --m-y: 38%;
    --g-x: 91%; --g-y: 38%;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); }
body {
  overflow: hidden;
  color: #fff;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- scene ---------- */
.scene { position: fixed; inset: 0; overflow: hidden; background: #000; }

.plate {
  position: absolute; left: 50%; top: 50%;
  width:  max(104vw, calc(104vh * var(--ar)));
  height: max(104vh, calc(104vw / var(--ar)));
  width:  max(104vw, calc(104lvh * var(--ar)));
  height: max(104lvh, calc(104vw / var(--ar)));
  transform:
    translate(-50%, calc(-50% + var(--shift)))
    translate3d(calc(var(--px) * -18px), calc(var(--py) * -12px), 0);
  will-change: transform;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.4) 9%, #000 18%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.4) 9%, #000 18%, #000 100%);
  opacity: 0;
  filter: brightness(.25) blur(6px);
  animation: scene-up 3.2s var(--ease) 1.5s forwards;
}
.kb {
  position: absolute; inset: 0;
  transform-origin: 50% 62%;
  animation: kenburns 46s ease-in-out 1.5s infinite alternate;
}
.hero, picture { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero { object-fit: cover; }

/* neon light pools: flicker the ambient light around each tube */
.pool {
  position: absolute; border-radius: 50%;
  width: 46%; aspect-ratio: 1 / 1.6;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen; pointer-events: none;
  opacity: .5;
}
.pool--m {
  left: var(--m-x); top: var(--m-y);
  background: radial-gradient(closest-side, rgba(255, 43, 214, .42), rgba(255, 43, 214, .12) 45%, transparent 75%);
  animation: tube-m 7.3s steps(1) 4.6s infinite;
}
.pool--g {
  left: var(--g-x); top: var(--g-y);
  background: radial-gradient(closest-side, rgba(150, 255, 40, .36), rgba(150, 255, 40, .1) 45%, transparent 75%);
  animation: tube-g 11.1s steps(1) 5.2s infinite;
}
/* the clock's own light spilling into the haze */
.spill {
  position: absolute; left: 50%; top: 0;
  width: min(120vw, 1100px); height: 60vh;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 22%, rgba(157, 255, 61, .16), rgba(157, 255, 61, .05) 45%, transparent 70%);
  mix-blend-mode: screen; opacity: 0;
  animation: fade-in 1.2s ease 1.2s forwards;
}

.dust { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; animation: fade-in 3s ease 2.4s forwards; }

.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(0,0,0,.55) 78%, rgba(0,0,0,.92) 100%),
    linear-gradient(to bottom, rgba(0,0,0,.55), transparent 28%, transparent 70%, rgba(0,0,0,.7));
}

.grain {
  position: absolute; inset: -120px; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .95 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: overlay; opacity: .2;
  animation: grain .9s steps(1) infinite;
}

/* ---------- stage / copy ---------- */
.stage {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  justify-items: center;
  padding: clamp(22px, 5.2vh, 64px) 24px max(env(safe-area-inset-bottom), clamp(22px, 5vh, 56px));
  text-align: center;
  pointer-events: none;
}

/* VFD clock */
.vfd {
  transform: translate3d(calc(var(--px) * 8px), calc(var(--py) * 6px), 0);
  will-change: transform;
}
.vfd__panel {
  position: relative; display: block;
  padding: .26em .44em .22em;
  font: 700 clamp(46px, min(8.2vw, 12.5vh), 132px)/1 "DSEG7", monospace;
  letter-spacing: .04em;
  border-radius: .12em;
  opacity: 0;
  animation: tube-on 1.3s linear .45s forwards;
}
.vfd__ghost, .vfd__lit { display: block; white-space: nowrap; }
.vfd__ghost i, .vfd__lit i { font-style: normal; }
.vfd__ghost { color: rgba(157, 255, 61, .035); }
.vfd__lit {
  /* box extends well past the digits so the scanline mask never clips the bloom */
  position: absolute; inset: -.3em -.2em -.34em;
  padding: .56em .64em .56em;
  color: #d9ffa8;
  text-shadow:
    0 0 .02em #fff,
    0 0 .06em var(--vfd),
    0 0 .16em rgba(157, 255, 61, .85),
    0 0 .42em rgba(157, 255, 61, .45),
    0 0 1em rgba(157, 255, 61, .25);
  animation: vfd-breathe 5.5s ease-in-out 2s infinite;
}
.vfd__lit b { font-weight: 700; }
.vfd__colon { display: inline-block; animation: heartbeat 1.15s ease-in-out 1.8s infinite; }
/* VFD phosphor grid: scanlines clipped to the glyphs only, never the glow */
.vfd__lit::after {
  content: attr(data-t);
  position: absolute; inset: 0;
  padding: inherit;
  color: transparent; text-shadow: none;
  background: repeating-linear-gradient(0deg, rgba(10, 40, 0, .4) 0 1px, transparent 1px 3px);
  -webkit-background-clip: text; background-clip: text;
  pointer-events: none;
}

/* headline: magenta neon tube */
.headline {
  margin: clamp(18px, 3.4vh, 40px) 0 0;
  max-width: 30ch;
  font: 400 clamp(30px, min(3.3vw, 5.6vh), 64px)/1.12 "Tilt Neon", system-ui, sans-serif;
  letter-spacing: .02em;
  text-wrap: balance;
  color: #ffc9f4;
  text-shadow:
    0 0 .01em #fff,
    0 0 .05em #ff9cf0,
    0 0 .14em var(--magenta),
    0 0 .32em rgba(255, 43, 214, .75),
    0 0 .8em rgba(255, 43, 214, .45),
    0 0 2em rgba(255, 43, 214, .25);
  transform: translate3d(calc(var(--px) * 5px), calc(var(--py) * 4px), 0);
  opacity: 0;
  animation: tube-on 1.1s linear 3.1s forwards;
}
.js .headline { opacity: 1; animation: none; }
.headline .ch { display: inline-block; opacity: 0; animation: tube-on .9s linear forwards; animation-delay: var(--d, 3.1s); white-space: pre; }
.headline .w { display: inline-block; white-space: nowrap; }

/* occasional buzz / glitch */
.buzz .headline {
  animation: glitch .5s steps(2) both;
}
.buzz .pool { opacity: .15 !important; }

/* sign-off */
.yet {
  margin: clamp(14px, 2.4vh, 26px) 0 0;
  font-size: clamp(15px, 1.25vw, 20px);
  letter-spacing: .48em;
  padding-left: .48em; /* optically re-centre tracked text */
  color: var(--lime-hot);
  text-shadow: 0 0 .5em rgba(157, 255, 61, .55);
  display: inline-flex; align-items: center;
}
.yet__txt {
  display: inline-block; overflow: hidden; white-space: nowrap;
  width: 0; animation: type 1s steps(8, end) 4.7s forwards;
  /* 8 glyphs, each 1ch + tracking */
  --w: calc(8ch + 8 * .48em);
}
.yet__caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: .1em;
  background: var(--lime); box-shadow: 0 0 .6em var(--lime);
  opacity: 0;
  animation: caret 1.05s steps(1) 4.4s infinite;
}

/* sound toggle */
.sound {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: .7em;
  padding: .7em .9em; border: 0; background: transparent; cursor: pointer;
  font: 400 11px/1 "JetBrains Mono", monospace; letter-spacing: .28em;
  color: rgba(255, 255, 255, .42);
  opacity: 0; animation: fade-in 1s ease 5.6s forwards;
  transition: color .3s;
}
.sound:hover, .sound:focus-visible { color: rgba(255, 255, 255, .85); }
.sound:focus-visible { outline: 1px solid rgba(157, 255, 61, .6); outline-offset: 2px; }
.sound__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.sound__bars i { width: 2px; height: 3px; background: currentColor; transition: height .3s; }
.sound__bars i:nth-child(2) { height: 6px; } .sound__bars i:nth-child(3) { height: 4px; } .sound__bars i:nth-child(4) { height: 7px; }
.sound[aria-pressed="true"] { color: var(--lime-hot); }
.sound[aria-pressed="true"] .sound__bars i { animation: eq .9s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(2) { animation-delay: -.3s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(3) { animation-delay: -.6s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(4) { animation-delay: -.15s; }

/* 404 extras */
.back {
  pointer-events: auto;
  color: rgba(234, 255, 176, .7); text-decoration: none;
  border-bottom: 1px solid rgba(157, 255, 61, .3);
  padding-bottom: .2em;
  transition: color .3s, border-color .3s;
}
.back:hover, .back:focus-visible { color: var(--lime-hot); border-color: var(--lime); outline: none; }

/* ---------- keyframes ---------- */
@keyframes scene-up {
  0%   { opacity: 0; filter: brightness(.25) blur(6px); }
  12%  { opacity: .35; }
  16%  { opacity: .12; }
  22%  { opacity: .5; }
  100% { opacity: 1; filter: brightness(1) blur(0); }
}
@keyframes kenburns {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to   { transform: scale(1.06) translate3d(-.8%, -.6%, 0); }
}
@keyframes fade-in { to { opacity: 1; } }
@keyframes tube-on {
  0% { opacity: 0; } 8% { opacity: .9; } 12% { opacity: .05; } 20% { opacity: .7; }
  24% { opacity: .1; } 34% { opacity: .95; } 38% { opacity: .35; } 46% { opacity: 1; }
  52% { opacity: .6; } 60%, 100% { opacity: 1; }
}
@keyframes heartbeat {
  0%, 100% { opacity: .42; }
  12% { opacity: 1; }
  22% { opacity: .62; }
  32% { opacity: 1; }
  55% { opacity: .42; }
}
@keyframes vfd-breathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.12); } 51% { filter: brightness(.92); } 52% { filter: brightness(1.1); } }
@keyframes tube-m {
  0% { opacity: .5; } 61% { opacity: .2; } 62% { opacity: .52; } 63% { opacity: .1; } 64% { opacity: .5; } 88% { opacity: .44; } 89% { opacity: .55; }
}
@keyframes tube-g {
  0% { opacity: .5; } 33% { opacity: .38; } 34% { opacity: .55; } 77% { opacity: .08; } 78% { opacity: .5; } 79% { opacity: .2; } 80% { opacity: .5; }
}
@keyframes grain {
  0% { transform: translate(0, 0); } 10% { transform: translate(-37px, 21px); } 20% { transform: translate(52px, -64px); }
  30% { transform: translate(-81px, 9px); } 40% { transform: translate(14px, 88px); } 50% { transform: translate(-59px, -33px); }
  60% { transform: translate(73px, 47px); } 70% { transform: translate(-12px, -91px); } 80% { transform: translate(96px, 2px); }
  90% { transform: translate(-28px, 66px); }
}
@keyframes type { to { width: var(--w); } }
@keyframes caret { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes glitch {
  0% { transform: translate(-2px, 0) skewX(-4deg); opacity: .3;
       text-shadow: -3px 0 rgba(157,255,61,.8), 3px 0 var(--magenta), 0 0 .5em rgba(255,43,214,.6); }
  25% { transform: translate(3px, 1px); opacity: 1; }
  50% { transform: translate(0, -1px) skewX(3deg); opacity: .15;
        text-shadow: 2px 0 rgba(157,255,61,.7), -2px 0 var(--magenta); }
  75% { opacity: .9; transform: none; }
  100% { opacity: 1; transform: none; }
}
@keyframes eq { from { height: 2px; } to { height: 10px; } }

/* ---------- small screens ---------- */
@media (max-aspect-ratio: 4/5) {
  .stage { padding-top: max(env(safe-area-inset-top), 9vh); }
  .vfd__panel { font-size: clamp(44px, 17vw, 110px); }
  .headline { font-size: clamp(26px, 8.2vw, 44px); max-width: 13ch; margin-top: 3.4vh; }
  .yet { font-size: 13px; }
  .sound { left: 50%; right: auto; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .plate { opacity: 1; filter: none; transform: translate(-50%, calc(-50% + var(--shift))); }
  .kb { transform: scale(1.04); }
  .vfd__panel, .headline, .headline .ch, .spill, .dust, .sound, .yet__caret { opacity: 1; }
  .vfd, .headline { transform: none; }
  .yet__txt { width: auto; }
  .vfd__colon { opacity: .85; }
}

/* 404: longer sign-off */
.page-404 .yet__txt { --w: calc(13ch + 13 * .48em); animation-timing-function: steps(13, end); }
.page-404 .yet .back .yet__txt { vertical-align: bottom; }

/* =====================================================================
   v3 — the lights. Two additive light layers rebuilt from the art
   (magenta-lit + lime-lit) replace the flat hero once they load.
   JS drives their opacity; see js/main.js.
   ===================================================================== */
.lights { position: absolute; inset: 0; pointer-events: none; }
.lt { position: absolute; inset: 0; will-change: opacity; }
.lt--g, .lt--glow { mix-blend-mode: plus-lighter; }
.lt img { position: absolute; display: block; max-width: none; }
.lt__base { inset: 0; width: 100%; height: 100%; }
.lt--glow { opacity: 0; }
.lights-on .kb > picture { visibility: hidden; }
.lights-on .pool { animation: none; }

/* clue overlays + text that only shows in the dark (empty by default) */
.clue-ov { position: absolute; pointer-events: none; opacity: 0; transition: opacity .25s; }
.whisper {
  position: absolute; transform: translate(-50%, -50%);
  font: 400 clamp(10px, 1.1vw, 16px)/1.4 "JetBrains Mono", monospace; letter-spacing: .3em;
  color: #c9ffd0; text-shadow: 0 0 .5em rgba(160, 255, 170, .7), 0 0 1.4em rgba(120, 255, 140, .35);
  white-space: pre; opacity: 0; pointer-events: none;
}

/* the colon forgets a beat */
.vfd__colon.skip { animation-play-state: paused; opacity: .16 !important; }

/* the cursor's second thought */
.yet__more { display: inline-block; white-space: pre; }

/* sound prompt: small, blinking, a dare */
.sound { letter-spacing: .2em; text-transform: none; font-size: 12px; }
.sound__label { color: rgba(234, 255, 176, .78); text-shadow: 0 0 .6em rgba(157, 255, 61, .25); }
.sound:hover .sound__label, .sound:focus-visible .sound__label { color: var(--lime-hot); }
.sound__caret {
  display: inline-block; width: .6em; height: 1.1em; margin-left: -.35em;
  background: rgba(184, 255, 46, .7); box-shadow: 0 0 .5em rgba(184, 255, 46, .5);
  animation: caret 1.05s steps(1) infinite;
}
.sound[aria-pressed="true"] .sound__caret { display: none; }
.sound[aria-pressed="true"] .sound__label { color: rgba(234, 255, 176, .5); }

.offer {
  position: fixed; left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 56px));
  transform: translate(-50%, 8px);
  display: flex; align-items: baseline; gap: 1.1em; flex-wrap: wrap; justify-content: center;
  padding: .9em 1.3em; max-width: calc(100vw - 32px);
  font: 400 12px/1.4 "JetBrains Mono", monospace; letter-spacing: .14em;
  color: rgba(234, 255, 176, .8);
  background: rgba(0, 0, 0, .72); border: 1px solid rgba(157, 255, 61, .22);
  box-shadow: 0 0 30px rgba(157, 255, 61, .08);
  opacity: 0; transition: opacity .4s, transform .4s;
}
.offer.is-open { opacity: 1; transform: translate(-50%, 0); }
.offer button {
  font: inherit; letter-spacing: inherit; border: 0; background: none; cursor: pointer; padding: .2em .1em;
  color: rgba(234, 255, 176, .55);
}
.offer button:hover, .offer button:focus-visible { color: var(--lime-hot); text-shadow: 0 0 .6em rgba(157, 255, 61, .6); outline: none; }
.offer .offer__yes { color: var(--lime-hot); }

@media (max-aspect-ratio: 4/5) {
  .sound { letter-spacing: .14em; white-space: nowrap; }
  .offer { bottom: max(58px, calc(env(safe-area-inset-bottom) + 50px)); font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .sound__caret { opacity: 1; }
  .offer { transition: none; }
}
.lt img[hidden] { display: none; }

/* phones: fit the art to the width so both tubes stay in frame; anchor it
   to the bottom (the top of the art fades to black under the clock anyway) */
@media (max-aspect-ratio: 4/5) {
  .plate {
    top: auto; bottom: -1.5%;
    width:  max(102vw, calc(86vh * var(--ar)));
    height: max(calc(102vw / var(--ar)), 86vh);
    width:  max(102vw, calc(86lvh * var(--ar)));
    height: max(calc(102vw / var(--ar)), 86lvh);
    transform: translate(-50%, 0) translate3d(calc(var(--px) * -10px), calc(var(--py) * -8px), 0);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.5) 14%, #000 26%, #000 100%);
            mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.5) 14%, #000 26%, #000 100%);
  }
}
@media (max-aspect-ratio: 4/5) and (prefers-reduced-motion: reduce) {
  .plate { transform: translate(-50%, 0); }
}
/* the green light leaking out of the box, into the air and onto the bar */
.glow-haze {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(120, 255, 60, .16), rgba(120, 255, 60, .06) 40%, rgba(120, 255, 60, .02) 70%, transparent 100%);
  filter: blur(6px);
  pointer-events: none;
}
.glow-haze--wide { left: 56.5%; top: 78%; width: 40%; height: 30%; }
.glow-haze--tall { left: 61%; top: 74%; width: 62%; height: 14%; }

/* black 404: just the clock and "not yet." */
.page-black { background: #000; }
.stage--black { align-content: center; grid-template-rows: auto auto; padding-bottom: 12vh; }
.vfd--home { pointer-events: auto; text-decoration: none; color: inherit; outline: none; }
.vfd--home:focus-visible .vfd__panel { outline: 1px solid rgba(157, 255, 61, .5); outline-offset: 6px; }
.page-black .yet { margin-top: clamp(18px, 3vh, 32px); }
.page-black .yet__txt { animation-delay: 1.7s; }
.page-black .yet__caret { animation-delay: 1.4s; }


/* shorter headline + secondary line ("don't feed him." variant) */
.headline {
  font-size: clamp(36px, min(4.6vw, 7.4vh), 80px);
  max-width: 18ch;
  margin-top: clamp(16px, 3vh, 36px);
}
.still {
  margin: clamp(10px, 1.6vh, 18px) 0 0;
  max-width: 28ch;
  font: 400 clamp(15px, min(1.7vw, 2.6vh), 24px)/1.25 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .22em;
  padding-left: .22em;
  color: #9af7ff;
  text-shadow:
    0 0 .04em #fff,
    0 0 .16em rgba(0, 229, 255, .9),
    0 0 .55em rgba(0, 229, 255, .45);
  transform: translate3d(calc(var(--px) * 5px), calc(var(--py) * 4px), 0);
  opacity: 0;
  animation: tube-on .9s linear 4.35s forwards;
}
.yet { margin-top: clamp(12px, 2vh, 22px); }
.yet__txt { animation-delay: 5.4s; }
.yet__caret { animation-delay: 5.1s; }
.sound { animation-delay: 6.3s; }

@media (max-aspect-ratio: 4/5) {
  .headline { font-size: clamp(32px, 10.5vw, 54px); max-width: 18ch; }
  .still { font-size: clamp(13px, 3.6vw, 18px); letter-spacing: .16em; padding-left: .16em; }
}

@media (prefers-reduced-motion: reduce) {
  .still { opacity: 1; transform: none; }
}
