/* Bitcoin Infinity · tokens */
:root,
[data-theme="dark"] {
  --bg-canvas: #0C0907;
  --bg-surface: #14100D;
  --bg-raised: #1B1714;
  --bg-elevated: #221D19;
  --bg-overlay: rgba(20, 16, 13, 0.92);

  --hairline: rgba(247, 147, 26, 0.10);
  --hairline-strong: rgba(247, 147, 26, 0.22);
  --rule: rgba(255, 240, 220, 0.08);
  --rule-strong: rgba(255, 240, 220, 0.16);

  --text-primary: #F5EFE6;
  --text-secondary: #C9BFB1;
  --text-tertiary: #8E8478;
  --text-quiet: #5C5449;
  --text-on-accent: #0C0907;

  --accent: #F7931A;
  --accent-soft: #F7931A;
  --accent-muted: rgba(247, 147, 26, 0.55);
  --accent-glow: rgba(247, 147, 26, 0.18);
  --accent-tint: rgba(247, 147, 26, 0.06);

  --semantic-warn: #E6B450;
  --semantic-danger: #D9544D;
  --semantic-ok: #8FB373;

  --font-serif: "Source Serif 4", "Source Serif Pro", "Tiempos Text", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease-standard: cubic-bezier(0.2, 0, 0.38, 0.9);
  --ease-entrance: cubic-bezier(0, 0, 0.38, 0.9);
  --ease-exit: cubic-bezier(0.2, 0, 1, 0.9);
  --ease-expressive: cubic-bezier(0.4, 0.14, 0.3, 1);

  --duration-fast-01: 70ms;
  --duration-fast-02: 110ms;
  --duration-moderate-01: 150ms;
  --duration-moderate-02: 240ms;
  --duration-slow-01: 400ms;
  --duration-slow-02: 700ms;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --nav-width: 220px;
  --topbar-height: 56px;
  --spine-height: 40px;
  --canvas-max: 1240px;

  /* Type scale (BB-UPGRADE-001) — uses clamp() so the same token spans desktop and mobile.
     The mono/tag scale is kept separate because tag text is uniformly small with
     less variance (no fluid scaling). */
  --fs-xs:      clamp(11px, 0.85vw, 12px);
  --fs-sm:      clamp(13px, 1.0vw,  14px);
  --fs-base:    clamp(16px, 1.3vw,  18px);
  --fs-md:      clamp(19px, 1.6vw,  22px);
  --fs-lg:      clamp(22px, 2.0vw,  28px);
  --fs-xl:      clamp(24px, 2.4vw,  32px);
  --fs-2xl:     clamp(32px, 3.6vw,  44px);
  --fs-display: clamp(40px, 5vw,    64px);

  --fs-tag-xs:  clamp(13px, 1.0vw, 14px);
  --fs-tag-sm:  clamp(14px, 1.1vw, 15px);
  --fs-tag-md:  clamp(1rem, 1.3vw, 18px);

  --lh-tight:   1.05;
  --lh-snug:    1.2;
  --lh-normal:  1.5;
  --lh-relaxed: 1.6;

  --ls-tight:   -0.012em;
  --ls-normal:  0;
  --ls-wide:    0.04em;
  --ls-mono:    0.14em;

  /* Breakpoint reference (documentation only — CSS @media cannot use vars):
     --bp-tablet:    1024px
     --bp-phone-l:   768px
     --bp-phone:     414px
     --bp-small:     360px */
}

[data-theme="light"] {
  --bg-canvas: #F5EFE6;
  --bg-surface: #ECE4D6;
  --bg-raised: #E2D9C7;
  --bg-elevated: #D8CDB8;
  --bg-overlay: rgba(245, 239, 230, 0.94);
  --hairline: rgba(28, 20, 12, 0.10);
  --hairline-strong: rgba(28, 20, 12, 0.22);
  --rule: rgba(28, 20, 12, 0.08);
  --rule-strong: rgba(28, 20, 12, 0.18);
  --text-primary: #14100D;
  --text-secondary: #3A312A;
  --text-tertiary: #6A6055;
  --text-quiet: #8E8478;
  --text-on-accent: #0C0907;
  --accent-glow: rgba(247, 147, 26, 0.22);
  --accent-tint: rgba(247, 147, 26, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  overflow: hidden;
}

::selection { background: var(--accent); color: var(--text-on-accent); }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
input, textarea { font-family: inherit; color: inherit; }

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

.mono { font-family: var(--font-mono); font-feature-settings: "ss01", "tnum"; }
.mono-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: clamp(1rem, 1.05vw, 1.125rem);
  font-weight: 500;
  color: var(--text-secondary);
}
.mono-tag {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: clamp(1rem, 1.05vw, 1.125rem);
  font-weight: 500;
  color: var(--text-secondary);
}
.mono-meta {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.05vw, 1.125rem);
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* F1: Reduced motion · hard off, no near-zero hack */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
