/* Crescos design tokens, revision 5 (the Crescos design system, 2026-10-31: a navy that reads as navy, #12253C). Written from the system's tokens.json; the
 * system is the source and this file follows it.
 *
 * Fifteen colour roles from eight colours, each with a light and a dark value. Navy #12253C in place of near-black;
 * the yellow tuned to it (#FFD43A); the greys, the hairline and the AI blue drawn to sit with the navy.
 * data-theme="light" or "dark" on <html> fixes the theme (the theme switch in the bar sets it); without it, the theme follows
 * the system. Either value also works on any element, for a section or a card in the other theme.
 *
 * Tokens only: no selector here styles an element. Every page uses these names and no others; /v1 keeps its own CSS.
 * The system's source is design-system/project/tokens.json in this repo: change a value there and here together, then
 * run `node scripts/check-tokens.mjs`. */

:root {
  color-scheme: light dark;

  /* ---- Colour, light --------------------------------------------------------------------------------------------------- */
  --color-bg: #FAFAF9;              /* paper: the whole page; sections are divided by space and a hairline, never by colour */
  --color-bg-surface: #FFFFFF;      /* a window, a card, the form */
  --color-bg-subtle: #F3F3F1;       /* a well inside a window: the next step, a selected row */
  --color-text: #12253C;            /* navy: all text, the navy button, a person's disc. 16:1 on paper */
  --color-text-secondary: #3E4954;  /* the lead under a heading, the paragraph beside a figure */
  --color-text-muted: #5B646E;      /* the label over a heading, captions, counts, the footer; the software dot. 5.8:1 */
  --color-border: #E3E7EA;          /* the hairline: the only line */
  --color-border-row: #ECEFF1;      /* between rows inside a window */
  --color-border-control: #89929A;  /* an input's edge, 3:1 */
  --color-brand: #FFD43A;           /* yellow: the one call to action, the mark, the underline, the marker. Never a ground */
  --color-info: #2951DB;            /* blue: the AI dot and anything an agent did */
  --color-danger: #9A2E12;          /* red: a slow step, a rising measure, a conflict, a stopped run */
  --color-success: #13693A;         /* green: running, on track */
  --color-warning: #6E4A00;         /* amber: waiting on a person; a link on hover */
  --color-focus: #2951DB;           /* the 2px focus ring, outside the control: the AI blue */
  --color-on-brand: #12253C;        /* text on yellow, both themes (derived, not a role). 12:1 */

  /* ---- Type ------------------------------------------------------------------------------------------------------------- */
  --font-display: 'Funnel Display', ui-sans-serif, system-ui, sans-serif;                 /* the wordmark only, at 800 */
  --font-sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;      /* everything else */
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;         /* a time or a count inside a window */

  --text-display: 3.5rem;    --leading-display: 1.05; --tracking-display: -0.02em;   /* 56px: the page's one headline */
  --text-heading: 2.5rem;    --leading-heading: 1.1;  --tracking-heading: -0.015em;  /* 40px: a section heading */
  --text-card: 1.5rem;       --leading-card: 1.2;     --tracking-card: -0.01em;      /* 24px: one picture, one moment */
  --text-lead: 1.25rem;      --leading-lead: 1.4;                                      /* 20px, regular, secondary */
  --text-body: 1.0625rem;    --leading-body: 1.55;                                     /* 17px */
  --text-ui: 0.9375rem;      --leading-ui: 1.4;                                        /* 15px: inside a window; buttons */
  --text-small: 0.875rem;    --leading-small: 1.45;                                    /* 14px: captions, the footer */
  --text-label: 0.8125rem;   --leading-label: 1.3;                                     /* 13px, medium, muted: the label */
  --text-mono: 0.8125rem;                                                              /* 13px */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-wordmark: 800;
  --measure: 60ch;

  /* ---- Space, shape, line, layout ---------------------------------------------------------------------------------------- */
  --space-8: 8px;  --space-12: 12px;  --space-16: 16px;  --space-24: 24px;  --space-48: 48px;  --space-64: 64px;  --space-96: 96px;  --space-128: 128px;
  --radius-sm: 4px;      /* a tag, a well */
  --radius-md: 6px;      /* buttons and inputs */
  --radius-lg: 8px;      /* a window, a card */
  --radius-xl: 12px;     /* a device frame */
  --radius-pill: 999px;  /* discs only */
  --content-max: 1200px;
  --gutter: 24px;
  --bar-height: 64px;
  --control-height: 44px;
  --control-height-app: 36px;
  --nav-width: 220px;
  --focus-width: 2px;
  --focus-offset: 2px;
  --shadow-overlay: 0 24px 60px rgba(18,37,60, 0.4);  /* a dialog over the page; the only shadow */

  /* ---- Motion ----------------------------------------------------------------------------------------------------------- */
  --duration-fast: 150ms;   /* colour on hover and focus */
  --duration-base: 200ms;   /* the day stepper's crossfade */
  --ease-out: cubic-bezier(.2, .7, .2, 1);

  --z-bar: 20;
  --z-skip: 30;
}

/* ---- Colour, dark: paper becomes navy, navy becomes white, the greys and the hairline flip, yellow stays ---------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #12253C; --color-bg-surface: #1E2F45; --color-bg-subtle: #2B3B50;
    --color-text: #FFFFFF; --color-text-secondary: #D3DAE1; --color-text-muted: #9DA7B2;
    --color-border: #3E4D5F; --color-border-row: #2B3B50; --color-border-control: #717C8A;
    --color-info: #A6BAFF; --color-danger: #F1AA94; --color-success: #88D9A5; --color-warning: #FFD43A; --color-focus: #A6BAFF;
  }
}
:root[data-theme="dark"], [data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #12253C; --color-bg-surface: #1E2F45; --color-bg-subtle: #2B3B50;
  --color-text: #FFFFFF; --color-text-secondary: #D3DAE1; --color-text-muted: #9DA7B2;
  --color-border: #3E4D5F; --color-border-row: #2B3B50; --color-border-control: #717C8A;
  --color-info: #A6BAFF; --color-danger: #F1AA94; --color-success: #88D9A5; --color-warning: #FFD43A; --color-focus: #A6BAFF;
}
/* Light on any element too, so a light card can sit on a navy section (and the page's own light theme is explicit) */
:root[data-theme="light"], [data-theme="light"] {
  color-scheme: light;
  --color-bg: #FAFAF9; --color-bg-surface: #FFFFFF; --color-bg-subtle: #F3F3F1;
  --color-text: #12253C; --color-text-secondary: #3E4954; --color-text-muted: #5B646E;
  --color-border: #E3E7EA; --color-border-row: #ECEFF1; --color-border-control: #89929A;
  --color-info: #2951DB; --color-danger: #9A2E12; --color-success: #13693A; --color-warning: #6E4A00; --color-focus: #2951DB;
}

@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0ms; --duration-base: 0ms; }
}
