/*
 * Design tokens for the estate-planning app (rebuild, ticket D0, 2026-09-28).
 * 2026-10-05: colours and shapes follow the Speak app's quiz screen on Mobbin (owner choice): white answer
 * cards on a light page, royal blue #1F49FF for the one button and progress, pale blue #E1E5FE for the
 * plan and Next chips, near-black text, bold sans headings. Reference: design/storyboard/refs/speak-quiz.jpg.
 * Specification: design/rebuild/spec.md. This file holds custom properties only; components and
 * layout are written in later stylesheets that read these names. Nothing here draws anything.
 *
 * Rules carried by these tokens:
 * - Colour is referenced by role, never by hue. The app is light-only, including when the
 *   device prefers dark. Every text/background pair used in the spec is listed there with its
 *   contrast ratio (WCAG 2.2 AA: 4.5:1 text, 3:1 large text and non-text UI).
 * - One brand accent. A firm may override --color-brand, --color-brand-hover, --color-on-brand and
 *   --color-brand-tint only with values that keep the ratios in spec section 2.6.
 * - Flat colour only; no decorative shadows. Shadows exist only for layers above the page.
 * - Motion: transform and opacity only, feedback under 200 ms, all durations 0 ms under
 *   prefers-reduced-motion: reduce.
 * - Breakpoints cannot be read from custom properties inside media queries; they are listed as
 *   documentation values (--bp-*) and must be copied literally: 40rem and 64rem.
 */

