/* ============================================================
   SOCIALVERSE v2 — Cinematic Edition
   ============================================================ */

:root {
  --bg: #02030a;
  --bg-2: #060818;
  --ink: #f3f6ff;
  --ink-2: rgba(243, 246, 255, 0.86);
  --muted: #a3acc9;
  --dim: rgba(243, 246, 255, 0.58);
  --cyan: #6ee0ff;
  --cyan-deep: #1fb6e6;
  --violet: #a98bff;
  --line: rgba(255, 255, 255, 0.12);
  --line-hi: rgba(255, 255, 255, 0.22);
  --glass: rgba(5, 7, 18, 0.62);

  --f-display: 'Barlow Condensed', 'Oswald', system-ui, sans-serif;
  --f-body: 'Barlow', system-ui, -apple-system, sans-serif;
  --f-mono: 'Space Mono', ui-monospace, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 3.2vw, 48px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* written every frame by app.js */
  --warp: 0;
  --lb-base: 3.4vh;

  /* z-index scale */
  --z-gl: 0;
  --z-backdrop: 1;
  --z-vignette: 2;
  --z-ui: 10;
  --z-letterbox: 60;
  --z-grain: 70;
  --z-hud: 80;
  --z-header: 90;
  --z-nav: 95;
  --z-cursor: 100;
  --z-intro: 1000;
}

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

html { -webkit-text-size-adjust: 100%; }
html, body { overscroll-behavior: none; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scrollbar-width: none;
}
body::-webkit-scrollbar { display: none; }
body.is-intro { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
ul { list-style: none; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: calc(var(--z-intro) + 1);
  padding: 12px 18px; background: var(--ink); color: var(--bg);
  font-weight: 600; border-radius: 100px; text-decoration: none;
  transform: translateY(-200%); transition: transform .3s var(--ease-out);
}
.skip-link:focus { transform: none; }

.mono { font-family: var(--f-mono); }
.ico { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============================================================
   INTRO — countdown title card
   ============================================================ */
#intro {
  position: fixed; inset: 0; z-index: var(--z-intro);
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 60%, #0a1030 0%, #02030a 62%);
  color: var(--ink);
}
#intro.is-done { pointer-events: none; }
.intro-bar {
  position: absolute; left: 0; right: 0; height: 50.5%;
  background: #000; transform-origin: center;
}
.intro-bar--t { top: 0; }
.intro-bar--b { bottom: 0; }
.intro-bars { position: absolute; inset: 0; pointer-events: none; }
.intro-center {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  text-align: center; padding: 0 24px;
}
.intro-kicker {
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.42em;
  text-transform: uppercase; color: var(--dim);
}
.intro-count {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(6rem, 22vw, 15rem); line-height: 0.82; letter-spacing: -0.02em;
  display: flex; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.intro-t { font-size: 0.32em; color: var(--cyan); margin-right: 0.12em; letter-spacing: 0.04em; }
#intro-num { display: inline-block; min-width: 1.05em; }
.intro-progress {
  width: min(320px, 70vw); height: 1px; background: var(--line); overflow: hidden;
}
.intro-progress span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform: scaleX(0); transform-origin: left;
  box-shadow: 0 0 12px var(--cyan);
}
.intro-status {
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--cyan); min-height: 1.2em;
}
.intro-skip {
  position: absolute; z-index: 3;
  right: var(--gutter); bottom: calc(var(--gutter) + var(--safe-b));
  min-height: 44px; padding: 0 20px;
  font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--line); border-radius: 100px;
  transition: color .25s, border-color .25s;
}
.intro-skip:hover { color: var(--ink); border-color: var(--cyan); }
#flash {
  position: fixed; inset: 0; z-index: calc(var(--z-intro) - 1);
  background: radial-gradient(circle at 50% 55%, #fff 0%, #cfefff 35%, rgba(110,224,255,0) 75%);
  opacity: 0; pointer-events: none;
}

