/* PathKEY design system v3 — tokens. Bright theme only.
 *
 * The only file allowed to hold colour literals (test/tokens.test.mjs checks).
 * Components read ROLE tokens (section 2 onwards); the ramps in section 1
 * exist so the roles can be defined. Reconciled with alignmentkey.com
 * (docs/design-system-v3.md §0): Rubik everywhere, teal for navigation,
 * selection, links and icons, gold for the one main call to action and for
 * highlights, pill buttons, 16px cards, a thin gold bar across the top and a
 * soft teal-left / gold-right wash behind page headers. */

:root {
  color-scheme: light only;

  /* 1 · Brand ramps (alignmentkey.com) */
  --ak-teal-900: #0A4C53;
  --ak-teal-800: #0B5C64;
  --ak-teal-700: #0E6E78;   /* brand deep teal: eyebrows, links, hover */
  --ak-teal-600: #137780;   /* brand teal, 5.28:1 on white */
  --ak-teal-500: #3A8F97;
  --ak-teal-400: #6FAEB3;
  --ak-teal-300: #A7D4D8;
  --ak-teal-200: #CFEAEC;
  --ak-teal-100: #DFF1F2;
  --ak-teal-50:  #E9F3F4;
  --ak-teal-25:  #F4FAFA;
  --ak-teal-grad-end: #8FC3C7; /* score bars: teal-600 → this */

  --ak-gold-800: #6B5200;
  --ak-gold-700: #8A6A00;   /* gold as small text, 5.07:1 */
  --ak-gold-650: #A38200;   /* gold as large text (two-tone headings), 3.09:1 on the darkest wash */
  --ak-gold-600: #B38F00;   /* gold marks that must reach 3:1; pressed CTA */
  --ak-gold-550: #C9A200;   /* hovered CTA */
  --ak-gold-500: #DBB100;   /* brand gold: the CTA fill, rules and dots. 2.04:1 on white, so this step is a fill or mark and never a text colour; text in gold uses gold-700 and darker */
  --ak-gold-300: #F0D58F;
  --ak-gold-100: #FDF2D0;
  --ak-gold-50:  #FEF9E9;

  --n-0:   #FFFFFF;
  --n-25:  #FBFBFA;         /* brand off-white */
  --n-50:  #F9F9F9;         /* brand section ground */
  --n-75:  #F6F6F4;
  --n-100: #F3F3F1;         /* canvas, sunken */
  --n-150: #ECECEA;
  --n-200: #E3E3E1;         /* brand hairline */
  --n-300: #D0D0CD;
  --n-400: #A5A5A2;
  --n-450: #8F8F8C;         /* field borders, idle rings: 3.24:1 */
  --n-500: #777777;         /* brand grey: icons only */
  --n-600: #5E5E5C;         /* muted text, 6.50:1 */
  --n-700: #444442;
  --n-800: #2E2E2D;
  --n-900: #1E1E1E;         /* brand ink */

  --green-700: #17693F; --green-600: #1E7F4F; --green-50: #E8F4ED;
  --amber-700: #8F4A00; --amber-600: #B35C00; --amber-50: #FDF0E2;
  --red-700:   #971B12; --red-600:   #B42318; --red-50:   #FDECEA; --red-300: #F4A29B;

  /* 2 · Surfaces */
  --bg-canvas:          var(--n-50);
  --bg-surface:         var(--n-0);
  --bg-subtle:          var(--n-25);    /* table heads, card footers, group rows */
  --bg-sunken:          var(--n-100);   /* tracks, wells, kbd, search trigger */
  --bg-hover:           var(--n-75);
  --bg-pressed:         var(--n-150);
  --bg-selected:        var(--ak-teal-50);
  --bg-selected-strong: var(--ak-teal-100);
  --bg-selected-row:    var(--ak-teal-25);
  --bg-glass:           rgba(255, 255, 255, .92);
  --bg-scrim:           rgba(30, 30, 30, .36);
  --bg-inverse:         var(--n-900);   /* toast, tooltip: the only dark surfaces */
  --bg-desk:            var(--n-150);   /* behind A4 sheets */
  /* The soft brand wash behind page headers, sign-in and empty states:
   * teal from the top left, gold from the top right, never saturated. */
  --bg-wash: var(--wash-image), var(--n-25);
  --wash-image:
    radial-gradient(90% 180% at 0% 0%, rgba(19, 119, 128, .09), rgba(19, 119, 128, 0) 62%),
    radial-gradient(70% 160% at 100% 0%, rgba(219, 177, 0, .12), rgba(219, 177, 0, 0) 60%);
  --bg-wash-darkest: #E4EDEE;           /* the wash's darkest point under text (contrast test) */

  /* 3 · Lines */
  --line:            var(--n-200);
  --line-soft:       var(--n-150);
  --line-control:    var(--n-300);      /* segmented tracks, outline chips */
  --line-field:      var(--n-450);      /* inputs, selects, checkboxes, radios, switch off */
  --line-field-hover:var(--n-600);
  --line-strong:     var(--n-400);

  /* 4 · Text and icons */
  --text:             var(--n-900);
  --text-2:           var(--n-700);
  --text-muted:       var(--n-600);
  --text-placeholder: #737371;
  --text-disabled:    var(--n-400);
  --text-on-accent:   var(--n-0);
  --text-on-cta:      var(--n-900);     /* ink on the gold pill, 8.18:1 */
  --text-link:        var(--ak-teal-700);
  --text-eyebrow:     var(--ak-teal-700);
  --text-kpi:         var(--ak-teal-800);
  --text-heading-accent: var(--ak-gold-650);   /* the gold phrase in a two-tone heading (≥ 24px bold) */
  --icon:             var(--n-500);
  --icon-accent:      currentColor;           /* a line icon is one colour… */
  --icon-accent-tile: var(--ak-gold-500);     /* …except inside an icon tile, where its accent stroke is gold (duotone) */
  --mask-solid:       #000;                   /* the opaque stop of an edge-fade mask (only its alpha counts) */
  /* Control glyphs drawn by CSS (data URIs cannot read variables): n-500 strokes. */
  --chevron-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777777' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --search-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777777' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");

  /* 5 · Meaning */
  --accent:         var(--ak-teal-600);   /* teal: navigation, selection, confirm, data */
  --accent-hover:   var(--ak-teal-700);
  --accent-pressed: var(--ak-teal-800);
  --accent-text:    var(--ak-teal-800);
  --accent-soft:    var(--ak-teal-50);
  --accent-soft-2:  var(--ak-teal-100);
  --accent-line:    var(--ak-teal-300);

  --cta:          var(--ak-gold-500);     /* gold: the ONE main call to action on a page */
  --cta-hover:    var(--ak-gold-550);
  --cta-pressed:  var(--ak-gold-600);

  --highlight:       var(--ak-gold-500);  /* needs you, changed */
  --highlight-ring:  var(--ak-gold-700);
  --highlight-soft:  var(--ak-gold-100);
  --highlight-faint: var(--ak-gold-50);
  --highlight-text:  var(--ak-gold-700);
  --highlight-strong-text: var(--ak-gold-800);

  --ok:   var(--green-600); --ok-text:   var(--green-700); --ok-soft:   var(--green-50);
  --warn: var(--amber-600); --warn-text: var(--amber-700); --warn-soft: var(--amber-50);
  --crit: var(--red-600);   --crit-text: var(--red-700);   --crit-soft: var(--red-50);
  --info: var(--ak-teal-600); --info-text: var(--ak-teal-800); --info-soft: var(--ak-teal-50);
  --crit-on-inverse: var(--red-300);
  --accent-on-inverse: var(--ak-teal-300);

  --zone-low:  var(--n-150);
  --zone-mid:  var(--ak-teal-100);
  --zone-high: var(--ak-teal-300);
  --data:       var(--ak-teal-600);
  --data-track: var(--n-150);
  --data-fill:  linear-gradient(90deg, var(--ak-teal-600), var(--ak-teal-grad-end));
  --data-fill-highlight: var(--ak-gold-500);

  /* 6 · Type (Rubik only) */
  --font-ui:   "Rubik", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --fs-11: 11px; --lh-11: 16px;   /* eyebrows, overlines, table heads (caps) */
  --fs-12: 12px; --lh-12: 16px;   /* meta, chips, captions */
  --fs-13: 13px; --lh-13: 20px;   /* tables, dense UI, button labels */
  --fs-14: 14px; --lh-14: 20px;   /* default UI and body */
  --fs-16: 16px; --lh-16: 24px;   /* respondent body, dialog titles, card titles on dashboards */
  --fs-20: 20px; --lh-20: 26px;   /* object titles */
  --fs-26: 26px; --lh-26: 32px;   /* page H1 */
  --fs-32: 32px; --lh-32: 38px;   /* sign-in and done screens only */
  --fw-light: 300; --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  --track-tight: -0.012em; --track-display: -0.022em; --track-caps: 0.06em; --track-eyebrow: 0.14em;

  /* 7 · Space (4px grid) and sizes */
  --sp-0h: 2px; --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 28px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;
  --h-xs: 24px; --h-sm: 28px; --h-md: 34px; --h-lg: 40px; --h-xl: 48px;
  --row-dense: 36px; --row: 44px; --row-comfy: 52px;
  --topline-h: 3px; --appbar-h: 56px; --rail-w: 244px; --rail-w-collapsed: 64px;
  --master-w: 256px; --savebar-h: 60px; --tabbar-h: 60px; --grip-w: 22px;
  --content-max: 1440px; --gutter: 28px; --gutter-phone: 16px;
  --edge-fade: 32px;   /* the fade on the cut-off side of a strip that scrolls sideways */

  /* 8 · Shape: pills for buttons and tags, soft 16px cards */
  --r-2: 2px; --r-4: 4px; --r-6: 6px; --r-8: 8px; --r-10: 10px; --r-12: 12px; --r-16: 16px; --r-20: 20px; --r-full: 999px;
  --r-control: 10px;   /* inputs, selects, nav items */
  --r-tile: 10px;      /* icon tiles */
  --r-card: 16px;
  --r-menu: 12px;
  --r-dialog: 20px;

  /* 9 · Elevation: hairline first, shadow second */
  --shadow-card: 0 1px 2px rgba(30, 30, 30, .04), 0 2px 8px -2px rgba(30, 30, 30, .05);
  --shadow-1: 0 1px 2px rgba(30, 30, 30, .05);
  --shadow-2: 0 1px 2px rgba(30, 30, 30, .04), 0 6px 16px -4px rgba(30, 30, 30, .08);
  --shadow-3: 0 2px 4px rgba(30, 30, 30, .04), 0 14px 36px -10px rgba(30, 30, 30, .18);
  --shadow-4: 0 4px 8px rgba(30, 30, 30, .05), 0 28px 64px -16px rgba(30, 30, 30, .26);
  --shadow-bar: 0 -1px 0 var(--line), 0 -10px 28px -12px rgba(30, 30, 30, .14);
  --shadow-seg: 0 1px 2px rgba(30, 30, 30, .10), 0 0 0 1px rgba(30, 30, 30, .04);
  --shadow-cta: 0 1px 2px rgba(107, 82, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .22);
  --shadow-confirm: 0 1px 2px rgba(11, 92, 100, .25), inset 0 1px 0 rgba(255, 255, 255, .10);
  --focus-ring: 0 0 0 2px var(--n-0), 0 0 0 4px var(--ak-teal-600);
  --focus-ring-inset: inset 0 0 0 2px var(--ak-teal-600);
  --focus-ring-inverse: 0 0 0 2px var(--n-900), 0 0 0 4px var(--ak-teal-300);
  --ring-field: 0 0 0 3px rgba(19, 119, 128, .16);
  --kbd-on-fill: rgba(255, 255, 255, .18);
  --kbd-on-cta: rgba(30, 30, 30, .10);

  /* 10 · Motion (design §9): 120–320 ms, no bounce */
  --dur-1: 120ms;   /* colour, hover, press */
  --dur-2: 160ms;   /* toggles, thumbs, row highlight, menus */
  --dur-3: 200ms;   /* panels, dialogs, toasts, save bar, accordions, page content */
  --dur-4: 320ms;   /* data: numbers, markers, progress, meters */
  --dur-exit: 130ms;
  --dur-shimmer: 1200ms;
  --ease:       cubic-bezier(.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0, 0, .2, 1);
  --ease-exit:  cubic-bezier(.4, 0, 1, 1);
  --ease-move:  cubic-bezier(.65, 0, .35, 1);
  --lift: 4px; --slide: 12px; --stagger: 30ms;

  /* 11 · Layers */
  --z-sticky: 10; --z-savebar: 20; --z-tabbar: 25; --z-appbar: 30; --z-drawer: 35;
  --z-popover: 40; --z-dialog: 50; --z-toast: 60; --z-tooltip: 70;

  /* 12 · Shell, form and status vocabulary qualified in T1.16 (docs/design/codexr-reuse.md).
   * Geometry only: no new colour and no new motion timing. The patterns that
   * read these live in css/codexr.css; screens adopt them in T1.19, T1.33,
   * T1.47 and T2.17. */
  --rail-w-icons: 72px;       /* icon-only rail = 16 + 40 icon slot + 16, so the icon axis never moves when the rail opens */
  --rail-pad-x: 16px;
  --rail-icon-slot: 40px;
  --rail-item-h: 38px;
  --rail-brand-h: 32px;
  --rail-heading-h: 20px;
  --rail-toggle: 24px;        /* the open / close button on the rail edge */
  --form-w: 320px;            /* the sign-in column */
  --field-h: 44px;            /* sign-in and second-step fields */
  --otp-cell-w: 44px; --otp-cell-h: 52px; --otp-gap: 8px;
  --mark-size: 14px;

  /* Status = mark shape + word + colour. Colour is the third cue, never the only one.
   * The word is the default English vocabulary; screens put the word in the
   * markup as real text and translate it with the rest of their copy. */
  --mark-img-check:     url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --mark-img-triangle:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 21.5 20h-19z'/%3E%3Cpath d='M12 10v4.5M12 17.4v.1'/%3E%3C/svg%3E");
  --mark-img-cross:     url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E");
  --mark-img-half:      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 4a8 8 0 0 1 0 16z' fill='%23000'/%3E%3C/svg%3E");
  --mark-img-ring:      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5'%3E%3Ccircle cx='12' cy='12' r='7.5'/%3E%3C/svg%3E");

  --status-ok-word: "Complete";          --status-ok-mark: var(--mark-img-check);     --status-ok-ink: var(--ok-text);
  --status-attention-word: "Needs attention"; --status-attention-mark: var(--mark-img-triangle); --status-attention-ink: var(--highlight-text);
  --status-crit-word: "Failed";          --status-crit-mark: var(--mark-img-cross);   --status-crit-ink: var(--crit-text);
  --status-active-word: "In progress";   --status-active-mark: var(--mark-img-half);  --status-active-ink: var(--accent-text);
  --status-idle-word: "Not started";     --status-idle-mark: var(--mark-img-ring);    --status-idle-ink: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; --dur-4: 1ms; --dur-exit: 1ms;
    --lift: 0px; --slide: 0px; --stagger: 0ms;
  }
}

/* Migration aliases for the page stylesheets written before v3. Kept for one
 * release (audit-v3 F10 removes them); new code uses the role tokens above. */
:root {
  --paper: var(--bg-canvas); --surface: var(--bg-surface); --surface-2: var(--bg-hover); --surface-3: var(--bg-pressed);
  --ink: var(--text); --ink-2: var(--text-2); --muted: var(--text-muted); --muted-2: var(--icon);
  --teal: var(--accent); --teal-soft: var(--accent-soft); --teal-ink: var(--accent-text); --on-teal: var(--text-on-accent);
  --brass: var(--highlight); --brass-soft: var(--highlight-soft); --brass-ink: var(--highlight-text);
  --focus: var(--accent);
  --font-display: var(--font-ui); --font-mono: var(--font-ui);
  --step--1: 13px; --step-0: 14px; --step-1: 16px; --step-2: 20px; --step-3: 24px; --step-4: 26px;
  --r-sm: var(--r-6); --r-md: var(--r-10); --r-lg: var(--r-card);
  --rail: var(--rail-w);
  --t-fast: var(--dur-1); --t-med: var(--dur-3); --t-slow: var(--dur-4);
}
