/* WAYCRAFT download page. Tokens follow waysa.net (navy glass, WAY blue, sand lanterns, Readex Pro). */
:root {
  --night: #060b18;
  --navy: #0e1424;
  --ink: #edf1f8;
  --dim: rgba(237, 241, 248, 0.7);
  --faint: rgba(237, 241, 248, 0.48);
  --line: rgba(237, 241, 248, 0.11);
  --line-2: rgba(237, 241, 248, 0.22);
  --glass: rgba(14, 20, 36, 0.58);
  --blue: #2f77f8;
  --blue-ink: #89b2fb;
  --sand: #e3b877;
  --green: #45d496;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 5vw, 72px);
  --font: "Readex Pro", "Segoe UI", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.75; font-weight: 400;
  overflow-x: clip;
}
img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, ol, figure { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue-ink); outline-offset: 3px; border-radius: 6px; }
h2 { font-size: clamp(1.95rem, 3.8vw, 3rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }

.skip { position: fixed; top: -60px; right: 16px; z-index: 50; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--night); text-decoration: none; }
.skip:focus { top: 12px; }

/* ===== top bar ===== */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 72px; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 28px;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.bar.solid { background: rgba(6, 11, 24, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { border-radius: 10px; box-shadow: 0 0 24px rgba(137, 178, 251, 0.35); }
.brand-name { font-weight: 600; letter-spacing: 0.04em; font-size: 1.02rem; opacity: 0; transition: opacity 0.4s var(--ease); }
.bar.solid .brand-name { opacity: 1; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--dim); font-size: 0.95rem; transition: color 0.25s, background 0.25s; }
.nav a:hover { color: var(--ink); background: rgba(237, 241, 248, 0.06); }
.bar-dl {
  padding: 9px 20px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 0.95rem;
  background: rgba(47, 119, 248, 0.16); border: 1px solid rgba(137, 178, 251, 0.35); color: var(--ink);
  transition: background 0.25s;
}
.bar-dl:hover { background: rgba(47, 119, 248, 0.3); }

/* ===== hero ===== */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; z-index: -3; transition: opacity 1.6s var(--ease), transform 3.2s var(--ease); }
.stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.hero-shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to top, var(--night) 0%, rgba(6, 11, 24, 0.82) 22%, rgba(6, 11, 24, 0) 55%),
    linear-gradient(to left, rgba(6, 11, 24, 0.7) 0%, rgba(6, 11, 24, 0) 48%),
    linear-gradient(to bottom, rgba(6, 11, 24, 0.55) 0%, rgba(6, 11, 24, 0) 18%);
}
.hero-copy { width: min(860px, 100%); padding: 0 var(--gutter) clamp(56px, 11vh, 120px); }
.hero h1 {
  font-size: clamp(3.1rem, 8vw, 6.4rem); line-height: 1.05; font-weight: 700; letter-spacing: -0.01em;
  text-shadow: 0 4px 40px rgba(6, 11, 24, 0.7);
}
.lede { margin-top: 18px; max-width: 34em; color: var(--dim); font-size: clamp(1.05rem, 1.6vw, 1.22rem); font-weight: 300; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 26px; border-radius: 999px;
  text-decoration: none; font-weight: 500; font-size: 1.05rem; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-main { background: linear-gradient(180deg, #ffffff, #d6e3fb); color: #0a1226; box-shadow: 0 10px 40px -8px rgba(137, 178, 251, 0.6), inset 0 -2px 0 rgba(10, 18, 38, 0.12); }
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 16px 50px -8px rgba(137, 178, 251, 0.8), inset 0 -2px 0 rgba(10, 18, 38, 0.12); }
.btn-main:active { transform: translateY(0); }
.btn-glass { background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn-glass:hover { background: rgba(88, 101, 242, 0.28); border-color: rgba(137, 150, 255, 0.5); }
.fine { margin-top: 16px; color: var(--faint); font-size: 0.9rem; }

/* live Discord count (hidden until the numbers arrive) */
.live {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 7px 16px 7px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 0.92rem; color: var(--dim); text-decoration: none; transition: border-color 0.3s;
}
.live[hidden] { display: none; }
.live:hover { border-color: rgba(69, 212, 150, 0.5); }
.live b { color: var(--ink); font-weight: 600; }
.live-dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--green); opacity: 0; animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(0.4); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }

.scroll-cue { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; width: 26px; height: 42px; border-radius: 14px; border: 1.5px solid var(--line-2); }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); animation: cue 2s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* intro: the stars draw the WAY logo, then the night castle fades in under them */
.intro .hero-video { opacity: 0; transform: scale(1.06); }
.intro .hero-copy > *, .intro .bar, .intro .scroll-cue { opacity: 0; transform: translateY(16px); }
.hero-copy > *, .bar, .scroll-cue { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), background 0.4s var(--ease), border-color 0.4s var(--ease); }
.revealed .hero-video { opacity: 1; transform: none; }
.revealed .hero-copy > *, .revealed .bar, .revealed .scroll-cue { opacity: 1; transform: none; }
.revealed .hero-copy > :nth-child(2) { transition-delay: 0.08s; }
.revealed .hero-copy > :nth-child(3) { transition-delay: 0.16s; }
.revealed .hero-copy > :nth-child(4) { transition-delay: 0.24s; }
.revealed .hero-copy > :nth-child(5) { transition-delay: 0.32s; }

