/* ── tokens ── */
:root {
  /* Dark UA controls (scrollbars, form controls) without per-element styling. */
  color-scheme: dark;

  --bg: #0c0811;
  --surface: #14132b;
  --card: #1a1c34;
  --border: #28263b;
  --hover: #232b4c;
  --hover-border: #475070;
  --chip-hover-bg: #1a1d3b;

  --text: #ffffff;
  --text-70: rgba(255, 255, 255, 0.702);
  /* 0.50: 0.45 measured 4.03:1 and failed AA. */
  --text-45: rgba(255, 255, 255, 0.50);

  --mint: #23ecbb;
  --orange: #ff8906;
  --sky: #7cc4ff;
  --sky-65: rgba(124, 196, 255, 0.65);
  /* MITRE blue split: #1473f3 was 3.14:1 as text; --blue-text for text, --blue-fill behind white. */
  --blue-text: #5ea8ff;
  --blue-fill: #0f5fd0;
  --blue-hover: #24549b;
  --blue-active: #0b4bae;
  --deep: #14132b;

  --accent: #c9cbe6;

  --technique: var(--mint);
  --theme: var(--orange);
  --cta: var(--sky);

  --ramp-1: #6f5f9c;
  --ramp-2: #8d7cc0;
  --ramp-3: #b3a3dd;
  --ramp-4: #e6dbff;
  --bar-track: #141228;

  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Measured header height, re-declared per breakpoint as the no-JS fallback; site.js writes the exact value. */
  --header-h: 66px;

  --t-fast: 120ms;
  --t-slow: 180ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  /* Reserved height of the stat row, written by site.js; condensing never changes document length. */
  --stats-h: auto;
}

/* ── fonts ── */
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── base ── */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

input { font-family: inherit; }
input::placeholder { color: var(--text-45); }
::selection { background: var(--accent); color: var(--deep); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }

h1, h2, h3 { text-wrap: balance; }

.skip-link {
  position: absolute; top: 8px; left: -9999px; z-index: 60;
  padding: 10px 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--accent);
  color: var(--text); font-size: 13px; line-height: 18px;
}
.skip-link:focus { left: 8px; }

/* ── header ── */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(12, 8, 17, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--border);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--bg); }
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: auto; height: 28px; flex: 0 0 auto; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.brand-sub {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-45);
  border-left: 1px solid var(--border); padding-left: 10px;
}
.header-spacer { flex: 1; min-width: 12px; }

.site-nav { display: flex; align-items: center; gap: 8px 16px; font-size: 13px; line-height: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--text-70); }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }

.header-tools { display: flex; align-items: center; gap: 10px; }
.search-box { position: relative; display: flex; }
/* 240 px: a 188 px field clipped the placeholder to "Search the framewo". */
.search-input {
  width: 240px; padding: 8px 34px 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; line-height: 18px;
}
.search-key {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  min-width: 18px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text-45); font-family: var(--mono); font-size: 11px; line-height: 16px;
  text-align: center; pointer-events: none;
}
/* :placeholder-shown is the empty test. */
.search-input:focus ~ .search-key,
.search-input:not(:placeholder-shown) ~ .search-key { display: none; }
.search-input:focus { border-color: var(--hover-border); }
/* outline: none on the input beats the global :focus-visible, so the ring is restored here. */
.search-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* No filter: invert() on the cancel button: color-scheme already draws it light. */

.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 420px; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); z-index: 40;
  opacity: 1; transform: translateY(0);
  transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
}
@starting-style {
  .search-results:not([hidden]) { opacity: 0; transform: translateY(-4px); }
}
.search-results[hidden] { display: none; }
.sidebar-list, .search-results { scrollbar-width: thin; scrollbar-color: var(--hover-border) transparent; }
.search-result {
  display: flex; gap: 12px; align-items: baseline; padding: 9px 12px;
  border-radius: 8px; color: var(--text);
}
.search-result:hover, .search-result:focus-visible, .search-result.is-active {
  background: var(--hover); color: var(--text);
}
.search-group {
  display: block; padding: 10px 12px 4px;
  font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-45);
}
.search-group:first-child { padding-top: 4px; }
.sr-id { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 64px; }
.sr-name { flex: 1; font-size: 13px; line-height: 18px; }
.sr-layer { font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-45); }
.search-empty { padding: 10px 12px; font-size: 13px; line-height: 19px; color: var(--text-70); }
.search-result mark {
  background: rgba(201, 203, 230, 0.16); color: inherit;
  border-radius: 2px; padding: 0 1px; margin: 0 -1px;
}
.search-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 6px; padding: 8px 12px 4px; border-top: 1px solid var(--border);
  font-size: 11px; line-height: 16px; color: var(--text-45);
}
@media (hover: none), (max-width: 620px) {
  .search-keys { display: none; }
}

/* ── page wrappers ── */
.wrap { margin: 0 auto; }
.wrap-home { max-width: 1240px; padding: 64px 28px 96px; }
.wrap-entry { max-width: 1240px; padding: 36px 28px 96px; }
.wrap-nav { max-width: 1240px; padding: 48px 28px 96px; }
.wrap-cell { max-width: 1000px; padding: 36px 28px 96px; }
.wrap-doc { max-width: 820px; padding: 56px 28px 96px; }

.kicker {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}

