/*
  Design tokens — custom properties only (PLAN-design-and-filtering §3).

  No selectors beyond :root live here. Components live in css/ui.css; a
  migrated template links tokens.css + ui.css and drops main.css. Values were
  contrast-checked against white; ratios noted are from the plan.
*/
:root {
  /* ---------- 3.1 Typography ---------- */
  --font-ui: "Inter Tight", system-ui, -apple-system, sans-serif; /* 400,500,600,700 */
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;          /* 400,500 */

  /* Fixed rem scale (no fluid clamp; ratio ≈1.2; base 16px = 1rem). The four
     small sizes carry a pixel floor so body copy and labels never shrink past
     what reads comfortably. */
  --text-xs: max(0.6875rem, 11px);     /* 11px — mono labels, column headers, provenance chips;
                                          always uppercase+tracked, never body copy */
  --text-sm: max(0.8125rem, 12px);     /* 13px — secondary metadata, footnotes, table sublines */
  --text-base: max(0.96875rem, 13.5px);/* 15.5px — body, list rows, inputs, buttons */
  --text-md: max(1.0625rem, 14.5px);   /* 17px — ledes, expanded-panel stat values */
  --text-lg: 1.25rem;     /* 20px — section headings (h3/h4 duty) */
  --text-xl: 1.5625rem;   /* 25px — page headings (h2 duty) */
  --text-2xl: 2.0625rem;  /* 33px — the one page title (h1) on app pages */
  --text-3xl: 2.75rem;    /* 44px — landing hero headline ONLY (36px below 640px) */

  /* ---------- 3.2 Color ---------- */
  /* Neutral ramp (from d-revised, grays darkened to pass contrast). */
  --paper: #fcfcfb;   /* page background */
  --panel: #ffffff;   /* rows, inputs, raised surfaces */
  --tint: #f6f6f4;    /* hover wash, expanded-panel background, sidebar wells */
  --rule: #e4e3e0;    /* primary hairline */
  --rule-2: #efeeec;  /* secondary hairline (between rows) */
  --ink: #16161a;     /* primary text — ~17:1 */
  --ink-2: #4a4a52;   /* secondary text — ~8.4:1 */
  --ink-3: #6e6e78;   /* metadata/labels — ~4.8:1 (minimum text gray) */
  --ink-disabled: #a0a0a8; /* disabled control faces only, never information */

  /* Cyan, tamed. The logo's #52cbd9 is ~1.9:1 — never text, never meaning. */
  --brand-logo: #52cbd9;   /* the logo artwork ONLY */
  --accent: #0e7c8c;       /* ~4.9:1 on white; white on it ~4.9:1 */
  --accent-hover: #0c6b79;
  --accent-ring: #2aa5b3;  /* ~3.0:1 — non-text indicators only (focus ring, selected border) */
  --accent-wash: #e9f5f7;  /* selected-state bg tint; text on it must be --accent or --ink */

  /* The brand band: page mastheads, table heads and the call to action on the
     public pages sit on this. White on it is ~7.9:1; the logo cyan on it is
     ~4.1:1, so cyan there is for lines and large numerals, never body text. */
  --brand-deep: #0b5a66;
  --brand-deep-hover: #094b55;
  --brand-deep-soft: #d9eef1; /* secondary text on the band, ~6.5:1 */

  /* Tag washes: a filled pill behind --good and --warn-family text. */
  --good-wash: #e4f3ea;  /* --good on it ~5.5:1 */
  --warn-wash: #fdf3dc;
  --warn-ink: #7a4e0c;   /* on --warn-wash ~6.5:1 */

  /* Semantic colors (text-safe on white, ~5:1 or better). */
  --good: #2f6b46;   /* measured/coach-stated provenance, success */
  --info: #1c5b7a;   /* informational */
  --warn: #8a5a12;   /* imputed/estimated provenance, cautions */
  --danger: #a8442a; /* errors, destructive actions (replaces --secondary #ff485a) */

  /* Fit-band colors — ordinal cool→warm; rendered as outline tags with colored
     text, never solid blocks. The tag always carries its text label. */
  --fit-safety: #2f6b46;
  --fit-vlikely: #256e63;
  --fit-likely: #1c5b7a;
  --fit-target: #8a5a12;
  --fit-reach: #a8442a;
  --fit-unlikely: #6e6e78;

  /* Fit-band colors, vivid — the feed card's filled pill and big match
     number use these instead of the muted set above. The originals were
     tuned as small text on white (§ their own comment: contrast-checked
     against white); a solid pill and a 2.75rem number can carry far more
     saturation before it stops reading as text, so the card gets a
     brighter, happier set with the same cool→warm order and the same
     white-on-pill contrast. */
  --pop-safety: #16a34a;
  --pop-vlikely: #0d9488;
  --pop-likely: #2563eb;
  --pop-target: #f59e0b;
  --pop-reach: #f43f5e;
  --pop-unlikely: #64748b;

  /* ---------- 3.3 Spacing & layout ---------- */
  /* In rem so spacing follows the UI scale; px values are at the 16px base. */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */

  /* Page frame. Every page reads at --container-max; the feed widens to
     --container-wide so a maximized window shows three rows of four to six
     schools instead of two cards across. */
  --container-max: 71.25rem;  /* 1140px */
  --container-wide: 120rem;   /* 1920px */
  --gutter: var(--space-10);
  --nav-h: 3.75rem;       /* 60px — the sticky site header, border included */
  --sidebar-w: 16rem;     /* 256px — filter sidebars and profile side columns */
  --card-min: 18rem;      /* 288px — narrowest a feed card column may get */
  --control-h: 2.25rem;   /* 36px — toolbar inputs, pills and compact buttons */
  --page-top: var(--space-8); /* nav to first content on app pages */

  --radius-sm: 3px; /* tags/chips */
  --radius: 6px;    /* controls, buttons */
  --radius-lg: 10px;/* floating sheets */

  /* ---------- 3.4 Borders & shadows ---------- */
  --border: 1px solid var(--rule);
  --border-soft: 1px solid var(--rule-2);
  --shadow-1: 0 1px 2px rgba(22, 22, 26, 0.05);                                   /* sticky bars */
  --shadow-2: 0 1px 2px rgba(22, 22, 26, 0.04), 0 4px 12px rgba(22, 22, 26, 0.06);  /* dropdowns, popovers */
  --shadow-3: 0 2px 4px rgba(22, 22, 26, 0.05), 0 12px 32px rgba(22, 22, 26, 0.10); /* mobile filter sheet, modals */

  /* ---------- 3.5 Motion ---------- */
  --ease: cubic-bezier(0.2, 0, 0, 1); /* ease-out */
  --dur-fast: 120ms; /* hovers, color/opacity */
  --dur-base: 160ms; /* expand/collapse, selection */
  --dur-slow: 240ms; /* sheet slide-in */

  /* ---------- 3.6 Z-index scale ---------- */
  /* Replaces main.css's 99999 nav and the 999/1000 scattered in templates. */
  --z-dropdown: 100;
  --z-subhead: 190; /* the feed's mobile sub-header, just under the nav */
  --z-sticky: 200;
  --z-sheet-backdrop: 300;
  --z-sheet: 310;
  --z-toast: 400;
  --z-tooltip: 500;
}

/* The hero headline steps down on small screens (§3.1). */
@media (max-width: 640px) {
  :root {
    --text-3xl: 2.25rem; /* 36px */
  }
}

/* Tablets and small laptops get a medium gutter, phones the narrowest. */
@media (max-width: 1023px) {
  :root {
    --gutter: var(--space-6);
  }
}

/* Phones get the narrower page gutter, nav included. */
@media (max-width: 480px) {
  :root {
    --gutter: var(--space-4);
  }
}

/* ---------- UI scale ----------
   Every size in tokens.css and ui.css is in rem, so the root font size is one
   dial for the whole interface. It stays at the browser default (16px) on every
   device; a reader's own browser zoom and default font size apply on top. There
   used to be a desktop rule here that dropped the root to 75%, which made the
   whole site too small to read comfortably. */
