/*
 * Yail.Shared.Web - yail-tokens.css
 *
 * The one place a colour is written (spec 2026-10-20-colour-cleanup-design.md).
 * Palette names (--yail-coffee ... --yail-slate) appear here only; every other
 * stylesheet, view and script uses the ROLE tokens below. Dark mode (spec
 * 2026-10-20-dark-mode-design.md) gives the role layer "Espresso" values in the
 * two dark blocks at the end; palette names and Fixed tokens are never redefined.
 * Every document loads this first, before any other stylesheet.
 */
:root {
  color-scheme: light;

  /* Palette */
  --yail-coffee: #3D2A1A;
  --yail-amber: #A86D2C;
  --yail-cream: #F5EBD9;
  --yail-stone: #C9B895;
  --yail-mocha: #6B5B45;
  --yail-ink: #2B1D11;
  --yail-amber-light: #D4A56F;
  --yail-coffee-dark: #1A1209;
  --yail-olive: #5F7A3A;
  --yail-rust: #9b3e2a;
  --yail-ochre: #8B5E1F;
  --yail-slate: #4a5c7a;

  /* Surfaces */
  --yail-page: var(--yail-cream);
  --yail-surface: #fff;
  --yail-surface-subtle: #fbf6ec;
  --yail-surface-sunken: color-mix(in srgb, var(--yail-cream) 50%, var(--yail-stone));
  /* The empty part of a bar, meter or rail: sunken in light; dark gives it a value that shows on a card. */
  --yail-track: var(--yail-surface-sunken);
  /* Inner fill: hover and chip/panel fills inside a surface. --yail-page is only the page background. */
  --yail-fill-subtle: var(--yail-cream);
  /* Faint hairlines, grid lines and separator rings: cream in light; dark mode gives it its own value. */
  --yail-line-faint: var(--yail-cream);
  /* Neutral grey-brown fill: off/paused dots, "other" blocks. */
  --yail-fill-neutral: color-mix(in srgb, var(--yail-inverse) 12%, var(--yail-surface));
  /* Stone fill (the stone avatar), light end and deep end of its gradient; text on it is --yail-text-on-accent. */
  --yail-fill-stone: color-mix(in srgb, var(--yail-surface-sunken) 80%, var(--yail-shadow));
  --yail-fill-stone-deep: color-mix(in srgb, var(--yail-surface-sunken) 40%, var(--yail-shadow));
  --yail-scrim: color-mix(in srgb, var(--yail-coffee-dark) 45%, transparent);

  /* Text */
  --yail-text: var(--yail-ink);
  --yail-text-strong: var(--yail-coffee);
  --yail-text-muted: var(--yail-mocha);
  --yail-text-faint: var(--yail-stone);
  --yail-text-on-fill: #fff;

  /* Lines and focus */
  --yail-border: var(--yail-stone);
  --yail-border-subtle: color-mix(in srgb, var(--yail-stone) 40%, transparent);
  --yail-border-strong: var(--yail-coffee);
  --yail-focus: color-mix(in srgb, var(--yail-amber) 16%, transparent);

  /* Accent */
  --yail-accent: var(--yail-amber);
  --yail-accent-soft: var(--yail-amber-light);
  /* Secondary text (Bootstrap .text-secondary and friends): the soft accent pulled toward the strong
     text, because amber-light alone is about 2.2:1 on white; this is about 4.6:1 and still not the accent. */
  --yail-accent-soft-text: color-mix(in srgb, var(--yail-accent-soft) 55%, var(--yail-text-strong));
  --yail-accent-tint: color-mix(in srgb, var(--yail-accent) 10%, transparent);
  --yail-text-on-accent: #fff;
  /* Not a colour: the --heat above which text on a .heat cell takes the dark-fill ink (--yail-text-on-accent).
     1 in light, where the views mark a hot cell with .is-hot at .85 instead; .6 in dark, where the bright tones cross. */
  --yail-heat-ink-from: 1;

  /* Inverse (dark fills) */
  --yail-inverse: var(--yail-ink);
  --yail-inverse-hover: var(--yail-coffee);
  --yail-text-on-inverse: var(--yail-cream);
  --yail-text-on-inverse-muted: color-mix(in srgb, var(--yail-cream) 65%, transparent);
  /* Accent text and marks on the inverse fill (.hero-dark eyebrows and italics, claim keys) */
  --yail-accent-on-inverse: var(--yail-accent-soft);
  /* The full accent on the inverse fill (the portfolio queue's labels): amber in light, deep amber in dark. */
  --yail-accent-on-inverse-strong: var(--yail-accent);
  /* A module logo's tile (.yail-mega-ic, .dw-icon, .pcard-sm img, …): cream with an amber edge in light,
     raised espresso with an amber-light edge in dark, where the logo itself is swapped for its dark twin. */
  --yail-logo-tile: var(--yail-cream);
  --yail-logo-edge: color-mix(in srgb, var(--yail-amber) 55%, transparent);
  /* Fixed — a theme must not redefine this. Backdrop behind camera/video/media; stays dark in every theme. */
  --yail-media-backdrop: #0a0a0a;

  /* Status */
  --yail-good: var(--yail-olive);
  --yail-warn: var(--yail-ochre);
  --yail-danger: var(--yail-rust);
  --yail-info: var(--yail-slate);
  --yail-good-tint: color-mix(in srgb, var(--yail-good) 10%, transparent);
  --yail-warn-tint: color-mix(in srgb, var(--yail-warn) 10%, transparent);
  --yail-danger-tint: color-mix(in srgb, var(--yail-danger) 10%, transparent);
  --yail-info-tint: color-mix(in srgb, var(--yail-info) 10%, transparent);
  --yail-good-border: color-mix(in srgb, var(--yail-good) 30%, transparent);
  --yail-warn-border: color-mix(in srgb, var(--yail-warn) 30%, transparent);
  --yail-danger-border: color-mix(in srgb, var(--yail-danger) 30%, transparent);
  --yail-info-border: color-mix(in srgb, var(--yail-info) 30%, transparent);

  /* Shadow */
  --yail-shadow: var(--yail-coffee);
  /* Fixed — a theme must not redefine this. Text on a pale or accent swatch fill is always dark, on a dark one always white. */
  --yail-on-swatch-dark: var(--yail-ink);
  --yail-on-swatch-light: #fff;

  /* Fixed — a theme must not redefine these. Fixed backgrounds: a brand asset previewed on white, black, grey or a checkerboard, and a
     printed page. These do not follow the theme: the point is to see the asset on that colour. */
  --yail-preview-white: #fff;
  --yail-preview-black: #000;
  --yail-preview-grey: #374151;
  --yail-preview-checker: #e5e7eb;
  /* Muted text on the white and checker previews: the light theme's muted text, fixed so it stays dark on white. */
  --yail-preview-muted: var(--yail-mocha);
  --yail-print-paper: #fff;
  --yail-print-ink: #111;
  --yail-print-rule: #999;
  --yail-print-muted: #555;

  /* Fixed — a theme must not redefine these. A received email's HTML body, written by its sender for a white page: drawn
     on white with dark ink in every theme, so the sender's own colours stay readable (Yail.Mail's message page). */
  --yail-mail-paper: #fff;
  --yail-mail-ink: var(--yail-ink);
  --yail-mail-edge: var(--yail-stone);

  /* Fixed — a theme must not redefine these. Drawn over the CRM map's tiles, which are third-party light imagery in
     every theme: the heat ramp, low to high, and the searched area's dashed outline. */
  --yail-map-heat-1: var(--yail-amber-light);
  --yail-map-heat-2: var(--yail-amber);
  --yail-map-heat-3: var(--yail-rust);
  --yail-map-heat-4: var(--yail-coffee);
  --yail-map-ink: var(--yail-ink);

  /* Fixed — a theme must not redefine these. Categorical series (HR's R&D bands) */
  --yail-cat-1: #BC5E1B;
  --yail-cat-2: #9C4A12;
  --yail-cat-3: #D9913F;
  --yail-cat-4: #6E6B3C;
  --yail-cat-5: #4E5B63;
  --yail-cat-6: #8C5A4A;
  --yail-cat-7: #B3A48D;
  --yail-cat-8: #D8CDB6;

  /* Type (not a colour; here because every --yail-* is declared in this file) */
  --yail-font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --shadow-card: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 4%, transparent), 0 8px 28px color-mix(in srgb, var(--yail-shadow) 6%, transparent);
  --shadow-card-soft: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 3%, transparent), 0 4px 14px color-mix(in srgb, var(--yail-shadow) 4%, transparent);
}

