/* ============================================================
   bm.css — blackmesa.ca Design Framework v1.3
   by Matthew Drummond (mattdrummond.ca)

   FONTS: Load in your HTML <head>, not via CSS @import.
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap" rel="stylesheet">
   ============================================================ */

/* ============================================================
   TOKENS
   Visual tokens → palette.  Role tokens → semantic aliases.
   Container widths: --narrow 900 | default 1280 | --wide 1600
   ============================================================ */

:root {
  --bm-bg:          #070a0d;
  --bm-surface:     #0c1018;
  --bm-surface-2:   #111720;
  --bm-surface-3:   #161e2a;

  --bm-border:      rgba(255,255,255,0.06);
  --bm-border-hi:   rgba(255,255,255,0.12);
  --bm-border-focus:rgba(255,129,15,0.55);

  /* WCAG AA compliant on --bm-bg (≥ 4.5 : 1) */
  --bm-text:        #d8e4f0;                       /* ~14.5:1 */
  --bm-text-muted:  rgba(216,228,240,0.58);        /* ~ 5.5:1 */
  --bm-text-dim:    rgba(216,228,240,0.52);        /* ~ 4.6:1 */

  --bm-amber:       #ff810f;
  --bm-amber-hi:    #ff9a3d;
  --bm-amber-dim:   rgba(255,129,15,0.12);

  --bm-cyan:        #3dd6e8;
  --bm-cyan-dim:    rgba(61,214,232,0.10);

  --bm-crit:        #e84c3d;
  --bm-crit-dim:    rgba(232,76,61,0.12);
  --bm-high:        #e8803d;
  --bm-high-dim:    rgba(232,128,61,0.12);
  --bm-med:         #e8c03d;
  --bm-med-dim:     rgba(232,192,61,0.10);
  --bm-low:         #3de88a;
  --bm-low-dim:     rgba(61,232,138,0.10);
  --bm-info:        #3d9de8;
  --bm-info-dim:    rgba(61,157,232,0.10);

  --bm-online:  var(--bm-low);
  --bm-warning: var(--bm-med);
  --bm-offline: var(--bm-crit);

  /* Role tokens — use in new components */
  --bm-color-bg-page:        var(--bm-bg);
  --bm-color-bg-panel:       var(--bm-surface);
  --bm-color-bg-panel-alt:   var(--bm-surface-2);
  --bm-color-bg-inset:       var(--bm-surface-3);
  --bm-color-text-primary:   var(--bm-text);
  --bm-color-text-secondary: var(--bm-text-muted);
  --bm-color-text-tertiary:  var(--bm-text-dim);
  --bm-color-border-default: var(--bm-border);
  --bm-color-border-strong:  var(--bm-border-hi);
  --bm-color-accent-primary: var(--bm-amber);
  --bm-color-accent-secondary: var(--bm-cyan);

  --bm-font-head: 'Rajdhani', sans-serif;
  --bm-font-mono: 'Share Tech Mono', monospace;
  --bm-font-body: 'DM Sans', sans-serif;

  --bm-s1: 4px;  --bm-s2: 8px;  --bm-s3: 12px; --bm-s4: 16px;
  --bm-s5: 24px; --bm-s6: 32px; --bm-s7: 48px; --bm-s8: 64px;

  --bm-r:  3px;
  --bm-r2: 6px;
  --bm-t:  150ms ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }

/* Honour the [hidden] attribute — prevent display:flex overrides */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bm-bg);
  color: var(--bm-text);
  font-family: var(--bm-font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: 0.018;
  pointer-events: none;
  z-index: 0;
}

/* Skip link — first focusable element */
.bm-skip {
  position: absolute;
  left: -9999px;
  top: var(--bm-s2);
  z-index: 200;
  padding: var(--bm-s2) var(--bm-s4);
  background: var(--bm-amber);
  color: var(--bm-bg);
  font-family: var(--bm-font-mono);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--bm-r);
  text-decoration: none;
}
.bm-skip:focus { left: var(--bm-s4); }

/* Focus ring — keyboard only */
:focus-visible {
  outline: 2px solid var(--bm-border-focus);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1,h2,h3,h4,h5,h6 {
  font-family: var(--bm-font-head);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--bm-text);
}

h1 { font-size: clamp(28px,4vw,40px); font-weight: 700; }
h2 { font-size: clamp(22px,3vw,30px); }
h3 { font-size: clamp(18px,2.5vw,22px); }
h4 { font-size: 16px; }
h5 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bm-text-muted); }
h6 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bm-text-dim); }

