/* ===== FOUNDR DESIGN TOKENS ===== */
:root {
  /* Brand */
  --brand: #5172FF;
  --brand-soft: rgba(81, 114, 255, 0.18);
  --brand-glow: rgba(81, 114, 255, 0.55);

  /* Dark (default) */
  --bg: #0A0A0B;
  --bg-elev: #111114;
  --bg-card: #0F0F12;
  --fg: #F5F5F4;
  --fg-dim: #9A9AA2;
  --fg-faint: #56565C;
  --rule: rgba(255, 255, 255, 0.08);
  --rule-strong: rgba(255, 255, 255, 0.16);
  --grain-opacity: 0.06;

  /* Type */
  --font-display: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Scale */
  --pad-page: clamp(20px, 3vw, 48px);
  --radius: 14px;
  --radius-lg: 22px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-snap: cubic-bezier(0.3, 1.4, 0.4, 1);
}

[data-theme="light"] {
  --bg: #F3F2EE;
  --bg-elev: #EBEAE4;
  --bg-card: #FFFFFF;
  --fg: #0A0A0B;
  --fg-dim: #56565C;
  --fg-faint: #9A9AA2;
  --rule: rgba(0, 0, 0, 0.1);
  --rule-strong: rgba(0, 0, 0, 0.2);
  --grain-opacity: 0.04;
}

/* Font-pair tweak */
[data-fontpair="editorial"] {
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Inter Tight', sans-serif;
}
[data-fontpair="mono"] {
  --font-display: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Inter Tight', sans-serif;
}
[data-fontpair="classic"] {
  --font-display: 'Inter Tight', sans-serif;
  --font-body: 'Inter Tight', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 600ms var(--ease-out), color 600ms var(--ease-out);
}
html { overflow-x: clip; }
body { cursor: none; }
[data-cursor="default"] body { cursor: auto; }

a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; color: inherit; cursor: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--brand); color: #fff; }

.mono { font-family: var(--font-mono); font-feature-settings: "liga" 0; letter-spacing: 0.02em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* Page container */
.page { padding: 0 var(--pad-page); }

/* Ambient grain + gradient */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  mix-blend-mode: overlay; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='1'/></svg>");
}
.aurora {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40vw 40vw at var(--ax, 30%) var(--ay, 40%), rgba(81,114,255,0.35), transparent 60%),
    radial-gradient(35vw 35vw at var(--bx, 70%) var(--by, 70%), rgba(81,114,255,0.15), transparent 60%);
  filter: blur(40px);
  transition: opacity 800ms var(--ease-out);
}
[data-theme="light"] .aurora {
  background:
    radial-gradient(45vw 45vw at var(--ax, 30%) var(--ay, 40%), rgba(81,114,255,0.75), transparent 65%),
    radial-gradient(40vw 40vw at var(--bx, 70%) var(--by, 70%), rgba(81,114,255,0.45), transparent 65%);
  filter: blur(24px);
  opacity: 1;
}

/* Cursor */
.cursor-ring, .cursor-dot {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  border-radius: 50%; will-change: transform;
}
.cursor-ring {
  width: 36px; height: 36px; border: 1px solid var(--fg);
  transform: translate(-50%, -50%);
  transition: width 220ms var(--ease-out), height 220ms var(--ease-out), background 220ms, border-color 220ms;
  mix-blend-mode: difference;
}
.cursor-dot {
  width: 4px; height: 4px; background: var(--brand);
  transform: translate(-50%, -50%);
}
body.cursor-hover .cursor-ring {
  width: 70px; height: 70px; background: var(--brand); border-color: var(--brand);
}
body.cursor-text .cursor-ring {
  width: 6px; height: 28px; border-radius: 2px;
}

[data-cursor="crosshair"] .cursor-ring {
  width: 54px; height: 54px; background: transparent;
  border: 1px dashed var(--brand); mix-blend-mode: normal;
}
[data-cursor="crosshair"] .cursor-ring::before,
[data-cursor="crosshair"] .cursor-ring::after {
  content: ''; position: absolute; background: var(--brand);
}
[data-cursor="crosshair"] .cursor-ring::before {
  left: 50%; top: -6px; bottom: -6px; width: 1px; transform: translateX(-50%);
}
[data-cursor="crosshair"] .cursor-ring::after {
  top: 50%; left: -6px; right: -6px; height: 1px; transform: translateY(-50%);
}
[data-cursor="blob"] .cursor-ring {
  width: 48px; height: 48px; background: var(--brand); border-color: transparent;
  filter: blur(12px); opacity: 0.7; mix-blend-mode: normal;
}
[data-cursor="default"] .cursor-ring, [data-cursor="default"] .cursor-dot { display: none; }

/* Magnetic affordance helper */
[data-magnet] { transition: transform 300ms var(--ease-out); will-change: transform; }

/* Reveal primitives */
.reveal-mask { overflow: hidden; display: inline-block; }
.reveal-mask > * { display: inline-block; transform: translateY(110%); }
.reveal-mask.in > * {
  transform: translateY(0);
  transition: transform 900ms var(--ease-out) var(--delay, 0ms);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  letter-spacing: 0.02em;
  position: relative; overflow: hidden;
  transition: background 250ms, color 250ms, transform 250ms var(--ease-out);
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: #3E5BFF; }
.btn--ghost { background: transparent; color: var(--fg); border: 1px solid var(--rule-strong); }
.btn--ghost:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn .arrow {
  display: inline-block; transition: transform 300ms var(--ease-out);
}
.btn:hover .arrow { transform: translateX(4px); }

/* Marquee */
.marquee {
  display: flex; overflow: hidden; gap: 60px; white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex; gap: 60px; animation: marquee var(--dur, 40s) linear infinite;
  flex-shrink: 0;
}
.marquee__track.rev { animation-direction: reverse; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Noise border card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

/* Tweak panel */
.tweaks {
  position: fixed; right: 20px; bottom: 20px; z-index: 9500;
  background: var(--bg-card); border: 1px solid var(--rule-strong);
  border-radius: 16px; padding: 16px; width: 260px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: none;
}
.tweaks.active { display: block; }
.tweaks h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 12px; }
.tweaks .row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tweaks .row:last-child { margin-bottom: 0; }
.tweaks .label { font-family: var(--font-mono); font-size: 10px; color: var(--fg-dim); width: 100%; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.tweaks button {
  padding: 6px 10px; font-size: 11px; font-family: var(--font-mono);
  border: 1px solid var(--rule-strong); border-radius: 6px; cursor: none;
}
.tweaks button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Mobile */
@media (max-width: 720px) {
  body { cursor: auto; }
  .cursor-ring, .cursor-dot { display: none; }
}

/* Mobile aurora — touch devices don't trigger mousemove, so the cursor-
   linked gradient never moves and at 40px blur it washes out to almost
   nothing on a small viewport. Pin it at a flattering spot behind the
   hero (top-left of the screen), spread it wider, and bump the saturation
   so the hero doesn't feel flat. */
@media (max-width: 820px) {
  .aurora {
    filter: blur(28px);
    background:
      radial-gradient(75vw 70vw at 25% 22%, rgba(81,114,255,0.60), transparent 62%),
      radial-gradient(55vw 55vw at 85% 78%, rgba(81,114,255,0.30), transparent 60%);
  }
  [data-theme="light"] .aurora {
    filter: blur(20px);
    background:
      radial-gradient(75vw 70vw at 25% 22%, rgba(81,114,255,0.85), transparent 62%),
      radial-gradient(55vw 55vw at 85% 78%, rgba(81,114,255,0.50), transparent 60%);
  }
}