/* Light, chosen: the toggle's Light wins over an OS that prefers dark. */
:root[data-yail-theme="light"] {
  color-scheme: light;
}

/*
 * Dark ("Espresso"). The same declarations twice, held equal by ThemeTokenTests.Dark_blocks_are_identical:
 * System (no data-yail-theme) follows the OS through the media query; Dark is chosen with the attribute.
 * Roles only: palette names and Fixed tokens are never redefined here.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-yail-theme="light"]) {
    color-scheme: dark;

    /* Surfaces */
    --yail-page: #15100B;
    --yail-surface: #1F1812;
    --yail-surface-subtle: #251D16;
    --yail-surface-sunken: #110D09;
    --yail-track: #3A2F24;
    --yail-fill-subtle: #2A2119;
    --yail-line-faint: #30261C;
    --yail-fill-neutral: color-mix(in srgb, var(--yail-inverse) 14%, var(--yail-surface));
    --yail-fill-stone: #C9B895;
    --yail-fill-stone-deep: #A8977A;
    --yail-scrim: color-mix(in srgb, #000 60%, transparent);

    /* Text */
    --yail-text: #EDE3D2;
    --yail-text-strong: #F5EBD9;
    --yail-text-muted: #B3A48C;
    --yail-text-faint: #7D6E58;
    --yail-text-on-fill: #1A1209;

    /* Lines and focus */
    --yail-border: #45382A;
    --yail-border-subtle: color-mix(in srgb, var(--yail-mocha) 35%, transparent);
    --yail-border-strong: #C9B895;
    --yail-focus: color-mix(in srgb, var(--yail-accent) 28%, transparent);

    /* Accent: amber-light, because amber itself is too dark on espresso. The soft accent stays the lighter
       amber (fills, gradients, text on surface); accent on the inverse fill, which is cream here, goes deep. */
    --yail-accent: #D4A56F;
    --yail-accent-soft: #E2BE8F;
    --yail-accent-soft-text: color-mix(in srgb, var(--yail-accent-soft) 55%, var(--yail-text-strong));
    --yail-accent-tint: color-mix(in srgb, var(--yail-accent) 14%, transparent);
    --yail-text-on-accent: #1A1209;
    --yail-heat-ink-from: 0.6;

    /* Inverse: the cream fill (primary button, org chip, toast) */
    --yail-inverse: #F5EBD9;
    --yail-inverse-hover: #E6D8C0;
    --yail-text-on-inverse: #1A1209;
    --yail-text-on-inverse-muted: color-mix(in srgb, #1A1209 65%, transparent);
    --yail-accent-on-inverse: #7F4F1A;
    --yail-accent-on-inverse-strong: #7F4F1A;
    --yail-logo-tile: #2A2018;
    --yail-logo-edge: color-mix(in srgb, #D4A56F 55%, transparent);

    /* Status, brightened to read on espresso */
    --yail-good: #9CBF6E;
    --yail-warn: #E0B060;
    --yail-danger: #E08770;
    --yail-info: #9DB2D4;
    --yail-good-tint: color-mix(in srgb, var(--yail-good) 14%, transparent);
    --yail-warn-tint: color-mix(in srgb, var(--yail-warn) 14%, transparent);
    --yail-danger-tint: color-mix(in srgb, var(--yail-danger) 14%, transparent);
    --yail-info-tint: color-mix(in srgb, var(--yail-info) 14%, transparent);
    --yail-good-border: color-mix(in srgb, var(--yail-good) 35%, transparent);
    --yail-warn-border: color-mix(in srgb, var(--yail-warn) 35%, transparent);
    --yail-danger-border: color-mix(in srgb, var(--yail-danger) 35%, transparent);
    --yail-info-border: color-mix(in srgb, var(--yail-info) 35%, transparent);

    /* Shadow: black, and the card shadows deepened to show on a dark page */
    --yail-shadow: #000;
    --shadow-card: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 30%, transparent), 0 8px 28px color-mix(in srgb, var(--yail-shadow) 40%, transparent);
    --shadow-card-soft: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 25%, transparent), 0 4px 14px color-mix(in srgb, var(--yail-shadow) 30%, transparent);
  }
}