/* ============================================================
   STAGE — WebGL, hero backdrop, overlays
   ============================================================ */
#webgl-container {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  z-index: var(--z-gl); pointer-events: none; background: var(--bg);
}
#webgl-container canvas { display: block; }

#hero-backdrop {
  position: fixed; inset: 0; height: 100lvh;
  z-index: var(--z-backdrop); pointer-events: none; overflow: hidden;
}
#hero-backdrop .kb {
  position: absolute; inset: 0;
  will-change: transform;
  transform-origin: 53% 62%;
}
#hero-backdrop .kb-in { position: absolute; inset: 0; transform-origin: 53% 62%; }
#hero-backdrop .kb-drift {
  position: absolute; inset: 0;
  animation: kenburns 38s ease-in-out infinite alternate;
  transform-origin: 53% 62%;
}
#hero-backdrop picture, #hero-backdrop img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 58%;
}
#hero-backdrop::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(2,3,10,0.55) 0%, rgba(2,3,10,0) 28%, rgba(2,3,10,0) 60%, rgba(2,3,10,0.9) 100%),
    radial-gradient(ellipse at 50% 60%, transparent 40%, rgba(2,3,10,0.55) 100%);
}
@keyframes kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.13) translate3d(-1.2%, -1.5%, 0); }
}

/* anamorphic flare — placed on the star by app.js (--fx/--fy in px) */
.flare {
  position: absolute; left: var(--fx, 53%); top: var(--fy, 62%);
  width: 0; height: 0; pointer-events: none;
}
.flare-streak {
  position: absolute; left: 50%; top: 50%;
  width: 150vw; height: 3px; transform: translate(-50%, -50%);
  background: linear-gradient(90deg, transparent 0%, rgba(110,224,255,0) 18%, rgba(110,224,255,0.55) 42%, #fff 50%, rgba(110,224,255,0.55) 58%, rgba(110,224,255,0) 82%, transparent 100%);
  filter: blur(1.5px);
  mix-blend-mode: screen;
  animation: flarePulse 5.5s ease-in-out infinite;
}
.flare-streak.is-wide {
  height: 22px; opacity: 0.35; filter: blur(10px);
  animation-delay: -2s;
}
.flare-core {
  position: absolute; left: 50%; top: 50%;
  width: 220px; height: 220px; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(150,225,255,0.45) 12%, rgba(110,160,255,0.12) 38%, transparent 70%);
  mix-blend-mode: screen;
  animation: corePulse 5.5s ease-in-out infinite;
}
.flare-ghost {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(169,139,255,0.35);
  background: radial-gradient(circle, rgba(169,139,255,0.10), transparent 70%);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
}
@keyframes flarePulse {
  0%, 100% { transform: translate(-50%, -50%) scaleX(0.82); opacity: 0.75; }
  50%      { transform: translate(-50%, -50%) scaleX(1.08); opacity: 1; }
}
@keyframes corePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
  50%      { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

#vignette {
  position: fixed; inset: 0; z-index: var(--z-vignette); pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 52%, rgba(0,0,0,0.6) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.4) 100%);
}

/* film grain — texture generated at runtime */
#grain {
  position: fixed; inset: -50%; z-index: var(--z-grain); pointer-events: none;
  opacity: 0.075; mix-blend-mode: overlay;
  background-size: 180px 180px;
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-6%, 4%); }
  40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); }
  80% { transform: translate(7%, 2%); }
  100% { transform: translate(-2%, -5%); }
}

/* cinemascope letterbox — breathes with warp */
.letterbox {
  position: fixed; left: 0; right: 0; z-index: var(--z-letterbox);
  height: calc(var(--lb-base) + 7vh);
  background: #000; pointer-events: none;
  will-change: transform;
}
.letterbox--t { top: 0; transform: translate3d(0, calc(-7vh * (1 - var(--warp))), 0); }
.letterbox--b { bottom: 0; transform: translate3d(0, calc(7vh * (1 - var(--warp))), 0); }

