/* ==========================================================================
   GGUFCOIN design tokens · v0.3 draft (internal, not final)
   Source of truth: the brand visual spec, sections 4, 5, 6 and 9.2.
   Plain CSS custom properties. No external resources, system fonts only.

   Theming
   - Light is the default.
   - Follows the OS (prefers-color-scheme) unless the page sets
     <html data-theme="light"> or <html data-theme="dark">.
   - Any element can force a surface with data-surface="dark" or
     data-surface="light" (e.g. Proof-register panels are always dark).
   ========================================================================== */

:root {
  /* ---- 4.1 Core colours (fixed, never change with theme) --------------- */
  --color-ink: #111110;          /* text and mark on light grounds */
  --color-paper: #F6F3EC;        /* light ground; text and mark on dark grounds */
  --color-carbon: #0E0E0D;       /* dark ground */
  --color-white: #FFFFFF;
  --color-ember: #E8590C;        /* the mark's bar, primary button, key chart line.
                                    On light grounds: graphics and text >= 24px only */
  --color-ember-deep: #B4420A;   /* accent text and links on light grounds */
  --color-ember-glow: #FF8A3D;   /* accent text, dots and lines on dark grounds */

  /* Usage rule: Ember covers at most 5% of any screen;
     at most one solid Ember button per screen. */
  --ember-max-area: 5%;

  /* ---- 4.3 Status colours, both modes (status only, never decoration) -- */
  --status-confirmed-light: #1F8A4C;
  --status-confirmed-dark: #4CC38A;
  --status-pending-light: #77746C;
  --status-pending-dark: #8E8B83;
  --status-voided-light: #C8321F;
  --status-voided-dark: #FF6B5A;

  /* ---- 4.4 Quantized ramp ("what weights look like") ------------------
     Illustrations and dot matrices use only these steps, never gradients. */
  --ramp-1: #FFD9BF;
  --ramp-2: #FF8A3D;
  --ramp-3: #E8590C;
  --ramp-4: #7A2C05;
  --ramp-0-dark: #2A1A10;        /* extra darkest cell, dark grounds only */

  /* ---- 4.2 Neutrals + semantic roles: LIGHT ---------------------------- */
  --text: #111110;               /* headings, body */
  --text-2: #55524B;             /* captions, labels */
  --text-3: #77746C;             /* placeholders, footnotes (14px and up only) */
  --line: #D9D4C8;               /* 1px dividers and borders */
  --surface: #FFFFFF;            /* cards, inputs */
  --bg: #F6F3EC;                 /* page background */

  --accent-text: var(--color-ember-deep);    /* links, emphasised words */
  --accent-graphic: var(--color-ember);      /* dots, lines, chart highlight */
  --accent-fill: var(--color-ember);         /* primary button fill */
  --on-accent: var(--color-ink);             /* text on the primary button: Ink on Ember (~5.3:1; white was ~3.6:1) */
  --mark-ring: var(--text);                  /* the mark's arcs (Ink on light, Paper on dark) */
  --mark-bar: var(--color-ember);            /* the mark's bar: Ember (set to Ink on an Ember ground) */
  --baseline-color: var(--text);             /* the 2px "ground" rule */

  --confirmed: var(--status-confirmed-light);
  --pending: var(--status-pending-light);
  --voided: var(--status-voided-light);
  --notice: var(--color-ember-deep);

  --glass-bg: rgba(255, 255, 255, 0.70);     /* 70% of --surface */
  color-scheme: light;

  /* ---- 5.1 Font stacks (system fonts; nothing is downloaded) ----------- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;  /* product, UI, body */
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;                        /* numbers, rules, hashes, code, wordmark */
  --font-serif: "New York", ui-serif, "Iowan Old Style", "Source Serif 4", Georgia, serif;                   /* slogan, vision, long-form titles */

  /* ---- 5.2 Type scale (desktop; phone values below) --------------------
     size / line-height / tracking / weight per step. */
  --fs-display: 88px;  --lh-display: 1.0;  --tr-display: -0.03em;
  --fw-display-sans: 700; --fw-display-serif: 500;
  --fs-h1: 56px;       --lh-h1: 1.05;      --tr-h1: -0.025em;
  --fw-h1-sans: 700;   --fw-h1-serif: 500;
  --fs-h2: 36px;       --lh-h2: 1.15;      --tr-h2: -0.02em;   --fw-h2: 650;
  --fs-h3: 24px;       --lh-h3: 1.25;      --tr-h3: -0.01em;   --fw-h3: 650;
  --fs-lead: 20px;     --lh-lead: 1.5;     --tr-lead: 0;       --fw-lead: 400;
  --fs-body: 17px;     --lh-body: 1.6;     --tr-body: 0;       --fw-body: 400;
  --fs-small: 14px;    --lh-small: 1.5;    --tr-small: 0;      --fw-small: 400;
  --fs-label: 12px;    --lh-label: 1.3;    --tr-label: 0.08em; --fw-label: 500;   /* mono, ALL CAPS */
  --fs-data-l: 48px;   --lh-data-l: 1.0;   --tr-data-l: -0.02em; --fw-data-l: 600; /* mono, tabular */
  --fs-data: 16px;     --lh-data: 1.5;     --tr-data: 0;       --fw-data: 400;    /* mono, tabular */

  --tr-wordmark: 0.04em;         /* GGUFCOIN wordmark: mono 600, all caps */
  --fw-wordmark: 600;
  --numeric: tabular-nums;       /* use with font-variant-numeric everywhere */
  --measure: 68ch;               /* body line length: 60-75 characters */

  /* ---- 6 Spacing (multiples of 4) -------------------------------------- */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;
  --space-128: 128px;

  /* ---- 6 Radii ---------------------------------------------------------- */
  --radius-input: 6px;           /* inputs, small tags, code */
  --radius-button: 10px;
  --radius-card: 16px;
  --radius-panel: 24px;
  --radius-pill: 999px;

  /* ---- 6 Lines, shadow, glass ------------------------------------------ */
  --line-width: 1px;             /* every divider and border */
  --baseline-width: 2px;         /* the ink "ground" rule content sits on */
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.12);   /* floating panels only; cards get a line */
  --glass-blur: 24px;            /* product register and app only; fall back to solid --surface */

  /* ---- 6 Layout grid ---------------------------------------------------- */
  --grid-columns: 12;
  --grid-max: 1120px;
  --grid-margin: 32px;
  --target-min: 44px;            /* minimum touch/click target */

  /* ---- 10 Focus ---------------------------------------------------------- */
  --focus-width: 2px;
  --focus-offset: 2px;
  --focus-color: var(--color-ember);

  /* ---- 9.2 Motion -------------------------------------------------------- */
  --dur-fast: 120ms;             /* press, hover */
  --dur-base: 240ms;             /* expand, switch, digit roll, page entry */
  --dur-slow: 480ms;             /* panels appear, in-page scroll */
  --dur-ambient: 1200ms;         /* minimum for breathing / orbiting */
  --dur-breathe: 1600ms;         /* pending dot, opacity 40%-100% */
  --dur-orbit: 6000ms;           /* computing: one lap of the ring */
  --dur-signature: 3200ms;       /* Orbit -> Three -> Settle */
  --stagger: 40ms;               /* page-entry stagger between blocks */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);       /* almost everything */
  --ease-settle: cubic-bezier(0.34, 1.4, 0.64, 1);   /* only the "settle" beat */
}