p       { color: var(--bm-text); line-height: 1.7; }
a       { color: var(--bm-amber); text-decoration: none; transition: opacity var(--bm-t); }
a:hover { opacity: 0.75; }

code, .mono { font-family: var(--bm-font-mono); font-size: 0.9em; }

small, .text-sm { font-size: 12px; }
.text-muted { color: var(--bm-text-muted); }
.text-dim   { color: var(--bm-text-dim); }
.text-amber { color: var(--bm-amber); }
.text-cyan  { color: var(--bm-cyan); }

.bm-eyebrow {
  font-family: var(--bm-font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bm-amber);
}

/* Prose — longform reading (blog posts, briefs, docs) */
.bm-prose {
  max-width: 700px;
  font-size: 16px;
  line-height: 1.8;
}
.bm-prose > * + *                    { margin-top: 1.25em; }
.bm-prose h2                         { font-size: 22px; margin-top: 2em; }
.bm-prose h3                         { font-size: 18px; margin-top: 1.5em; }
.bm-prose blockquote                 { border-left: 2px solid var(--bm-amber); padding-left: var(--bm-s4); color: var(--bm-text-muted); font-style: italic; }
.bm-prose code                       { background: var(--bm-surface-2); padding: 1px 5px; border-radius: var(--bm-r); font-size: 0.88em; }
.bm-prose ul, .bm-prose ol           { padding-left: var(--bm-s5); }
.bm-prose li                         { margin-bottom: 0.4em; }
.bm-prose img                        { max-width: 100%; height: auto; border-radius: var(--bm-r2); }
.bm-prose a                          { text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   LAYOUT
   ============================================================ */

.bm-container        { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--bm-s5); }
.bm-container--narrow { max-width: 900px; }
.bm-container--wide   { max-width: 1600px; }

/* ============================================================
   NAV
   ============================================================ */

.bm-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7,10,13,0.88);
  border-bottom: 1px solid var(--bm-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bm-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: var(--bm-s4);
}

.bm-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--bm-s3);
  text-decoration: none;
  color: var(--bm-text);
}

.bm-nav__brand-name {
  font-family: var(--bm-font-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bm-text);
}
.bm-nav__brand-name span { color: var(--bm-amber); }

.bm-nav__divider { width: 1px; height: 18px; background: var(--bm-border-hi); }

.bm-nav__tool {
  font-family: var(--bm-font-mono);
  font-size: 12px;
  color: var(--bm-text-muted);
  letter-spacing: 0.04em;
}

.bm-nav__links {
  display: flex;
  align-items: center;
  gap: var(--bm-s4);
  list-style: none;
}

.bm-nav__links a {
  font-family: var(--bm-font-mono);
  font-size: 12px;
  color: var(--bm-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color var(--bm-t);
}

.bm-nav__links a:hover,
.bm-nav__links a[aria-current="page"] { color: var(--bm-amber); opacity: 1; }

.bm-nav__status {
  display: flex;
  align-items: center;
  gap: var(--bm-s2);
  font-family: var(--bm-font-mono);
  font-size: 11px;
  color: var(--bm-text-muted);
}

/* Mobile toggle */
.bm-nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--bm-border-hi);
  border-radius: var(--bm-r);
  background: transparent;
  color: var(--bm-text-muted);
  cursor: pointer;
  transition: color var(--bm-t), border-color var(--bm-t);
}
.bm-nav__toggle:hover { color: var(--bm-amber); border-color: var(--bm-amber); }

.bm-nav__toggle-bar {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
  transition: background var(--bm-t);
}
.bm-nav__toggle-bar::before,
.bm-nav__toggle-bar::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--bm-t);
}
.bm-nav__toggle-bar::before { top: -5px; }
.bm-nav__toggle-bar::after  { top: 5px; }

/* Open state — X icon */
.bm-nav__toggle[aria-expanded="true"] .bm-nav__toggle-bar { background: transparent; }
.bm-nav__toggle[aria-expanded="true"] .bm-nav__toggle-bar::before { top: 0; transform: rotate(45deg); }
.bm-nav__toggle[aria-expanded="true"] .bm-nav__toggle-bar::after  { top: 0; transform: rotate(-45deg); }

/* ============================================================
   PAGE HEADER
   ============================================================ */