/* ── view options ── */
.view-line { display: flex; align-items: center; gap: 16px 24px; }
.view-line > :first-child { flex: 1; min-width: 0; }
.view-line .kicker { margin-bottom: 0; }
.view-line-kicker { margin-bottom: 16px; }

/* overflow: the group's radius is the only rounding, so a button's fill reaches its own edges. */
.view-options {
  flex: 0 0 auto; display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.view-toggle {
  display: grid; place-items: center;
  padding: 3px 10px; border: 0; background: transparent;
  color: var(--text-45); font-family: inherit; font-size: 11px; line-height: 16px;
  font-weight: 500; letter-spacing: 0.3px; white-space: nowrap; cursor: pointer;
}
.view-toggle + .view-toggle { border-left: 1px solid var(--border); }

.view-toggle:hover,
.view-switch-btn:hover { background: var(--hover); color: var(--text); }
/* Drawn inside the button: the clipping group cuts an outset ring, and the global focus radius notches a filled cell. */
.view-toggle:focus-visible,
.view-switch-btn:focus-visible { border-radius: 0; outline-offset: -2px; }
/* --hover-border: --surface measured 1.09:1 against --bg, invisible; no border, or the pill would widen when on. */
.ids-hidden #ids-toggle,
.subs-shown #subs-toggle { background: var(--hover-border); color: var(--text); }

/* Both labels ship in the markup so a stored preference never flashes the wrong word, and they share one
   cell and swap by visibility so the wider one sizes the button whichever is showing. */
.ids-label, .subs-label { grid-area: 1 / 1; }
.ids-label-show, .subs-label-hide { visibility: hidden; }
.ids-hidden .ids-label-show, .subs-shown .subs-label-hide { visibility: visible; }
.ids-hidden .ids-label-hide, .subs-shown .subs-label-show { visibility: hidden; }

/* ── home: hero + stats ── */
.hero { max-width: 760px; }
.hero-title { margin: 0 0 20px; font-size: 48px; line-height: 52px; font-weight: 700; letter-spacing: 0.3px; }
.hero-lead { margin: 0 0 12px; font-size: 17px; line-height: 26px; color: var(--text-70); text-wrap: pretty; }
.hero-sub { margin: 0; font-size: 14px; line-height: 22px; color: var(--text-45); }

.stats-sentinel { height: 1px; margin-top: 35px; }
.stats {
  position: sticky; top: var(--header-h); z-index: 20;
  height: var(--stats-h);
  /* Reserved slot: keeps the expanded height while only .stats-inner condenses. Only the painted strip takes the pointer. */
  pointer-events: none;
}
.stats-inner {
  pointer-events: auto;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch;
  background: var(--bg);
  padding: 0; border-bottom: 1px solid transparent;
  transition: padding var(--t-slow) ease, border-color var(--t-slow) ease;
}
/* The basis pays the box's border forward (24 px of gaps + 3 × 2 px) or the four boxes do not come out equal. */
.stat-cards {
  flex: 3 1 calc(24px + 3 * 2px);
  min-width: 0; display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch;
}

/* ── the controls box ── */
.stats-inner > .stat-controls {
  flex: 1 1 0;
  /* 280 px: the narrowest box that holds "Show sub-entries" in a 2 × 2 grid; it also decides where the row wraps. */
  min-width: 280px;
  padding: 0; overflow: hidden;
}
.stats:not(.is-condensed) .stat-controls {
  display: grid; grid-template-rows: 1fr 1fr;
}
/* Equal columns in both row states: the wider button sets both. */
.stats-inner .view-switch,
.stats-inner .view-options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.stats:not(.is-condensed) .stat-controls > .view-switch,
.stats:not(.is-condensed) .stat-controls > .view-options {
  align-self: stretch; border: 0; border-radius: 0; background: none;
}
/* Shadow, not a border: a border sits inside the row and leaves the two rows a pixel apart. */
.stats:not(.is-condensed) .stat-controls > .view-options { box-shadow: 0 -1px 0 var(--border); }
.stats:not(.is-condensed) .stat-controls .view-switch-btn,
.stats:not(.is-condensed) .stat-controls .view-toggle {
  justify-content: center;
  /* 32 px: at the phone width the row is only as tall as this, and the indicator must fit under the label. */
  min-height: 32px; padding: 2px 6px;
  text-align: center; white-space: normal;
}

.stats-inner .view-toggle { padding: 7px 12px; }
.stats.is-condensed .view-options { border-radius: 999px; }

/* ── the Cards / Matrix switch ── */
.view-switch {
  flex: 0 0 auto; align-self: center;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); overflow: hidden;
}
.view-switch-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 0; background: transparent;
  color: var(--text-45); font-family: inherit; font-size: 11px; line-height: 16px;
  font-weight: 500; letter-spacing: 0.3px; white-space: nowrap; cursor: pointer;
}
.view-switch-icon { flex: 0 0 auto; }
.view-switch-text { position: relative; }
.view-switch-btn[aria-checked="true"] { color: var(--text); }
.view-switch-btn[aria-checked="true"] .view-switch-icon { color: var(--accent); }
/* Anchored to the label, not the cell: the capsule's curved end would clip a full-width bar. */
.view-switch-btn[aria-checked="true"] .view-switch-text::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 5px);
  height: 2px; border-radius: 1px; background: var(--accent);
}
/* Closer wherever the cell is only as tall as its label: 5 px would put the bar on the line below. */
.stats.is-condensed .view-switch-btn[aria-checked="true"] .view-switch-text::after { top: calc(100% + 2px); }
.stat {
  flex: 1; min-width: 180px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px;
  transition: padding var(--t-slow) ease, border-color var(--t-slow) ease, background-color var(--t-slow) ease;
}
.stat-value { display: block; font-size: 32px; line-height: 34px; font-weight: 700; transition: font-size var(--t-slow) ease; }
.stat-technique { color: var(--technique); }
.stat-theme { color: var(--theme); }
.stat-cta { color: var(--cta); }
.stat-label { display: block; margin-top: 6px; font-size: 12px; line-height: 17px; color: var(--text-70); }
.stat-short { display: none; font-size: 12px; line-height: 18px; color: var(--text-70); }
.stat-jump:hover { border-color: var(--hover-border); background: var(--hover); }
.stat-jump:hover .stat-label, .stat-jump:hover .stat-short { color: var(--text); }
.stat-jump.is-current { background: var(--hover); }
.stat-jump-technique.is-current { border-color: var(--technique); }
.stat-jump-theme.is-current { border-color: var(--theme); }
.stat-jump-cta.is-current { border-color: var(--cta); }

