/* ============================================================
   IDST — design system
   Dark-first. Accent derived from the original IDST primary
   (#149dcc), pushed saturated for the dark ground and deepened
   for the light ground so both read as designed, not inverted.
   ============================================================ */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/BricolageGrotesque-Variable.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'InterVar';
  src: url('../fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #07090c;
  --bg-2: #0b0f15;
  --surface: #10161e;
  --surface-2: #151d27;
  --ink: #e9f1f7;
  --ink-dim: #b3c1cf;
  --muted: #7d8b9b;
  --line: #1b232e;
  --line-bright: #2a3644;
  --accent: #2bd4f0;
  --accent-ink: #04212a;
  --warn: #f0a92b; /* the 1% — mismatches, prototypes, caveats */
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;

  --display: 'Bricolage', ui-sans-serif, system-ui, sans-serif;
  --body: 'InterVar', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;

  --gut: clamp(1.25rem, 4vw, 2.5rem);
  --maxw: 1180px;
  --rule: 1px solid var(--line);
  --r: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme='light'] {
  --bg: #f1efe9;
  --bg-2: #e9e6de;
  --surface: #fbfaf7;
  --surface-2: #f4f2ec;
  --ink: #0a0e13;
  --ink-dim: #333d49;
  --muted: #5e6b79;
  --line: #d8d4c9;
  --line-bright: #c2bdaf;
  --accent: #0a7ba6;
  --accent-ink: #ffffff;
  --warn: #a8620a;
  --shadow: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f1efe9;
    --bg-2: #e9e6de;
    --surface: #fbfaf7;
    --surface-2: #f4f2ec;
    --ink: #0a0e13;
    --ink-dim: #333d49;
    --muted: #5e6b79;
    --line: #d8d4c9;
    --line-bright: #c2bdaf;
    --accent: #0a7ba6;
    --accent-ink: #ffffff;
    --warn: #a8620a;
    --shadow: none;
  }
}

/* SVG sprite: must stay rendered (not display:none) or its <mask> never applies. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  font-variation-settings: 'opsz' 18;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.75rem 1.25rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip:focus { left: 0; }

/* ---------- type ---------- */
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(3rem, 11vw, 8.5rem); font-variation-settings: 'wght' 700, 'wdth' 88, 'opsz' 96; }
h2 { font-size: clamp(2rem, 5.2vw, 3.9rem); font-variation-settings: 'wght' 620, 'wdth' 92, 'opsz' 48; }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.15; font-variation-settings: 'wght' 620, 'wdth' 95, 'opsz' 24; }
p { margin: 0 0 1.1em; max-width: 62ch; }
p:last-child { margin-bottom: 0; }

.lede { font-size: clamp(1.1rem, 1rem + 0.7vw, 1.5rem); line-height: 1.42; color: var(--ink-dim); max-width: 34ch; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.eyebrow::before { content: ''; width: 1.75rem; height: 1px; background: currentColor; flex: none; }
.small { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.wrap { width: min(100% - (var(--gut) * 2), var(--maxw)); margin-inline: auto; }
section { padding-block: clamp(5rem, 12vh, 9rem); position: relative; }
.rule-top { border-top: var(--rule); }

.grid-2 {
  display: grid; gap: clamp(2rem, 5vw, 4.5rem);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); align-items: start; }
  .grid-2.sticky-left > :first-child { position: sticky; top: 7rem; }
}

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 90;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem var(--gut);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s, background 0.4s;
}
.nav.stuck { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; margin-right: auto; }
.brand svg { width: 26px; height: 26px; color: var(--ink); flex: none; }
.brand b {
  font-family: var(--display); font-size: 1.08rem; letter-spacing: 0.01em;
  font-variation-settings: 'wght' 700, 'wdth' 84;
}
.nav-links { display: none; gap: 1.5rem; }
@media (min-width: 860px) { .nav-links { display: flex; } }
.nav-links a {
  text-decoration: none; font-size: 0.85rem; color: var(--muted);
  transition: color 0.25s; position: relative; padding-block: 0.35rem;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--accent); transition: width 0.35s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  background: transparent; border: var(--rule); border-radius: 9px;
  cursor: pointer; color: var(--muted); transition: color 0.25s, border-color 0.25s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-bright); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn[aria-pressed='true'] { color: var(--accent); border-color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.4rem; border-radius: 100px; text-decoration: none;
  font-size: 0.92rem; font-weight: 550; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  transition: transform 0.3s var(--ease), background 0.3s, box-shadow 0.3s;
  will-change: transform; cursor: pointer;
}
.btn:hover { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-bright); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }

/* ---------- preloader ---------- */
#preload {
  position: fixed; inset: 0; z-index: 300; background: var(--bg);
  display: grid; place-content: center; justify-items: center; gap: 1.1rem;
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
#preload.done { opacity: 0; visibility: hidden; pointer-events: none; }
#preload svg { width: 46px; height: 46px; color: var(--ink); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-7px); } }
#preload .num {
  font-family: var(--display); font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-variation-settings: 'wght' 700, 'wdth' 80; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
#preload .cap { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); }
#preload .bar { width: min(230px, 50vw); height: 1px; background: var(--line); overflow: hidden; }
#preload .bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: flex; align-items: flex-end; padding-bottom: clamp(3rem, 8vh, 6rem); padding-top: 7rem; }
#gl { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.hero-fallback {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 55% at 68% 42%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(40% 40% at 22% 72%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  opacity: 0.85;
}
.hero-fallback::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(currentColor 0.6px, transparent 0.6px);
  background-size: 4px 4px; color: var(--ink); opacity: 0.09;
  -webkit-mask-image: radial-gradient(60% 60% at 60% 45%, #000, transparent 75%);
  mask-image: radial-gradient(60% 60% at 60% 45%, #000, transparent 75%);
}
.hero .wrap { position: relative; z-index: 2; }
.hero h1 { margin-bottom: 1.5rem; }
.hero h1 .ch { display: inline-block; will-change: transform, opacity; }
.hero h1 .accent { color: var(--accent); }
.hero .lede { max-width: 40ch; }

.scroll-cue {
  position: absolute; left: var(--gut); bottom: 1.5rem; z-index: 2;
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 0.55rem;
}
.scroll-cue::after {
  content: ''; width: 1px; height: 26px;
  background: linear-gradient(var(--accent), transparent);
  animation: drop 2s ease-in-out infinite;
}
@keyframes drop { 0%, 100% { transform: scaleY(0.3); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } }

/* everything after the hero sits on an opaque plate above the canvas */
.plate { position: relative; z-index: 1; background: var(--bg); }

/* ---------- proof ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: var(--rule); border-radius: var(--r); overflow: hidden; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); padding: clamp(1.25rem, 3vw, 2rem); box-shadow: var(--shadow); }
.stat .n {
  font-family: var(--display); font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  font-variation-settings: 'wght' 700, 'wdth' 78; letter-spacing: -0.04em;
  line-height: 1; font-variant-numeric: tabular-nums; display: block;
}
.stat .l { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin-top: 0.7rem; display: block; }
.stat.hero-stat .n { color: var(--accent); }

/* ---------- cards ---------- */
.cards { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); margin-top: 3rem; }
@media (min-width: 820px) { .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  background: var(--surface); border: var(--rule); border-radius: var(--r);
  padding: clamp(1.5rem, 3vw, 2.1rem); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 0.85rem;
  transition: border-color 0.4s, transform 0.5s var(--ease);
}
.card:hover { border-color: var(--line-bright); }
.card .tag {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.card .tag.warn { color: var(--warn); }
.card p { color: var(--ink-dim); font-size: 0.95rem; }
.card ul { margin: 0; padding-left: 1.05rem; color: var(--muted); font-size: 0.88rem; }
.card li { margin-bottom: 0.35rem; }
.card .foot { margin-top: auto; padding-top: 1rem; border-top: var(--rule); font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

/* ---------- evidence ---------- */
.case {
  border: var(--rule); border-radius: var(--r); background: var(--surface);
  padding: clamp(1.6rem, 4vw, 3rem); box-shadow: var(--shadow);
}
.case-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 1.25rem; margin-bottom: 1.5rem; }
.case-head h3 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
.badge {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.13em; text-transform: uppercase;
  padding: 0.3rem 0.6rem; border-radius: 100px; border: 1px solid currentColor; color: var(--accent);
}
.badge.warn { color: var(--warn); }
.spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: var(--rule); border-radius: 10px; overflow: hidden; margin-top: 1.75rem; }
.spec div { background: var(--surface-2); padding: 0.9rem 1rem; }
.spec dt { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.spec dd { margin: 0.35rem 0 0; font-family: var(--display); font-size: 1.15rem; font-variation-settings: 'wght' 620, 'wdth' 88; font-variant-numeric: tabular-nums; }

.strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2.5rem; }
.chip {
  font-family: var(--mono); font-size: 0.74rem; padding: 0.45rem 0.8rem;
  border: var(--rule); border-radius: 100px; color: var(--muted); background: var(--surface);
}
.chip b { color: var(--ink-dim); font-weight: 500; }