/* scan-lines during warp */
#warp-lines {
  position: fixed; inset: 0; z-index: var(--z-vignette); pointer-events: none;
  opacity: calc(var(--warp) * 0.5);
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 3px);
}

/* ============================================================
   HEADER + HUD
   ============================================================ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-header);
  padding: calc(var(--safe-t) + clamp(14px, 2.2vw, 28px)) var(--gutter) 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.logo-wrap {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; justify-self: start; min-height: 44px;
}
.logo-img {
  width: 48px; height: 48px; object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(110, 224, 255, 0.35));
}
.logo-text {
  font-family: var(--f-display); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.42em; text-transform: uppercase;
}
.hud-timecode {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.18em;
  color: var(--dim); font-variant-numeric: tabular-nums;
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ff3b4d;
  box-shadow: 0 0 10px #ff3b4d; animation: rec 1.4s steps(2) infinite;
}
@keyframes rec { 50% { opacity: 0.15; } }

.header-cta {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 20px;
  font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line-hi); border-radius: 100px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .25s, background-color .25s, color .25s;
}
.header-cta:hover { border-color: var(--cyan); background: rgba(110,224,255,0.08); }
.header-cta .pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(110,224,255,0.7); animation: ping 2s infinite;
}
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(110,224,255,0); } 100% { box-shadow: 0 0 0 0 rgba(110,224,255,0); } }

#progress {
  position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: calc(var(--z-header) + 1);
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform: scaleX(0); transform-origin: left; pointer-events: none;
  box-shadow: 0 0 12px rgba(110,224,255,0.8);
}

.hud {
  position: fixed; z-index: var(--z-hud); pointer-events: none;
  font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.2em;
  color: var(--dim); text-transform: uppercase;
  bottom: calc(var(--lb-base) + 18px); font-variant-numeric: tabular-nums;
}
.hud-bl { left: var(--gutter); }
.hud-br { right: var(--gutter); display: flex; gap: 22px; }
.hud-br .val { color: var(--cyan); }
.hud-item { display: flex; gap: 10px; }

/* ============================================================
   SECTOR NAV
   ============================================================ */
#sector-nav {
  position: fixed; top: 50%; right: var(--gutter); z-index: var(--z-nav);
  transform: translate(160%, -50%); opacity: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px;
  background: rgba(5, 7, 18, 0.55);
  border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  transition: transform .8s var(--ease-out), opacity .8s ease;
}
#sector-nav.visible, #sector-nav:focus-within { transform: translate(0, -50%); opacity: 1; }
.nav-btn {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 14px 0 12px; border-radius: 8px;
  font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim); text-align: left; white-space: nowrap;
  transition: color .25s, background-color .25s;
}
.nav-btn .n { color: rgba(255,255,255,0.35); transition: color .25s; }
.nav-btn .bar {
  width: 14px; height: 1px; background: currentColor; opacity: 0.5;
  transition: width .35s var(--ease-out), opacity .35s, background-color .35s;
}
.nav-btn:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.nav-btn.active { color: var(--ink); background: rgba(110,224,255,0.09); }
.nav-btn.active .n { color: var(--cyan); }
.nav-btn.active .bar { width: 26px; opacity: 1; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

/* ============================================================
   UI LAYER (pinned)
   ============================================================ */
#scroll-container { position: relative; width: 100%; }
#ui-layer {
  position: relative; width: 100%;
  height: 100vh; height: 100svh;
  z-index: var(--z-ui); overflow: hidden;
}