/* padding-block, not padding: the matrix view sets padding-inline on the same element. */
.stats.is-condensed .stats-inner {
  padding-block: 8px; border-bottom-color: var(--border);
  background: rgba(12, 8, 17, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
}
/* Repeated rather than merged with the header's fallback: same specificity, later glass rule would win on source order. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .stats.is-condensed .stats-inner { background: var(--bg); }
}
.stats.is-condensed .stat {
  flex: 0 1 auto; min-width: 0;
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
}
.stats.is-condensed .stat-value { font-size: 15px; line-height: 20px; }
.stats.is-condensed .stat-short { display: inline; white-space: nowrap; }
.stats.is-condensed .stat-label { display: none; }
.stats.is-condensed .stat-controls {
  flex: 0 0 auto; min-width: 0; align-self: center;
  display: flex; align-items: center; gap: 12px;
  padding: 0; border: 0; border-radius: 0; background: none;
}

/* Transitions off while site.js measures both states; a transition mid-flight reports the old value. */
.stats.is-measuring .stats-inner,
.stats.is-measuring .stat,
.stats.is-measuring .stat-value { transition: none; }

.back-to-top { margin: 40px 0 0; font-size: 12px; line-height: 18px; }
.back-to-top a { color: var(--text-70); }
.back-to-top a:hover { color: var(--text); }

/* ── home: layer sections ── */
.layer-section { margin-top: 72px; border-top: 1px solid var(--border); padding-top: 32px; scroll-margin-top: 56px; }

.stats + .layer-section { margin-top: 40px; }
.layer-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.layer-code { font-family: var(--mono); font-size: 12px; }
.layer-code-technique { color: var(--technique); }
.layer-code-theme { color: var(--theme); }
.layer-code-cta { color: var(--cta); }
.layer-title { margin: 0; font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: 0.3px; }
.layer-tagline { font-size: 13px; line-height: 18px; color: var(--text-45); }

.cat-group { margin-top: 28px; }
.cat-name {
  margin: 0; font-weight: 500;
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-70);
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px; margin-top: 16px;
  align-items: stretch;
}
.subs-shown .card-grid { align-items: start; }
.card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 10px; padding: 16px; color: var(--text);
}
.card-main { display: flex; flex-direction: column; gap: 8px; color: var(--text); }
/* The ::after overlay makes the whole card the link; sub-entry links sit above it. */
.card-main::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card-sublist { position: relative; z-index: 1; display: none; }

