/* ============================================
   DDD Design Tokens & Base Styles
   Single source of truth for the design system
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* ============================================
     Stable Tape color system — single source of truth for every semantic
     color on the site. Mint = live/positive/expansion/primary CTA. Coral
     red = contraction/negative — calmer than a pure error red on purpose,
     since contraction is a normal market state, not a failure. Amber =
     research-beta/warning/source-coverage notes only, never used for a
     live canonical metric. Neutral gray = flat/balanced/unavailable.
     Everything below this block is aliased onto these tokens so existing
     component CSS (--accent, --tape-pos, etc.) picks the new palette up
     automatically without a rename pass. ============================= */
  --st-bg: #0A0C10;
  --st-surface-1: #0F1319;
  --st-surface-2: #141A21;
  --st-surface-3: #1B232C;
  --st-border: #1F242D;
  --st-grid: #27303B;

  --st-text: #F3F5F7;
  --st-text-secondary: #A8B0BA;
  --st-text-muted: #7D8794;

  --st-blue: #86C0FF;
  --st-blue-strong: #5A96FF;
  --st-blue-mid: #2F70FF;
  --st-blue-soft: #D8E9FF;
  --st-blue-surface: #10203A;

  --st-mint: #A8F2D2;
  --st-mint-strong: #6FE3B5;
  --st-mint-mid: #35C79A;
  --st-mint-soft: #CFF8EA;

  --st-red: #E56A59;
  --st-red-strong: #F07B69;
  --st-red-mid: #D4574A;
  --st-red-soft: #F3B3AD;
  --st-red-surface: #3B1F1F;

  --st-amber: #FFC869;
  --st-neutral: #6C7480;
  --st-neutral-surface: #27303B;

  /* Colors — unified with the terminal-style home hero. Aliased onto the
     --st-* system above; the hex values are kept as comments only to
     document how close the old and new palettes are. */
  --bg: var(--st-bg);              /* was #080A0F */
  --bg-deep: var(--st-bg);
  --bg-card: var(--st-surface-1);  /* was #11151C */
  --bg-ui: var(--st-surface-1);
  --border: var(--st-border);      /* was #1E2630 */
  --border-hairline: var(--st-border);
  /* Opaque panel edges — avoids moiré / double-line from border + shadow rings */
  --border-card: #2a3342;
  --border-card-hover: #3d4d62;
  --border-card-nested: #242c38;
  --text: var(--st-text);              /* was #F3F0E9 */
  --text-secondary: var(--st-text-secondary); /* was #A8ABAE */
  --text-muted: var(--st-text-secondary);
  --text-faint: #4b5563;
  --accent: var(--st-blue-strong);
  --accent-light: var(--st-blue);
  --accent-dim: rgba(90, 150, 255, 0.16);
  --accent-glow: rgba(90, 150, 255, 0.09);

    /* Typography — sitewide system limited to Fraunces, IBM Plex Sans, and IBM Plex Mono. */
    --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', 'Courier New', monospace;

  /* Layout */
  --max-w: 680px;        /* narrative / reading column (index, faq, learn, methodology) */
  --max-w-wide: 1120px;  /* data-heavy pages (issuers, chains, history) */
  --gap: clamp(2.5rem, 5vw, 4rem);
  --gap-sm: clamp(1.5rem, 3vw, 2.5rem);
  --gap-lg: clamp(4rem, 8vw, 6rem);
}

/* Desktop: scale container widths up on wider viewports */
@media (min-width: 1024px) {
  :root {
    --max-w: 720px;
  }
}
@media (min-width: 1280px) {
  :root {
    --max-w-wide: 1200px;
  }
}
@media (min-width: 1600px) {
  :root {
    --max-w-wide: 1280px;
  }
}

html {
  color-scheme: dark only;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  scrollbar-width: thin;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  max-width: 100vw;
}

::selection { background: var(--accent-dim); color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }
button:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
section { padding: var(--gap) 0; }

/* Mobile spacing overrides — tighter vertical rhythm without cramping */
@media (max-width: 600px) {
  :root {
    --gap: 1.75rem;
    --gap-sm: 1rem;
    --gap-lg: 2.5rem;
  }
}

