/* ==========================================================================
   MintRSS design tokens
   ==========================================================================
   Load AFTER bootstrap.min.css. Bootstrap CSS only: no Bootstrap JS, no Popper.

   Identity: "instrument panel". Warm graphite neutrals, one azure accent,
   sharp 2-4px geometry, hairline borders, no shadows or gradients. Data and
   hostnames are set in IBM Plex Mono, prose in IBM Plex Sans. Status states are
   rectangular "annunciators": icon + label + tinted fill, never colour alone.

   Colour modes
   - Every colour token is ONE definition written as light-dark(<light>, <dark>).
   - Default follows the OS (color-scheme: light dark).
   - A manual choice sets data-bs-theme="light|dark" on <html>, which pins
     color-scheme. "Auto" simply removes the attribute. See static/js/theme.js.
   - light-dark() needs Chrome/Edge 123+, Safari 17.5+, Firefox 120+.

   Fonts: IBM Plex Sans and Plex Mono are self-hosted (static/vendor/fonts, see
   static/css/fonts.css and static/vendor/README.md). Nothing is fetched from a
   third party. The fallback stacks below keep the page usable while they load.

   Contrast (checked with the dataviz skill's contrast() on every pair that is
   used): body and secondary text >= 7:1; muted text >= 4.5:1; status text on
   its tinted chip >= 5.6:1 in both modes; marks (uptime ticks, meter fills,
   control borders) >= 3:1 against the surface they sit on.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* ---- Type ----------------------------------------------------------- */
  --mr-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mr-font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* One scale, seven steps. rem so user zoom still works. */
  --mr-fs-label: 0.6875rem;  /* 11  mono caps labels, annunciators      */
  --mr-fs-meta:  0.75rem;    /* 12  secondary text, units, timestamps   */
  --mr-fs-dense: 0.8125rem;  /* 13  table cells, dense lists            */
  --mr-fs-body:  0.875rem;   /* 14  default UI text                     */
  --mr-fs-title: 1.25rem;    /* 20  page title, panel heading           */
  --mr-fs-display: 1.75rem;  /* 28  section numbers                     */
  --mr-fs-hero:  3rem;       /* 48  the single headline number per page */
  --mr-lh-body: 1.45;
  /* MintRSS addition: long-form article text only. Chrome stays on the scale above. */
  --mr-fs-read: 1.0625rem;   /* 17  article body                        */
  --mr-lh-read: 1.6;
  --mr-measure: 68ch;
  --mr-lh-tight: 1.2;
  --mr-tracking-label: 0.07em;

  /* ---- Geometry ------------------------------------------------------- */
  --mr-radius-sm: 2px;       /* chips, marks, small controls */
  --mr-radius:    3px;       /* buttons, inputs, tiles       */
  --mr-radius-lg: 4px;       /* panels                       */
  --mr-topbar-h: 3rem;

  /* ---- Surfaces and ink ------------------------------------------------ */
  --mr-bg:           light-dark(#f1f0ec, #111110);   /* page            */
  --mr-surface:      light-dark(#fbfaf8, #181817);   /* panels, bars    */
  --mr-surface-2:    light-dark(#f5f4f0, #1f1f1d);   /* hover, wells    */
  --mr-surface-3:    light-dark(#ebe9e3, #282826);   /* pressed, active */
  --mr-border:       light-dark(#dcdad3, #2d2d2a);   /* hairlines       */
  --mr-border-strong:light-dark(#c3c0b7, #403f3b);
  --mr-control-border: light-dark(#8a877e, #7a786f); /* inputs, buttons: >= 3:1 */
  --mr-text:         light-dark(#1a1a18, #ebeae4);
  --mr-text-strong:  light-dark(#000000, #ffffff);
  --mr-text-2:       light-dark(#4b4a45, #bab8ae);   /* secondary */
  --mr-text-muted:   light-dark(#66645c, #928f85);   /* tertiary, still >= 4.8:1 */

  /* ---- Accent (one) ----------------------------------------------------
     Azure. Links, active nav, focus, capacity fills, sparklines.
     Never used for status. */
  --mr-accent-text:  light-dark(#1d62c4, #6da7ec);   /* text/icons on surfaces */
  --mr-accent-hover: light-dark(#124a9c, #9ec5f4);
  --mr-accent-mark:  light-dark(#2a78d6, #3987e5);   /* data marks (dataviz blue, slot 1) */
  --mr-accent-btn:   light-dark(#1d62c4, #6da7ec);
  --mr-accent-btn-text: light-dark(#ffffff, #0b0b0a);
  --mr-focus:        light-dark(#1d62c4, #8fbcf5);

  /* ---- Status language -------------------------------------------------
     Per state: -solid (marks, >= 3:1), -fg (text/icon on the tint, >= 5.6:1),
     -bg (tint), -bd (hairline). Every use pairs an icon with a label.

       state             icon                         label
       up                bi-check-circle-fill         Up
       degraded          bi-exclamation-triangle-fill Degraded
       down              bi-x-octagon-fill            Down
       stale             bi-hourglass-split           Stale   (violet, not orange: orange sat 19 degrees
                                                              from red and the two chips read as one)
       expected-offline  bi-pause-circle              Expected offline
       site-unreachable  bi-wifi-off                  Site unreachable
       unknown           bi-question-circle           Unknown
       warn (capacity)   bi-pie-chart-fill            e.g. Overcommitted  (uses degraded colours)
  */
  --mr-up-solid:       light-dark(#0e9170, #109f7b);   /* green leaning teal: stays apart from red/amber for red-green colour blindness */
  --mr-up-fg:          light-dark(#005c46, #5fd9b8);
  --mr-degraded-solid: light-dark(#b27500, #fab219);
  --mr-degraded-fg:    light-dark(#734400, #fbc548);
  --mr-down-solid:     light-dark(#d03b3b, #d03b3b);
  --mr-down-fg:        light-dark(#a31f1f, #ff8f8a);
  --mr-stale-solid:    light-dark(#7a4fc9, #a283ea);   /* violet: "we don't know", far from red/amber */
  --mr-stale-fg:       light-dark(#5b30ad, #c4b0f4);
  --mr-offline-solid:  light-dark(#66645c, #928f85);
  --mr-offline-fg:     light-dark(#4b4a45, #bab8ae);
  --mr-unreach-bg:     #c33030;                       /* filled chip, white text: 5.5:1 */
  --mr-unreach-fg:     #ffffff;

  --mr-up-bg:       color-mix(in srgb, var(--mr-up-solid) 14%, var(--mr-surface));
  --mr-degraded-bg: color-mix(in srgb, var(--mr-degraded-solid) 14%, var(--mr-surface));
  --mr-down-bg:     color-mix(in srgb, var(--mr-down-solid) 14%, var(--mr-surface));
  --mr-stale-bg:    color-mix(in srgb, var(--mr-stale-solid) 14%, var(--mr-surface));
  --mr-offline-bg:  color-mix(in srgb, var(--mr-offline-solid) 14%, var(--mr-surface));
  --mr-up-bd:       color-mix(in srgb, var(--mr-up-solid) 45%, var(--mr-surface));
  --mr-degraded-bd: color-mix(in srgb, var(--mr-degraded-solid) 45%, var(--mr-surface));
  --mr-down-bd:     color-mix(in srgb, var(--mr-down-solid) 45%, var(--mr-surface));
  --mr-stale-bd:    color-mix(in srgb, var(--mr-stale-solid) 45%, var(--mr-surface));
  --mr-offline-bd:  color-mix(in srgb, var(--mr-offline-solid) 45%, var(--mr-surface));

  /* ---- Data ink -------------------------------------------------------- */
  --mr-viz-1:    var(--mr-accent-mark);
  --mr-nodata:   light-dark(#85827a, #716f67);        /* no-data day tick: >= 3:1 */
  --mr-track:    color-mix(in srgb, var(--mr-accent-mark) 14%, var(--mr-surface));
  /* Capacity ramp, one hue. m1 strongest (in-guest used) .. m3 faintest (allocated). */
  --mr-m1: light-dark(#184f95, #a3c8f5);   /* 7.8 / 10.3 : 1 on surface */
  --mr-m2: light-dark(#2e6ec1, #5b9be8);   /* 4.9 / 6.2 : 1 */
  --mr-m3: light-dark(#4a8fe6, #2d6fc7);   /* 3.2 / 3.6 : 1 (was 2.0 / 2.7, below the mark floor) */
  --mr-mark-radius: 2px;

  /* ---- Bridge to Bootstrap 5.3 (--bs-*) -------------------------------- */
  --bs-body-font-family: var(--mr-font-sans);
  --bs-body-font-size: var(--mr-fs-body);
  --bs-body-line-height: var(--mr-lh-body);
  --bs-body-color: var(--mr-text);
  --bs-body-bg: var(--mr-bg);
  --bs-emphasis-color: var(--mr-text-strong);
  --bs-heading-color: var(--mr-text-strong);
  --bs-secondary-color: var(--mr-text-2);
  --bs-secondary-bg: var(--mr-surface-2);
  --bs-tertiary-color: var(--mr-text-muted);
  --bs-tertiary-bg: var(--mr-surface-2);
  --bs-border-color: var(--mr-border);
  --bs-border-color-translucent: var(--mr-border);
  --bs-border-radius: var(--mr-radius);
  --bs-border-radius-sm: var(--mr-radius-sm);
  --bs-border-radius-lg: var(--mr-radius-lg);
  --bs-border-radius-xl: var(--mr-radius-lg);
  --bs-link-color: var(--mr-accent-text);
  --bs-link-hover-color: var(--mr-accent-hover);
  --bs-primary: var(--mr-accent-btn);
  --bs-success: var(--mr-up-solid);
  --bs-warning: var(--mr-degraded-solid);
  --bs-danger: var(--mr-down-solid);
  --bs-success-text-emphasis: var(--mr-up-fg);
  --bs-warning-text-emphasis: var(--mr-degraded-fg);
  --bs-danger-text-emphasis: var(--mr-down-fg);
  --bs-success-bg-subtle: var(--mr-up-bg);
  --bs-warning-bg-subtle: var(--mr-degraded-bg);
  --bs-danger-bg-subtle: var(--mr-down-bg);
  --bs-success-border-subtle: var(--mr-up-bd);
  --bs-warning-border-subtle: var(--mr-degraded-bd);
  --bs-danger-border-subtle: var(--mr-down-bd);
  --bs-focus-ring-color: color-mix(in srgb, var(--mr-focus) 40%, transparent);
}

/* A manual choice pins the scheme; no attribute = follow the OS. */
:root[data-bs-theme="light"] { color-scheme: light; }
:root[data-bs-theme="dark"]  { color-scheme: dark; }

/* Bootstrap still reads a few colours as "r, g, b" triplets (rgba(var(--bs-*-rgb))),
   and light-dark() cannot produce a triplet, so these are the only values written
   out per mode. Everything the hub styles itself uses the --mr-* tokens above and
   avoids Bootstrap's .bg-*, .text-* and .link-* colour utilities. */
:root {
  --bs-body-color-rgb: 26, 26, 24;
  --bs-body-bg-rgb: 241, 240, 236;
  --bs-emphasis-color-rgb: 0, 0, 0;
  --bs-secondary-bg-rgb: 245, 244, 240;
  --bs-tertiary-bg-rgb: 245, 244, 240;
  --bs-primary-rgb: 29, 98, 196;
  --bs-link-color-rgb: 29, 98, 196;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) {
    --bs-body-color-rgb: 235, 234, 228;
    --bs-body-bg-rgb: 17, 17, 16;
    --bs-emphasis-color-rgb: 255, 255, 255;
    --bs-secondary-bg-rgb: 31, 31, 29;
    --bs-tertiary-bg-rgb: 31, 31, 29;
    --bs-primary-rgb: 109, 167, 236;
    --bs-link-color-rgb: 109, 167, 236;
  }
}
:root[data-bs-theme="dark"] {
  --bs-body-color-rgb: 235, 234, 228;
  --bs-body-bg-rgb: 17, 17, 16;
  --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-secondary-bg-rgb: 31, 31, 29;
  --bs-tertiary-bg-rgb: 31, 31, 29;
  --bs-primary-rgb: 109, 167, 236;
  --bs-link-color-rgb: 109, 167, 236;
}
