/* =====================================================================
   FEDR — the design system's token layer.  SPEC M9 §3.

   Loaded BEFORE styles.css.  This is the only file in the tree that may
   contain a literal colour, and it is the file a customer's CI swap edits.

   Everything visual is declared here and nowhere else. Three rules make
   a customer CI swap safe:

     1. Structural colour NEVER derives from the accent. Swapping the
        accent pair cannot move a border, a surface or a text colour.
     2. The accent always travels with --fedr-on-accent, the ink that
        rides on top of it. FEDR's yellow needs black; a customer's navy
        needs white. One pair, one swap.
     3. On a LIGHT surface the accent may not carry meaning alone.
        #F0BC40 on white is 1.75:1 — it fails even the 3:1 non-text
        threshold. It reinforces an ink signal (weight, a rule, a fill);
        it is never the only thing saying "this one is active".
        On the ink bar it is 10.1:1 and carries meaning by itself.
   ===================================================================== */

/* ---------- typefaces (self-hosted, no network, works air-gapped) ---------- */

@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Sans"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family: "Plex Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-serif-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Serif"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-serif-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Serif"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-serif-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-serif-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }


/* ===================================================================
   1. PRIMITIVES — the only literal colours in the system.
   A warm neutral ramp (hue ~40°, very low chroma). Warm, because a warm
   accent on cold grey is the single most common way a one-colour palette
   reads as cheap. Measured contrasts are in the comments; see
   M9 §3.1 for the audit.
   =================================================================== */
:root {
  /* neutral ramp — light */
  --n-00: #FFFFFF;
  --n-05: #FAF8F5;   /* paper */
  --n-10: #F1EEE8;   /* sunken fill, hover */
  --n-20: #E3DFD7;   /* hairline */
  --n-30: #C9C3B8;   /* stronger rule */
  --n-40: #9A9286;   /* control border — 3.07:1 on white, the WCAG floor */
  --n-50: #787266;   /* meta text — 4.78:1 on white */
  --n-60: #6B6559;   /* secondary text — 5.78:1 */
  --n-80: #3A362F;   /* strong secondary — 12.0:1 */
  --n-95: #1A1814;   /* ink — 17.7:1 */

  /* brand — the pair that a customer swaps, and nothing else */
  --fedr-accent: #F0BC40;
  --fedr-accent-hover: #E3AC28;
  --fedr-on-accent: #1A1814;      /* ink on yellow = 10.1:1 */

  /* functional, not brand: link blue stays put when the accent changes */
  --fedr-link: #1A4FA0;           /* 7.87:1 on white */
  --fedr-link-visited: #5B3E8E;   /* 8.32:1 */

  --fedr-danger: #A3341F;
  --fedr-on-danger: #FFFFFF;      /* 8.1:1 on the danger fill */
  --fedr-success: #1F6B43;
}

/* ===================================================================
   2. SEMANTIC ROLES — what the rest of the CSS is allowed to name.
   Nothing outside this file may use an --n-* primitive.
   =================================================================== */
