/* Wilson — shared tokens, orb, nav, typography */
/* Dark is default; [data-theme="light"] flips to warm cream. No external fonts. */

:root {
  /* Dark (default) — pulled from the Wilson shell palette */
  --bg: #0F0D0E;
  --bg-elev: #1A1718;
  --bg-sunk: #0A0809;
  --text: #F5F0EB;
  --text-dim: #A89F97;
  --text-faint: #6B625A;
  --rule: rgba(245, 240, 235, 0.08);
  --rule-strong: rgba(245, 240, 235, 0.16);
  --card-tint: rgba(245, 240, 235, 0.025);

  /* Orb semantic colors — matches WilsonOrbView.swift */
  --c-coral: #F97066;
  --c-green: #86EFAC;
  --c-orange: #FDBA74;
  --c-teal: #67E8F9;
  --c-red: #FF4444;

  /* Active orb color — --orb-target is set instantly by the scroll observer,
     --orb is the smoothly-lerped value written by the canvas every frame
     (so everything that uses var(--orb) transitions in sync with the orb). */
  --orb-target: #F97066;
  --orb: #F97066;
  --orb-alpha: 0.62;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  /* No monospace — the title font is used for everything */
  --font-mono: var(--font);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="light"] {
  --bg: #F4EFE8;
  --bg-elev: #FBF7F1;
  --bg-sunk: #EAE3DA;
  --text: #14110F;
  --text-dim: #463F37;
  --text-faint: #726859;
  --rule: rgba(26, 22, 21, 0.1);
  --rule-strong: rgba(26, 22, 21, 0.18);
  --card-tint: rgba(26, 22, 21, 0.025);
  --orb-alpha: 0.95;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4EFE8;
    --bg-elev: #FBF7F1;
    --bg-sunk: #EAE3DA;
    --text: #14110F;
    --text-dim: #463F37;
    --text-faint: #726859;
    --rule: rgba(26, 22, 21, 0.1);
    --rule-strong: rgba(26, 22, 21, 0.18);
    --card-tint: rgba(26, 22, 21, 0.025);
    --orb-alpha: 0.95;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

/* ------------------------------------------------------------------ */
/* THE ORB — fixed background layer, color morphs on scroll           */
/* ------------------------------------------------------------------ */

.orb-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}

/* Soft color bloom sitting BEHIND the dot canvas — gives the halo */
.orb {
  position: absolute;
  top: 50%; left: 50%;
  width: min(140vw, 1700px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%,
      color-mix(in oklab, var(--orb) 70%, transparent) 0%,
      color-mix(in oklab, var(--orb) 32%, transparent) 38%,
      transparent 72%);
  filter: blur(90px) saturate(1.25);
  opacity: calc(var(--orb-alpha) * 0.95);
  transition:
    background 2s var(--ease),
    opacity 1.2s var(--ease);
  animation: orb-breathe 7s ease-in-out infinite;
  will-change: transform;
}

/* The actual halftone-dot canvas, crisp on top of the bloom */
.orb-canvas {
  position: absolute;
  top: 50%; left: 50%;
  width: min(120vw, 1400px);
  height: min(120vw, 1400px);
  transform: translate(-50%, -50%);
  opacity: calc(var(--orb-alpha) * 1.5);
  transition: opacity 1.2s var(--ease);
  animation: orb-breathe 7s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
}

@keyframes orb-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.97); }
  50%      { transform: translate(-50%, -50%) scale(1.03); }
}

/* film grain / paper texture so the orb has a skin instead of a plasticky sheen */
.orb-stage::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  pointer-events: none;
}

[data-theme="light"] .orb-stage::after {
  background-image:
    radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px);
}

/* fade-to-edge vignette keeps text legible. Stronger in light mode
   because the bright orb washes text if left unvignetted. */
.orb-stage .vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 45% 40% at center,
      color-mix(in oklab, var(--bg) 40%, transparent) 0%,
      transparent 60%),
    radial-gradient(ellipse at center,
      transparent 15%,
      color-mix(in oklab, var(--bg) 55%, transparent) 50%,
      var(--bg) 92%);
  pointer-events: none;
}
[data-theme="light"] .orb-stage .vignette,
:root:not([data-theme="dark"]) .orb-stage .vignette {
  background: radial-gradient(ellipse at center,
    transparent 10%,
    color-mix(in oklab, var(--bg) 75%, transparent) 35%,
    var(--bg) 80%);
}

