:root {
  --bg: #0a0a12;
  --bg-alt: #0f0f1a;
  --surface: #14141f;
  --ink: #f2f1f8;
  --ink-dim: #a6a3bd;
  --ink-faint: #6c6a85;
  --accent: #00d9c0;
  --accent-2: #6c5ce7;
  --accent-rgb: 0, 217, 192;
  --border: #232236;
  --radius: 14px;
  --wrap: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Subtle film-grain overlay for depth — cheap (inline SVG turbulence
   filter, no image asset) and non-interactive. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%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");
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(10, 10, 18, 0.6);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: nav-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.nav-wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-cta:hover { background: #00b39e; }
.nav-progress {
  position: absolute;
  bottom: -1px; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}

@media (max-width: 720px) {
  .nav-links a:not(.nav-cta) { display: none; }
}

/* ── Reveal-on-scroll ────────────────────────────────────────────────────
   Driven continuously by scroll position via the --p custom property
   (0 → 1, set every animation frame in script.js), not a one-shot class
   toggle — so the motion scrubs smoothly with scroll in both directions
   instead of firing a fixed-duration transition once. */
.reveal {
  --p: 0;
  opacity: var(--p);
  transform: translateY(calc((1 - var(--p)) * 36px)) scale(calc(0.985 + var(--p) * 0.015));
  will-change: opacity, transform;
}
/* Elements inside a section that should lag slightly behind the section's
   own progress, for a subtle layered-depth feel (index number vs copy). */
.story-index {
  --ip: 0;
  opacity: calc(0.35 + var(--ip) * 0.65);
  transform: translateY(calc((1 - var(--ip)) * 20px));
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
  .story-index {
    opacity: 1;
    transform: none;
  }
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 24px 80px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hero-bg.has-webgl #hero-canvas {
  opacity: 1;
}
.hero-bg.has-webgl .orb {
  opacity: 0;
  transition: opacity 1.2s ease;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 40%, transparent 90%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.orb-1 {
  width: 480px; height: 480px;
  background: var(--accent);
  top: -140px; left: 10%;
}
.orb-2 {
  width: 380px; height: 380px;
  background: var(--accent-2);
  top: 20%; right: 5%;
  opacity: 0.28;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 16px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  padding-bottom: 0.08em;
}
.accent-text {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 50%, var(--accent) 90%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-sub {
  font-size: 1.15rem;
  color: var(--ink-dim);
  max-width: 600px;
  margin: 0 auto 36px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Hero entrance ─────────────────────────────────────────────────────
   One-time animation on page load, separate from the scroll-linked
   .reveal system — the hero is already in view on load, so scroll
   progress alone wouldn't produce a visible entrance for it. The h1 does
   a "curtain" clip-path wipe as the eye-catching centerpiece; everything
   else staggers in around it. */
@keyframes nav-in {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes fade-up-in {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes curtain-in {
  from { clip-path: inset(0 0 100% 0); opacity: 0; }
  to { clip-path: inset(0 0 0% 0); opacity: 1; }
}
.hero-content .eyebrow {
  animation: fade-up-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}
.hero h1 {
  animation: curtain-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
}
.hero-sub {
  animation: fade-up-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.68s both;
}
.hero-actions {
  animation: fade-up-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.84s both;
}
@media (prefers-reduced-motion: reduce) {
  .nav, .hero-content .eyebrow, .hero h1, .hero-sub, .hero-actions {
    animation: none;
  }
}

/* Cursor-reactive glow — desktop/fine-pointer only, position set from
   script.js via --mx/--my on .hero-bg. */
.cursor-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    360px circle at var(--mx, 50%) var(--my, 50%),
    rgba(var(--accent-rgb), 0.14),
    transparent 70%
  );
}
.hero-bg.cursor-active .cursor-glow {
  opacity: 1;
}
@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #00b39e; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-wide { width: 100%; }

/* ── Story sections ──────────────────────────────────────────────────────
   No hard border between sections — a visible seam line works against the
   continuous scroll-scrub feel. Instead each section fades in from the
   previous one's background colour over its first ~200px, so alternating
   sections blend into each other rather than cutting sharply. */
.story-section {
  padding: 120px 24px;
  background: linear-gradient(to bottom, var(--bg-alt) 0, var(--bg) 200px, var(--bg) 100%);
}
.story-section.alt {
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg-alt) 200px, var(--bg-alt) 100%);
}
#discover {
  background: var(--bg);
}
.story-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: start;
}
.story-index {
  font-size: 5rem;
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--border);
  line-height: 1;
  letter-spacing: -0.02em;
}
.story-copy { max-width: 640px; }
.story-copy h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  line-height: 1.18;
}
.story-copy .body {
  color: var(--ink-dim);
  font-size: 1.05rem;
  margin: 0 0 24px;
}
.tag-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.tag-list li:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .story-inner { grid-template-columns: 1fr; gap: 16px; }
  .story-index { font-size: 3rem; }
  .story-section { padding: 80px 20px; }
}

/* ── CTA / contact ───────────────────────────────────────────────────── */
.cta-section {
  padding: 130px 24px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(var(--accent-rgb), 0.16), transparent 70%),
    linear-gradient(to bottom, var(--bg-alt) 0, var(--bg) 200px, var(--bg) 100%);
}
.cta-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.cta-inner h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.cta-inner .body {
  color: var(--ink-dim);
  margin: 0 0 36px;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 10px;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--ink-faint);
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-fine {
  color: var(--ink-faint);
  font-size: 0.82rem;
  text-align: center;
  margin: 16px 0 0;
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  padding: 32px 24px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.footer-sep { opacity: 0.5; }
.footer-inner a {
  color: var(--ink-faint);
  text-decoration: none;
}
.footer-inner a:hover { color: var(--ink-dim); }