.bm-page-header {
  padding: var(--bm-s7) 0 var(--bm-s6);
  border-bottom: 1px solid var(--bm-border);
}
.bm-page-header h1 { margin-bottom: var(--bm-s2); }
.bm-page-header p  { color: var(--bm-text-muted); font-size: 14px; max-width: 600px; }

/* ============================================================
   CARDS
   ============================================================ */

.bm-card {
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  padding: var(--bm-s5);
  transition: border-color var(--bm-t);
}
.bm-card:hover    { border-color: var(--bm-border-hi); }
.bm-card--flush   { padding: 0; overflow: hidden; }
.bm-card--accent  { border-left: 2px solid var(--bm-amber); }
.bm-card--compact { padding: var(--bm-s3); }

.bm-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--bm-s3) var(--bm-s5);
  border-bottom: 1px solid var(--bm-border);
}
.bm-card--compact .bm-card__header { padding: var(--bm-s2) var(--bm-s3); }

.bm-card__title {
  font-family: var(--bm-font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bm-text-muted);
}

.bm-card__body { padding: var(--bm-s5); }
.bm-card--compact .bm-card__body { padding: var(--bm-s3); }

/* ============================================================
   STATS
   ============================================================ */

.bm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--bm-border);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  overflow: hidden;
}

.bm-stat { background: var(--bm-surface); padding: var(--bm-s4) var(--bm-s5); }

.bm-stat__label {
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bm-text-dim);
  margin-bottom: var(--bm-s1);
}

.bm-stat__value {
  font-family: var(--bm-font-head);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--bm-text);
}

.bm-stat__value--crit  { color: var(--bm-crit); }
.bm-stat__value--high  { color: var(--bm-high); }
.bm-stat__value--med   { color: var(--bm-med); }
.bm-stat__value--low   { color: var(--bm-low); }
.bm-stat__value--amber { color: var(--bm-amber); }
.bm-stat__value--cyan  { color: var(--bm-cyan); }

.bm-stat__sub { font-size: 11px; color: var(--bm-text-dim); margin-top: var(--bm-s1); }

.bm-stats--compact .bm-stat        { padding: var(--bm-s2) var(--bm-s3); }
.bm-stats--compact .bm-stat__value { font-size: 22px; }

/* ============================================================
   TABLES
   ============================================================ */

.bm-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
}

.bm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bm-table thead { background: var(--bm-surface-2); }

.bm-table th {
  padding: var(--bm-s2) var(--bm-s4);
  text-align: left;
  font-family: var(--bm-font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--bm-text-dim);
  border-bottom: 1px solid var(--bm-border);
  white-space: nowrap;
}

.bm-table th[aria-sort]       { cursor: pointer; }
.bm-table th[aria-sort]:hover { color: var(--bm-text-muted); }

.bm-table td {
  padding: var(--bm-s3) var(--bm-s4);
  border-bottom: 1px solid var(--bm-border);
  vertical-align: middle;
  color: var(--bm-text);
}

.bm-table tr:last-child td    { border-bottom: none; }
.bm-table tbody tr             { background: var(--bm-surface); transition: background var(--bm-t); }
.bm-table tbody tr:hover       { background: var(--bm-surface-2); }
.bm-table .col-mono            { font-family: var(--bm-font-mono); font-size: 12px; }
.bm-table .col-muted           { color: var(--bm-text-muted); }

.bm-table--compact th { padding: var(--bm-s1) var(--bm-s3); font-size: 9px; }
.bm-table--compact td { padding: var(--bm-s2) var(--bm-s3); font-size: 12px; line-height: 1.3; }

/* ============================================================
   TAGS
   ============================================================ */

.bm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--bm-r);
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
  white-space: nowrap;
  line-height: 1.6;
}

.bm-tag--crit  { background: var(--bm-crit-dim); color: var(--bm-crit); border: 1px solid rgba(232,76,61,0.2); }
.bm-tag--high  { background: var(--bm-high-dim); color: var(--bm-high); border: 1px solid rgba(232,128,61,0.2); }
.bm-tag--med   { background: var(--bm-med-dim);  color: var(--bm-med);  border: 1px solid rgba(232,192,61,0.2); }
.bm-tag--low   { background: var(--bm-low-dim);  color: var(--bm-low);  border: 1px solid rgba(61,232,138,0.2); }
.bm-tag--info  { background: var(--bm-info-dim); color: var(--bm-info); border: 1px solid rgba(61,157,232,0.2); }
.bm-tag--amber { background: var(--bm-amber-dim);color: var(--bm-amber);border: 1px solid rgba(255,129,15,0.2); }
.bm-tag--cyan  { background: var(--bm-cyan-dim); color: var(--bm-cyan); border: 1px solid rgba(61,214,232,0.2); }
.bm-tag--ghost { background: transparent;        color: var(--bm-text-muted); border: 1px solid var(--bm-border-hi); }