.card-main:focus-visible { outline: none; }
.card:has(> .card-main:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:hover .card-main { color: var(--text); }
.card:hover { background: var(--hover); border-color: var(--hover-border); color: var(--text); }
.card-technique { border-left-color: var(--technique); }
.card-technique:hover { border-left-color: var(--technique); }
.card-theme { border-left-color: var(--theme); }
.card-theme:hover { border-left-color: var(--theme); }
.card-cta { border-left-color: var(--cta); }
.card-cta:hover { border-left-color: var(--cta); }
/* Reserved heights (badge row, two name lines, three description lines) so content cannot change a card's shape. */
.card-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  min-height: 18px;
}
.card-id { font-family: var(--mono); font-size: 11px; line-height: 16px; letter-spacing: 0.4px; }
.card-technique .card-id { color: var(--technique); }
.card-theme .card-id { color: var(--theme); }
.card-cta .card-id { color: var(--cta); }
.card-subs {
  font-size: 10px; line-height: 14px; letter-spacing: 0.4px; color: var(--text-45);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.card-name { font-weight: 600; font-size: 14px; line-height: 19px; min-height: 38px; }
.card-desc {
  font-size: 12px; line-height: 17px; color: var(--text-45); min-height: 51px;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

.ids-hidden .card-id,
.ids-hidden .card-sub-id,
.ids-hidden .entry-id,
.ids-hidden .sub-id,
.ids-hidden .chip-id,
.ids-hidden .sib-id,
.ids-hidden .atk-cell-id,
.ids-hidden .mx-cell-id,
.ids-hidden .mx-sub-id,
.ids-hidden .sr-id { display: none; }
/* The top row is empty once the ID goes, so the sub-entry chip rides the name's first line instead. */
.ids-hidden .card-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 0; }
.ids-hidden .card-top {
  grid-area: 1 / 2; align-self: start; justify-content: flex-end; align-items: center; height: 19px;
}
.ids-hidden .card-name { grid-area: 1 / 1; }
.ids-hidden .card-desc { grid-column: 1 / -1; }
.ids-hidden .card-subs { margin-left: 8px; }
.ids-hidden .sub-desc { padding-left: 0; }
.ids-hidden .copy-id-wrap { display: none; }

.subs-shown .card-sublist {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 0; padding: 10px 0 0; list-style: none;
  border-top: 1px solid var(--border);
  opacity: 1; transition: opacity 160ms var(--ease-out);
}
@starting-style {
  .subs-shown .card-sublist { opacity: 0; }
}
.card-sub {
  display: flex; gap: 8px; align-items: baseline;
  padding: 4px 6px; border-radius: 5px; color: var(--text-70);
  font-size: 11px; line-height: 16px;
}
.card-sub:hover { background: var(--chip-hover-bg); color: var(--text); }
.card-sub-id { font-family: var(--mono); font-size: 10px; color: var(--text-45); flex: 0 0 auto; }
.card-technique .card-sub-id { color: var(--technique); }
.card-theme .card-sub-id { color: var(--theme); }
.card-cta .card-sub-id { color: var(--sky-65); }
.card-sub-name { flex: 1; min-width: 0; }

.catch-all { margin: 20px 0 0; font-size: 12px; line-height: 18px; color: var(--text-45); }
/* The link text is the ID and carries no *-id class, or "Hide IDs" would blank the sentence. */
.catch-all a { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.catch-all a:hover { color: var(--text); }

/* ── home: the Matrix view ── */
/* Both layouts are in the HTML; these two rules are the whole switch. */
.view-matrix .card-grid,
.view-matrix .cat-group { display: none; }
html:not(.view-matrix) .mx-band { display: none; }

/* Full-bleed only from 1368 px, where the bands gain 64 px a side over the 1240 px column; below that one left edge. */
@media (min-width: 1368px) {
  .view-matrix .wrap-home { max-width: none; }
  .view-matrix .kicker { max-width: 1184px; }
  .view-matrix .kicker,
  .view-matrix .hero { margin-left: max(0px, calc((100% - 1184px) / 2)); }
  /* Padding rather than max-width so --stats-h measures the same box in both views. */
  .view-matrix .stats-inner { padding-inline: max(0px, calc((100% - 1184px) / 2)); }
  .view-matrix .layer-section,
  .view-matrix .back-to-top { max-width: 1800px; margin-left: auto; margin-right: auto; }
}

/* ── the band model, shared by both views ── */
/* grid-auto-flow: column: the column count is whatever the band contains; data-cols is for check.mjs. */
.mx-band, .atk-band {
  display: grid;
  grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  column-gap: 10px; row-gap: 28px; align-items: start;
  max-width: 1800px; margin: 28px auto 0;
}
.mx-col, .atk-col { min-width: 0; }

/* Heads park under the header plus, on the home page, the condensed stat row (site.js writes --stats-condensed-h; 48 px is the no-JS fallback). */
.mx-col-head, .atk-col-head {
  position: sticky; z-index: 2;
  margin: 0; padding: 2px 2px 8px;
  background: rgba(12, 8, 17, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--border);
}
/* Repeated rather than merged with the header's fallback: same specificity, later glass rule would win on source order. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mx-col-head, .atk-col-head { background: var(--bg); }
}
.mx-col-head { top: calc(var(--header-h) + var(--stats-condensed-h, 48px)); }
.atk-col-head { top: var(--header-h); }
/* Two name lines always reserved so every column's first cell starts level. */
.mx-col-name, .atk-col-name {
  display: block; min-height: 36px; overflow-wrap: anywhere;
  font-size: 13px; line-height: 18px; font-weight: 600;
}
.mx-col-count, .atk-col-label {
  display: block; margin-top: 3px;
  font-size: 11px; line-height: 16px; font-weight: 500; color: var(--text-45);
}
.mx-cells, .atk-cells {
  display: flex; flex-direction: column; gap: 6px;
  margin: 10px 0 0; padding: 0; list-style: none;
}
.mx-cells > li { container: mx-cell / inline-size; }

.mx-cell {
  display: block; position: relative; background: var(--card);
  border: 1px solid var(--border); border-left: 2px solid var(--border);
  border-radius: 6px; padding: 6px 9px; color: var(--text);
}
.mx-cell:hover { background: var(--hover); border-color: var(--accent); color: var(--text); }
.mx-cell-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mx-cell-id { font-family: var(--mono); font-size: 10px; line-height: 14px; letter-spacing: 0.4px; }
/* margin-left: auto, not just space-between: with IDs hidden the count is alone in the row. */
.mx-cell-count { margin-left: auto; font-size: 10px; line-height: 14px; color: var(--text-45); }
.mx-cell-name {
  display: block; margin-top: 2px; overflow-wrap: anywhere;
  font-size: 12px; line-height: 16px; font-weight: 500;
}

.mx-band-technique .mx-cell, .mx-band-technique .mx-cell:hover { border-left-color: var(--technique); }
.mx-band-theme .mx-cell, .mx-band-theme .mx-cell:hover { border-left-color: var(--theme); }
.mx-band-cta .mx-cell, .mx-band-cta .mx-cell:hover { border-left-color: var(--cta); }
.mx-band-technique .mx-cell-id { color: var(--technique); }
.mx-band-theme .mx-cell-id { color: var(--theme); }
.mx-band-cta .mx-cell-id { color: var(--cta); }

.mx-band-row .mx-cells {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 6px 10px;
}
.mx-band-row .mx-col-head {
  padding: 0; border: 0; background: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}

.mx-subs { display: none; }
.subs-shown .mx-subs {
  display: flex; flex-direction: column; gap: 2px;
  margin: 4px 0 0 10px; padding: 0 0 0 8px; list-style: none;
  border-left: 1px solid var(--border);
  opacity: 1; transition: opacity 160ms var(--ease-out);
}
@starting-style {
  .subs-shown .mx-subs { opacity: 0; }
}
.subs-shown .mx-band-technique .mx-subs { border-left-color: color-mix(in srgb, var(--technique) 60%, transparent); }
.subs-shown .mx-band-theme .mx-subs { border-left-color: color-mix(in srgb, var(--theme) 60%, transparent); }
.subs-shown .mx-band-cta .mx-subs { border-left-color: color-mix(in srgb, var(--cta) 60%, transparent); }
.mx-sub {
  display: flex; gap: 8px; align-items: baseline;
  padding: 6px; border-radius: 4px; color: var(--text-70);
  font-size: 11px; line-height: 16px;
}
.mx-sub:hover { background: var(--chip-hover-bg); color: var(--text); }
.mx-sub-id { font-family: var(--mono); font-size: 10px; color: var(--text-45); flex: 0 0 auto; }
.mx-band-technique .mx-sub-id { color: var(--technique); }
.mx-band-theme .mx-sub-id { color: var(--theme); }
.mx-band-cta .mx-sub-id { color: var(--sky-65); }
.mx-sub-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* Container query, not media query: the three bands wrap at different viewport widths. */
@container mx-cell (max-width: 180px) {
  .mx-sub { display: block; }
  .mx-sub-id { display: block; }
}

/* Same trade as the cards: the count moves beside the name so a counted cell matches a plain one. */
.ids-hidden .mx-cell { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.ids-hidden .mx-cell-top {
  grid-area: 1 / 2; align-self: start; align-items: center; height: 16px; margin-top: 2px;
}
.ids-hidden .mx-cell-name { grid-area: 1 / 1; }
/* padding, not a gap: a column gap would also indent the cells that have no count. */
.ids-hidden .mx-cell-count { padding-left: 8px; }

/* ── entry page ── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; line-height: 17px; color: var(--text-45);
}
.breadcrumb a { color: var(--text-45); }
.breadcrumb a:hover { color: var(--text); }

.entry-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 40px;
  margin-top: 24px; align-items: start;
}
.entry-body { min-width: 0; }

.entry-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cell-meta { margin-top: 24px; }
.badge {
  font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--deep);
  border-radius: 4px; padding: 3px 8px; font-weight: 600;
}
.badge-technique { background: var(--technique); }
.badge-theme { background: var(--theme); }
.badge-cta { background: var(--cta); }
.badge-mitre { background: var(--blue-fill); color: var(--text); }

.entry-id { font-family: var(--mono); font-size: 13px; color: var(--text-70); }
.entry-cat { font-size: 12px; color: var(--text-45); }

/* ── copy the ID ── */
.copy-id {
  all: unset;
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 2px 6px; margin: -2px -6px; border-radius: 4px; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out);
}
.copy-id:hover, .copy-id:focus-visible { background: var(--card); }
.copy-id:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Reserves the wider label so the text beside it never shifts. */
.copy-hint {
  display: inline-block; min-width: 7ch;
  font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-45);
  opacity: 0; transition: opacity var(--t-fast) var(--ease-out);
}
.copy-id:hover .copy-hint,
.copy-id:focus-visible .copy-hint,
.copy-id.is-copied .copy-hint { opacity: 1; }
.copy-hint-done { display: none; color: var(--accent); }
.copy-id.is-copied .copy-hint-idle { display: none; }
.copy-id.is-copied .copy-hint-done { display: inline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.doc-end { height: 1px; }
.entry-title { margin: 14px 0 0; font-size: 38px; line-height: 44px; font-weight: 700; letter-spacing: 0.3px; }
.entry-desc { margin: 20px 0 0; font-size: 16px; line-height: 26px; color: var(--text-70); max-width: 70ch; text-wrap: pretty; }
.entry-note { margin: 14px 0 0; font-size: 13px; line-height: 21px; color: var(--text-45); max-width: 72ch; }

.panel {
  margin-top: 32px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px;
}
.panel-label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-45); }
.map-row { margin-top: 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.map-key { font-size: 12px; line-height: 18px; color: var(--text); min-width: 112px; font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.map-note { margin-top: 14px; font-size: 11px; line-height: 16px; color: var(--text-45); }
.map-note-lead { margin: 12px 0 0; font-size: 13px; line-height: 21px; color: var(--text-70); max-width: 72ch; }

.chip-ext {
  display: inline-flex; align-items: baseline; gap: 8px; background: var(--hover);
  border: 1px solid var(--border); border-radius: 4px; padding: 5px 10px;
  color: var(--text); font-size: 12px; line-height: 17px;
}
.chip-ext:hover { background: var(--chip-hover-bg); color: var(--text); }
.chip-ext-mitre:hover { border-color: var(--blue-text); }
.chip-ext-mitre .chip-id { color: var(--blue-text); }
.chip-id { font-family: var(--mono); }

.section-h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 700; }

.sub-list { margin-top: 40px; }
.sub-list .section-h2 { margin-bottom: 4px; }
.sub-items { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.sub-item {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; color: var(--text);
}
.sub-item:hover { background: var(--hover); border-color: var(--hover-border); color: var(--text); }
.sub-item-head { display: flex; align-items: baseline; gap: 12px; }
.sub-id { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 72px; }
.sub-name { font-weight: 600; font-size: 14px; line-height: 19px; }
.sub-desc {
  margin-top: 6px; padding-left: 84px; max-width: 72ch;
  font-size: 12px; line-height: 18px; color: var(--text-45);
}

.connected { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 28px; }
.rel-group { margin-top: 18px; }
.rel-label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; }
.rel-label-technique { color: var(--technique); }
.rel-label-theme { color: var(--theme); }
.rel-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px;
  color: var(--text); font-size: 12px; line-height: 17px;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip-technique:hover { border-color: var(--technique); }
.chip-theme:hover { border-color: var(--theme); }
.chip-technique .chip-id { color: var(--technique); }
.chip-theme .chip-id { color: var(--theme); }

/* ── related reading ── */
.related-reading { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 28px; }
.rr-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rr-item {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; color: var(--text);
}
.rr-item:hover { background: var(--hover); border-color: var(--hover-border); color: var(--text); }
.rr-title { font-size: 13px; line-height: 19px; max-width: 72ch; }
.rr-source {
  flex: 0 0 auto; font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-45); white-space: nowrap;
}
.rr-why { flex-basis: 100%; font-size: 12px; line-height: 17px; color: var(--text-45); max-width: 72ch; }