:root {
  color-scheme: light;

  /* ---------- Colour: surfaces (light) ---------- */
  --color-page: #F6F4F1;            /* page background, a quiet paper tone */
  --color-surface: #FFFFFF;         /* cards, fields, tables, header */
  --color-surface-sunk: #EBE9EC;    /* table header rows, code, progress track, hunk lines */
  --color-surface-raised: #FFFFFF;  /* menus and dialogs; separated by --shadow-overlay */
  --color-scrim: rgba(28, 26, 29, 0.48); /* behind a modal dialog */

  /* ---------- Colour: text (light) ---------- */
  --color-text: #1C1A1D;            /* body and headings */
  --color-text-muted: #5F5B66;      /* secondary text; never for required information alone */
  --color-text-inverse: #FFFFFF;

  /* ---------- Colour: lines (light) ---------- */
  --color-border: #E6E3E8;          /* decorative separators only; not a control boundary */
  --color-border-strong: #8A8692;   /* field, choice card and checkbox boundaries (3:1 non-text) */

  /* ---------- Colour: brand accent (light); the only accent ---------- */
  --color-brand: #1F49FF;           /* primary button fill, links, selected choice, current nav */
  --color-brand-hover: #1A3BD6;
  --color-on-brand: #FFFFFF;        /* text on --color-brand */
  --color-brand-tint: #E1E5FE;      /* plan and Next status chips */
  --color-link: var(--color-brand);
  --color-link-visited: #4A3F7A;    /* staff tables only; customer pages do not style :visited */

  /* ---------- Colour: focus ---------- */
  --color-focus: #1F49FF;           /* 3 px outline, 2 px offset, on every focusable element */
  --color-focus-halo: #FFFFFF;      /* inner 2 px halo so the ring shows on brand-filled buttons */

  /* ---------- Colour: status (light). Each has text, tint (background) and rule (border) ---------- */
  --color-success: #13673A;
  --color-success-tint: #E5F1E9;
  --color-success-rule: #13673A;
  --color-warning: #6A4700;         /* text on warning tint */
  --color-warning-tint: #FBF2DC;
  --color-warning-rule: #8F6000;
  --color-danger: #A3281D;
  --color-danger-tint: #FAEAE8;
  --color-danger-rule: #A3281D;
  --color-info: #1F49FF;
  --color-info-tint: #E1E5FE;
  --color-info-rule: #1F49FF;
  --color-neutral: #3B3842;         /* neutral badge text */
  --color-neutral-tint: #EBE9EC;
  --color-neutral-rule: #8A8692;

  /* SAMPLE notice: neutral, not alarming, never dismissible */
  --color-sample-bg: #EBE9EC;
  --color-sample-text: #1C1A1D;
  --color-sample-rule: #8A8692;

  /* Diff lines (prefix characters +, -, @@ carry the meaning; colour only supports it) */
  --color-diff-add: #E5F1E9;
  --color-diff-del: #FAEAE8;
  --color-diff-hunk: #EBE9EC;

  /* ---------- Typography ---------- */
  /* No web fonts: the content security policy serves only same-origin files and no licensed face
     is in the repository. These stacks use faces already on the reader's device. */
  --font-serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, ui-serif, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale (rem; 1rem = 16px at default browser size). Named by role in the spec. */
  --text-xs: 0.8125rem;   /* 13px  code, diff, table metadata in staff pages */
  --text-sm: 0.9375rem;   /* 15px  staff body, helper text, badges, table cells */
  --text-base: 1.0625rem; /* 17px  customer body and fields */
  --text-md: 1.1875rem;   /* 19px  card titles, h3 */
  --text-lg: 1.375rem;    /* 22px  h2, staff h1 */
  --text-xl: 1.875rem;     /* 30px customer title and question */
  --text-2xl: 2.125rem;    /* 34px customer title at desktop */

  --leading-tight: 1.2;   /* display headings */
  --leading-snug: 1.35;   /* h2, h3, buttons, labels */
  --leading-body: 1.55;   /* customer reading text */
  --leading-dense: 1.45;  /* staff text and tables */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  --tracking-normal: 0;
  --numeric-tabular: tabular-nums; /* all money, counts, dates in tables */

  --measure-read: 38rem;  /* longest line of customer prose (about 70 characters) */
  --measure-staff: 52rem; /* longest line of staff prose (lead paragraphs) */

  /* ---------- Spacing (4px base) ---------- */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4  */
  --space-2: 0.5rem;   /* 8  */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.5rem;   /* 24 */
  --space-6: 2rem;     /* 32 */
  --space-7: 3rem;     /* 48 */
  --space-8: 4rem;     /* 64 */
  --space-9: 6rem;     /* 96 */

  --gutter: var(--space-4);         /* page side padding at 390 */
  --gutter-wide: var(--space-6);    /* page side padding from 64rem */

  /* ---------- Layout widths ---------- */
  --width-customer: 34rem;    /* customer single column */
  --width-customer-wide: 64rem; /* customer column + aside (review, checkout, recommendations) */
  --width-aside: 20rem;
  --width-staff: 90rem;       /* staff content area including the side navigation */
  --width-staff-nav: 15rem;
  --width-dialog: 32rem;

  --bp-medium: 40rem;  /* documentation only: copy literally into media queries */
  --bp-wide: 64rem;    /* documentation only */

  /* ---------- Sizing ---------- */
  --target-min: 44px;        /* smallest tap target anywhere */
  --control-height: 56px;    /* customer buttons and fields */
  --control-height-staff: 40px; /* staff inline controls; the 44px target is kept with padding or spacing */
  --choice-min-height: 56px; /* choice cards and yes/no */
  --row-height-staff: 44px;  /* table row minimum */
  --header-height: 60px;
  --progress-height: 6px;
  --icon-size: 20px;

  /* ---------- Borders and radius ---------- */
  --border-width: 1px;
  --border-width-strong: 2px; /* invalid field, selected choice card */
  --rule-width: 3px;          /* left rule on alerts and the SAMPLE notice */
  --radius-sm: 4px;   /* badges, code, tags */
  --radius-md: 14px;   /* buttons, fields, choice cards */
  --radius-lg: 16px;  /* cards, dialogs, alerts */
  --radius-full: 999px; /* progress track only */

  /* ---------- Focus ---------- */
  --focus-width: 3px;
  --focus-offset: 2px;
  --focus-ring: var(--focus-width) solid var(--color-focus);

  /* ---------- Shadows (layers only; cards use borders) ---------- */
  --shadow-none: none;
  --shadow-card: 0 1px 2px rgba(28, 26, 29, 0.06);
  --space-action: 2.5rem; /* 40px content-to-action gap */
  --space-field: 1.25rem; /* 20px between repeat fields */
  --weight-bold: 700;
  --shadow-sticky: 0 1px 0 var(--color-border);  /* sticky header or table head edge */
  --shadow-overlay: 0 8px 24px rgba(20, 22, 25, 0.16), 0 1px 3px rgba(20, 22, 25, 0.12); /* menus, dialogs */

  /* ---------- Layers ---------- */
  --z-base: 0;
  --z-sticky: 10;
  --z-menu: 20;
  --z-dialog: 30;
  --z-toast: 40;

  /* ---------- Motion ---------- */
  /* Only transform and opacity animate. Feedback starts at once and ends within 200 ms. */
  --duration-instant: 0ms;
  --duration-fast: 100ms;   /* press, hover, checkbox tick */
  --duration-base: 160ms;   /* disclosure open, menu, alert appearing */
  --duration-slow: 240ms;   /* dialog enter only; never a feedback response */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --press-scale: 0.98;
  --enter-distance: 4px;    /* translateY distance for menus and alerts entering */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
    --press-scale: 1;
    --enter-distance: 0px;
  }
}