/* Annotation modifier — smaller disclosure badges */
.bm-annotation            { font-size: 9px; letter-spacing: 0.08em; padding: 1px 6px; }
.bm-annotation--unverified { border-style: dashed; }
.bm-annotation--stale      { color: var(--bm-text-dim); border-color: var(--bm-border-hi); background: transparent; }
.bm-annotation--superseded { color: var(--bm-text-dim); border-color: var(--bm-border-hi); background: transparent; text-decoration: line-through; }

/* ============================================================
   PILLS / FILTERS
   ============================================================ */

.bm-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--bm-s2);
}

.bm-filter-label {
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--bm-text-dim);
  margin-right: var(--bm-s1);
}

.bm-pill {
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--bm-border-hi);
  background: transparent;
  color: var(--bm-text-muted);
  font-family: var(--bm-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--bm-t);
  white-space: nowrap;
}
.bm-pill:hover  { border-color: var(--bm-amber); color: var(--bm-amber); }
.bm-pill.active,
.bm-pill[aria-pressed="true"] { background: var(--bm-amber-dim); border-color: var(--bm-amber); color: var(--bm-amber); }

.bm-pill--crit.active, .bm-pill--crit[aria-pressed="true"] { background: var(--bm-crit-dim); border-color: var(--bm-crit); color: var(--bm-crit); }
.bm-pill--high.active, .bm-pill--high[aria-pressed="true"] { background: var(--bm-high-dim); border-color: var(--bm-high); color: var(--bm-high); }
.bm-pill--med.active,  .bm-pill--med[aria-pressed="true"]  { background: var(--bm-med-dim);  border-color: var(--bm-med);  color: var(--bm-med); }
.bm-pill--low.active,  .bm-pill--low[aria-pressed="true"]  { background: var(--bm-low-dim);  border-color: var(--bm-low);  color: var(--bm-low); }

/* ============================================================
   BUTTONS
   ============================================================ */

.bm-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--bm-s2);
  padding: 7px var(--bm-s4);
  border-radius: var(--bm-r);
  border: 1px solid transparent;
  font-family: var(--bm-font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--bm-t);
  white-space: nowrap;
  line-height: 1;
}

.bm-btn--primary       { background: var(--bm-amber); color: var(--bm-bg); border-color: var(--bm-amber); }
.bm-btn--primary:hover { background: var(--bm-amber-hi); border-color: var(--bm-amber-hi); opacity: 1; color: var(--bm-bg); }

.bm-btn--outline       { background: transparent; color: var(--bm-text-muted); border-color: var(--bm-border-hi); }
.bm-btn--outline:hover { border-color: var(--bm-amber); color: var(--bm-amber); opacity: 1; }

.bm-btn--ghost       { background: transparent; color: var(--bm-text-muted); border-color: transparent; padding-left: var(--bm-s2); padding-right: var(--bm-s2); }
.bm-btn--ghost:hover { color: var(--bm-text); opacity: 1; }

.bm-btn--sm { padding: 4px var(--bm-s3); font-size: 11px; }

.bm-btn--danger       { background: transparent; color: var(--bm-crit); border-color: rgba(232,76,61,0.3); }
.bm-btn--danger:hover { background: var(--bm-crit-dim); border-color: var(--bm-crit); opacity: 1; }

/* ============================================================
   INPUTS
   ============================================================ */

.bm-input-wrap { position: relative; display: flex; align-items: center; }

.bm-input {
  width: 100%;
  padding: 8px var(--bm-s4);
  background: var(--bm-surface);
  border: 1px solid var(--bm-border-hi);
  border-radius: var(--bm-r);
  color: var(--bm-text);
  font-family: var(--bm-font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--bm-t);
  -webkit-appearance: none;
}
.bm-input::placeholder { color: var(--bm-text-dim); }
.bm-input:focus        { border-color: var(--bm-border-focus); }
.bm-input--search      { padding-left: 36px; }