.sidebar { position: sticky; top: calc(var(--header-h) + 16px); }
.sidebar-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px;
}
.sidebar-label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-45); }
.sidebar-list {
  display: flex; flex-direction: column; margin-top: 12px; max-height: 60vh; overflow: auto;
  overscroll-behavior: contain;
}
.sib {
  position: relative; display: flex; gap: 8px; align-items: baseline;
  padding: 7px 8px 7px 12px; border-radius: 6px; font-size: 12px; line-height: 17px; color: var(--text-70);
}
.sib:hover { background: var(--hover); color: var(--text); }
.sib-active { background: var(--hover); color: var(--text); font-weight: 600; }
.sib-mark { position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--accent); border-radius: 2px; }
.sib-id { font-family: var(--mono); font-size: 10px; color: var(--text-45); min-width: 58px; }
.sib-name { flex: 1; }

/* ── ATT&CK view ── */
.nav-head { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-end; }
.nav-head-main { flex: 1; min-width: 420px; }
.page-title { margin: 14px 0 0; font-size: 38px; line-height: 44px; font-weight: 700; letter-spacing: 0.3px; }
.nav-lead { margin: 16px 0 0; font-size: 15px; line-height: 25px; color: var(--text-70); max-width: 74ch; text-wrap: pretty; }
.nav-hint { margin: 0; font-size: 12px; line-height: 18px; color: var(--text-45); max-width: 34ch; }
.nav-version { margin: 14px 0 0; font-size: 12px; line-height: 19px; color: var(--text-45); max-width: 82ch; }
.nav-version-tag {
  font-family: var(--mono); font-size: 11px; color: var(--text-70);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; margin-right: 6px;
  white-space: nowrap;
}
.nav-actions {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  flex: 0 0 320px; width: 320px; max-width: 100%;
}