@media (prefers-reduced-motion: reduce) {
  .orb, .orb-canvas { animation: none; }
  .orb { transition: background 0.4s linear; }
}

/* ------------------------------------------------------------------ */
/* NAV                                                                */
/* ------------------------------------------------------------------ */

.nav {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.nav__brand {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 10px;
  font-weight: 600; font-size: 0.875rem; letter-spacing: 0.06em;
}
.nav__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--orb);
  box-shadow: 0 0 12px var(--orb);
  transition: background 1.2s var(--ease), box-shadow 1.2s var(--ease);
}
.nav a {
  padding: 8px 14px;
  font-size: 0.875rem;
  color: var(--text-dim);
  border-radius: 999px;
  transition: color 0.18s, background 0.18s;
}
.nav a:hover { color: var(--text); background: var(--card-tint); }
.nav a[aria-current="page"] { color: var(--text); background: var(--card-tint); }
.nav__cta {
  padding: 8px 16px !important;
  background: var(--text) !important;
  color: var(--bg) !important;
  font-weight: 500;
}
.nav__cta:hover { background: var(--text) !important; opacity: 0.88; }

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: color 0.18s, background 0.18s;
}
.theme-toggle:hover { color: var(--text); background: var(--card-tint); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .sun,
:root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon,
:root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: block; }
}

/* ------------------------------------------------------------------ */
/* LAYOUT                                                             */
/* ------------------------------------------------------------------ */

.wrap  { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 760px; }

section {
  position: relative;
  padding: 140px 0;
}
section + section { border-top: 1px solid var(--rule); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: currentColor;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.015em; line-height: 1.3; }

p.lede {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  color: var(--text-dim);
  max-width: 620px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ */
/* BUTTONS                                                            */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  font-size: 0.9375rem; font-weight: 500;
  border-radius: 999px;
  transition: transform 0.12s, background 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--text);
  color: var(--bg);
}
.btn--primary:hover {
  box-shadow: 0 0 0 6px var(--card-tint);
}

.btn--orb {
  background: var(--orb);
  color: #0A0809;
  box-shadow: 0 8px 40px -12px var(--orb);
  transition: background 1.2s var(--ease), transform 0.12s, box-shadow 0.25s;
}
.btn--orb:hover {
  box-shadow: 0 12px 60px -10px var(--orb);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--rule-strong);
}
.btn--ghost:hover { border-color: var(--text); }

.btn__chev { width: 14px; height: 14px; opacity: 0.7; }

/* ------------------------------------------------------------------ */
/* CARDS                                                              */
/* ------------------------------------------------------------------ */

.card {
  padding: 28px;
  background: color-mix(in oklab, var(--bg-elev) 96%, transparent);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.card__kicker {
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--orb);
  transition: color 1.2s var(--ease);
  margin-bottom: 10px;
}

.card p {
  color: var(--text-dim);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.card h3 { margin-bottom: 8px; }

/* ------------------------------------------------------------------ */
/* FOOTER                                                             */
/* ------------------------------------------------------------------ */

footer {
  padding: 56px 0 48px;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--text-faint);
}
footer .wrap {
  display: flex; flex-wrap: wrap; gap: 24px;
  justify-content: space-between; align-items: center;
}
footer a:hover { color: var(--text); }

/* ------------------------------------------------------------------ */
/* LIFT — soft radial backdrop behind text so it reads over the orb   */
/* ------------------------------------------------------------------ */

.lift {
  position: relative;
  isolation: isolate;
}
.lift::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -40px -60px;
  background: radial-gradient(ellipse at center,
    color-mix(in oklab, var(--bg) 82%, transparent) 0%,
    color-mix(in oklab, var(--bg) 55%, transparent) 45%,
    transparent 78%);
  filter: blur(20px);
  pointer-events: none;
}
[data-theme="light"] .lift::before,
:root:not([data-theme="dark"]) .lift::before {
  background: radial-gradient(ellipse at center,
    color-mix(in oklab, var(--bg) 88%, transparent) 0%,
    color-mix(in oklab, var(--bg) 62%, transparent) 45%,
    transparent 78%);
}

