/*
 * MelloMerge design tokens (SPEC Rev 49: navy and teal, arcade accents). Every color, radius, shadow and
 * font used by the app is defined here; no other stylesheet holds a color literal.
 * Light values on :root, dark values under prefers-color-scheme: dark (unless <html data-theme="light">)
 * and again under :root[data-theme="dark"] for a forced Dark choice (see src/lib/theme.ts).
 * Legacy token names (--bg-primary, --green, --cta-*, ...) stay as aliases of the Rev 49 palette.
 * Font files are declared in fonts.css (kept out of this file: site/ copies tokens.css byte for byte).
 */
:root {
  color-scheme: light dark;

  /* Fonts */
  --font-ui: 'Oxanium', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-sans: var(--font-ui);
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, 'Source Code Pro', monospace;
  --font-pixel: 'Press Start 2P', ui-monospace, monospace; /* wordmark and Source title only */
  --font-seg: 'Share Tech Mono', ui-monospace, monospace; /* counters only */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 600;

  /* Type scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 40px;
  --text-4xl: 52px;
  --text-5xl: 64px;
  /* Fluid display sizes for marketing headlines */
  --display-xl: clamp(40px, 7.2vw, 92px);
  --display-lg: clamp(34px, 5.2vw, 64px);
  --display-md: clamp(28px, 3.6vw, 44px);
  --tracking-display: -0.035em;
  --tracking-label: 0.06em;
  --leading-tight: 1.1;
  --leading-display: 1.02;
  --leading-body: 1.6;

  /* Rev 49 palette: surfaces and lines */
  --bg: #e6ecf6;
  --surface: #f8fbff;
  --surface-2: #eef3fb;
  --surface-3: #dce6f5;
  --line: #c0cde3;
  --line-strong: #56698f;
  --text: #0a1733;
  --muted: #42557c;
  --accent: #0f766e; /* teal: primary action, current location */
  --accent-hover: #115e59;
  --accent-ink: #ffffff;
  --accent-text: #0f766e;
  --accent-soft: #d7efec;
  --link: #0f766e;
  --link-hover: #115e59;
  --hot: #1d4ed8; /* electric blue trim */
  --coin: #0e7490; /* cyan highlight */
  --ok: #0f766e;
  --focus: #1d4ed8;
  --on-solid: #ffffff; /* text on solid green, blue, red and purple fills */
  --on-yellow: #0a1733;
  --scrim: rgba(4, 11, 28, 0.45);

  /* Arcade parts: seven-segment counters, bezel, dot grid, scanlines, striped rows */
  --seg-bg: #020a1c;
  --seg-text: #2dd4bf;
  --seg-hi: #67e8f9;
  --bezel: #0b1a3d;
  --arcade-shadow: #2dd4bf;
  --grid: rgba(10, 23, 51, 0.07);
  --scanline: rgba(10, 23, 51, 0.04);
  --row-alt: rgba(29, 78, 216, 0.05);

  /* Surfaces (legacy names) */
  --bg-primary: var(--surface);
  --bg-secondary: var(--surface-2);
  --bg-oat: var(--bg);
  --bg-inverse: #0a1733;

  /* Text */
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --text-tertiary: #4a5d85;
  --text-inverse: #f8fbff;

  /* Borders */
  --border-primary: var(--line-strong);
  --border-secondary: var(--line);
  --border-hover: #0a1733;
  --edge: var(--line); /* the 2px edge of tiles and secondary buttons */

  /* Palette */
  --green: #15803d;
  --green-hover: #166534;
  --green-edge: #166534;
  --green-text: #166534;
  --green-100: #e1f3e6;
  --green-200: #bfe5ca;

  --blue: #1d4ed8;
  --blue-600: #1e40af;
  --blue-100: #e3ebfd;
  --blue-200: #c5d4fa;

  --yellow: #f2c55c;
  --yellow-text: #7a4f00;
  --yellow-100: #fcf3d9;
  --yellow-200: #f7e3a6;

  --red: #c5203b;
  --red-600: #a3122b;
  --red-text: #b3122e;
  --red-100: #fde8ec;
  --red-200: #f9c9d2;

  --purple: #6d3fd8;
  --purple-text: #5b2fc4;
  --purple-100: #efe9fd;
  --purple-200: #dccffa;

  --teal: #0f766e;
  --teal-text: #0f766e;
  --teal-100: #d7efec;
  --teal-200: #b4e0db;

  --gray-text: #42557c;
  --gray-100: #eef3fb;
  --gray-200: #dce6f5;
  --gray-400: #8296ba;

  /* Diff */
  --diff-add-bg: #e4f3d9;
  --diff-add-sign: #2f6b12;
  --diff-del-bg: #fde8ec;
  --diff-del-sign: #b3122e;
  --diff-hunk-bg: #e3ebfd;
  --diff-hunk-text: #1d4ed8;

  /* Syntax and language colors */
  --syn-kw: #0f766e;
  --syn-type: #1d4ed8;
  --syn-str: #8a5a00;
  --syn-com: #42557c;
  --lang-go: #0f766e;
  --lang-ts: #1d4ed8;
  --lang-md: #56698f;
  --lang-other: #a9b9dc;

  /* Buttons: teal with dark ink in dark, white ink in light */
  --cta-bg: var(--accent);
  --cta-text: var(--accent-ink);
  --cta-edge: var(--accent);
  --cta-hover: var(--accent-hover);

  /* Elevation */
  --shadow-subtle: 0 1px 2px rgba(10, 23, 51, 0.08);
  --shadow-base: 0 2px 8px rgba(10, 23, 51, 0.14);
  --shadow-md: 0 6px 18px rgba(10, 23, 51, 0.16);
  --shadow-lg: 0 12px 32px rgba(10, 23, 51, 0.2);
  --shadow-pop: 0 8px 24px rgba(10, 23, 51, 0.18), 0 0 0 1px var(--line);

  /* Marketing night sections and chrome: dark in both schemes */
  --bg-night: #040b1c;
  --bg-night-raised: #081530;
  --text-night: #e6eeff;
  --text-night-secondary: #9fb2d8;
  --border-night: #1f3561;
  --night-hover: rgba(230, 238, 255, 0.12);
  --night-field: rgba(230, 238, 255, 0.1);
  --night-field-hover: rgba(230, 238, 255, 0.16);
  --night-tip: #13294f;
  --term-text: #e6eeff;
  --term-dim: rgba(230, 238, 255, 0.5);
  --term-ok: #a6e37a;
  --term-blue: #7aa2ff;
  --term-warn: #f2c55c;
  --term-key: #67e8f9;
  --term-name: #2dd4bf;
  --gradient-hero: radial-gradient(60% 50% at 15% 10%, rgba(79, 125, 255, 0.22), transparent 70%),
    radial-gradient(50% 45% at 85% 5%, rgba(45, 212, 191, 0.18), transparent 70%),
    radial-gradient(55% 50% at 60% 90%, rgba(103, 232, 249, 0.14), transparent 70%);
  --gradient-text: linear-gradient(92deg, #1d4ed8 0%, #0e7490 45%, #0f766e 100%);
  --gradient-band: linear-gradient(120deg, #1d4ed8 0%, #0e7490 50%, #0f766e 100%);
  /* Brand mark gradient (same hues as the home headline) */
  --logo-a: #1d4ed8;
  --logo-b: #0e7490;
  --logo-c: #0f766e;
  /* Fixed-scheme brand marks (logo page panels, dark app bar) and paper/ink for fixed-scheme panels */
  --ink-on-band: #ffffff; /* text on the marketing gradient band (dark gradient in both schemes) */
  --paper: #f8fbff;
  --ink: #0a1733;
  --logo-light-a: #1d4ed8;
  --logo-light-b: #0e7490;
  --logo-light-c: #0f766e;
  --logo-dark-a: #4f7dff;
  --logo-dark-b: #67e8f9;
  --logo-dark-c: #2dd4bf;

  /* Radii: small */
  --radius-xs: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 6px;
  --radius-2xl: 8px;
  --radius-3xl: 12px;
  --radius-pill: 9999px;

  --raise-y: 0px; /* no raised bottom edge; buttons are flat with a 2px border */

  /* Focus ring */
  --focus-ring: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--focus);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
  --dur-med: 240ms;

  --header-h: 64px;

  --gradient-purple: linear-gradient(160deg, var(--purple-100), var(--bg-primary) 70%);
  --gradient-teal: linear-gradient(160deg, var(--teal-100), var(--bg-primary) 70%);
  --gradient-yellow: linear-gradient(160deg, var(--yellow-100), var(--bg-primary) 70%);
  --gradient-blue: linear-gradient(160deg, var(--blue-100), var(--bg-primary) 70%);
  --gradient-green: linear-gradient(160deg, var(--green-100), var(--bg-primary) 70%);
  --gradient-red: linear-gradient(160deg, var(--red-100), var(--bg-primary) 70%);
}

/* A forced Light choice keeps native controls and scrollbars light. */
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #040b1c;
    --surface: #081530;
    --surface-2: #0d1d40;
    --surface-3: #13294f;
    --line: #1f3561;
    --line-strong: #5470a8;
    --text: #e6eeff;
    --muted: #9fb2d8;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-ink: #03201c;
    --accent-text: #2dd4bf;
    --accent-soft: #0c2f3a;
    --link: #2dd4bf;
    --link-hover: #5eead4;
    --hot: #4f7dff;
    --coin: #67e8f9;
    --ok: #5eead4;
    --focus: #7aa2ff;
    --on-solid: #040b1c;
    --scrim: rgba(2, 6, 20, 0.6);

    --bezel: #13294f;
    --arcade-shadow: #0f766e;
    --grid: rgba(84, 112, 168, 0.16);
    --scanline: rgba(2, 6, 20, 0.3);
    --row-alt: rgba(45, 212, 191, 0.045);

    --bg-inverse: #e6eeff;
    --text-tertiary: #8ea3cc;
    --text-inverse: #040b1c;
    --border-hover: #e6eeff;

    --green: #4ade80;
    --green-hover: #86efac;
    --green-edge: #22c55e;
    --green-text: #86efac;
    --green-100: rgba(74, 222, 128, 0.12);
    --green-200: rgba(74, 222, 128, 0.26);
    --blue: #7aa2ff;
    --blue-600: #9db8ff;
    --blue-100: rgba(79, 125, 255, 0.16);
    --blue-200: rgba(79, 125, 255, 0.3);
    --yellow-text: #f2c55c;
    --yellow-100: rgba(242, 197, 92, 0.13);
    --yellow-200: rgba(242, 197, 92, 0.26);
    --red: #ff8fa0;
    --red-600: #ffb0bd;
    --red-text: #ff8fa0;
    --red-100: rgba(255, 143, 160, 0.14);
    --red-200: rgba(255, 143, 160, 0.28);
    --purple: #b6a0ff;
    --purple-text: #c9b8ff;
    --purple-100: rgba(182, 160, 255, 0.15);
    --purple-200: rgba(182, 160, 255, 0.3);
    --teal-text: #5eead4;
    --teal: #2dd4bf;
    --teal-100: rgba(45, 212, 191, 0.12);
    --teal-200: rgba(45, 212, 191, 0.26);
    --gray-text: #9fb2d8;
    --gray-100: #0d1d40;
    --gray-200: #13294f;
    --gray-400: #5470a8;

    --diff-add-bg: rgba(166, 227, 122, 0.12);
    --diff-add-sign: #a6e37a;
    --diff-del-bg: rgba(255, 143, 160, 0.13);
    --diff-del-sign: #ff8fa0;
    --diff-hunk-bg: rgba(79, 125, 255, 0.16);
    --diff-hunk-text: #9db8ff;

    --syn-kw: #2dd4bf;
    --syn-type: #7aa2ff;
    --syn-str: #f2c55c;
    --syn-com: #9fb2d8;
    --lang-go: #2dd4bf;
    --lang-ts: #7aa2ff;
    --lang-md: #9fb2d8;
    --lang-other: #2a4275;

    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line);

    --bg-night: #02060f;
    --gradient-hero: radial-gradient(60% 50% at 15% 10%, rgba(79, 125, 255, 0.28), transparent 70%),
      radial-gradient(50% 45% at 85% 5%, rgba(45, 212, 191, 0.2), transparent 70%),
      radial-gradient(55% 50% at 60% 90%, rgba(103, 232, 249, 0.12), transparent 70%);
    --gradient-text: linear-gradient(92deg, #7aa2ff 0%, #67e8f9 45%, #2dd4bf 100%);
    --logo-a: #4f7dff;
    --logo-b: #67e8f9;
    --logo-c: #2dd4bf;
  }
}
/* Forced dark (data-theme="dark"): same values as the block above. Keep the two in sync (tests/theme.test.ts checks). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #040b1c;
  --surface: #081530;
  --surface-2: #0d1d40;
  --surface-3: #13294f;
  --line: #1f3561;
  --line-strong: #5470a8;
  --text: #e6eeff;
  --muted: #9fb2d8;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-ink: #03201c;
  --accent-text: #2dd4bf;
  --accent-soft: #0c2f3a;
  --link: #2dd4bf;
  --link-hover: #5eead4;
  --hot: #4f7dff;
  --coin: #67e8f9;
  --ok: #5eead4;
  --focus: #7aa2ff;
  --on-solid: #040b1c;
  --scrim: rgba(2, 6, 20, 0.6);

  --bezel: #13294f;
  --arcade-shadow: #0f766e;
  --grid: rgba(84, 112, 168, 0.16);
  --scanline: rgba(2, 6, 20, 0.3);
  --row-alt: rgba(45, 212, 191, 0.045);

  --bg-inverse: #e6eeff;
  --text-tertiary: #8ea3cc;
  --text-inverse: #040b1c;
  --border-hover: #e6eeff;

  --green: #4ade80;
  --green-hover: #86efac;
  --green-edge: #22c55e;
  --green-text: #86efac;
  --green-100: rgba(74, 222, 128, 0.12);
  --green-200: rgba(74, 222, 128, 0.26);
  --blue: #7aa2ff;
  --blue-600: #9db8ff;
  --blue-100: rgba(79, 125, 255, 0.16);
  --blue-200: rgba(79, 125, 255, 0.3);
  --yellow-text: #f2c55c;
  --yellow-100: rgba(242, 197, 92, 0.13);
  --yellow-200: rgba(242, 197, 92, 0.26);
  --red: #ff8fa0;
  --red-600: #ffb0bd;
  --red-text: #ff8fa0;
  --red-100: rgba(255, 143, 160, 0.14);
  --red-200: rgba(255, 143, 160, 0.28);
  --purple: #b6a0ff;
  --purple-text: #c9b8ff;
  --purple-100: rgba(182, 160, 255, 0.15);
  --purple-200: rgba(182, 160, 255, 0.3);
  --teal-text: #5eead4;
  --teal: #2dd4bf;
  --teal-100: rgba(45, 212, 191, 0.12);
  --teal-200: rgba(45, 212, 191, 0.26);
  --gray-text: #9fb2d8;
  --gray-100: #0d1d40;
  --gray-200: #13294f;
  --gray-400: #5470a8;

  --diff-add-bg: rgba(166, 227, 122, 0.12);
  --diff-add-sign: #a6e37a;
  --diff-del-bg: rgba(255, 143, 160, 0.13);
  --diff-del-sign: #ff8fa0;
  --diff-hunk-bg: rgba(79, 125, 255, 0.16);
  --diff-hunk-text: #9db8ff;

  --syn-kw: #2dd4bf;
  --syn-type: #7aa2ff;
  --syn-str: #f2c55c;
  --syn-com: #9fb2d8;
  --lang-go: #2dd4bf;
  --lang-ts: #7aa2ff;
  --lang-md: #9fb2d8;
  --lang-other: #2a4275;

  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line);

  --bg-night: #02060f;
  --gradient-hero: radial-gradient(60% 50% at 15% 10%, rgba(79, 125, 255, 0.28), transparent 70%),
    radial-gradient(50% 45% at 85% 5%, rgba(45, 212, 191, 0.2), transparent 70%),
    radial-gradient(55% 50% at 60% 90%, rgba(103, 232, 249, 0.12), transparent 70%);
  --gradient-text: linear-gradient(92deg, #7aa2ff 0%, #67e8f9 45%, #2dd4bf 100%);
  --logo-a: #4f7dff;
  --logo-b: #67e8f9;
  --logo-c: #2dd4bf;
}