.bm-input-icon {
  position: absolute;
  left: 10px;
  color: var(--bm-text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
}

select.bm-input {
  cursor: pointer;
  padding-right: var(--bm-s6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23475669' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ============================================================
   TOOLBAR
   ============================================================ */

.bm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--bm-s3);
  padding: var(--bm-s3) 0;
  margin-bottom: var(--bm-s3);
}

.bm-toolbar__left,
.bm-toolbar__right {
  display: flex;
  align-items: center;
  gap: var(--bm-s2);
  flex-wrap: wrap;
}

.bm-toolbar--compact { padding: var(--bm-s2) 0; margin-bottom: var(--bm-s2); gap: var(--bm-s2); }

/* ============================================================
   FEED
   ============================================================ */

.bm-feed {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bm-border);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  overflow: hidden;
}

.bm-feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: var(--bm-s4);
  padding: var(--bm-s4) var(--bm-s5);
  background: var(--bm-surface);
  text-decoration: none;
  transition: background var(--bm-t);
}
.bm-feed-item:hover { background: var(--bm-surface-2); }

.bm-feed-item__source {
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bm-amber);
  white-space: nowrap;
  padding-top: 2px;
  min-width: 100px;
}
.bm-feed-item__title { font-size: 13px; color: var(--bm-text); line-height: 1.4; }
.bm-feed-item__meta  { font-family: var(--bm-font-mono); font-size: 11px; color: var(--bm-text-dim); white-space: nowrap; padding-top: 2px; }

.bm-feed--compact .bm-feed-item        { padding: var(--bm-s2) var(--bm-s4); gap: var(--bm-s3); }
.bm-feed--compact .bm-feed-item__title  { font-size: 12px; }

/* ============================================================
   SEARCH RESULTS
   ============================================================ */

.bm-search-results {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bm-border);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  overflow: hidden;
}

.bm-search-result {
  padding: var(--bm-s4) var(--bm-s5);
  background: var(--bm-surface);
  transition: background var(--bm-t);
}
.bm-search-result:hover { background: var(--bm-surface-2); }

.bm-search-result__header {
  display: flex;
  align-items: baseline;
  gap: var(--bm-s3);
  margin-bottom: var(--bm-s1);
}

.bm-search-result__title   { font-size: 14px; font-weight: 500; color: var(--bm-text); }
.bm-search-result__title a { color: var(--bm-amber); text-decoration: none; }

.bm-search-result__source {
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bm-text-dim);
  flex-shrink: 0;
}

.bm-search-result__excerpt {
  font-size: 13px;
  color: var(--bm-text-muted);
  line-height: 1.6;
  margin-bottom: var(--bm-s2);
}

.bm-search-result mark {
  background: var(--bm-amber-dim);
  color: var(--bm-amber);
  border-radius: 2px;
  padding: 0 2px;
}

.bm-search-result__footer {
  display: flex;
  align-items: center;
  gap: var(--bm-s3);
  font-family: var(--bm-font-mono);
  font-size: 10px;
  color: var(--bm-text-dim);
}

/* ============================================================
   STATUS
   ============================================================ */

.bm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bm-font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bm-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bm-status--online .bm-status__dot  { background: var(--bm-online);  box-shadow: 0 0 0 2px rgba(61,232,138,0.2); }
.bm-status--warning .bm-status__dot { background: var(--bm-warning); box-shadow: 0 0 0 2px rgba(232,192,61,0.2); }
.bm-status--offline .bm-status__dot { background: var(--bm-offline); box-shadow: 0 0 0 2px rgba(232,76,61,0.2); }

.bm-status--online  { color: var(--bm-online); }
.bm-status--warning { color: var(--bm-warning); }
.bm-status--offline { color: var(--bm-offline); }

@keyframes bm-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.4; transform: scale(0.75); }
}
.bm-status--live .bm-status__dot { animation: bm-pulse 2s ease-in-out infinite; }

/* ============================================================
   TERMINAL
   ============================================================ */

.bm-terminal {
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  padding: var(--bm-s4) var(--bm-s5);
  font-family: var(--bm-font-mono);
  font-size: 13px;
}
.bm-terminal__line   { display: flex; align-items: center; gap: var(--bm-s2); }
.bm-terminal__prompt { color: var(--bm-amber); user-select: none; flex-shrink: 0; }
.bm-terminal__cmd    { color: var(--bm-text); }
.bm-terminal__out    { color: var(--bm-text-muted); margin: 2px 0 var(--bm-s2); }

@keyframes bm-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.bm-terminal__cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--bm-amber);
  vertical-align: middle;
  animation: bm-blink 1.1s step-end infinite;
  opacity: 0.85;
}