.btn-primary {
  display: inline-flex; padding: 11px 18px; border-radius: 6px; border: none;
  background: var(--blue-fill); color: var(--text); font-family: inherit; font-size: 14px;
  font-weight: 500; letter-spacing: 0.3px; cursor: pointer;
}
.btn-primary:hover { background: var(--blue-hover); color: var(--text); }
.btn-outline {
  display: inline-flex; margin-top: 16px; padding: 9px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text);
}
.btn-outline:hover { border-color: var(--blue-text); color: var(--text); }

.legend { display: block; font-size: 11px; color: var(--text-45); }
.legend-label { display: block; margin-bottom: 7px; white-space: nowrap; }
.legend-scale { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.legend-step { display: inline-flex; align-items: center; gap: 5px; }
.legend-step-label { font-family: var(--mono); font-size: 10px; color: var(--text-70); }
.legend-unit { font-size: 11px; color: var(--text-45); }
.legend-bar { width: 18px; height: 6px; border-radius: 2px; display: block; }
.legend-bar.l1 { background: var(--ramp-1); }
.legend-bar.l2 { background: var(--ramp-2); }
.legend-bar.l3 { background: var(--ramp-3); }
.legend-bar.l4 { background: var(--ramp-4); }

.atk-toolbar { display: block; margin-top: 4px; max-width: 100%; }

/* ── ATT&CK tactic band ── */

@media (min-width: 1368px) {
  .wrap-nav { max-width: none; }
  .wrap-nav > .view-line,
  .wrap-nav > .nav-head {
    max-width: 1184px; margin-left: max(0px, calc((100% - 1184px) / 2));
  }
}

.atk-cell {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 11px; color: var(--text);
}
.atk-cell:hover { background: var(--hover); border-color: var(--accent); color: var(--text); }
.atk-cell-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.atk-cell-id { font-family: var(--mono); font-size: 11px; color: var(--blue-text); }
.atk-cell-count { font-size: 10px; color: var(--text-45); }
.atk-cell-name { margin-top: 5px; font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.atk-tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag-mobile {
  display: inline-flex; align-items: center; border-radius: 4px; padding: 2px 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-45);
  font-size: 10px; line-height: 14px; letter-spacing: 0.6px; text-transform: uppercase;
  white-space: nowrap;
}
.atk-bar { margin-top: 9px; height: 3px; border-radius: 2px; background: var(--bar-track); overflow: hidden; }
.atk-bar-fill { height: 3px; }
.atk-bar-fill.b1 { width: 25%; background: var(--ramp-1); }
.atk-bar-fill.b2 { width: 50%; background: var(--ramp-2); }
.atk-bar-fill.b3 { width: 75%; background: var(--ramp-3); }
.atk-bar-fill.b4 { width: 100%; background: var(--ramp-4); }

/* ── ATT&CK cell page ── */
.cell-title { margin: 14px 0 0; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: 0.3px; }
.cell-lead { margin: 16px 0 0; font-size: 15px; line-height: 25px; color: var(--text-70); max-width: 70ch; }
.cell-mobile-note { margin: 12px 0 0; font-size: 13px; line-height: 21px; color: var(--text-45); max-width: 74ch; }
.mapped-here { margin-top: 36px; border-top: 1px solid var(--border); padding-top: 28px; }

/* ── doc pages ── */
.doc-title { margin: 16px 0 0; font-size: 40px; line-height: 46px; font-weight: 700; letter-spacing: 0.3px; }
.doc-lead { margin: 20px 0 0; font-size: 17px; line-height: 27px; color: var(--text-70); text-wrap: pretty; max-width: 72ch; }
.doc-block { margin-top: 44px; border-top: 1px solid var(--border); padding-top: 28px; }
.doc-h2 { margin: 0 0 16px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: 0.3px; }
.doc-p { margin: 0 0 14px; font-size: 15px; line-height: 25px; color: var(--text-70); text-wrap: pretty; max-width: 72ch; }
.doc-item {
  display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 14px; padding: 14px 0; border-top: 1px solid var(--border);
}
.doc-term {
  font-family: var(--mono); font-size: 12px; line-height: 22px; color: var(--accent);
  min-width: 0; overflow-wrap: break-word;
}
.doc-text { font-size: 14px; line-height: 22px; color: var(--text-70); max-width: 72ch; }
.doc-p a, .doc-text a, .doc-lead a { text-decoration: underline; text-underline-offset: 2px; }

/* ── footer ── */
.site-footer { border-top: 1px solid var(--border); background: var(--bg); }
.footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 36px 28px 24px;
  display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start;
}
.footer-brand { flex: 1; min-width: 260px; }
.footer-brand-row { display: flex; align-items: center; gap: 10px; }
.footer-mark { width: auto; height: 22px; flex: 0 0 auto; }
.footer-name { font-weight: 700; font-size: 14px; letter-spacing: 0.3px; }
.footer-tagline { margin: 12px 0 0; font-size: 12px; line-height: 19px; color: var(--text-45); max-width: 44ch; }
.footer-version { margin-top: 14px; font-family: var(--mono); font-size: 11px; color: var(--text-45); }
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: 12px; line-height: 18px; }
.footer-col-label {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-45); margin-bottom: 2px;
}
.footer-col a { color: var(--text-70); }
.footer-col a:hover { color: var(--text); }