/* Per-letter halation: multi-layer text-shadow of the bg color so every
   letter has a soft bg-colored glow. Reads as "text melted into the
   background" instead of "text sitting on a card". No visible box. */
h1, h2, h3, .lede,
.steps h3, .steps p,
.after__step h3, .after__step p,
.log__item h3, .log__item p,
.req__value, .req p,
.priv__key, .priv__item p,
.hero__meta,
.eyebrow {
  text-shadow:
    0 0 6px var(--bg),
    0 0 14px var(--bg),
    0 0 24px var(--bg);
}

/* Light mode — tighter/stronger halation because the orb is much brighter */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] .lede,
[data-theme="light"] .steps h3,
[data-theme="light"] .steps p,
[data-theme="light"] .after__step h3,
[data-theme="light"] .after__step p,
[data-theme="light"] .log__item h3,
[data-theme="light"] .log__item p,
[data-theme="light"] .req__value,
[data-theme="light"] .req p,
[data-theme="light"] .priv__key,
[data-theme="light"] .priv__item p,
[data-theme="light"] .hero__meta,
[data-theme="light"] .eyebrow,
:root:not([data-theme="dark"]) h1,
:root:not([data-theme="dark"]) h2,
:root:not([data-theme="dark"]) h3,
:root:not([data-theme="dark"]) .lede,
:root:not([data-theme="dark"]) .steps h3,
:root:not([data-theme="dark"]) .steps p,
:root:not([data-theme="dark"]) .after__step h3,
:root:not([data-theme="dark"]) .after__step p,
:root:not([data-theme="dark"]) .log__item h3,
:root:not([data-theme="dark"]) .log__item p,
:root:not([data-theme="dark"]) .req__value,
:root:not([data-theme="dark"]) .req p,
:root:not([data-theme="dark"]) .priv__key,
:root:not([data-theme="dark"]) .priv__item p,
:root:not([data-theme="dark"]) .hero__meta,
:root:not([data-theme="dark"]) .eyebrow {
  text-shadow:
    0 0 4px var(--bg),
    0 0 10px var(--bg),
    0 0 18px var(--bg),
    0 0 28px color-mix(in oklab, var(--bg) 70%, transparent);
}

/* Don't halate text INSIDE cards — cards are already opaque, halation just
   looks blurry there. */
.card h1, .card h2, .card h3, .card p,
.tier h1, .tier h2, .tier h3, .tier p,
.pain-card h1, .pain-card h2, .pain-card h3, .pain-card p,
.receipt p, .trace__line {
  text-shadow: none !important;
}

/* ------------------------------------------------------------------ */
/* SCROLL REVEAL                                                      */
/* ------------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------------ */
/* RESPONSIVE                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 860px) {
  .nav a:not(.nav__cta) { display: none; } /* hide Home/Pricing/Download text links */
}

@media (max-width: 720px) {
  section { padding: 96px 0; }
  .wrap { padding: 0 20px; }
  .nav {
    top: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    width: auto;
    max-width: none;
    padding: 4px;
    justify-content: space-between;
  }
  .nav__brand {
    padding: 6px 10px 6px 8px;
    font-size: 0.8125rem;
  }
  .nav__cta {
    padding: 8px 14px !important;
    font-size: 0.8125rem;
  }
  .theme-toggle { width: 34px; height: 34px; }

  h1 { font-size: clamp(2.25rem, 10vw, 3.5rem); line-height: 1.05; }
  h2 { font-size: clamp(1.75rem, 7vw, 2.25rem); }
  p.lede { font-size: 1rem; }

  .orb { width: 180vw; filter: blur(60px) saturate(1.2); }
  .orb-canvas { width: 160vw; height: 160vw; }

  .btn { padding: 12px 20px; font-size: 0.9375rem; width: 100%; justify-content: center; }
}

@media (max-width: 420px) {
  .nav__brand span:last-child { display: none; } /* hide WILSON text, keep dot */
}