/* ============================================================
   DIVIDERS
   ============================================================ */

.bm-divider {
  height: 1px;
  background: var(--bm-border);
  margin: var(--bm-s5) 0;
}

.bm-divider--label { display: flex; align-items: center; gap: var(--bm-s3); }
.bm-divider--label::before,
.bm-divider--label::after { content: ''; flex: 1; height: 1px; background: var(--bm-border); }
.bm-divider--label span {
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bm-text-dim);
  white-space: nowrap;
}

.bm-divider--hazard {
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--bm-amber) 0px, var(--bm-amber) 8px, transparent 8px, transparent 14px);
  opacity: 0.25;
  margin: var(--bm-s5) 0;
}

/* ============================================================
   MICRO-PRIMITIVES
   ============================================================ */

.bm-sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--bm-text-dim);
  flex-shrink: 0;
}

.bm-last-updated {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--bm-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--bm-text-dim);
}
.bm-last-updated__time { color: var(--bm-text-muted); }

/* ============================================================
   STATEFUL — skeleton, empty, notices
   ============================================================ */

@keyframes bm-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.bm-skeleton {
  background: linear-gradient(90deg, var(--bm-surface-2) 0%, var(--bm-surface-3) 40%, var(--bm-surface-2) 80%);
  background-size: 800px 100%;
  animation: bm-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--bm-r);
}
.bm-skeleton--line    { height: 12px; margin-bottom: var(--bm-s2); width: 100%; }
.bm-skeleton--line:last-child { width: 65%; }
.bm-skeleton--heading { height: 22px; width: 45%; margin-bottom: var(--bm-s3); }
.bm-skeleton--block   { height: 60px; width: 100%; margin-bottom: var(--bm-s3); }
.bm-skeleton--circle  { width: 36px; height: 36px; border-radius: 50%; }

.bm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--bm-s8) var(--bm-s5);
  text-align: center;
}
.bm-empty__icon   { color: var(--bm-text-dim); margin-bottom: var(--bm-s4); opacity: 0.4; }
.bm-empty__title  { font-family: var(--bm-font-head); font-size: 16px; font-weight: 600; color: var(--bm-text-muted); margin-bottom: var(--bm-s2); }
.bm-empty__desc   { font-size: 13px; color: var(--bm-text-dim); max-width: 360px; line-height: 1.6; }
.bm-empty__action { margin-top: var(--bm-s4); }

.bm-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--bm-s3);
  padding: var(--bm-s3) var(--bm-s4);
  border-radius: var(--bm-r2);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}
.bm-notice__icon  { flex-shrink: 0; margin-top: 1px; }
.bm-notice__body  { flex: 1; min-width: 0; }
.bm-notice__title { font-family: var(--bm-font-head); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; margin-bottom: 2px; }

.bm-notice--error   { background: var(--bm-crit-dim);  border-color: rgba(232,76,61,0.25);  color: var(--bm-crit); }
.bm-notice--warning { background: var(--bm-med-dim);   border-color: rgba(232,192,61,0.25); color: var(--bm-med); }
.bm-notice--success { background: var(--bm-low-dim);   border-color: rgba(61,232,138,0.25); color: var(--bm-low); }
.bm-notice--info    { background: var(--bm-info-dim);  border-color: rgba(61,157,232,0.25); color: var(--bm-info); }
.bm-notice--stale   { background: var(--bm-amber-dim); border-color: rgba(255,129,15,0.2);  color: var(--bm-amber); }

/* ============================================================
   DETAIL PAGE
   ============================================================ */

.bm-detail-hero {
  padding: var(--bm-s6) 0 var(--bm-s5);
  border-bottom: 1px solid var(--bm-border);
}
.bm-detail-hero__eyebrow { display: flex; align-items: center; gap: var(--bm-s2); margin-bottom: var(--bm-s2); }

.bm-detail-hero__title {
  font-family: var(--bm-font-head);
  font-size: clamp(24px,3.5vw,36px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--bm-text);
  margin-bottom: var(--bm-s3);
}

.bm-detail-hero__desc { color: var(--bm-text-muted); font-size: 14px; line-height: 1.7; max-width: 720px; }

.bm-detail-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--bm-s3);
  margin-top: var(--bm-s4);
  font-family: var(--bm-font-mono);
  font-size: 11px;
  color: var(--bm-text-dim);
}

.bm-detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--bm-s6);
  padding: var(--bm-s6) 0;
  align-items: start;
}

