/* ==========================================================================
   CastleCRM design system, "Job Bag". 1 of 5: TOKENS.
   Every colour, size, rule and timing used by the components is a custom property here.
   Two layers:
     1. Primitives (--c-*): the inks and stocks themselves. Components never use these directly.
     2. Roles (--surface, --text, --rule, --ink-y ...): what components use. A dark theme redefines only
        the roles, in a [data-theme="dark"] block at the end of this file, and no component changes.
   The style guide (/styleguide/) reads the primitive hex values from this file to show swatches and
   contrast ratios, so keep one primitive per line: name, hex value, then a short note comment.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo/Archivo.c350c9e53bb9.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- 1. Primitives: process inks on bright stock ---------- */
  --c-night: #14123A;          /* deepest ink: login ground */
  --c-ink: #17154A;            /* text, heavy rules, the strap */
  --c-ink-2: #2A2770;          /* field on the strap */
  --c-ink-3: #45418F;          /* field border on the strap */
  --c-royal: #3A35B0;          /* primary, links, K chip */
  --c-royal-wash: #E9E8FB;     /* selected rows */
  --c-lavender: #CFCCFF;       /* text on the strap */
  --c-lavender-dim: #A9A6DA;   /* secondary text on the strap */
  --c-lavender-off: #8A87C8;   /* sections not built yet, on the strap (5.1:1) */
  --c-gold: #F5B63A;           /* highlighter, current item, stitching, Y chip */
  --c-gold-wash: #FFF1C9;      /* chosen break, highlighted row */
  --c-gold-pale: #FFF6DD;      /* key fact */
  --c-gold-text: #7E5200;      /* gold as text on white */
  --c-cyan: #006A8E;           /* on the move (C chip), information */
  --c-cyan-wash: #E3F1F6;
  --c-magenta: #A4155F;        /* money (M chip) */
  --c-magenta-wash: #F8E4EE;
  --c-green: #22663A;          /* done, success */
  --c-green-wash: #DDEFE2;
  --c-red: #B3261E;            /* no fail, danger, errors */
  --c-red-wash: #FBE3E1;
  --c-slate: #55536F;          /* muted text */
  --c-slate-2: #6E6C86;        /* faint text (meets 4.5:1 on white) */
  --c-grey: #8A889E;           /* off: cancelled, disabled graphics only */
  --c-field: #B8B6C8;          /* input borders */
  --c-rule: #D5D4DF;           /* rules between groups */
  --c-rule-2: #E9E8EF;         /* hairlines between rows */
  --c-stock-2: #F3F3F6;        /* header rows, toolbars, fact band */
  --c-stock-3: #F8F8FB;        /* row hover */
  --c-stock: #FFFFFF;          /* the page */

  /* ---------- 2. Roles ---------- */
  color-scheme: light;
  --surface: var(--c-stock);
  --surface-sunk: var(--c-stock-2);
  --surface-hover: var(--c-stock-3);
  --surface-selected: var(--c-royal-wash);
  --surface-highlight: var(--c-gold-wash);
  --surface-key: var(--c-gold-pale);
  --surface-inverse: var(--c-night);   /* login art panel */
  --text: var(--c-ink);
  --text-muted: var(--c-slate);
  --text-faint: var(--c-slate-2);
  --text-off: var(--c-grey);           /* graphics and disabled only, never body text */
  --text-inverse: var(--c-stock);
  --rule-strong: var(--c-ink);
  --rule: var(--c-rule);
  --rule-soft: var(--c-rule-2);
  --border-field: var(--c-field);
  --primary: var(--c-royal);
  --primary-hover: var(--c-ink);
  --on-primary: var(--c-stock);
  --accent: var(--c-gold);
  --on-accent: var(--c-ink);
  --link: var(--c-royal);
  --link-hover: var(--c-ink);
  --focus: var(--c-royal);
  --focus-on-dark: var(--c-gold);

  /* The strap (top navigation) */
  --strap-bg: var(--c-ink);
  --strap-text: var(--c-lavender);
  --strap-text-dim: var(--c-lavender-dim);
  --strap-text-off: var(--c-lavender-off);
  --strap-field: var(--c-ink-2);
  --strap-field-border: var(--c-ink-3);
  --strap-current: var(--c-gold);
  --strap-on-current: var(--c-ink);
  --stitch: var(--c-gold);

  /* Status inks: grouped like a four-colour press (DESIGN.md "Colour roles") */
  --ink-y: var(--c-gold);       --on-ink-y: var(--c-ink);     /* waiting on someone */
  --ink-k: var(--c-royal);      --on-ink-k: var(--c-stock);   /* being made */
  --ink-c: var(--c-cyan);       --on-ink-c: var(--c-stock);   /* on the move */
  --ink-m: var(--c-magenta);    --on-ink-m: var(--c-stock);   /* money */
  --ink-done: var(--c-green);   --on-ink-done: var(--c-stock);
  --ink-danger: var(--c-red);   --on-ink-danger: var(--c-stock);
  --ink-off: var(--c-grey);

  /* Feedback (alerts, messages, validation) */
  --info: var(--c-cyan);        --info-wash: var(--c-cyan-wash);
  --success: var(--c-green);    --success-wash: var(--c-green-wash);
  --warning: var(--c-gold-text);--warning-wash: var(--c-gold-pale);
  --danger: var(--c-red);       --danger-wash: var(--c-red-wash);
  --money: var(--c-magenta);    --money-wash: var(--c-magenta-wash);

  /* ---------- Type: one family, used at its extremes ---------- */
  --font: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-0: 12.5px;   /* labels, column headers, meta */
  --fs-1: 13.5px;   /* body, table cells, controls */
  --fs-2: 15px;     /* record numbers in rows, product names */
  --fs-3: 18px;     /* panel titles */
  --fs-4: 24px;     /* totals, ticket title on phones */
  --fs-5: 40px;     /* page titles */
  --fs-6: 52px;     /* the ticket stub number */
  --lh-tight: 0.95;
  --lh-snug: 1.15;
  --lh-body: 1.4;
  --wd-condensed: 62%;  /* ticket stub number, line numbers */
  --wd-tight: 75%;      /* chip numerals */
  --wd-narrow: 82%;     /* labels and column headers */
  --wd-semi: 92%;       /* navigation, buttons */
  --wd-table: 94%;      /* table cells */
  --wd-normal: 100%;
  --wd-wide: 110%;      /* panel and section titles */
  --wd-xwide: 118%;     /* page titles */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;
  --fw-black: 850;
  --fw-max: 900;
  --tracking-title: -0.02em;

  /* ---------- Space (4 px grid) ---------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;
  --gutter: var(--sp-7);       /* page side padding (16 px on phones) */
  --page-max: 1680px;

  /* ---------- Density and controls ---------- */
  --row-h: 36px;               /* one table row */
  --row-h-grid: 32px;          /* spreadsheet grid row */
  --strap-h: 60px;
  --ctl-h: 34px;               /* buttons */
  --ctl-h-sm: 28px;
  --field-h: 32px;             /* inputs and selects */
  --chip: 22px;                /* status patch */
  --chip-lg: 30px;
  --icon: 16px;
  --icon-sm: 12px;
  --icon-lg: 20px;
  --icon-stroke: 2;
  --tap: 44px;                 /* minimum touch target on phones */

  /* ---------- Shape and rules: square, ruled ---------- */
  --radius: 0;                 /* everything is square; the only round things are radios */
  --notch: 12px;               /* cut corners on the ticket header */
  --rule-hair: 1px;
  --rule-mid: 1.5px;           /* buttons, the workflow strip, checkbox ticks */
  --rule-heavy: 2px;           /* above tables, under panel titles, ticket frame */
  --rule-title: 3px;           /* under page titles */
  --focus-ring: 2px;

  /* ---------- Motion ---------- */
  --dur-fast: 120ms;
  --dur: 180ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  /* ---------- Layers ---------- */
  --z-sticky: 10;
  --z-strap: 20;
  --z-overlay: 30;
}

/* A dark theme goes here later: redefine the role tokens only (surfaces, text, rules, strap, inks), e.g.
   :root[data-theme="dark"] { color-scheme: dark; --surface: var(--c-night); --text: #F1F0FF; ... }
   No component file should need to change. */
