:root {
  --bg: #05080f;
  --text: #eef2f8;
  --muted: #8b98b0;
  --red: #ff3b30;
  --gold: #ffcd3c;
  --cyan: #4fd8ff;
  --paper: #f5efe2;
  --ink: #0d121c;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
/* Scrolling stops at each section. */
html { scroll-behavior: smooth; scroll-snap-type: y mandatory; }
html { overflow-x: clip; }
body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Layers behind and above the content */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; }

.glow {
  position: fixed;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 75% 40%, rgba(255, 59, 48, 0.12), transparent 70%),
    radial-gradient(35% 30% at 20% 80%, rgba(79, 216, 255, 0.08), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 5;
  pointer-events: none;
  opacity: 0.07;
  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 type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(6) infinite;
}

/* Boot screen: a red scan line runs down and opens the page */
.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: grid;
  place-items: center;
  animation: boot-out 0.7s var(--ease) 1.5s forwards;
}
.boot-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  top: 0;
  background: var(--red);
  box-shadow: 0 0 24px 4px rgba(255, 59, 48, 0.7);
  animation: boot-scan 1.4s var(--ease) forwards;
}
.boot-text { font: 500 13px/1 var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.boot-count { color: var(--gold); }
.booted .boot { display: none; }

/* Cursor ring, only with a mouse */
.cursor { display: none; }
@media (pointer: fine) {
  .cursor {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    pointer-events: none;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 1px solid rgba(255, 205, 60, 0.7);
    border-radius: 50%;
    transition: width 0.3s var(--ease), height 0.3s var(--ease), margin 0.3s var(--ease), border-color 0.3s;
  }
  .cursor span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140%;
    height: 1px;
    margin-left: -70%;
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
    opacity: 0;
    transition: opacity 0.3s;
  }
  .cursor.on-link { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--red); }
  .cursor.on-link span { opacity: 1; }
}

/* Header and section rail */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  /* left edge lines up with the text, right edge with the section menu */
  padding: 22px clamp(16px, 2.5vw, 32px) 22px clamp(16px, 6vw, 96px);
  mix-blend-mode: difference;
}
.brand img { filter: invert(1); height: 25px; width: auto; display: block; }
.where { margin: 0; font: 500 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: #fff; }
.clock { margin-left: 10px; opacity: 0.6; }
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 6px;
  vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  animation: ping 1.8s infinite;
}