.footer-legal {
  max-width: 1240px; margin: 0 auto; padding: 20px 28px 56px;
  border-top: 1px solid var(--border);
}
.footer-copyright { margin: 0; font-size: 11px; line-height: 18px; color: var(--text-45); }
.footer-copyright a { color: var(--text-70); text-decoration: underline; text-underline-offset: 2px; }
.footer-copyright a:hover { color: var(--text); }
.footer-notice { margin: 6px 0 0; font-size: 10px; line-height: 16px; color: var(--text-45); max-width: 110ch; }

/* Negative margin cancels the padding: rows keep their height, hit areas grow to 24 px (WCAG 2.5.8). */
.site-nav a, .breadcrumb a, .footer-col a { padding: 6px 0; margin: -6px 0; }

/* "\2197" / "" is the alternative-text syntax: the arrow is decorative. */
.chip-ext > span:last-child::after,
.rr-source::after,
.btn-outline::after,
.doc-p a[target="_blank"]::after,
.doc-text a[target="_blank"]::after,
.doc-lead a[target="_blank"]::after,
.footer-col a[target="_blank"]::after {
  content: "\2197" / ""; margin-left: 0.4em; font-size: 0.85em; opacity: 0.55;
}

/* Declared after every :hover rule so the press state wins. Colour fades stay on under reduced motion (WCAG 2.3.3 targets motion). */
.card, .card-main, .card-sub, .chip, .chip-ext, .sib, .sub-item, .rr-item, .atk-cell,
.mx-cell, .mx-sub, .view-toggle, .view-switch-btn,
.btn-primary, .btn-outline, .search-result, .site-nav a, .breadcrumb a,
.footer-col a, .back-to-top a, .catch-all a {
  transition: background-color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}