/* ===== story: pinned while the particles morph ===== */
.story { position: relative; height: 520vh; }
.story-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: radial-gradient(80% 70% at 30% 50%, #0b1630 0%, var(--night) 70%); }
.morph { position: absolute; inset: 0; width: 100%; height: 100%; }
.story-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--night), transparent 14%, transparent 86%, var(--night)),
    radial-gradient(34% 46% at 28% 50%, rgba(47, 119, 248, 0.13), transparent 72%);
}
.chapters { position: absolute; inset: 0 var(--gutter) 0 auto; width: min(520px, 42vw); display: grid; align-items: center; }
.ch { grid-area: 1 / 1; opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.9s var(--ease); pointer-events: none; }
.ch.is-on { opacity: 1; transform: none; pointer-events: auto; }
.ch h2 { font-size: clamp(2.2rem, 4.6vw, 3.8rem); font-weight: 700; line-height: 1.1; }
.ch p { margin-top: 16px; color: var(--dim); font-weight: 300; font-size: clamp(1.05rem, 1.5vw, 1.2rem); max-width: 26em; }
.ch-dots { position: absolute; left: var(--gutter); top: 50%; translate: 0 -50%; display: grid; gap: 12px; }
.ch-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: background 0.4s, transform 0.4s var(--ease), box-shadow 0.4s; }
.ch-dots i.is-on { background: var(--blue-ink); transform: scale(1.6); box-shadow: 0 0 12px var(--blue-ink); }
.no-gl .morph { display: none; }
.no-gl .story-pin { background: url(img/night-poster.webp) 50% 40% / cover; }
.no-gl .story-pin::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, rgba(6, 11, 24, 0.92) 30%, rgba(6, 11, 24, 0.45)); }

/* ===== town: sideways strip ===== */
.town { position: relative; }
.town-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.town-track { display: flex; align-items: stretch; gap: clamp(14px, 1.8vw, 26px); padding: 0 var(--gutter); width: max-content; will-change: transform; }
.town-intro { width: min(380px, 80vw); flex: none; display: flex; flex-direction: column; justify-content: center; padding-inline-end: 24px; }
.town-intro p { margin-top: 12px; color: var(--dim); font-weight: 300; }
.shot { position: relative; flex: none; width: min(62vw, calc(64vh * 16 / 9)); margin: 0; }
.shot img {
  width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px; background: var(--navy);
  border: 1px solid var(--line); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
}
.shot figcaption { margin-top: 14px; color: var(--dim); font-size: 0.97rem; line-height: 1.6; max-width: 34em; }
.shot figcaption b { color: var(--ink); font-weight: 600; margin-inline-end: 8px; }
.town-bar { margin: 34px var(--gutter) 0; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.town-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(to left, var(--blue-ink), var(--sand)); transform-origin: right; transform: scaleX(0); }