/* HERO */
#hero-astronaut {
  position: absolute; top: 7%; left: 5vw;
  width: min(42vw, 680px);
  z-index: 6; pointer-events: none;
  will-change: transform, opacity;
  --glow: 110, 224, 255;
  --tint: 0;
}
.astro-glow {
  position: absolute; left: 50%; top: 50%; width: 130%; height: 130%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(var(--glow), 0.34), rgba(var(--glow), 0.08) 55%, transparent 75%);
  filter: blur(10px);
}
.astro-floater { animation: floatAstro 14s ease-in-out infinite; }
.astro-body { position: relative; transform: rotate(-4deg); }
.astro-body img {
  width: 100%; height: auto;
  filter: contrast(1.06) saturate(1.08) drop-shadow(18px 40px 50px rgba(0,0,0,0.8));
}
/* light from the video frames washes over the suit (masked to the astronaut) */
.astro-tint {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(var(--glow), 1) 0%, rgba(var(--glow), 0.4) 60%, transparent 100%);
  mix-blend-mode: color;
  opacity: var(--tint);
  -webkit-mask: url(assets/astronaut-v2.webp) center / 100% 100% no-repeat;
          mask: url(assets/astronaut-v2.webp) center / 100% 100% no-repeat;
}
#seq {
  position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100lvh;
  z-index: var(--z-backdrop); pointer-events: none;
  opacity: 0; visibility: hidden; display: block;
}
@keyframes floatAstro {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%      { transform: translate3d(0, -3%, 0) rotate(-2deg); }
}

#hero-content {
  position: absolute; top: 50%; right: 7vw;
  transform: translateY(-46%);
  width: min(48vw, 760px);
  text-align: right; z-index: 7;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.32em;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 1.4rem;
}
.hero-eyebrow::before { content: ''; width: 40px; height: 1px; background: currentColor; box-shadow: 0 0 8px currentColor; }

