/* ============================================================
   Design tokens - app-owned, brand-neutral.
   Structure (type scale, spacing, radii, shadows, neutrals,
   status colours) lives here; ACCENT colour comes from the
   brand slot in app.css. No external font dependencies: the
   system stack holds until the product has its own identity.
   ============================================================ */

:root {
  /* --- Type --- */
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --text-2xs: 0.6875rem;
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base:1rem;
  --text-md:  1.125rem;
  --text-lg:  1.375rem;
  --text-xl:  1.75rem;
  --text-2xl: 2.25rem;
  --text-3xl: 3rem;
  --text-4xl: 4rem;
  --text-5xl: 5.5rem;

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-wider: 0.08em;

  /* --- Spacing (8px grid with half-steps) --- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-9: 4rem;
  --space-10: 5rem;
  --space-12: 6rem;

  /* --- Radius (defaults; app.css curves them further) --- */
  --radius-none: 0;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  /* --- Borders --- */
  --border-width: 1px;
  --border-width-strong: 2px;
  --border-accent-width: 3px;

  /* --- Shadows --- */
  --shadow-xs: 0 1px 2px rgba(22, 22, 26, 0.06);
  --shadow-sm: 0 1px 3px rgba(22, 22, 26, 0.08), 0 1px 2px rgba(22, 22, 26, 0.04);
  --shadow-md: 0 2px 8px rgba(22, 22, 26, 0.08), 0 1px 3px rgba(22, 22, 26, 0.06);
  --shadow-lg: 0 8px 24px rgba(22, 22, 26, 0.10), 0 2px 6px rgba(22, 22, 26, 0.06);

  /* --- Focus ring (colour set by the brand slot in app.css) --- */
  --ring-width: 3px;

  /* --- Motion --- */
  --ease-standard: cubic-bezier(0.2, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;

  /* --- Layout --- */
  --container-max: 1280px;
  --grid-gutter: var(--space-5);

  /* --- Neutral scale --- */
  --neutral-0:   #FFFFFF;
  --neutral-50:  #F7F7F8;
  --neutral-100: #EBEBEB;
  --neutral-200: #DCDCDE;
  --neutral-300: #C2C2C6;
  --neutral-400: #9B9BA1;
  --neutral-500: #76767C;
  --neutral-600: #565660;
  --neutral-700: #3C3C44;
  --neutral-800: #26262C;
  --neutral-900: #16161A;
  --ink: #1A1A1E;

  /* --- Semantic status --- */
  --success: #2E7D4F;
  --success-bg: #E7F1EB;
  --warning: #C77B30;
  --warning-bg: #FBF0E3;
  --error: #C0392B;
  --error-bg: #FBE9E7;
  --info: #2E5E8C;
  --info-bg: #E8EEF4;

  /* --- Semantic aliases (light defaults; dark remap in app.css).
         Accent aliases are owned by the brand slot in app.css. --- */
  --text-primary: var(--ink);
  --text-secondary: var(--neutral-600);
  --text-muted: var(--neutral-500);
  --text-inverse: var(--neutral-0);

  --surface-page: var(--neutral-50);
  --surface-card: var(--neutral-0);
  --surface-sunken: var(--neutral-100);
  --surface-inverse: var(--neutral-900);

  --border-subtle: var(--neutral-200);
  --border-default: var(--neutral-300);
  --border-strong: var(--neutral-400);
}

/* ============================================================
   Base element defaults
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); text-wrap: pretty; }

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: var(--text-sm); }

code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }
