/* ds-foundation.css: the shared, colour-free base layer of the design system.
 *
 * Canonical copy: shared/design-system/ds-foundation.css. Services that
 * cannot reach ../shared at build/serve time (knowledge-gateway COPY . .,
 * study-note-html rsynced into a web root, history-web's own build) carry a
 * byte-identical copy under the same file name; tests/check_design_system.py
 * fails on any drift. Change it HERE, then copy it to each adopter.
 *
 * Rules behind these values: .claude/rules/design-system.md
 * Colour lives in each site family's own theme layer, not here. Every token
 * is --ds-* so it can never collide with a site's existing --bg/--accent etc.
 */
:root {
  /* Spacing: a 4px grid. Inside a control 4-12, related items 4-8,
     groups 12-24, sections 32-64. */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;
  --ds-space-10: 40px;
  --ds-space-12: 48px;
  --ds-space-16: 64px;
  --ds-space-20: 80px;

  /* Type scale (size / line height). Hierarchy comes from size and colour,
     not weight. CJK text sits in every family, so line heights stay open. */
  --ds-text-xs: 12px;   --ds-leading-xs: 16px;   /* meta, counts (mono welcome) */
  --ds-text-sm: 13px;   --ds-leading-sm: 20px;   /* captions, secondary */
  --ds-text-md: 15px;   --ds-leading-md: 24px;   /* body, nav items */
  --ds-text-lg: 18px;   --ds-leading-lg: 28px;   /* card titles, lead text */
  --ds-text-xl: 22px;   --ds-leading-xl: 30px;   /* section headings */
  --ds-text-2xl: 28px;  --ds-leading-2xl: 36px;  /* page titles */
  --ds-text-3xl: 40px;  --ds-leading-3xl: 48px;  /* hero headline, desktop only */

  /* Weights: 400 and 500 do the work; 600 for rare emphasis. Never 700+. */
  --ds-weight-regular: 400;
  --ds-weight-medium: 500;
  --ds-weight-strong: 600;

  /* Radius by size: small controls < cards < sheets. Nested radius =
     outer radius minus the padding between them. Pills = half the height. */
  --ds-radius-sm: 6px;
  --ds-radius-md: 10px;
  --ds-radius-lg: 14px;

  /* Touch & layout (2026-09-08 mobile-first rules, still binding). */
  --ds-touch-min: 44px;
  --ds-nav-height: 56px;
  --ds-content-max: 1440px;
  --ds-reading-max: 760px;
  --ds-app-max: 1280px;      /* dashboards and tool pages (2026-11-02) */
  --ds-gutter-mobile: 16px;
  --ds-gutter-desktop: 32px;

  /* Hairlines are the text colour at low opacity (set per theme). */
  --ds-hairline-alpha: 0.08;

  /* Motion: one curve, short durations, transform/opacity only. */
  --ds-ease: cubic-bezier(0.2, 0, 0, 1);
  --ds-dur-fast: 120ms;
  --ds-dur-base: 200ms;

  /* Focus ring: always visible on keyboard focus. */
  --ds-focus-width: 2px;
  --ds-focus-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --ds-dur-fast: 0ms; --ds-dur-base: 0ms; }
}