.hero-title {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(3.4rem, 8.4vw, 9.6rem);
  line-height: 0.84; letter-spacing: -0.01em; text-transform: uppercase;
  margin-bottom: 1.8rem;
}
.hero-line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-line .ch { display: inline-block; will-change: transform; }
.hero-line--b { font-style: italic; }
.hero-title .accent {
  background: linear-gradient(100deg, #ffffff 0%, var(--cyan) 38%, var(--violet) 62%, #ffffff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: shimmer 7s linear infinite;
  padding-right: 0.06em;
  display: inline-block;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.hero-sub {
  font-size: clamp(1.02rem, 1.2vw, 1.2rem); line-height: 1.65;
  color: var(--ink-2); max-width: 34em; margin-left: auto; margin-bottom: 2.4rem;
  text-shadow: 0 2px 16px rgba(0,0,0,0.9);
}
.hero-ctas { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; }

/* BUTTONS */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 56px; padding: 0 30px; border-radius: 100px;
  font-family: var(--f-display); font-weight: 700; font-size: 1rem;
  letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
  transition: box-shadow .45s var(--ease-out), background-color .3s, border-color .3s, color .3s;
  isolation: isolate; overflow: hidden;
}
.btn .ico { transition: transform .35s var(--ease-out); }
.btn:hover .ico { transform: translateX(4px); }
.btn-primary {
  color: #02030a; background: var(--ink);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4), 0 18px 50px rgba(110,224,255,0.25);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, var(--cyan), #ffffff 50%, var(--violet));
  transform: translateX(-101%); transition: transform .6s var(--ease-out);
}
.btn-primary:hover::before { transform: translateX(0); }
.btn-primary:hover { box-shadow: 0 0 0 1px var(--cyan), 0 24px 70px rgba(110,224,255,0.45); }
.btn-ghost {
  color: var(--ink); border: 1px solid var(--line-hi);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.btn-ghost:hover { border-color: var(--cyan); background: rgba(110,224,255,0.08); }
.btn-xl { min-height: 64px; padding: 0 40px; font-size: 1.1rem; }

/* SCROLL HINT */
.scroll-hint {
  position: absolute; left: 50%; bottom: calc(var(--lb-base) + 28px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.34em;
  color: var(--dim); text-transform: uppercase; z-index: 7;
}
.scroll-line { width: 1px; height: 46px; background: var(--line); position: relative; overflow: hidden; }
.scroll-line::after {
  content: ''; position: absolute; left: 0; top: -40%; width: 1px; height: 40%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: scrollLine 1.8s var(--ease-out) infinite;
}
@keyframes scrollLine { to { top: 100%; } }

/* PANELS */
.panel {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: min(35rem, 40vw);
  opacity: 0; visibility: hidden; z-index: 8;
}
.panel--left { left: 6vw; }
.panel--right { right: max(7vw, calc(var(--gutter) + 236px)); width: min(35rem, 36vw); }
.panel--center {
  left: 50%; transform: translate(-50%, -50%);
  width: min(46rem, 86vw); text-align: center;
}
.panel-ghost {
  position: absolute; top: 50%; left: 50%;
  font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(7rem, 20vw, 22rem); line-height: 0.8; letter-spacing: -0.02em;
  color: transparent; -webkit-text-stroke: 1px rgba(110, 224, 255, 0.16);
  white-space: nowrap; pointer-events: none; z-index: -1;
  will-change: transform;
}
.frame {
  position: relative;
  padding: clamp(28px, 3vw, 44px) clamp(24px, 2.8vw, 42px);
  background: linear-gradient(160deg, rgba(10, 13, 32, 0.78) 0%, rgba(4, 6, 16, 0.6) 100%);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.25); -webkit-backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: 0 50px 120px rgba(0,0,0,0.65);
}
.corner { position: absolute; width: 18px; height: 18px; border-color: var(--cyan); border-style: solid; border-width: 0; filter: drop-shadow(0 0 6px rgba(110,224,255,0.7)); }
.corner.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.scan {
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.7; pointer-events: none;
  animation: scan 4.5s ease-in-out infinite;
}
@keyframes scan { 0%, 100% { top: 0; opacity: 0; } 10% { opacity: 0.7; } 50% { top: 100%; opacity: 0.4; } 60% { opacity: 0; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 1.1rem;
}
.panel--center .panel-head { justify-content: center; }
.panel-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.26em;
  color: var(--cyan); text-transform: uppercase;
}
.panel-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.panel-idx {
  font-family: var(--f-display); font-weight: 800; font-size: 3.4rem; line-height: 0.8;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.35);
}
.panel--center .panel-idx { display: none; }
.frame h2 {
  font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(2.6rem, 4.4vw, 4.8rem); line-height: 0.88; letter-spacing: -0.005em;
  margin-bottom: 1.1rem;
  text-shadow:
    calc(var(--warp) * -6px) 0 0 rgba(255, 60, 100, calc(var(--warp) * 0.8)),
    calc(var(--warp) * 6px) 0 0 rgba(110, 224, 255, calc(var(--warp) * 0.8));
}
.frame p {
  font-size: clamp(1rem, 1.08vw, 1.1rem); line-height: 1.72; color: var(--ink-2);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.4rem; }
.panel--center .chips { justify-content: center; }
.chips li {
  font-family: var(--f-mono); font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); padding: 7px 12px; border: 1px solid var(--line); border-radius: 100px;
}
.panel-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 1.5rem;
  min-height: 44px;
  font-family: var(--f-display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid transparent; transition: color .25s, gap .3s var(--ease-out);
}
.panel-link:hover { color: var(--cyan); gap: 14px; }

