/* DeltaStrat — design tokens + base styles
   Swiss-clinical, neo-grotesk + mono, cold cyan accent on near-black.
*/

:root {
  /* ── Color tokens ──────────────────────────────────────────────── */
  --bg-0: #0B0F14;                         /* page base */
  --bg-1: #11161D;                         /* elevated surface */
  --bg-2: #161C24;                         /* card */
  --bg-3: #1C232C;                         /* raised */
  --line: rgba(255, 255, 255, 0.10);       /* hairline */
  --line-2: rgba(255, 255, 255, 0.06);     /* soft divider */

  --fg-0: #FFFFFF;                         /* primary text */
  --fg-1: #BFC7CE;                         /* secondary */
  --fg-2: #8A939B;                         /* tertiary */
  --fg-3: #5A6470;                         /* muted */

  /* Accent — cold cyan (controlled, not neon) */
  --accent: #19B5E8;
  --accent-dim: #1289B0;
  --accent-glow: rgba(25, 181, 232, 0.18);
  --accent-soft: rgba(25, 181, 232, 0.07);

  --danger: oklch(0.68 0.16 25);
  --ok: oklch(0.74 0.13 150);
  --warn: oklch(0.78 0.14 85);

  /* ── Type ─────────────────────────────────────────────────────── */
  --ff-sans: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --ff-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ff-display: var(--ff-sans);

  /* ── Spacing scale (based on 4px) ─────────────────────────────── */
  --s-0: 4px; --s-1: 8px; --s-2: 12px; --s-3: 16px; --s-4: 20px;
  --s-5: 24px; --s-6: 32px; --s-7: 40px; --s-8: 48px; --s-9: 64px;
  --s-10: 80px; --s-11: 96px; --s-12: 128px; --s-13: 160px;

  /* Density-driven section padding (overridden by body[data-density]) */
  --section-y: 120px;
  --container: 1360px;
  --gutter: 32px;

  /* ── Radius / shadow ──────────────────────────────────────────── */
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px;

  /* ── Motion ───────────────────────────────────────────────────── */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t-med: 260ms;
  --t-slow: 520ms;
}

body[data-density="compact"] {
  --section-y: 88px;
}
body[data-density="comfortable"] {
  --section-y: 160px;
}

/* ── Font pairings driven by tweak ────────────────────────────── */
body[data-font="neo"] {
  --ff-sans: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, monospace;
}
body[data-font="geo"] {
  --ff-sans: 'Space Grotesk', 'Helvetica Neue', sans-serif;
  --ff-mono: 'Space Mono', ui-monospace, monospace;
}
body[data-font="editorial"] {
  --ff-sans: 'Instrument Sans', 'Helvetica Neue', sans-serif;
  --ff-display: 'Instrument Serif', 'Times New Roman', serif;
  --ff-mono: 'JetBrains Mono', monospace;
}
body[data-font="mono"] {
  --ff-sans: 'JetBrains Mono', ui-monospace, monospace;
  --ff-display: 'JetBrains Mono', ui-monospace, monospace;
  --ff-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv11';
  overflow-x: hidden;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

/* ── Noise / grain layer ──────────────────────────────────────── */
body[data-grain="on"]::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  mix-blend-mode: overlay;
  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>");
}

/* ── Global scanline field (subtle) ───────────────────────────── */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9998;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 2px,
      oklch(1 0 0 / 0.008) 2px,
      oklch(1 0 0 / 0.008) 3px
    );
}

/* ── Typography primitives ────────────────────────────────────── */
.eyebrow {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.h-display {
  font-family: var(--ff-display);
  font-size: clamp(48px, 7.2vw, 112px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  font-weight: 500;
  white-space: pre-line;
}
.h-xl {
  font-family: var(--ff-display);
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 500;
  white-space: pre-line;
}
.h-lg {
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.h-md {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.body-lg {
  font-size: clamp(16px, 1.1vw, 19px);
  line-height: 1.55;
  color: var(--fg-1);
  max-width: 64ch;
}
.mono { font-family: var(--ff-mono); font-size: 12px; letter-spacing: 0.02em; }
.mono-sm { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.04em; }

/* Scanline text effect on hero title (subtle) */
.scan-text {
  position: relative;
  display: inline-block;
}
.scan-text::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 3px,
    oklch(0 0 0 / 0.35) 3px, oklch(0 0 0 / 0.35) 4px
  );
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* ── Layout ───────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.section + .section { border-top: 1px solid var(--line); }
.section-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  align-items: end;
  margin-bottom: 64px;
}
.section-head .left .eyebrow { margin-bottom: 14px; }
@media (max-width: 900px) {
  .section-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 40px; }
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-0);
  background: var(--bg-1);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-primary {
  background: var(--fg-0);
  color: var(--bg-0);
  border-color: var(--fg-0);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
  box-shadow: 0 0 0 1px var(--accent);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn .arrow {
  transition: transform var(--t-fast) var(--ease);
}
.btn:hover .arrow { transform: translateX(3px); }

/* ── Chips / tags ────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-1);
}
.chip-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* ── Status pill ──────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: 100px;
  background: oklch(0 0 0 / 0.35);
  backdrop-filter: blur(10px);
}
.status-pill .dot {
  width: 6px; height: 6px;
  background: var(--ok);
  border-radius: 50%;
  position: relative;
}
.status-pill .dot::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0.35;
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Grid overlay decoration ──────────────────────────────────── */
.grid-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line-2) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: 0.4;
}

/* ── Entrance animation ──────────────────────────────────────── */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.js-reveal .reveal:not(.in) {
  opacity: 0;
  transform: translateY(16px);
}
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
.reveal[data-delay="5"] { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .page-enter { animation: none !important; opacity: 1 !important; }
}

/* ── Form ────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field .req { color: var(--accent); }
.field .err {
  color: var(--danger);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--fg-0);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  font-family: var(--ff-sans);
}
.field textarea { resize: vertical; min-height: 120px; font-family: var(--ff-sans); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1 L6 6 L11 1' stroke='%23999' stroke-width='1.2' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 36px;
}

/* ── Utilities ────────────────────────────────────────────────── */
.u-flex { display: flex; }
.u-center { display: flex; align-items: center; justify-content: center; }
.u-col { display: flex; flex-direction: column; }
.u-gap-2 { gap: 12px; } .u-gap-3 { gap: 16px; } .u-gap-4 { gap: 20px; } .u-gap-5 { gap: 24px; }
.u-muted { color: var(--fg-2); }
.u-mono { font-family: var(--ff-mono); }
.u-caps { text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Scanline sweep for hero ─────────────────────────────────── */
.scan-sweep {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.scan-sweep::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 200px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--accent-soft) 50%,
    transparent 100%
  );
  animation: sweep 12s linear infinite;
}
@keyframes sweep {
  0% { top: -200px; }
  100% { top: calc(100% + 200px); }
}

/* ── Accent underline link ───────────────────────────────────── */
.u-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color var(--t-fast) var(--ease);
}
.u-link:hover { border-color: var(--accent); }

/* ── Card reset ─────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 32px;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.card:hover {
  border-color: var(--line);
  background: var(--bg-2);
}
.card-ix { cursor: pointer; }
.card-ix:hover {
  border-color: var(--accent-dim);
}

/* ── Corner ticks decoration ─────────────────────────────────── */
.corners {
  position: relative;
}
.corners::before,
.corners::after,
.corners > .tl,
.corners > .br {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--accent);
}
.corners::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corners::after { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corners > .tl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corners > .br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ── Focus states ─────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Page transition ──────────────────────────────────────────── */
.page-enter {
  opacity: 1 !important;
}
