/* ===== Tokens ===== */
:root {
  --ink: #050708;
  --paper: #F4F6F5;
  --signal: #2B8B94;
  --signal-bright: #3CA5AF;
  --signal-dim: #0C3A3E;
  --mist: #8B9598;
  --line: #1B2224;
}

html { scroll-behavior: smooth; }
body { background: var(--ink); color: var(--paper); }
canvas { display: block; }
::selection { background: var(--signal-bright); color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal-bright); outline-offset: 3px; border-radius: 4px; }

/* Film grain over everything: the "ethereal" layer */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .06;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Aurora (hero only) ===== */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; mix-blend-mode: screen;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 55vw; height: 55vw; left: -10vw; top: -20vw; background: var(--signal); }
.aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -8vw; top: 5vw; background: var(--signal-bright); opacity: .35; animation-duration: 28s; }
.aurora span:nth-child(3) { width: 50vw; height: 30vw; left: 25vw; bottom: -18vw; background: #7FD6CF; opacity: .22; animation-duration: 34s; }
@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1) rotate(0deg); }
  50% { transform: translate3d(6vw,4vw,0) scale(1.15) rotate(20deg); }
  100% { transform: translate3d(-4vw,8vw,0) scale(.95) rotate(-10deg); }
}
.aurora::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, var(--ink)); }

/* ===== Brutal surfaces ===== */
.brutal { border: 2px solid var(--paper); box-shadow: 6px 6px 0 var(--signal); transition: transform .15s ease, box-shadow .15s ease; }
.brutal-btn { border: 2px solid var(--paper); box-shadow: 4px 4px 0 var(--paper); transition: transform .12s ease, box-shadow .12s ease; }
.brutal-btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--paper); }
.brutal-btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--paper); }
a.brutal:hover { transform: translate(-3px,-3px); box-shadow: 9px 9px 0 var(--signal); }

/* ===== Glass ===== */
.glass { background: rgba(244,246,245,.04); border: 1px solid rgba(244,246,245,.10); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* ===== Bento spotlight (follows the cursor) ===== */
.spot { position: relative; isolation: isolate; }
.spot::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%), rgba(60,165,175,.18), transparent 60%);
}
.spot:hover::before { opacity: 1; }

/* ===== Marquee ===== */
.marquee { display: flex; gap: 3rem; width: max-content; animation: marquee 40s linear infinite; will-change: transform; -webkit-backface-visibility: hidden; }
@media (hover: hover) { .marquee-wrap:hover .marquee { animation-play-state: paused; } }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== HUD / toasts ===== */
.xp-fill { transition: width .6s cubic-bezier(.2,.8,.2,1); }
.toast-in { animation: toast .35s cubic-bezier(.2,.9,.3,1.3); }
@keyframes toast { from { transform: translateY(16px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.pop { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.25); } }

/* Hero entrance: the one orchestrated moment */
.rise { opacity: 0; transform: translateY(24px); animation: rise .8s cubic-bezier(.2,.8,.2,1) forwards; }
.rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .18s; } .rise.d3 { animation-delay: .3s; } .rise.d4 { animation-delay: .45s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Headline outline treatment */
.outline-text { color: transparent; -webkit-text-stroke: 1.5px var(--paper); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora span, .rise { animation: none !important; opacity: 1; transform: none; }
  .marquee { animation-duration: 90s; }
  *:not(.marquee), *::before, *::after { transition-duration: .01ms !important; }
}

/* ===== Scroll-driven reveals ===== */
.js [data-reveal] {
  opacity: 0; transform: translateY(42px); filter: blur(10px);
  transition: opacity 1s cubic-bezier(.16,1,.3,1), transform 1s cubic-bezier(.16,1,.3,1), filter 1s ease;
  transition-delay: var(--d, 0ms);
}
.js [data-reveal="scale"] { transform: translateY(30px) scale(.94); }
.js [data-reveal="left"] { transform: translateX(-48px); }
.js [data-reveal].in { opacity: 1; transform: none; filter: none; }
.js [data-reveal="clip"] { opacity: 1; filter: none; transform: none; clip-path: inset(0 0 96% 0 round 24px); transition: clip-path 1.2s cubic-bezier(.16,1,.3,1); transition-delay: var(--d, 0ms); }
.js [data-reveal="clip"].in { clip-path: inset(0 0 0 0 round 24px); }

/* Word-by-word headline rise */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.split .w > span { display: inline-block; transform: translateY(110%) rotate(4deg); transition: transform 1.1s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i) * 60ms + var(--d, 0ms)); }
.split.in .w > span { transform: none; }

/* Timeline line draws as you scroll */
.timeline-line { transform-origin: top; transform: scaleY(var(--p, 0)); }

/* Scroll progress bar */
#scroll-progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 45; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--signal), var(--signal-bright)); }

/* 3D tilt cards */
[data-tilt] { transform-style: preserve-3d; transition: transform .25s ease; will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js [data-reveal="clip"], .split .w > span { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
  .timeline-line { transform: none; }
}
.js [data-tilt].tilting { transition: transform .2s ease; transition-delay: 0ms; }