/* ============================================
   Terminal primitives — shared across subpages.
   Mirrors the home hero's eyebrow/headline recipe so every page reads as
   one surface. Pages can override layout (width, padding) while keeping
   the typographic language consistent.
   ============================================ */
.page-header {
  padding: 6rem 0 1.75rem;
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: 1.75rem;
}
.hero-eyebrow,
.section-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}
.hero-headline,
.page-title {
  font-family: var(--serif-display);
  font-weight: 300;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.85rem;
  font-variant-numeric: tabular-nums lining-nums;
}
.hero-headline .hero-pct,
.hero-headline .accent,
.page-title .accent {
  color: var(--accent);
}
.hero-meta {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.page-intro {
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 58ch;
}

@media (max-width: 600px) {
  .page-header { padding: 4.5rem 0 1.25rem; }
  .hero-headline,
  .page-title { font-size: clamp(26px, 8vw, 34px); }
}

/* ============================================
   Shared card system
   ============================================ */
:root {
  --card-radius: 14px;
  --card-padding: 1.25rem;
  --card-bg: linear-gradient(180deg, rgba(15,19,27,0.97), rgba(10,13,18,0.94));
  --card-border: rgba(255,255,255,0.07);
  --card-border-accent: rgba(90,150,255,0.22);
}

.ddd-card {
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  padding: var(--card-padding);
}
.ddd-card--accent { border-color: var(--card-border-accent); }
.ddd-card-title {
  font-family: var(--serif-display);
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}
.ddd-card-body {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.ddd-card-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* ============================================
   Shared badge system
   ============================================ */
.ddd-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ddd-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ddd-badge--live      { color: var(--st-mint-strong); border-color: rgba(111,227,181,0.3);  background: rgba(111,227,181,0.07); }
.ddd-badge--live .ddd-badge-dot      { background: var(--st-mint-strong); box-shadow: 0 0 6px rgba(111,227,181,0.6); }
.ddd-badge--bootstrap { color: var(--st-mint-strong); border-color: rgba(111,227,181,0.22); background: rgba(111,227,181,0.05); }
.ddd-badge--bootstrap .ddd-badge-dot { background: var(--st-mint-strong); }
.ddd-badge--planned   { color: #a78bfa; border-color: rgba(167,139,250,0.25); background: rgba(167,139,250,0.06); }
.ddd-badge--planned .ddd-badge-dot   { background: #a78bfa; opacity: 0.6; }
.ddd-badge--research  { color: var(--st-amber); border-color: rgba(255,200,105,0.25);  background: rgba(255,200,105,0.06); }
.ddd-badge--research .ddd-badge-dot  { background: var(--st-amber); opacity: 0.6; }
.ddd-badge--delayed   { color: var(--st-amber); border-color: rgba(255,200,105,0.3);   background: rgba(255,200,105,0.06); }
.ddd-badge--delayed .ddd-badge-dot   { background: var(--st-amber); }
.ddd-badge--error     { color: var(--st-red-strong); border-color: rgba(240,123,105,0.25); background: rgba(240,123,105,0.06); }
.ddd-badge--error .ddd-badge-dot     { background: var(--st-red-strong); }
.ddd-badge--context   { color: rgba(232,234,237,0.45); border-color: rgba(255,255,255,0.09); background: rgba(255,255,255,0.03); }
.ddd-badge--context .ddd-badge-dot   { background: rgba(232,234,237,0.3); }

/* ============================================
   Shared button / CTA system
   ============================================ */
.ddd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
  min-height: 40px;
}
/* Primary — teal fill */
.ddd-btn--primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.ddd-btn--primary:hover { opacity: 0.88; color: var(--bg); }
/* Secondary — outlined */
.ddd-btn--secondary {
  background: transparent;
  color: var(--accent);
  border-color: rgba(90,150,255,0.34);
}
.ddd-btn--secondary:hover { border-color: var(--accent); color: var(--accent-light); }
/* Subtle — text link style */
.ddd-btn--subtle {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
}
.ddd-btn--subtle:hover { color: var(--accent); border-color: rgba(90,150,255,0.28); }