:root[data-yail-theme="dark"] {
  color-scheme: dark;

  /* Surfaces */
  --yail-page: #15100B;
  --yail-surface: #1F1812;
  --yail-surface-subtle: #251D16;
  --yail-surface-sunken: #110D09;
  --yail-track: #3A2F24;
  --yail-fill-subtle: #2A2119;
  --yail-line-faint: #30261C;
  --yail-fill-neutral: color-mix(in srgb, var(--yail-inverse) 14%, var(--yail-surface));
  --yail-fill-stone: #C9B895;
  --yail-fill-stone-deep: #A8977A;
  --yail-scrim: color-mix(in srgb, #000 60%, transparent);

  /* Text */
  --yail-text: #EDE3D2;
  --yail-text-strong: #F5EBD9;
  --yail-text-muted: #B3A48C;
  --yail-text-faint: #7D6E58;
  --yail-text-on-fill: #1A1209;

  /* Lines and focus */
  --yail-border: #45382A;
  --yail-border-subtle: color-mix(in srgb, var(--yail-mocha) 35%, transparent);
  --yail-border-strong: #C9B895;
  --yail-focus: color-mix(in srgb, var(--yail-accent) 28%, transparent);

  /* Accent: amber-light, because amber itself is too dark on espresso. The soft accent stays the lighter
     amber (fills, gradients, text on surface); accent on the inverse fill, which is cream here, goes deep. */
  --yail-accent: #D4A56F;
  --yail-accent-soft: #E2BE8F;
  --yail-accent-soft-text: color-mix(in srgb, var(--yail-accent-soft) 55%, var(--yail-text-strong));
  --yail-accent-tint: color-mix(in srgb, var(--yail-accent) 14%, transparent);
  --yail-text-on-accent: #1A1209;
  --yail-heat-ink-from: 0.6;

  /* Inverse: the cream fill (primary button, org chip, toast) */
  --yail-inverse: #F5EBD9;
  --yail-inverse-hover: #E6D8C0;
  --yail-text-on-inverse: #1A1209;
  --yail-text-on-inverse-muted: color-mix(in srgb, #1A1209 65%, transparent);
  --yail-accent-on-inverse: #7F4F1A;
  --yail-accent-on-inverse-strong: #7F4F1A;
  --yail-logo-tile: #2A2018;
  --yail-logo-edge: color-mix(in srgb, #D4A56F 55%, transparent);

  /* Status, brightened to read on espresso */
  --yail-good: #9CBF6E;
  --yail-warn: #E0B060;
  --yail-danger: #E08770;
  --yail-info: #9DB2D4;
  --yail-good-tint: color-mix(in srgb, var(--yail-good) 14%, transparent);
  --yail-warn-tint: color-mix(in srgb, var(--yail-warn) 14%, transparent);
  --yail-danger-tint: color-mix(in srgb, var(--yail-danger) 14%, transparent);
  --yail-info-tint: color-mix(in srgb, var(--yail-info) 14%, transparent);
  --yail-good-border: color-mix(in srgb, var(--yail-good) 35%, transparent);
  --yail-warn-border: color-mix(in srgb, var(--yail-warn) 35%, transparent);
  --yail-danger-border: color-mix(in srgb, var(--yail-danger) 35%, transparent);
  --yail-info-border: color-mix(in srgb, var(--yail-info) 35%, transparent);

  /* Shadow: black, and the card shadows deepened to show on a dark page */
  --yail-shadow: #000;
  --shadow-card: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 30%, transparent), 0 8px 28px color-mix(in srgb, var(--yail-shadow) 40%, transparent);
  --shadow-card-soft: 0 1px 1px color-mix(in srgb, var(--yail-shadow) 25%, transparent), 0 4px 14px color-mix(in srgb, var(--yail-shadow) 30%, transparent);
}

/* Text on an organisation-chosen swatch; the class comes from SwatchContrast.TextClass */
.on-swatch-dark { color: var(--yail-on-swatch-dark); }
.on-swatch-light { color: var(--yail-on-swatch-light); }

/* A module logo (/img/logos/…) is drawn in coffee for a light page. In dark it is replaced by its twin,
   <slug>-dark.svg, drawn in cream and amber-light: each logo names its twin below, and the two dark rules
   swap it in. A logo with no twin keeps --yail-logo-dark unset, so content stays normal and it shows as drawn. */
/* logos:dark:start (tools/make-dark-logos.mjs writes these lines) */
:where(img[src$="/img/logos/agent/agent.svg"]) { --yail-logo-dark: url("../img/logos/agent/agent-dark.svg"); }
:where(img[src$="/img/logos/block/block.svg"]) { --yail-logo-dark: url("../img/logos/block/block-dark.svg"); }
:where(img[src$="/img/logos/branding/branding.svg"]) { --yail-logo-dark: url("../img/logos/branding/branding-dark.svg"); }
:where(img[src$="/img/logos/build/build.svg"]) { --yail-logo-dark: url("../img/logos/build/build-dark.svg"); }
:where(img[src$="/img/logos/comply/comply.svg"]) { --yail-logo-dark: url("../img/logos/comply/comply-dark.svg"); }
:where(img[src$="/img/logos/connect/connect.svg"]) { --yail-logo-dark: url("../img/logos/connect/connect-dark.svg"); }
:where(img[src$="/img/logos/crm/crm.svg"]) { --yail-logo-dark: url("../img/logos/crm/crm-dark.svg"); }
:where(img[src$="/img/logos/dealroom/dealroom.svg"]) { --yail-logo-dark: url("../img/logos/dealroom/dealroom-dark.svg"); }
:where(img[src$="/img/logos/forgeahead/forgeahead.svg"]) { --yail-logo-dark: url("../img/logos/forgeahead/forgeahead-dark.svg"); }
:where(img[src$="/img/logos/hr/hr.svg"]) { --yail-logo-dark: url("../img/logos/hr/hr-dark.svg"); }
:where(img[src$="/img/logos/identity/identity.svg"]) { --yail-logo-dark: url("../img/logos/identity/identity-dark.svg"); }
:where(img[src$="/img/logos/ledger/ledger.svg"]) { --yail-logo-dark: url("../img/logos/ledger/ledger-dark.svg"); }
:where(img[src$="/img/logos/mail/mail.svg"]) { --yail-logo-dark: url("../img/logos/mail/mail-dark.svg"); }
:where(img[src$="/img/logos/membership/membership.svg"]) { --yail-logo-dark: url("../img/logos/membership/membership-dark.svg"); }
:where(img[src$="/img/logos/message/message.svg"]) { --yail-logo-dark: url("../img/logos/message/message-dark.svg"); }
:where(img[src$="/img/logos/monitor/monitor.svg"]) { --yail-logo-dark: url("../img/logos/monitor/monitor-dark.svg"); }
:where(img[src$="/img/logos/pitch/pitch.svg"]) { --yail-logo-dark: url("../img/logos/pitch/pitch-dark.svg"); }
:where(img[src$="/img/logos/rag/rag.svg"]) { --yail-logo-dark: url("../img/logos/rag/rag-dark.svg"); }
:where(img[src$="/img/logos/research/research.svg"]) { --yail-logo-dark: url("../img/logos/research/research-dark.svg"); }
:where(img[src$="/img/logos/runway/runway.svg"]) { --yail-logo-dark: url("../img/logos/runway/runway-dark.svg"); }
:where(img[src$="/img/logos/signal/signal.svg"]) { --yail-logo-dark: url("../img/logos/signal/signal-dark.svg"); }
:where(img[src$="/img/logos/space/space.svg"]) { --yail-logo-dark: url("../img/logos/space/space-dark.svg"); }
:where(img[src$="/img/logos/survey/survey.svg"]) { --yail-logo-dark: url("../img/logos/survey/survey-dark.svg"); }
:where(img[src$="/img/logos/tasks/tasks.svg"]) { --yail-logo-dark: url("../img/logos/tasks/tasks-dark.svg"); }
:where(img[src$="/img/logos/vault/vault.svg"]) { --yail-logo-dark: url("../img/logos/vault/vault-dark.svg"); }
:where(img[src$="/img/logos/verify/verify.svg"]) { --yail-logo-dark: url("../img/logos/verify/verify-dark.svg"); }
:where(img[src$="/img/logos/yailos/yailos.svg"]) { --yail-logo-dark: url("../img/logos/yailos/yailos-dark.svg"); }
/* logos:dark:end */
@media (prefers-color-scheme: dark) {
  :root:not([data-yail-theme="light"]) img[src*="/img/logos/"] { content: var(--yail-logo-dark); }
}
:root[data-yail-theme="dark"] img[src*="/img/logos/"] { content: var(--yail-logo-dark); }