.bm-keyfacts {
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-r2);
  overflow: hidden;
}

.bm-keyfacts__header {
  padding: var(--bm-s3) var(--bm-s4);
  border-bottom: 1px solid var(--bm-border);
  font-family: var(--bm-font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bm-text-muted);
}

.bm-keyfacts__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--bm-s3) var(--bm-s4);
  border-bottom: 1px solid var(--bm-border);
  gap: var(--bm-s3);
}
.bm-keyfacts__row:last-child { border-bottom: none; }

.bm-keyfacts__label { font-family: var(--bm-font-mono); font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--bm-text-dim); flex-shrink: 0; }
.bm-keyfacts__value { font-family: var(--bm-font-mono); font-size: 12px; color: var(--bm-text); text-align: right; }

.bm-timeline { position: relative; padding-left: var(--bm-s5); }
.bm-timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1px; background: var(--bm-border-hi); }

.bm-timeline__item              { position: relative; padding-bottom: var(--bm-s4); }
.bm-timeline__item:last-child   { padding-bottom: 0; }

.bm-timeline__dot {
  position: absolute;
  left: calc(-1 * var(--bm-s5) + 2px);
  top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bm-border-hi);
  border: 1.5px solid var(--bm-bg);
}

.bm-timeline__item--active .bm-timeline__dot { background: var(--bm-amber); box-shadow: 0 0 0 3px var(--bm-amber-dim); }
.bm-timeline__date { font-family: var(--bm-font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--bm-text-dim); margin-bottom: 2px; }
.bm-timeline__text { font-size: 13px; color: var(--bm-text); line-height: 1.5; }

.bm-references { list-style: none; }
.bm-references__item { display: flex; align-items: baseline; gap: var(--bm-s3); padding: var(--bm-s2) 0; border-bottom: 1px solid var(--bm-border); font-size: 13px; }
.bm-references__item:last-child { border-bottom: none; }
.bm-references__source { font-family: var(--bm-font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bm-text-dim); flex-shrink: 0; min-width: 80px; }
.bm-references__link   { color: var(--bm-amber); word-break: break-all; }

.bm-related {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--bm-border); border: 1px solid var(--bm-border); border-radius: var(--bm-r2); overflow: hidden;
}
.bm-related__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--bm-s3);
  padding: var(--bm-s3) var(--bm-s4); background: var(--bm-surface); text-decoration: none; transition: background var(--bm-t);
}
.bm-related__item:hover { background: var(--bm-surface-2); }
.bm-related__id   { font-family: var(--bm-font-mono); font-size: 12px; color: var(--bm-amber); }
.bm-related__desc { flex: 1; font-size: 12px; color: var(--bm-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bm-affected { list-style: none; }
.bm-affected__item { display: grid; grid-template-columns: 1fr auto auto; gap: var(--bm-s3); align-items: center; padding: var(--bm-s2) 0; border-bottom: 1px solid var(--bm-border); font-size: 13px; }
.bm-affected__item:last-child { border-bottom: none; }
.bm-affected__product { color: var(--bm-text); }
.bm-affected__version { font-family: var(--bm-font-mono); font-size: 11px; color: var(--bm-text-dim); }

/* ============================================================
   CHART WRAPPERS
   ============================================================ */

.bm-chart {
  position: relative; padding: var(--bm-s4);
  background: var(--bm-surface); border: 1px solid var(--bm-border); border-radius: var(--bm-r2);
}
.bm-chart__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--bm-s4); }
.bm-chart__title  { font-family: var(--bm-font-head); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bm-text-muted); }
.bm-chart__canvas { width: 100%; min-height: 180px; position: relative; }

.bm-chart-legend       { display: flex; align-items: center; flex-wrap: wrap; gap: var(--bm-s4); font-family: var(--bm-font-mono); font-size: 10px; color: var(--bm-text-muted); }
.bm-chart-legend__item { display: inline-flex; align-items: center; gap: 5px; }
.bm-chart-legend__swatch { width: 10px; height: 3px; border-radius: 1px; flex-shrink: 0; }

.bm-chart-axis { font-family: var(--bm-font-mono); font-size: 9px; letter-spacing: 0.04em; color: var(--bm-text-dim); fill: var(--bm-text-dim); }

.bm-chart-callout       { font-family: var(--bm-font-head); font-size: 24px; font-weight: 700; line-height: 1; color: var(--bm-text); }
.bm-chart-callout__label { font-family: var(--bm-font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bm-text-dim); margin-top: var(--bm-s1); }