:root {
  --surface:          var(--n-00);
  --surface-sunken:   var(--n-10);
  --surface-raised:   var(--n-00);
  --surface-rail:     var(--n-05);
  --surface-inverse:  var(--n-95);

  --text:             var(--n-95);
  --text-secondary:   var(--n-60);
  --text-muted:       var(--n-50);
  --text-inverse:     var(--n-05);
  --text-on-inverse-muted: #A8A296;   /* 4.9:1 on ink */

  --line:             var(--n-20);
  --line-strong:      var(--n-30);
  --line-control:     var(--n-40);

  --link:             var(--fedr-link);
  --link-visited:     var(--fedr-link-visited);


  /* The bar. M9 chose the ink bar (direction A); these are its only colours. */
  --bar-bg:           var(--n-95);
  --bar-text:         var(--n-05);
  --bar-text-muted:   var(--text-on-inverse-muted);
  --bar-hover:        rgba(255,255,255,.08);
  --bar-line:         transparent;
  --bar-brand:        var(--fedr-accent);
  /* The mark under the active mode tab. On the ink bar the accent is 10.1:1 and
     may carry it alone; on a light bar it is 1.75:1 and ink takes over. Same
     rule as everywhere else, expressed as one token instead of an opacity. */
  --bar-mark:         var(--fedr-accent);

  /* typefaces */
  --font-ui:    "Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Switched to the serif by .chat-msg.assistant.is-report only (M9 §4). */
  --font-prose: var(--font-ui);
  --font-report: "Plex Serif", Georgia, "Times New Roman", serif;
  --font-mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* type scale — 1.25 from 16, rounded to whole px and trimmed to eight steps */
  --t-11:  0.6875rem;   /* 11px  — group labels, tracked caps */
  --t-12:  0.75rem;     /* 12px  — badges, counts */
  --t-13:  0.8125rem;   /* 13px  — dense UI, tool log */
  --t-14:  0.875rem;    /* 14px  — UI default */
  --t-15:  0.9375rem;   /* 15px  — snippets */
  --t-16:  1rem;        /* 16px  — prose */
  --t-18:  1.125rem;    /* 18px  — result title, lead */
  --t-21:  1.3125rem;   /* 21px  — h3 */
  --t-26:  1.625rem;    /* 26px  — h2 */
  --t-33:  2.0625rem;   /* 33px  — h1 */

  --lh-tight: 1.25;
  --lh-ui:    1.45;
  --lh-prose: 1.7;

  /* space — 4px grid */
  --s-1: 0.25rem; --s-2: 0.5rem;  --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;    --s-7: 3rem;    --s-8: 4rem;

  /* radii — small and deliberate; the pill is for badges only */
  --r-1: 4px; --r-2: 6px; --r-3: 10px; --r-4: 14px; --r-pill: 999px;

  /* two shadows, both barely there; hairlines do most of the grouping */
  --shadow-1: 0 1px 2px rgba(26,24,20,.06);
  --shadow-2: 0 10px 28px -10px rgba(26,24,20,.22);

  /* motion */
  --t-fast: 120ms;
  --t-base: 180ms;
  --ease:   cubic-bezier(.2,.6,.2,1);

  /* layout — these four keep the repo's --fedr-* names: app.js writes
     --fedr-header-h from the live header height, and the old styles.css
     already used the other three. */
  --fedr-header-h:    56px;
  --fedr-sidebar-w:   16rem;
  --fedr-chat-column: 40rem;   /* ~74 characters at 16px Plex Sans */
  --fedr-page-max:    72rem;
  /* Header bottom to the wordmark, on both landing screens. Each screen
     subtracts its own container's padding from this, so one value moves both. */
  --fedr-lede-top:    12vh;
  --fedr-drawer-w:    22rem;   /* the search-options drawer */
}

/* The phone override of --fedr-lede-top lives in styles.css, section 6, not
   here: this file is imported by doc/pipeline/document.css, and WeasyPrint
   parses media *types* only. See the note there. */

/* ===================================================================
   3. DARK — tokens only (M9 §9). Anything that needs more than a token
   here is a token that was wrong.

   Keyed off data-bs-theme, the attribute Bootstrap's own variables read,
   so one attribute drives both. boot-route.js resolves
   prefers-color-scheme into it before first paint -- a media query alone
   cannot, because Bootstrap's variables do not respond to one.
   =================================================================== */
[data-bs-theme="dark"] {
  --n-00: #161512;
  --n-05: #1E1D19;
  --n-10: #272520;
  --n-20: #35322B;
  --n-30: #494539;
  --n-40: #66625A;   /* control border — 3.01:1 on #161512 */
  --n-50: #9C9588;
  --n-60: #B6AEA0;
  --n-80: #DCD6CB;
  --n-95: #F2EFE9;

  --surface:          var(--n-00);   /* #161512 — the page */
  --surface-raised:   var(--n-05);   /* #1E1D19 — composer, cards, popovers */
  --surface-sunken:   var(--n-10);   /* #272520 — inset fills INSIDE a raised thing */
  --surface-rail:     #100F0D;       /* continues the bar rather than lifting off it */
  --surface-inverse:  var(--n-95);

  --text:             var(--n-95);
  --text-secondary:   var(--n-60);
  --text-muted:       var(--n-50);
  --text-inverse:     #161512;
  --text-on-inverse-muted: #5E5A52;

  --link:         #7FB0FF;   /* 8.31:1 on #161512 */
  --link-visited: #C3A6F5;
  --fedr-danger:  #F08A72;
  --fedr-on-danger: #2A0D06;   /* the fill is light here, so its ink is not */
  --fedr-success: #5FC98E;

  --bar-bg:          #100F0D;
  --bar-text:        var(--n-95);
  --bar-text-muted:  var(--n-50);
  --bar-hover:       rgba(255,255,255,.07);
  --bar-line:        var(--n-20);
  --bar-brand:       var(--fedr-accent);
  --bar-mark:        var(--fedr-accent);


  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 10px 28px -10px rgba(0,0,0,.7);
}