.card:active, .sub-item:active, .rr-item:active, .atk-cell:active, .mx-cell:active,
.search-result:active,
.sib:active, .stat-jump:active { background: var(--surface); transition-duration: 0ms; }
.chip:active, .chip-ext:active { background: var(--card); transition-duration: 0ms; }
.view-toggle:active, .btn-outline:active { background: var(--card); }
.btn-primary:active { background: var(--blue-active); }

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition-old(root) { animation: vt-out 90ms var(--ease-out) both; }
  ::view-transition-new(root) { animation: vt-in 140ms var(--ease-out) both; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-group(site-header) { animation: none; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* ── responsive ── */

@media (max-width: 1200px) {
  :root { --header-h: 108px; }
}

@media (max-width: 1100px) {
  .nav-head-main { min-width: 320px; }
  .stat { min-width: calc(50% - 6px); }
  .stats.is-condensed .stat { min-width: 0; }
}

/* 1175: seven Themes columns need 149 px each for "Telecommunications" (128 px) */
@media (max-width: 1175px) {
  .mx-band[data-cols="7"] { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mx-band-row .mx-cells { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* 960: six columns fall under the 140 px floor */
@media (max-width: 960px) {
  .mx-band[data-cols="6"] { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* 685: four Themes columns clear the word floor down to 686; below, two across */
@media (max-width: 685px) {
  /* [data-cols], not a bare class: the two attribute selectors above would win on specificity. */
  .mx-band[data-cols] { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mx-band-row[data-cols] { grid-template-columns: minmax(0, 1fr); }
  .mx-band-row .mx-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 1367: nine columns fall under 125 px inside the reading column; 779: five under 140 px; 640: the site's two-column step. */
@media (max-width: 1367px) {
  .atk-band[data-cols="9"] { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 779px) {
  .atk-band[data-cols="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .atk-band[data-cols="9"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --header-h: 94px; }
  .header-inner { gap: 14px 18px; padding: 12px 20px; }
  .site-nav { gap: 8px 16px; order: 3; width: 100%; }
  .header-tools { order: 2; }
  .search-results { width: min(420px, calc(100vw - 40px)); }

  .wrap-home { padding: 44px 20px 72px; }
  .wrap-entry, .wrap-cell { padding: 28px 20px 72px; }
  .wrap-nav { padding: 36px 20px 72px; }
  .wrap-doc { padding: 40px 20px 72px; }

  .hero-title { font-size: 38px; line-height: 42px; }

  .entry-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .sidebar { position: static; }
  .sidebar-list { max-height: 320px; }

  .nav-head-main { min-width: 0; flex-basis: 100%; }
  .layer-section { margin-top: 56px; }
  .footer-inner { padding: 32px 20px 24px; }
  .footer-legal { padding: 20px 20px 48px; }
}

@media (max-width: 620px) {
  /* No-JS header heights, measured with fonts loaded: 131 px to 620, 157 to 560, 183 to 344; site.js writes the exact value. */
  :root { --header-h: 131px; }
  .header-inner { gap: 12px; }
  .header-spacer { display: none; }
  .header-tools { width: 100%; order: 2; flex-wrap: wrap; }
  .search-box { flex: 1 0 100%; }
  .search-input { width: 100%; }
  .search-results { left: 0; right: 0; width: auto; }
  .view-line { flex-wrap: wrap; gap: 10px; }
  .view-line > :first-child { flex: 1 0 100%; }
  .view-line > .view-options { margin-left: auto; }

  .hero-title { font-size: 30px; line-height: 36px; }
  .hero-lead { font-size: 16px; line-height: 25px; }
  /* Static below 620: a 131-183 px header plus a sticky bar would pin a third of the viewport. */
  .stat { min-width: 100%; }
  .stat-cards { flex: 1 0 100%; }
  .stats { position: static; height: auto; pointer-events: auto; }
  /* Overrides the 280 px floor above, which has higher specificity than .stat. */
  .stats-inner > .stat-controls { min-width: 100%; }
  /* The quarters are down to their 32 px floor here, so the indicator needs the capsule's tighter offset. */
  .view-switch-btn[aria-checked="true"] .view-switch-text::after { top: calc(100% + 2px); }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .mx-col-head { position: static; }
  .atk-col-head { position: static; }

  .entry-title, .page-title { font-size: 28px; line-height: 34px; }
  .cell-title { font-size: 26px; line-height: 32px; }
  .doc-title { font-size: 30px; line-height: 36px; }

  .panel { padding: 16px 16px; }
  .map-key { min-width: 0; flex-basis: 100%; }
  .sub-desc { padding-left: 0; }
  .doc-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-term { line-height: 18px; }
  .btn-primary { width: 100%; justify-content: center; }
  .nav-actions { flex-basis: 100%; width: 100%; }
  .nav-hint { max-width: none; }
}

@media (max-width: 560px) {
  :root { --header-h: 157px; }
}
@media (max-width: 344px) {
  :root { --header-h: 183px; }
}

/* ── reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stats-inner, .stat, .stat-value { transition: none; }
  /* .subs-shown .card-sublist as well: the fade is declared on the two-class selector. */
  .card-sublist, .subs-shown .card-sublist, .subs-shown .mx-subs { transition: none; }
  .search-results { transition: none; transform: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