/* ============================================================
   PAGINATION
   ============================================================ */

.bm-pagination {
  display: flex;
  align-items: center;
  gap: var(--bm-s1);
  font-family: var(--bm-font-mono);
  font-size: 12px;
}

.bm-pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--bm-s2);
  border: 1px solid var(--bm-border-hi);
  border-radius: var(--bm-r);
  background: transparent;
  color: var(--bm-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--bm-t);
}
.bm-pagination__item:hover                 { border-color: var(--bm-amber); color: var(--bm-amber); }
.bm-pagination__item[aria-current="page"]  { background: var(--bm-amber-dim); border-color: var(--bm-amber); color: var(--bm-amber); }
.bm-pagination__item[disabled]             { opacity: 0.3; pointer-events: none; }
.bm-pagination__ellipsis                   { color: var(--bm-text-dim); padding: 0 var(--bm-s1); }

/* ============================================================
   BRANDING HOOKS
   ::before / ::after — don't stack with other pseudo-elements.
   ============================================================ */

.bm-accent-corner { position: relative; }
.bm-accent-corner::before {
  content: ''; position: absolute; top: -1px; left: -1px;
  width: 16px; height: 16px;
  border-top: 2px solid var(--bm-amber); border-left: 2px solid var(--bm-amber);
  border-top-left-radius: var(--bm-r2); pointer-events: none; opacity: 0.5;
}

.bm-signal-stripe { position: relative; }
.bm-signal-stripe::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--bm-amber) 0%, transparent 100%);
  opacity: 0.3; border-top-right-radius: var(--bm-r2);
}

/* ============================================================
   FOOTER
   ============================================================ */

.bm-footer {
  border-top: 1px solid var(--bm-border);
  padding: var(--bm-s5) 0;
  margin-top: var(--bm-s7);
}

.bm-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--bm-s3);
}

.bm-footer__copy { font-family: var(--bm-font-mono); font-size: 11px; color: var(--bm-text-dim); letter-spacing: 0.04em; }

.bm-footer__links { display: flex; gap: var(--bm-s4); list-style: none; }
.bm-footer__links a { font-family: var(--bm-font-mono); font-size: 11px; color: var(--bm-text-dim); text-decoration: none; transition: color var(--bm-t); }
.bm-footer__links a:hover { color: var(--bm-amber); opacity: 1; }

/* ============================================================
   UTILITIES
   ============================================================ */

.bm-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--bm-s4); }
.bm-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--bm-s4); }
.bm-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--bm-s4); }

.bm-mt-1 { margin-top: var(--bm-s1); } .bm-mt-2 { margin-top: var(--bm-s2); }
.bm-mt-3 { margin-top: var(--bm-s3); } .bm-mt-4 { margin-top: var(--bm-s4); }
.bm-mt-5 { margin-top: var(--bm-s5); } .bm-mt-6 { margin-top: var(--bm-s6); }

.bm-mb-2 { margin-bottom: var(--bm-s2); } .bm-mb-3 { margin-bottom: var(--bm-s3); }
.bm-mb-4 { margin-bottom: var(--bm-s4); } .bm-mb-5 { margin-bottom: var(--bm-s5); }

.bm-flex { display: flex; }
.bm-gap-2 { gap: var(--bm-s2); } .bm-gap-3 { gap: var(--bm-s3); } .bm-gap-4 { gap: var(--bm-s4); }
.bm-items-center    { align-items: center; }
.bm-justify-between { justify-content: space-between; }

/* JS-controlled visibility — more reliable than [hidden] for dynamic toggling */
.js-hidden { display: none !important; }

.bm-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 960px) {
  .bm-detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .bm-grid-2, .bm-grid-3, .bm-grid-4 { grid-template-columns: 1fr; }

  /* Mobile menu */
  .bm-nav__toggle { display: flex; }
  .bm-nav__links {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(7,10,13,0.96);
    border-bottom: 1px solid var(--bm-border-hi);
    padding: var(--bm-s3) var(--bm-s5);
    gap: var(--bm-s1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .bm-nav__links.is-open { display: flex; }
  .bm-nav__links a { padding: var(--bm-s2) 0; font-size: 13px; }

  .bm-feed-item { grid-template-columns: 1fr; }
  .bm-feed-item__source { min-width: auto; }
  .bm-chart__header { flex-direction: column; align-items: flex-start; gap: var(--bm-s2); }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body::before { display: none; }
}