/* ---- Phone sizes (5.2) and phone grid (6) ------------------------------- */
@media (max-width: 640px) {
  :root {
    --fs-display: 44px;
    --fs-h1: 34px;
    --fs-h2: 26px;
    --fs-h3: 20px;
    --fs-lead: 18px;
    --fs-body: 16px;
    --grid-columns: 4;
    --grid-margin: 20px;
  }
}

/* ---- DARK values --------------------------------------------------------
   Defined twice on purpose: once for the OS preference (unless the page
   forces light), once for an explicit override. Keep both blocks in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #F1EEE6;
    --text-2: #A8A49A;
    --text-3: #7D7A72;
    --line: #2A2A27;
    --surface: #191917;
    --bg: #0E0E0D;
    --accent-text: var(--color-ember-glow);
    --accent-graphic: var(--color-ember-glow);
    --confirmed: var(--status-confirmed-dark);
    --pending: var(--status-pending-dark);
    --voided: var(--status-voided-dark);
    --notice: var(--color-ember-glow);
    --glass-bg: rgba(25, 25, 23, 0.70);
    color-scheme: dark;
  }
}

:root[data-theme="dark"],
[data-surface="dark"] {
  --text: #F1EEE6;
  --text-2: #A8A49A;
  --text-3: #7D7A72;
  --line: #2A2A27;
  --surface: #191917;
  --bg: #0E0E0D;
  --accent-text: var(--color-ember-glow);
  --accent-graphic: var(--color-ember-glow);
  --confirmed: var(--status-confirmed-dark);
  --pending: var(--status-pending-dark);
  --voided: var(--status-voided-dark);
  --notice: var(--color-ember-glow);
  --glass-bg: rgba(25, 25, 23, 0.70);
  color-scheme: dark;
}

/* Force a light surface inside a dark page (e.g. Belief-register panels). */
[data-surface="light"] {
  --text: #111110;
  --text-2: #55524B;
  --text-3: #77746C;
  --line: #D9D4C8;
  --surface: #FFFFFF;
  --bg: #F6F3EC;
  --accent-text: var(--color-ember-deep);
  --accent-graphic: var(--color-ember);
  --confirmed: var(--status-confirmed-light);
  --pending: var(--status-pending-light);
  --voided: var(--status-voided-light);
  --notice: var(--color-ember-deep);
  --glass-bg: rgba(255, 255, 255, 0.70);
  color-scheme: light;
}

/* Re-resolve role tokens that point at --text inside forced surfaces. */
[data-surface] {
  --mark-ring: var(--text);
  --baseline-color: var(--text);
}

/* ---- Reduced motion (9.1): stop everything, keep only state changes ---- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
    --dur-ambient: 0ms;
    --dur-breathe: 0ms;
    --dur-orbit: 0ms;
    --dur-signature: 0ms;
    --stagger: 0ms;
  }
}