/* ===== people ===== */
.people {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: clamp(24px, 5vw, 80px); align-items: center;
  padding: clamp(80px, 12vw, 150px) var(--gutter) 0;
}
.people-lede { margin-top: 12px; color: var(--dim); font-weight: 300; max-width: 30em; }
.who { margin-top: 34px; min-height: 96px; }
.who-name { font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 600; color: var(--sand); line-height: 1.3; }
.who-role { margin-top: 4px; color: var(--dim); font-weight: 300; }
.roster { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 26px; max-width: 480px; }
.face {
  position: relative; aspect-ratio: 1; padding: 0; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-2); background-color: var(--navy);
  background-image: var(--s), var(--s); background-size: 800% 800%; background-position: 71.43% 14.29%, 14.29% 14.29%;
  background-repeat: no-repeat; image-rendering: pixelated;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.face span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.face:hover { transform: translateY(-3px); border-color: rgba(137, 178, 251, 0.5); }
.face.is-on { border-color: var(--sand); box-shadow: 0 0 0 3px rgba(227, 184, 119, 0.18), 0 10px 30px -8px rgba(227, 184, 119, 0.5); }

.stage { position: relative; height: clamp(440px, 64vh, 600px); }
#npc-canvas { position: relative; z-index: 1; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#npc-canvas:active { cursor: grabbing; }
.stage-still { display: none; }
.plinth {
  position: absolute; left: 50%; bottom: 4%; width: min(320px, 70%); aspect-ratio: 4 / 1; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(47, 119, 248, 0.45), rgba(47, 119, 248, 0.08) 70%, transparent);
  box-shadow: 0 0 80px 10px rgba(47, 119, 248, 0.18);
}
.stage::before {
  content: ""; position: absolute; inset: 8% 10% 0; border-radius: 50% 50% 0 0;
  background: radial-gradient(60% 60% at 50% 60%, rgba(137, 178, 251, 0.14), transparent 70%);
}
.bubble {
  position: absolute; z-index: 2; top: -12px; right: 50%; translate: 50% 0; width: max-content; max-width: 88%;
  display: grid; gap: 2px; padding: 12px 18px; border-radius: 16px; text-align: center;
  background: rgba(6, 11, 24, 0.72); border: 1px solid var(--line-2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 0.98rem; line-height: 1.55; transition: opacity 0.35s var(--ease), transform 0.5s var(--ease);
}
.bubble::after { content: ""; position: absolute; bottom: -7px; left: 50%; width: 12px; height: 12px; translate: -50% 0; rotate: 45deg; background: inherit; border: inherit; border-width: 0 1px 1px 0; }
.bubble span:last-child { color: var(--dim); }
.bubble.swap { opacity: 0; transform: translateY(6px); }
.no-3d #npc-canvas { display: none; }
.no-3d .stage-still { display: block; position: absolute; inset: 14% 0 12%; width: 100%; height: 74%; object-fit: cover; border-radius: 22px; border: 1px solid var(--line); }

/* ===== launcher ===== */
.launcher {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 6vw, 96px); align-items: center;
  padding: clamp(80px, 12vw, 150px) var(--gutter) 0;
}
.lx-copy { order: -1; }
.lx { perspective: 1600px; --rx: 6deg; --ry: 14deg; }
.lx-frame {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--line-2);
  box-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(137, 178, 251, 0.08), 0 0 90px -20px rgba(47, 119, 248, 0.35);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform 0.8s var(--ease);
}
.lx-frame img { width: 100%; height: auto; }
.facts { margin-top: 26px; }
.facts > div { padding: 18px 0; border-top: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; font-size: 1.15rem; }
.facts dd { color: var(--dim); font-weight: 300; margin-top: 2px; max-width: 34em; }