/* ---------- method ---------- */
.steps { counter-reset: s; display: grid; gap: 0; margin-top: 3rem; }
.step {
  counter-increment: s; display: grid; gap: 0.35rem 1.75rem; padding-block: clamp(1.5rem, 3vw, 2.25rem);
  border-top: var(--rule); grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 780px) { .step { grid-template-columns: 5rem minmax(0, 22ch) minmax(0, 1fr); align-items: start; } }
.step::before {
  content: counter(s, decimal-leading-zero);
  font-family: var(--mono); font-size: 0.8rem; color: var(--accent); padding-top: 0.35rem;
}
.step h3 { font-size: 1.15rem; }
.step p { color: var(--muted); font-size: 0.93rem; margin: 0; }

/* ---------- pricing ---------- */
.price { position: relative; }
.price.feature { border-color: var(--accent); }
.price .amt {
  font-family: var(--display); font-size: clamp(2.2rem, 5vw, 3rem);
  font-variation-settings: 'wght' 700, 'wdth' 80; letter-spacing: -0.04em; line-height: 1;
}
.price .per { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- contact ---------- */
.contact-box { border: var(--rule); border-radius: var(--r); background: var(--surface); padding: clamp(1.75rem, 5vw, 3.5rem); box-shadow: var(--shadow); }
.mail {
  font-family: var(--display); font-size: clamp(1.5rem, 5.5vw, 3.2rem);
  font-variation-settings: 'wght' 640, 'wdth' 84; letter-spacing: -0.035em;
  text-decoration: none; display: inline-block; word-break: break-word;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.5s var(--ease), color 0.3s;
}
.mail:hover { color: var(--accent); background-size: 100% 2px; }

/* ---------- footer ---------- */
footer { border-top: var(--rule); padding-block: 3rem; background: var(--bg-2); position: relative; z-index: 1; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: center; justify-content: space-between; }
footer svg.mark { width: 30px; height: 30px; color: var(--muted); }
footer a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
footer a:hover { color: var(--ink); }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* ---------- reveal ---------- */
.rv { opacity: 0; transform: translateY(22px); }

/* ---------- custom cursor ---------- */
#cur {
  position: fixed; top: 0; left: 0; z-index: 250; pointer-events: none;
  width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 1px solid var(--accent); mix-blend-mode: difference;
  transition: width 0.3s var(--ease), height 0.3s var(--ease), margin 0.3s var(--ease), opacity 0.3s;
  opacity: 0;
}
#cur.on { opacity: 1; }
#cur.big { width: 52px; height: 52px; margin: -26px 0 0 -26px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (pointer: coarse) { #cur { display: none; } }
html[data-motion='reduced'] #cur { display: none; }

/* ---------- prose (secondary pages) ---------- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: 3rem; margin-bottom: 1rem; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.prose h3 { margin-top: 2rem; margin-bottom: 0.6rem; }
.prose ul { padding-left: 1.15rem; color: var(--ink-dim); }
.prose li { margin-bottom: 0.5rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
.prose th, .prose td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: var(--rule); }
.prose th { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.prose td { color: var(--ink-dim); }
.table-scroll { overflow-x: auto; }
.prose a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- motion off ----------
   JS resolves the preference (OS setting, overridable by the nav toggle) and stamps
   html[data-motion]. The media query below only covers the no-JS case, so an explicit
   opt-in to motion is not silently overridden by the OS setting. */
html[data-motion='reduced'] { scroll-behavior: auto; }
html[data-motion='reduced'] *,
html[data-motion='reduced'] *::before,
html[data-motion='reduced'] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
html[data-motion='reduced'] .rv { opacity: 1 !important; transform: none !important; }
html[data-motion='reduced'] #preload { display: none; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion]) { scroll-behavior: auto; }
  html:not([data-motion]) *,
  html:not([data-motion]) *::before,
  html:not([data-motion]) *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html:not([data-motion]) .rv { opacity: 1 !important; transform: none !important; }
  html:not([data-motion]) #preload { display: none; }
}