.final-title { font-size: clamp(3rem, 6.4vw, 6.6rem) !important; }
.final-sub { max-width: 32em; margin: 0 auto 2.2rem; }
.final-ctas { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* PORTAL (final sector) */
#portal {
  position: absolute; left: 50%; top: 50%;
  width: 150vmax; height: 150vmax;
  transform: translate(-50%, -50%);
  z-index: 1; pointer-events: none;
  opacity: 0; visibility: hidden;
  -webkit-mask-image: radial-gradient(circle, #000 18%, rgba(0,0,0,0.6) 34%, transparent 52%);
          mask-image: radial-gradient(circle, #000 18%, rgba(0,0,0,0.6) 34%, transparent 52%);
}
#portal .spin {
  position: absolute; inset: 0;
  animation: portalSpin 90s linear infinite;
  animation-play-state: paused;
}
#portal.is-live .spin { animation-play-state: running; }
#portal img { width: 100%; height: 100%; object-fit: cover; }
@keyframes portalSpin { to { transform: rotate(-360deg); } }

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  position: relative; z-index: var(--z-ui);
  background: linear-gradient(180deg, rgba(2,3,10,0) 0%, var(--bg) 14%, var(--bg) 100%);
  padding: 18vh 0 calc(var(--lb-base) + 40px + var(--safe-b));
  overflow: hidden;
}
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 2.2vw 0; }
.marquee-track {
  display: flex; width: max-content; gap: 3vw; align-items: center;
  animation: marquee 32s linear infinite;
}
.marquee-track span {
  font-family: var(--f-display); font-weight: 800; font-style: italic; text-transform: uppercase;
  font-size: clamp(3.4rem, 10vw, 11rem); line-height: 0.9; white-space: nowrap;
}
.marquee-track span:nth-child(4n+3) { color: transparent; -webkit-text-stroke: 1px rgba(243,246,255,0.5); }
.marquee-track svg { width: clamp(28px, 4vw, 64px); height: auto; color: var(--cyan); flex: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px;
  padding: 10vh var(--gutter) 6vh; max-width: 1440px; margin: 0 auto;
}
.f-brand p { color: var(--muted); max-width: 26em; margin: 18px 0 28px; }
.f-brand .logo-wrap { min-height: 0; }
.f-col h3 {
  font-family: var(--f-mono); font-size: 0.68rem; font-weight: 400; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 18px;
}
.f-col li + li { margin-top: 2px; }
.f-col a, .f-col button {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--f-display); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; transition: color .2s;
}
.f-col a:hover, .f-col button:hover { color: var(--cyan); }
.footer-base {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 24px var(--gutter) 0; max-width: 1440px; margin: 0 auto;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim);
}

/* ============================================================
   CURSOR (fine pointers only)
   ============================================================ */