/* ===== install: three lanterns on a lit road ===== */
.install { padding: clamp(80px, 12vw, 150px) var(--gutter) 0; }
.sec-head { max-width: 40em; margin-bottom: clamp(32px, 5vw, 56px); }
.road { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); position: relative; counter-reset: step; }
.road::before {
  content: ""; position: absolute; top: 15px; right: 15px; left: 15px; height: 2px;
  background: repeating-linear-gradient(to left, rgba(227, 184, 119, 0.55) 0 10px, transparent 10px 20px);
}
.road li { position: relative; padding-top: 58px; counter-increment: step; }
.lantern {
  position: absolute; top: 0; right: 0; width: 32px; height: 32px; border-radius: 9px;
  background: radial-gradient(circle at 50% 45%, #fff3d6 0 18%, var(--sand) 45%, #8a5a22 100%);
  box-shadow: 0 0 0 4px rgba(227, 184, 119, 0.14), 0 0 34px 6px rgba(227, 184, 119, 0.45);
}
.lantern::after { content: counter(step); position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; color: #3b2508; }
.road h3 { font-size: 1.25rem; font-weight: 600; }
.road p { margin-top: 6px; color: var(--dim); font-weight: 300; max-width: 26em; }

/* ===== finale ===== */
.finale { position: relative; text-align: center; padding: clamp(100px, 14vw, 180px) var(--gutter) clamp(90px, 12vw, 150px); }
.finale::before {
  content: ""; position: absolute; inset: 10% 5% 0; z-index: -1; pointer-events: none;
  background: radial-gradient(45% 45% at 50% 40%, rgba(47, 119, 248, 0.24), transparent 70%), radial-gradient(30% 30% at 50% 70%, rgba(227, 184, 119, 0.12), transparent 70%);
}
.finale-logo { margin: 0 auto 26px; border-radius: 22px; box-shadow: 0 0 0 1px var(--line-2), 0 0 60px 6px rgba(137, 178, 251, 0.4); }
.finale h2 { font-size: clamp(2.3rem, 5.4vw, 4.2rem); font-weight: 700; }
.finale p { margin-top: 10px; color: var(--dim); font-size: 1.15rem; font-weight: 300; }
.finale .cta { justify-content: center; }
.live-center { margin: 28px 0 0; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 32px var(--gutter) 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; color: var(--faint); font-size: 0.88rem; }
.foot-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 500; }
.foot-brand img { border-radius: 8px; }
.sha { margin-inline-start: auto; display: flex; flex-direction: column; gap: 2px; }
.sha code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.72rem; direction: ltr; word-break: break-all; color: rgba(237, 241, 248, 0.38); }

/* ===== phones and tablets ===== */
@media (max-width: 860px) {
  .nav { display: none; }
  .bar-dl { margin-inline-start: auto; }
  .story { height: 460vh; }
  .chapters { inset: auto var(--gutter) 9vh; width: auto; display: grid; align-items: end; }
  .ch h2 { font-size: clamp(2rem, 9vw, 2.8rem); }
  .ch p { margin-top: 10px; font-size: 1.02rem; }
  .ch-dots { left: 50%; top: auto; bottom: 3.5vh; translate: -50% 0; grid-auto-flow: column; }
  /* the strip becomes a swipeable row */
  .town { padding-top: clamp(80px, 12vw, 150px); }
  .town-pin { position: static; height: auto; overflow: visible; }
  .town-track { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 8px; transform: none !important; flex-wrap: nowrap; }
  .town-track::-webkit-scrollbar { display: none; }
  .town-intro { width: 72vw; scroll-snap-align: start; padding-inline-end: 8px; }
  .shot { width: 84vw; scroll-snap-align: center; }
  .town-bar { display: none; }
  .people { grid-template-columns: 1fr; }
  .stage { order: -1; height: clamp(380px, 58vh, 480px); margin-top: 0; }
  .roster { grid-template-columns: repeat(6, 1fr); max-width: none; }
  .launcher { grid-template-columns: 1fr; }
  .lx-copy { order: 0; }
  .lx { --rx: 4deg; --ry: 0deg; }
  .road { grid-template-columns: 1fr; gap: 34px; }
  .road::before { top: 16px; bottom: 16px; right: 15px; left: auto; width: 2px; height: auto; background: repeating-linear-gradient(to bottom, rgba(227, 184, 119, 0.55) 0 10px, transparent 10px 20px); }
  .road li { padding: 2px 56px 0 0; }
  .sha { margin-inline-start: 0; }
}
@media (max-width: 520px) {
  .bar { height: 64px; gap: 12px; }
  .brand-name { display: none; }
  .hero-video { object-position: 50% 45%; }
  .btn { width: 100%; justify-content: center; }
  .roster { gap: 8px; }
  .face { border-radius: 10px; }
  .scroll-cue { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
