/*
 * Amy B Sells design system v1: canonical tokens
 * ------------------------------------------------
 * Source of truth: docs/design-system/foundations.md
 * Derived from: docs/design-system-2026-12/tokens-v1.json -> canonical.tokens (107 tokens, validated by
 * scripts/canonical.mjs: every absorbed value exists in the observed inventory of site/ CSS).
 *
 * Status: wired into site/ (design system T8, HAB-17). site/assets/tokens.css is a byte-for-byte copy of this
 * file, linked on every page right before site-fixes.css; re-copy with `node scripts/design-tokens.mjs` after
 * editing (a unit test fails while the two differ). New hand-authored CSS must use these tokens only.
 *
 * "~ merges" comments list the near-duplicate source values each token replaces. Adopting the token
 * changes those values to the token value. Counts are declarations / live declarations (T1 audit).
 *
 * Breakpoint tokens are documentation only: custom properties cannot be used inside @media queries.
 * Write the literal value and follow the rule in foundations.md section 6.
 */

:root {
  /* ===== 1. Color: primitives ===================================================== */

  /* Ink and neutrals (text) */
  --color-ink: #333b47;                 /* 77/52. ~ merges #333333 (32/4), #313131 (4/0) */
  --color-ink-muted: #555e6b;           /* 8/8. Alias target for unused --amy-pill-ink #5c6672 */
  --color-ink-subtle: #6b7380;          /* 1/1 placeholder. ~ merges rgba(51,59,71,0.4) (8/4, fails at 2.14:1) */

  /* Borders and lines */
  --color-border-strong: #868f9c;       /* 4/4 field border, 3.18:1 on field bg */
  --color-border-strong-hover: #5f6977; /* 2/2 */
  --color-line: #e3e8ee;                /* 9/8 decorative. ~ merges #e6e6e6 (45/1), #e5e5e5 (2/1), #d5dce4 (1/1) */
  --color-line-hover: #b9c9d8;          /* 1/1 */

  /* Surfaces */
  --color-surface: #ffffff;             /* 289/128 */
  --color-on-dark: #ffffff;             /* ~ merges #f5f5f5 nav text (24/6), #efefef icon hover (8/8) */
  --color-field-bg: #fbfcfd;            /* 2/2. ~ merges #fcfcfc (5/2) */
  --color-page-bg: #f2f2f2;             /* 9/1 */
  --color-band: #f3f6f9;                /* 3/3 */
  --color-panel: #f6f8fb;               /* 3/3. ~ merges #f7f9fb (1/1), #f1f3f5 (1/0) */

  /* Brand blue ramp */
  --color-brand-primary-50: #eef5fb;    /* 4/3. ~ merges rgba(43,123,185,0.06) (1/1) */
  --color-brand-primary-100: #c9deed;   /* 8/6. ~ merges #cfe0ef (1/1) */
  --color-brand-primary: #2b7bb9;       /* 44/18 ("500"). ~ merges #337ab7 (5/1) */
  --color-brand-primary-600: #215fb5;   /* 4/4 nav active bg. ~ merges #296bc9 (2/0). DEPRECATED: see backlog P0-4 */
  --color-brand-primary-700: #1f5a87;   /* 12/8 */
  --color-brand-primary-800: #184a70;   /* 2/2. ~ merges #23527c (1/1) */
  --color-focus-ring: rgba(43, 123, 185, 0.2); /* 3/3 */

  /* Accent and CTA */
  --color-accent: #7fc2c2;              /* 43/35 teal/aqua: rules, footer link hover. Never text on light */
  --color-cta: #d11f46;                 /* 13/13 red marketing pill */

  /* Icons */
  --color-icon-muted: #9b9b9b;          /* 8/0. ~ merges #999999 (12/6) */
  --color-icon-muted-hover: #7f7f7f;    /* 4/0 */

  /* States (forms) */
  --color-error: #b3261e;
  --color-error-soft: #fdf1f0;
  --color-error-line: #f0c6c1;
  --color-error-ring: rgba(179, 38, 30, 0.18);
  --color-notice: #6b4500;
  --color-notice-soft: #fff8eb;
  --color-notice-line: #f0d9a8;
  --color-success: #1e7a46;
  --color-success-soft: #e9f6ee;        /* ~ merges rgba(30,122,70,0.06) */

  /* Effects */
  --color-shadow: rgb(16 24 40);        /* used at 4%, 6%, 8% alpha */
  --color-black-alpha-10: rgba(0, 0, 0, 0.1); /* 6/2. ~ merges 0.075 (8/0), 0.15 (2/0) */
  --color-scrim-light: rgba(255, 255, 255, 0.88); /* 1/1 sticky form action bar */

  /* ===== 2. Typography ============================================================= */

  --font-heading: "Cutive", Georgia, serif;                   /* Cutive has one weight: 400 */
  --font-body: "Questrial", Helvetica, Arial, sans-serif;     /* Questrial has one weight: 400 */
  --font-display: "Montserrat", sans-serif;                   /* home hero only; candidate to retire */

  --font-size-100: 14px;  /* ~ merges 13px (15/1) */
  --font-size-200: 16px;
  --font-size-300: 18px;  /* ~ merges 17px (3/3) */
  --font-size-400: 20px;  /* ~ merges 19px (1/1) */
  --font-size-500: 24px;  /* ~ merges 22px (3/2), 26px (2/1) */
  --font-size-600: 30px;  /* ~ merges 28px (3/1), 32px (1/1) */
  --font-size-700: 36px;
  --font-size-900: 60px;  /* display; ~ merges 55px (1/1) mobile step */

  --line-height-none: 1;
  --line-height-tight: 1.2;    /* ~ merges 1.25, 1.1, 1.3 */
  --line-height-heading: 1.4;  /* ~ merges 1.35, 1.42857143, 1.428571429 */
  --line-height-body: 1.5;     /* ~ merges 1.45, 1.6 */

  --font-weight-regular: 400;  /* ~ merges `normal` */
  --font-weight-medium: 500;   /* Montserrat only */
  --font-weight-bold: 700;     /* ~ merges `bold`. Synthesized (faux) on Questrial and Cutive */

  --letter-spacing-normal: 0;     /* ~ merges 0px */
  --letter-spacing-wide: 0.02em;  /* ~ merges 0.01em */

  /* ===== 3. Space (4px grid) ======================================================= */

  --space-0: 0;        /* ~ merges 0px */
  --space-0-5: 2px;    /* ~ merges 1px */
  --space-1: 4px;      /* ~ merges 5px (BB module margin, 120/39) */
  --space-2: 8px;      /* ~ merges 6px, 7px */
  --space-3: 12px;     /* ~ merges 10px (BB column padding, 143/34), 13px */
  --space-4: 16px;     /* ~ merges 15px (BB module margin, 132/54), 14px */
  --space-5: 20px;     /* ~ merges 18px. BB row padding */
  --space-6: 24px;     /* ~ merges 22px */
  --space-7: 32px;     /* ~ merges 28px (forms field gap, card padding-y) */
  --space-8: 40px;     /* ~ merges 44px. BB section padding, form group gap */
  --space-10: 80px;    /* ~ merges 72px (404) */
  --space-12: 96px;    /* ~ merges 88px, 100px */
  /* 48px and 64px are not observed; reserved for v2. */

  /* ===== 4. Radius, border, shadow ================================================= */

  --radius-sm: 4px;      /* theme buttons, inputs, carousel arrows */
  --radius-md: 12px;     /* ~ merges 8px, 14px. Form fields, form buttons, choice tiles */
  --radius-lg: 18px;     /* form card */
  --radius-pill: 999px;  /* ~ merges 32px (PowerPack CTA, 104/104), 30px */
  --radius-round: 50%;   /* ~ merges 100% */

  --border-width-thin: 1px;
  --border-width-field: 1.5px;
  --border-width-thick: 2px;
  --border-width-accent: 4px;  /* ~ merges 7px (BB row accent). Header bottom rule + footer top rule (footer is 7px today; slim to 4px decided 2026-12-03, backlog P2-6) */

  --shadow-card: 0 1px 2px rgb(16 24 40 / 0.04), 0 8px 24px rgb(16 24 40 / 0.06);
  --shadow-button: 0 1px 2px rgb(16 24 40 / 0.08);
  --shadow-menu: 0 1px 20px rgba(0, 0, 0, 0.1);   /* ~ merges .15 alpha, 0 0 7px variant */
  --shadow-focus: 0 0 0 4px rgb(43 123 185 / 0.2); /* field focus halo (with border-color change) */
  --shadow-focus-error: 0 0 0 4px rgb(179 38 30 / 0.18);
  --shadow-selected: inset 0 0 0 2px #2b7bb9;

  /* ===== 5. Breakpoints (documentation only; see header note) ====================== */

  --bp-xs: 400px;
  --bp-sm: 600px;   /* ~ merges 480px, 640px (forms) */
  --bp-md: 768px;   /* BB: max-width 768px / min-width 769px */
  --bp-lg: 992px;   /* BB: max-width 992px / min-width 993px */
  --bp-xl: 1200px;  /* BB: max-width 1200px / min-width 1201px */

  /* ===== 6. Layout widths ========================================================== */

  --container-max: 1100px;      /* ~ merges 1110px, theme .container 1020/980/900px */
  --container-form: 680px;      /* ~ merges 732px */
  --container-measure: 560px;   /* ~ merges 32ch */
  --container-col-small: 400px; /* BB small column cap on mobile */

  /* ===== 7. Z-index ================================================================ */

  --z-below: -1;
  --z-base: 1;        /* ~ merges 0, 2 */
  --z-dropdown: 10;   /* ~ merges 9 */
  --z-sticky: 20;
  --z-header: 100;   /* sticky header, all widths (phones decided 2026-12-03, backlog P1-15) */
  --z-overlay: 1000;  /* ~ merges 999-1046 */
  --z-top: 99999;     /* ~ merges 100000, 100010, 999998 */

  /* ===== 8. Motion ================================================================= */

  --duration-fast: 150ms;      /* ~ merges .12s, .08s, .18s, 200ms */
  --duration-base: 300ms;      /* ~ merges .25s, .35s */
  --duration-slow: 500ms;      /* ~ merges .4s, 400ms */
  --duration-entrance: 1s;     /* ~ merges 1000ms, .8s, 1.6s */
  --ease-standard: ease;
  --ease-out: ease-out;
  --ease-in-out: ease-in-out;
  --ease-linear: linear;

  /* ===== 9. Semantic aliases (v1 target) ============================================
   * References to the primitives above, no new values. Where the alias differs from what renders
   * today, the backlog item that adopts it is named. Components should use these names.
   */
  --color-text: var(--color-ink);
  --color-text-muted: var(--color-ink-muted);
  --color-heading: var(--color-ink);
  --color-link: var(--color-brand-primary-700);         /* today #2b7bb9; backlog P0-3 (AA headroom) */
  --color-link-hover: var(--color-brand-primary-800);
  --color-link-on-dark: var(--color-on-dark);
  --color-link-on-dark-hover: var(--color-accent);
  --color-header-bg: var(--color-ink);
  --color-footer-bg: var(--color-ink);
  --color-nav-text: var(--color-on-dark);               /* today #f5f5f5 */
  --color-nav-active-bg: var(--color-brand-primary-700); /* today #215fb5; backlog P0-4 */
  --color-nav-active-text: var(--color-brand-primary-100);
  --color-button-primary: var(--color-brand-primary);
  --color-button-primary-hover: var(--color-brand-primary-700);
  --color-button-primary-active: var(--color-brand-primary-800);
  --color-button-cta: var(--color-cta);
  --color-button-cta-hover: var(--color-ink);
  --color-rule: var(--color-accent);                    /* header + footer aqua rules, 4px (footer 7px today, P2-6) */

  /* Focus ring for buttons and links: the forms primary-button ring (observed 1/1 in forms.css),
   * made the site-wide standard (backlog P0-5). On dark surfaces the outer ring switches to the accent
   * (5.60:1 on ink) because brand blue on ink is 2.50:1 and fails the 3:1 non-text minimum. */
  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 5px var(--color-brand-primary);
  --focus-ring-on-dark: 0 0 0 2px var(--color-ink), 0 0 0 5px var(--color-accent);

  --control-height: 52px;       /* forms --amy-control-h; >= 44px tap target */
  --tap-target-min: 44px;       /* WCAG 2.5.5 target used by the T2 audit */
}