.rail {
  position: fixed;
  right: clamp(12px, 2.5vw, 32px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rail a {
  position: relative;
  display: block;
  width: 26px;
  height: 2px;
  background: rgba(238, 242, 248, 0.25);
  transition: width 0.5s var(--ease), background 0.3s;
}
.rail a span {
  position: absolute;
  right: calc(100% + 12px);
  top: -6px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.rail a:hover span, .rail a.active span { opacity: 1; transform: none; }
.rail a.active { width: 44px; background: var(--gold); }

/* Scenes */
main { position: relative; z-index: 10; }

.scene {
  /* Exactly one screen high, so each scroll step lands on one section. */
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  padding: clamp(84px, 12vh, 120px) clamp(16px, 6vw, 96px);
}
/* A window too low for a section: the section grows, and the step goes to its top. */
}
.scene .copy { width: min(500px, 42vw); }
.scene-hero { align-items: flex-end; padding-bottom: 12vh; }
.scene-hero .copy { width: min(760px, 100%); }

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.035em; line-height: 0.98; }
h1 { font-size: clamp(48px, 9vw, 132px); }
h2 { font-size: clamp(40px, 5.4vw, 80px); }

.lead { color: var(--muted); font-size: clamp(17px, 1.4vw, 20px); margin: 22px 0 0; max-width: 34rem; }
.small { font: 12px/1.6 var(--mono); color: var(--muted); margin-top: 28px; }

.hint { margin-top: 40px; font: 500 12px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.arrow {
  display: inline-block;
  width: 1px;
  height: 36px;
  margin-left: 12px;
  vertical-align: middle;
  background: linear-gradient(var(--gold), transparent);
  animation: fall 1.6s var(--ease) infinite;
}

/* Kinetic headings: each word rises out of a mask, one after the other */
.kinetic .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.kinetic .w > span {
  display: inline-block;
  transform: translateY(105%) rotate(6deg);
  transition: transform 1.1s var(--ease);
  transition-delay: calc(var(--i) * 70ms);
}
.in .kinetic .w > span { transform: none; }
.kinetic .w:last-child > span { color: var(--red); }

.copy > :not(.kinetic):not(.eyebrow) { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease) 0.35s, transform 1.2s var(--ease) 0.35s; }
.copy > .eyebrow { opacity: 0; transition: opacity 0.8s 0.1s; }
.in .copy > * { opacity: 1 !important; transform: none !important; }

/* Marquee */
.marquee {
  position: relative;
  z-index: 10;
  overflow: hidden;
  padding: 18px 0;
  border-block: 1px solid rgba(238, 242, 248, 0.12);
  background: rgba(5, 8, 15, 0.55);
  backdrop-filter: blur(6px);
  transform: rotate(-2deg) scale(1.05);
}
.marquee-track { display: flex; align-items: center; gap: 28px; width: max-content; animation: marquee 32s linear infinite; }
.marquee span { font: 800 clamp(28px, 4vw, 52px)/1 var(--sans); letter-spacing: -0.02em; white-space: nowrap; }
.marquee span:nth-of-type(3n) { color: transparent; -webkit-text-stroke: 1px var(--gold); }
.marquee i { width: 12px; height: 12px; background: var(--red); transform: rotate(45deg); flex: none; }

/* Typed code */
.typer {
  margin: 28px 0 0;
  padding: 18px 20px;
  font: 14px/1.7 var(--mono);
  background: rgba(13, 18, 28, 0.75);
  border: 1px solid rgba(79, 216, 255, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  min-height: 9.5em;
  white-space: pre-wrap;
}
.typer .k { color: #ff7a8a; }
.typer .f { color: var(--cyan); }
.typer .s { color: var(--gold); }
.typer .c { color: #5d6b84; }
.caret { display: inline-block; width: 8px; height: 1.1em; background: var(--gold); vertical-align: -0.2em; animation: blink 1s steps(1) infinite; }

/* Ticket */
.ticket {
  position: relative;
  margin-top: 30px;
  max-width: 360px;
  padding: 18px 20px 20px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: rotate(-1.5deg);
}
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--bg);
}
.ticket::before { left: -9px; }
.ticket::after { right: -9px; }
.ticket.printing { animation: print 1s var(--ease); }
.ticket-head {
  display: flex;
  justify-content: space-between;
  font: 600 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px dashed rgba(13, 18, 28, 0.3);
  padding-bottom: 10px;
}
.label { position: relative; margin: 14px 0 6px; height: 112px; }
.label svg { width: 100%; height: 100%; display: block; }
.label rect { transform-box: fill-box; transform-origin: 50% 100%; animation: bar 0.6s var(--ease) both; }
.label text { animation: fade 0.6s 0.6s both; }
.label::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 12px 2px rgba(255, 59, 48, 0.8);
  animation: scan 2.2s ease-in-out infinite alternate;
}
.proverb { margin: 8px 0 0; font-weight: 700; }
.proverb-en { margin: 2px 0 14px; color: #586378; font-size: 14px; }

button {
  font: 600 14px/1 var(--sans);
  padding: 11px 16px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s var(--ease);
}
button:hover { background: var(--red); transform: translateY(-1px); }
button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* Facts */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 32px; margin: 36px 0 0; }
.facts div { border-top: 1px solid rgba(238, 242, 248, 0.15); padding-top: 12px; }
.facts dt { font: 500 11px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 6px 0 0; font: 800 clamp(40px, 4.4vw, 64px)/1 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.facts div:first-child dd { color: var(--red); }

.note { font: 12px/1.5 var(--mono); color: var(--muted); margin-top: 22px; }

/* Version, bottom right */
.version {
  position: fixed;
  right: clamp(16px, 2.5vw, 32px);
  bottom: 18px;
  z-index: 20;
  margin: 0;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Toasts */
.toasts {
  position: fixed;
  left: clamp(16px, 4vw, 48px);
  bottom: 24px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  font: 500 12px/1.3 var(--mono);
  padding: 10px 14px;
  background: rgba(13, 18, 28, 0.85);
  border: 1px solid rgba(255, 205, 60, 0.35);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  animation: toast-in 0.6s var(--ease), toast-out 0.5s ease-in 4.5s forwards;
}
.toast b { color: var(--gold); font-weight: 600; }

@keyframes drift { to { transform: translate(-6%, 4%) scale(1.1); } }
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-5%, 3%); }
  40% { transform: translate(4%, -6%); }
  60% { transform: translate(-3%, 5%); }
  80% { transform: translate(6%, 2%); }
  100% { transform: translate(0, 0); }
}
@keyframes boot-scan { to { top: 100%; } }
@keyframes boot-out { to { clip-path: inset(0 0 100% 0); } }
@keyframes ping { 70% { box-shadow: 0 0 0 9px rgba(255, 59, 48, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); } }
@keyframes fall { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes scan { from { top: 2%; } to { top: 96%; } }
@keyframes bar { from { transform: scaleY(0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: rotate(-1.5deg) translateY(-30px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-20px); } }

@media (max-width: 860px) {
  .scene { align-items: flex-end; padding: 52vh 16px 72px; height: auto; min-height: 100vh; }
  .scene .copy { width: 100%; }
  .scene-hero { padding-bottom: 72px; }
  /* On a phone a section can be taller than the screen; it stops near a section but does not force it. */
  html { scroll-snap-type: y proximity; }
  .rail { display: none; }
  .where .clock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .boot { display: none; }
  .kinetic .w > span, .copy > * { transform: none !important; opacity: 1 !important; }
}

/* Low laptop screens: smaller headings and a shorter label card, so each section fits one screen. */
@media (min-width: 861px) and (max-height: 860px) {
  h2 { font-size: clamp(36px, 4.6vw, 60px); }
  .eyebrow { margin-bottom: 12px; }
  .lead { margin-top: 14px; }
  .ticket { margin-top: 18px; }
  .label { height: 84px; margin: 10px 0 4px; }
  .proverb-en { margin-bottom: 10px; }
}
@media (min-width: 861px) and (max-height: 700px) {
  .scene { height: auto; min-height: 100vh; }