#cursor { display: none; }
html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; }
html.has-cursor #cursor { display: block; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: var(--z-cursor); pointer-events: none;
  border-radius: 50%; transform: translate3d(-100px, -100px, 0);
}
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(243,246,255,0.45);
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), border-color .3s, background-color .3s;
  display: grid; place-items: center;
}
.cursor-ring span {
  font-family: var(--f-mono); font-size: 0.56rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: #02030a; opacity: 0; transition: opacity .2s;
}
#cursor.is-hover .cursor-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--cyan); background: rgba(110,224,255,0.1); }
#cursor.is-label .cursor-ring { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: var(--cyan); border-color: var(--cyan); }
#cursor.is-label .cursor-ring span { opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .hud-timecode { display: none; }
  .site-header { grid-template-columns: 1fr auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .f-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  :root { --lb-base: 0px; }
  body { font-size: 16px; }

  .logo-img { width: 40px; height: 40px; }
  .logo-text { font-size: 0.86rem; letter-spacing: 0.34em; }
  .header-cta { padding: 0 16px; font-size: 0.62rem; letter-spacing: 0.16em; }

  #hero-backdrop img { object-position: 50% 62%; }

  #hero-astronaut {
    top: calc(var(--safe-t) + 9svh); left: 9vw;
    width: 82vw;
  }
  .astro-tint {
    -webkit-mask-image: url(assets/astronaut-v2-760.webp);
            mask-image: url(assets/astronaut-v2-760.webp);
  }
  #hero-content {
    top: auto; bottom: calc(var(--safe-b) + 7svh); right: 16px; left: 16px;
    transform: none;
    width: auto; text-align: center;
  }
  .hero-eyebrow { justify-content: center; margin-bottom: 1rem; }
  .hero-title { font-size: clamp(3.1rem, 15vw, 5.6rem); margin-bottom: 1.1rem; }
  .hero-sub { margin: 0 auto 1.6rem; font-size: 1rem; }
  .hero-ctas { justify-content: center; }
  .hero-ctas .btn-ghost { display: none; }
  .btn { width: 100%; max-width: 420px; }
  .scroll-hint { display: none; }

  .panel, .panel--left, .panel--right, .panel--center {
    top: auto; left: 16px; right: 16px; width: auto;
    bottom: calc(var(--safe-b) + 84px);
    transform: none; text-align: left;
  }
  .panel--center { text-align: center; top: 50%; bottom: auto; transform: translateY(-50%); }
  .panel-ghost { top: auto; bottom: 100%; left: 0; font-size: 30vw; margin-bottom: 10px; }
  .panel--center .panel-ghost { display: none; }
  .frame { padding: 24px 20px 22px; backdrop-filter: blur(12px) saturate(1.15); -webkit-backdrop-filter: blur(12px) saturate(1.15); }
  .panel-idx { font-size: 2.4rem; }
  .frame h2 { font-size: clamp(2.3rem, 11vw, 3.2rem); margin-bottom: 0.7rem; }
  .frame p { font-size: 0.98rem; line-height: 1.62; }
  .chips { margin-top: 1rem; }
  .panel-link { margin-top: 0.8rem; }
  .final-title { font-size: clamp(2.2rem, 10.5vw, 3.4rem) !important; }
  .final-sub { margin-bottom: 1.4rem; }

  #sector-nav {
    top: auto; right: 12px; left: 12px;
    bottom: calc(var(--safe-b) + 12px);
    transform: translateY(160%);
    flex-direction: row; gap: 4px; padding: 6px;
    border-radius: 100px;
    overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  #sector-nav::-webkit-scrollbar { display: none; }
  #sector-nav.visible, #sector-nav:focus-within { transform: translateY(0); }
  .nav-btn { min-height: 44px; border-radius: 100px; padding: 0 16px; scroll-snap-align: center; font-size: 0.64rem; }
  .nav-btn .bar { display: none; }

  .hud { display: none; }
  .btn-xl { min-height: 56px; padding: 0 22px; font-size: 0.95rem; letter-spacing: 0.14em; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; padding-top: 8vh; }
}

@media (min-width: 601px) and (max-width: 900px) {
  #hero-astronaut { width: min(70vw, 520px); left: calc(50% - min(35vw, 260px)); top: calc(var(--safe-t) + 8svh); }
  .panel--left, .panel--right { right: auto; width: min(560px, calc(100% - 32px)); }
  .panel--right { left: auto; right: 16px; }
}

@media (max-width: 380px) {
  .logo-text { display: none; }
}

/* short landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --lb-base: 0px; }
  #hero-astronaut { width: 30vw; top: 8%; left: 4vw; }
  #hero-content { top: 12%; bottom: auto; right: 4vw; left: auto; transform: none; width: 52vw; text-align: right; }
  .hero-eyebrow { justify-content: flex-end; }
  .hero-title { font-size: 12vh; }
  .hero-sub { display: none; }
  .hero-ctas { justify-content: flex-end; }
  .panel, .panel--left, .panel--right { top: 50%; bottom: auto; transform: translateY(-50%); left: auto; right: 16px; width: 58vw; }
  .frame p, .chips { display: none; }
  .panel--center { left: 50%; right: auto; width: 76vw; transform: translate(-50%, -50%); }
  .final-title { font-size: 11vh !important; }
  .frame { padding: 16px 20px; }
  .panel-link { margin-top: 0.4rem; }
  #sector-nav { bottom: 8px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  #grain { animation: none; }
  .letterbox--t, .letterbox--b { transform: translate3d(0, 0, 0); height: var(--lb-base); }
}
