/* PIAtlas project page
 *
 * Layout: every section sits in one centered column (--page), so all left and right edges
 * line up; reading text uses a narrower centered column (--narrow).
 * Class colors keep the paper's hue for each class (F1 blue, F2 teal, F3 purple, F4 orange,
 * F5 ochre, F6 crimson), re-stepped so neighboring columns stay distinguishable under
 * color-vision deficiency, in day and in night mode. */

:root {
  color-scheme: light;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --surface-3: #E9EDF2;
  --ink: #131A27;
  --ink-2: #3D485C;
  --ink-3: #5F6B80;
  --line: #D2D9E2;
  --line-2: #E3E8EE;
  --nav: #1C2840;
  --nav-2: #2A3A5C;
  --nav-ink: #EEF2F8;
  --nav-ink-2: #AFBAD0;
  --accent: #1F5BC0;
  --accent-ink: #FFFFFF;
  --focus: #1F5BC0;
  --ok: #1B7F3B;
  --wild: #CF2E3C;
  --hl-alpha: 15%;
  --bar: #CDD5DF;
  --bar-ink: #4A566B;
  --bar-open: #2A3A5C;

  --f1: #205EA5; --f2: #127E63; --f3: #7A4F9F; --f4: #D17054; --f5: #886A01; --f6: #A92E52;
  --f1-on: #FFFFFF; --f2-on: #FFFFFF; --f3-on: #FFFFFF; --f4-on: #121826; --f5-on: #FFFFFF; --f6-on: #FFFFFF;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --page: 1200px;
  --narrow: 780px;
  --gutter: 24px;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 14px;
  --control: 38px;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 6%);
  --shadow-lg: -18px 0 44px rgb(16 24 40 / 18%);
}

/* Night mode. index.html sets data-theme on <html> before the first paint, from the visitor's
 * saved choice or, failing that, the system setting; the Day/Night switch changes it. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C1119;
  --surface: #151C27;
  --surface-2: #19212E;
  --surface-3: #232D3C;
  --ink: #E8EDF4;
  --ink-2: #B9C2CF;
  --ink-3: #8E99AB;
  --line: #2D3849;
  --line-2: #232C3A;
  --nav: #080D15;
  --nav-2: #1A2740;
  --nav-ink: #EEF2F8;
  --nav-ink-2: #98A4B9;
  --accent: #80B4F7;
  --accent-ink: #0C1119;
  --focus: #80B4F7;
  --ok: #5BC77F;
  --wild: #FF6F78;
  --hl-alpha: 24%;
  --bar: #2B3647;
  --bar-ink: #A9B4C5;
  --bar-open: #5C79AB;

  --f1: #4588D8; --f2: #349A82; --f3: #9B6FC2; --f4: #BD4D02; --f5: #B48F3C; --f6: #D05A6F;
  --f1-on: #0E1420; --f2-on: #0E1420; --f3-on: #0E1420; --f4-on: #FFFFFF; --f5-on: #0E1420; --f6-on: #0E1420;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-lg: -18px 0 44px rgb(0 0 0 / 50%);
}

[data-c="F1"] { --c: var(--f1); --c-on: var(--f1-on); }
[data-c="F2"] { --c: var(--f2); --c-on: var(--f2-on); }
[data-c="F3"] { --c: var(--f3); --c-on: var(--f3-on); }
[data-c="F4"] { --c: var(--f4); --c-on: var(--f4-on); }
[data-c="F5"] { --c: var(--f5); --c-on: var(--f5-on); }
[data-c="F6"] { --c: var(--f6); --c-on: var(--f6-on); }
[data-c] {
  --c-tint: color-mix(in srgb, var(--c) 9%, var(--surface));
  --c-tint-2: color-mix(in srgb, var(--c) 16%, var(--surface));
  --c-hl: color-mix(in srgb, var(--c) var(--hl-alpha), transparent);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r);
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.page {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.page.narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
section[id], [data-section] { scroll-margin-top: 16px; }
.eyebrow {
  margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}

/* ---------- top bar ---------- */
.topbar { background: var(--nav); color: var(--nav-ink); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; color: var(--nav-ink);
  text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: 0.01em;
}
.logo { width: 24px; height: 24px; }
.top-right { display: flex; align-items: center; gap: 14px; height: 100%; }
.topnav { display: flex; gap: 2px; height: 100%; }
.topnav a {
  display: flex; align-items: center; padding: 0 14px; color: var(--nav-ink-2);
  text-decoration: none; font-size: 13.5px; font-weight: 500; letter-spacing: 0.02em;
  border-block: 3px solid transparent;
}
.topnav a:hover { color: var(--nav-ink); background: rgb(255 255 255 / 5%); }
.topnav a[aria-current="true"] { color: var(--nav-ink); background: var(--nav-2); border-bottom-color: #7FB3F6; }
.theme-switch {
  display: inline-flex; padding: 2px; border-radius: 999px;
  background: rgb(255 255 255 / 7%); border: 1px solid rgb(255 255 255 / 14%);
}
.theme-switch button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border: 0; border-radius: 999px; background: transparent; color: var(--nav-ink-2);
  font-size: 12.5px; font-weight: 600;
}
.theme-switch button:hover { color: var(--nav-ink); }
.theme-switch button[aria-pressed="true"] { background: rgb(255 255 255 / 16%); color: var(--nav-ink); }
.theme-switch svg { width: 14px; height: 14px; }

/* ---------- hero ---------- */
.hero { background: var(--surface); border-bottom: 1px solid var(--line-2); text-align: center; padding: 64px 0 48px; }
.hero h1 {
  max-width: 940px; margin: 0 auto; font-size: clamp(26px, 3.6vw, 46px); font-weight: 700;
  line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance;
}
.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--nav); border-color: var(--nav); color: var(--nav-ink); }
.btn-primary:hover { background: var(--nav-2); border-color: var(--nav-2); }
:root[data-theme="dark"] .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
:root[data-theme="dark"] .btn-primary:hover { background: #A3C8F9; border-color: #A3C8F9; }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; box-shadow: none; }

/* six equal tiles: numbers share one baseline, labels sit below them */
.stats {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
  max-width: 960px; margin: 40px auto 0; background: var(--line-2);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden;
}
.stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 8px 16px; background: var(--surface-2);
}
.stats dd { order: -1; margin: 0; font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.stats dt { font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }

/* ---------- summary ---------- */
.intro { padding: 48px 0 0; }
.tldr {
  padding: 22px 26px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.tldr p { font-size: 16.5px; line-height: 1.65; }
.abstract-label { margin-top: 36px; }
.abstract { font-size: 15.5px; line-height: 1.75; color: var(--ink-2); }

/* ---------- section heads ---------- */
.matrix-section, .figures, .download, .cite { padding-top: 72px; }
.section-head { max-width: 760px; margin: 0 auto; text-align: center; }
.section-head h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.015em; }
.section-head p { margin-top: 10px; font-size: 16px; color: var(--ink-2); text-wrap: balance; }

/* ---------- matrix toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 28px; }
.seg {
  display: inline-flex; height: var(--control); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: var(--surface);
}
.seg button { padding: 0 14px; border: 0; background: transparent; font-size: 13.5px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--surface-3); }
.seg button:active { background: var(--nav); color: var(--nav-ink); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 300px; height: var(--control); padding: 0 34px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); font-size: 14px;
}
.search input::placeholder { color: var(--ink-3); }
.search kbd {
  position: absolute; right: 9px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface-2); color: var(--ink-3); font-size: 11px; line-height: 18px;
}
.search input:not(:placeholder-shown) + kbd { display: none; }
#incident {
  width: 250px; height: var(--control); padding: 0 34px 0 12px; border: 1px solid var(--line);
  border-radius: var(--r); background-color: var(--surface); font-size: 14px; color: var(--ink);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%238A94A6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
.check {
  display: inline-flex; align-items: center; gap: 8px; height: var(--control); padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  font-size: 13.5px; font-weight: 600; cursor: pointer; user-select: none;
}
.check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }

/* Show IDs and Download wrap to a second line together, never one alone */
.tool-pair { display: flex; gap: 10px; }

/* download menu: a disclosure whose panel lists the three formats */
.dl-menu { position: relative; }
.dl-menu > summary {
  display: inline-flex; align-items: center; gap: 7px; height: var(--control); padding: 0 12px 0 13px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  font-size: 13.5px; font-weight: 600; list-style: none; cursor: pointer; user-select: none;
}
.dl-menu > summary::-webkit-details-marker { display: none; }
.dl-menu > summary:hover, .dl-menu[open] > summary { border-color: var(--ink-3); }
.dl-menu > summary svg { width: 15px; height: 15px; color: var(--ink-2); }
.dl-menu > summary .chev { width: 12px; height: 12px; color: var(--ink-3); transition: transform .15s; }
.dl-menu[open] > summary .chev { transform: rotate(180deg); }
.dl-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 250px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 12px 32px rgb(16 24 40 / 16%);
}
:root[data-theme="dark"] .dl-pop { box-shadow: 0 12px 32px rgb(0 0 0 / 55%); }
.dl-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; text-align: left;
}
.dl-pop button:hover { background: var(--surface-3); }
.dl-pop button:focus-visible { outline-offset: -2px; }
.dl-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dl-text b { font-size: 13.5px; font-weight: 600; }
.dl-text small { font-size: 12px; color: var(--ink-3); }
/* file-type tile, shared by the menu and the download cards */
.ftype {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 30px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent);
  font: 700 11.5px/1 var(--mono); letter-spacing: 0.04em;
}

.status { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--ink-2); }
.status:empty { display: none; }
.case {
  position: relative; max-width: var(--narrow); margin: 16px auto 0; padding: 14px 18px 14px 20px;
  background: var(--surface); border: 1px solid var(--line-2); border-left: 4px solid var(--wild);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.case-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding-right: 80px; font-weight: 700; }
.case-title .muted { font-weight: 400; }
.case p { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.case p.muted { color: var(--ink-3); font-size: 13px; }
.case .case-close { position: absolute; top: 12px; right: 12px; }
/* auto margins center the row but keep its start visible when it has to scroll */
.col-jump { display: flex; align-items: center; gap: 6px; margin-top: 16px; overflow-x: auto; padding-bottom: 2px; }
.col-jump > :first-child { margin-left: auto; }
.col-jump > :last-child { margin-right: auto; }
.jump-label { flex: none; margin-right: 2px; font-size: 12.5px; color: var(--ink-3); }
.col-jump button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 600;
}
.col-jump button:hover { border-color: var(--c); background: var(--c-tint); }
.col-jump .badge { height: 20px; }

/* ---------- matrix ---------- */
.matrix-frame { position: relative; margin-top: 28px; }
.matrix-frame::before, .matrix-frame::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 32px; z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.matrix-frame::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.matrix-frame::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
.matrix-frame.can-left::before, .matrix-frame.can-right::after { opacity: 1; }
/* The scroller spans the window; its side padding equals the page margin, so the collapsed
 * matrix lines up with the page column while the expanded one can scroll to the window edge.
 * position: relative keeps absolutely positioned descendants (screen-reader labels) inside it. */
.matrix-scroll {
  position: relative; container-type: inline-size; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 4px max(var(--gutter), calc((100% - var(--page)) / 2)) 20px;
}
.matrix-scroll:focus-visible { outline-offset: -2px; }
.matrix {
  --gap: 12px;
  --open-cols: 0;
  --cw: clamp(146px, calc((100vw - 120px) / 6.3), 196px);
  display: flex; gap: var(--gap); width: max-content; margin-inline: auto; align-items: flex-start;
}
@supports (width: 1cqi) {
  /* six equal columns that exactly fill the page column */
  .matrix { --cw: max(146px, calc((100cqi - 5 * var(--gap)) / 6)); }
}
/* When sub-techniques are open (app.js adds .wide and sets --open-cols to the number of columns
 * that have one open), the matrix may use the whole window, centered, and every cell shrinks
 * so that the 6 + open-cols cell widths fit; cells never grow past their collapsed width and
 * never shrink below 96px, below which the matrix scrolls instead. */
.matrix-frame.wide .matrix-scroll { padding-inline: var(--gutter); }
@supports (width: 1cqi) {
  @media (min-width: 1000px) {
    .matrix-frame.wide .matrix {
      --cw: clamp(96px, calc((100cqi - 5 * var(--gap)) / (6 + var(--open-cols))), calc((var(--page) - 5 * var(--gap)) / 6));
    }
  }
}
.loading { padding: 24px; color: var(--ink-3); }

/* a column is as wide as its cells (one cell, or two when a technique is expanded), never its header */
.col { flex: none; display: flex; flex-direction: column; width: min-content; min-width: var(--cw); transition: opacity .15s; }
.col-head { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 3px solid var(--c); text-align: center; }
.col-title {
  display: grid; grid-template-rows: 20px 38px; row-gap: 6px; justify-items: center; align-items: center;
  color: var(--ink); text-decoration: none;
}
.col-name { max-height: 2.6em; overflow: hidden; padding: 0 6px; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.col-title:hover .col-name { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 2px; }
.col-count { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px; padding: 0 5px;
  border-radius: 5px; background: var(--c); color: var(--c-on);
  font: 600 11.5px/1 var(--mono); letter-spacing: 0.02em;
}

.techs, .subs { list-style: none; margin: 0; padding: 0; }
.techs { display: flex; flex-direction: column; gap: 8px; }
.tech { display: flex; align-items: stretch; }
.tech-cell {
  width: var(--cw); min-height: 50px; flex: none; display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--c);
  border-radius: var(--r-sm); overflow: hidden; transition: opacity .15s, box-shadow .15s;
}
.cell {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; line-height: 1.3;
}
.cell:hover { background: var(--c-tint); }
.cell:focus-visible { outline-offset: -3px; }
.cell[aria-current="true"] { background: var(--c-tint-2); box-shadow: inset 0 0 0 2px var(--c); }
.cid { display: none; flex: none; font: 600 10.5px/1 var(--mono); color: var(--ink-3); }
.matrix.show-ids .cid { display: inline; }
/* hyphenate long words; break a word without a hyphen only as a last resort */
.nm { min-width: 0; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 8 3 3; }
/* incident dot: fixed in the cell corner, so it never changes how the name wraps */
.matrix .cell.has-wild { padding-right: 12px; }
.wild { position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--wild); }
.wild-inline, .wild-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--wild); }
.wild-inline { margin-left: 4px; vertical-align: 2px; }

.tgl {
  flex: none; display: grid; place-items: center; width: 18px; padding: 0;
  border: 0; border-left: 1px solid var(--line); background: var(--bar); color: var(--bar-ink);
}
.tgl:hover { filter: brightness(0.95); }
.tgl svg { width: 10px; height: 10px; transition: transform .15s; }
.tech.open .tgl { background: var(--bar-open); border-left-color: var(--bar-open); color: #FFFFFF; }
.tech.open .tgl svg { transform: rotate(180deg); }
.tech.open .tech-cell { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.subs { width: var(--cw); flex: none; display: flex; flex-direction: column; gap: 4px; }
.subs li { display: flex; }
.cell.sub {
  min-height: 38px; padding: 6px 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12.5px; font-weight: 450;
}
.cell.sub:hover { background: var(--c-tint); }
.cell.sub[aria-current="true"] { background: var(--c-tint-2); }
/* compact text in narrow cells; placed after the base cell rules so it wins */
.tech-cell, .subs { container-type: inline-size; }
@container (max-width: 150px) {
  .cell { gap: 4px; padding: 5px 7px; font-size: 12px; line-height: 1.25; }
  .cell.sub { min-height: 34px; padding: 5px 7px; font-size: 11.5px; }
  .tgl { width: 14px; }
}

/* search and incident highlighting */
.matrix.filtering .tech-cell, .matrix.filtering .cell.sub { opacity: 0.3; }
.matrix.filtering .tech-cell.hit, .matrix.filtering .tech-cell.hit-sub, .matrix.filtering .cell.sub.hit { opacity: 1; }
.matrix.filtering .tech-cell.hit, .matrix.filtering .cell.sub.hit { box-shadow: 0 0 0 2px var(--accent); }
.matrix.filtering .cell.sub.hit { position: relative; z-index: 1; }
.matrix.filtering .col.no-hit .col-head { opacity: 0.35; }
.matrix.filtering .col-head.hit-class .col-name { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 3px; }

.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-top: 4px;
  font-size: 12.5px; color: var(--ink-3); text-align: center;
}
.legend code { font-size: 0.95em; }
.wild-dot { margin-right: 2px; vertical-align: 1px; }
.key-bar { display: inline-block; width: 7px; height: 13px; margin-right: 2px; vertical-align: -2px; background: var(--bar); border: 1px solid var(--line); border-radius: 1px; }

/* ---------- highlighted spans and entry chips ---------- */
.hl {
  padding: 0 2px; border-bottom: 2px solid var(--c); border-radius: 3px; background: var(--c-hl);
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.hl sup { margin-left: 2px; font: 600 9px/1 var(--mono); color: var(--ink-2); vertical-align: 5px; letter-spacing: 0; }
.payload { color: var(--ink-3); font-style: italic; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 5px; border: 1px solid transparent; border-radius: 4px;
  background: var(--c-tint-2); color: var(--ink); text-decoration: none; white-space: nowrap;
  font: 600 0.82em/1.55 var(--mono);
}
.chip::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.chip:hover { border-color: var(--c); }

/* ---------- detail panel ---------- */
.detail {
  position: fixed; top: 0; right: 0; z-index: 60; width: min(500px, 100vw); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .22s ease;
}
.detail.open { transform: none; }
.detail-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 10px 12px 10px 22px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; font-size: 12.5px; }
.crumbs a { padding: 2px 4px; border-radius: 4px; color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { background: var(--surface-3); color: var(--ink); }
.crumbs .here { padding: 2px 4px; color: var(--ink); font-weight: 600; }
.crumbs .slash { color: var(--ink-3); }
.detail-actions { flex: none; display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn .i-check { display: none; }
.icon-btn.copied { border-color: var(--ok); color: var(--ok); }
.icon-btn.copied .i-link { display: none; }
.icon-btn.copied .i-check { display: block; }
.detail-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 22px 22px 44px; }

.d-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.d-kicker code { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.detail h2 { margin-top: 10px; font-size: 26px; font-weight: 700; }
.detail h2:focus { outline: none; }
.d-desc { margin-top: 10px; font-size: 15px; line-height: 1.6; }
.d-sec { margin-top: 26px; }
.d-sec > h3, .d-sec > summary {
  margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3);
}
.count {
  display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px;
  background: var(--surface-3); color: var(--ink-2); font-size: 11px; text-align: center; letter-spacing: 0;
}
.src { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 16px 0 0; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.glance {
  display: grid; gap: 1px; margin: 18px 0 0; overflow: hidden;
  background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r);
}
.glance div { padding: 10px 14px; background: var(--surface-2); }
.glance dt { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.glance dd { margin: 2px 0 0; font-size: 14px; }

.example {
  margin: 0; padding: 12px 14px; background: var(--c-tint); border-left: 3px solid var(--c);
  border-radius: 0 var(--r) var(--r) 0; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere;
}
.example code { padding: 1px 4px; border-radius: 4px; background: rgb(127 127 127 / 12%); }
.illus { margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface-2); }
.illus-head { margin-bottom: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-3); }
.illus-head b { color: var(--ink-2); }
.illus pre, .illus .lit { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.illus pre.art { white-space: pre; overflow-x: auto; font-size: 11.5px; line-height: 1.25; }
.illus p.prose { font-size: 13.5px; line-height: 1.55; white-space: pre-line; color: var(--ink-2); }
.illus .row-label { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.illus .row-label:first-of-type { margin-top: 0; }
.illus .note { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
mark.rv { color: inherit; border-radius: 2px; background: color-mix(in srgb, var(--wild) 22%, transparent); outline: 1px solid color-mix(in srgb, var(--wild) 55%, transparent); }
mark.rv.zw { padding: 0 1px; color: var(--wild); font-weight: 700; }
mark.pl { padding: 0 1px; color: inherit; border-radius: 2px; background: color-mix(in srgb, var(--f3) 18%, transparent); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list > li { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); }
.list .li-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.list .li-head a { color: var(--ink); font-weight: 600; text-decoration: none; }
.list .li-head a:hover { text-decoration: underline; text-decoration-color: var(--c); }
.list .li-code { font: 600 11px/1 var(--mono); color: var(--ink-3); }
.list .li-def { margin-top: 3px; font-size: 13.5px; color: var(--ink-2); }
.list .li-ex { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--c); font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.list .li-meta { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.list .li-via { font-size: 12px; color: var(--ink-3); }
.siblings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.shares { display: grid; gap: 12px; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13.5px; }
.share-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.share-track { grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: 4px; background: var(--c-tint-2); }
.share-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--c); }

.corpus { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.corpus li { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); }
.corpus .src-name { margin-bottom: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.corpus .q { font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.effects { list-style: none; display: grid; gap: 4px; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.effects li { display: flex; align-items: baseline; gap: 6px; }
.effects .badge { flex: none; min-width: 22px; height: 16px; font-size: 10px; }

details.d-sec > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
details.d-sec > summary::-webkit-details-marker { display: none; }
details.d-sec > summary::before {
  content: ""; width: 7px; height: 7px; margin-right: 2px; transform: rotate(-45deg); transition: transform .15s;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
}
details.d-sec[open] > summary::before { transform: rotate(45deg); }
.rules { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; font-size: 13.5px; color: var(--ink-2); }
.rules li { padding-left: 12px; border-left: 2px solid var(--line); }
.d-source { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
.d-source b { color: var(--ink-2); font-weight: 600; }

/* ---------- figures ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.fig { margin: 28px 0 0; padding: 26px 28px; }
.fig-head h3 { font-size: 18px; font-weight: 700; }
.fig-head p { max-width: 80ch; margin-top: 6px; color: var(--ink-2); }
.fig figcaption { max-width: 100ch; margin-top: 16px; font-size: 13px; color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px 0 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 600;
}
.chip-btn .badge { opacity: 0.45; }
.chip-btn[aria-pressed="true"] { background: var(--c-tint-2); border-color: var(--c); }
.chip-btn[aria-pressed="true"] .badge { opacity: 1; }
.chip-btn.ghost { padding: 0 14px; color: var(--ink-2); }
.mock { margin-top: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mock-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--line-2); font-size: 12px; font-weight: 500; color: var(--ink-3);
}
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line); }
.mock-text { min-height: 80px; padding: 18px 20px 20px; font-size: 16.5px; line-height: 1.75; overflow-wrap: anywhere; }
.mock-text code { font-size: 0.82em; }
.builder-entries { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }

.table-scroll { margin-top: 18px; overflow-x: auto; }
.heat { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 2px; font-size: 13px; }
.heat th { padding: 6px 8px; font-weight: 600; color: var(--ink-2); text-align: left; white-space: nowrap; }
.heat thead th { vertical-align: bottom; font-size: 12px; }
.heat thead th.cls { text-align: center; }
.heat thead th.cls .badge { display: flex; width: max-content; margin: 0 auto 4px; }
.heat thead th.cls .part { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.heat thead th:first-child { width: 24%; }
.heat th.num, .heat td.n { text-align: right; }
.heat th.cov, .heat td.cov { text-align: center; }
.heat td { min-width: 52px; padding: 7px 4px; border-radius: 4px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat td.n, .heat td.cov { background: none; color: var(--ink-2); font-weight: 500; }
.heat td.n { padding-right: 12px; }
.heat td.v { cursor: default; }
.heat td.v:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.heat td.zero { background: var(--surface-2); color: var(--ink-3); font-weight: 500; }
.heat tbody th { font-weight: 500; color: var(--ink); }
.heat tr.sep td { height: 8px; padding: 0; }
.heat tr.total th { font-weight: 700; }
.scale { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.scale .ramp { width: 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #CDE2FB, #86B6EF, #3987E5, #1C5CAB, #0D366B); }
:root[data-theme="dark"] .scale .ramp { background: linear-gradient(90deg, #0D366B, #1C5CAB, #3987E5, #6DA7EC, #86B6EF); }
.zero-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.zero-key i { width: 14px; height: 10px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--line); }

.map-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-top: 20px; }
.img-card { padding: 10px; background: #FFFFFF; border: 1px solid var(--line-2); border-radius: 10px; }
.img-card img { display: block; width: 100%; height: auto; }
.map-caption { font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.map-caption p + p { margin-top: 12px; }

.tooltip {
  position: fixed; z-index: 80; max-width: 260px; padding: 8px 10px; pointer-events: none;
  background: var(--nav); color: var(--nav-ink); border-radius: var(--r); font-size: 12.5px; line-height: 1.4;
  box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
}
.tooltip b { display: block; font-size: 15px; }
.tooltip .tt-sub { color: var(--nav-ink-2); }

/* ---------- download ---------- */
.formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.format {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px 20px 16px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow);
  text-align: left; transition: border-color .15s;
}
.format:hover { border-color: var(--ink-3); }
.format .ftype { margin-bottom: 8px; }
.format-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.format-desc { margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.format-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px;
}
.format .get { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.format .get svg { flex: none; width: 15px; height: 15px; }
.format .size { flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.formats-note { margin-top: 14px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ---------- cite and footer ---------- */
.cite { padding-bottom: 72px; }
.bibtex { position: relative; margin-top: 24px; }
.bibtex pre {
  margin: 0; padding: 20px 22px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow); font-size: 13px; line-height: 1.7;
}
.bibtex .btn { position: absolute; top: 12px; right: 12px; }
.footer { padding: 26px 0 32px; background: var(--surface); border-top: 1px solid var(--line-2); text-align: center; font-size: 13px; color: var(--ink-3); }
.footer p + p { margin-top: 4px; }

/* ---------- responsive ---------- */
/* narrower search and incident list keep the toolbar on one line at 1024px */
@media (max-width: 1100px) {
  .search input { width: 266px; }
  #incident { width: 206px; }
}
@media (max-width: 860px) {
  .topnav a { padding: 0 11px; }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .map-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .img-card { max-width: 560px; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  .topbar-inner { height: 52px; }
  .topnav a { padding: 0 9px; font-size: 13px; }
  .topnav a[data-nav="overview"] { display: none; }
  .top-right { gap: 6px; }
  .theme-switch button { padding: 0 8px; }
  .theme-switch button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .brand { font-size: 18px; }
  .hero { padding: 40px 0 32px; }
  .buttons { margin-top: 22px; }
  .stats { margin-top: 28px; }
  .stats > div { padding: 14px 6px 12px; }
  .stats dd { font-size: 21px; }
  .intro { padding-top: 32px; }
  .tldr { padding: 16px 18px; }
  .tldr p { font-size: 15.5px; }
  .abstract-label { margin-top: 28px; }
  .matrix-section, .figures, .download, .cite { padding-top: 52px; }
  .cite { padding-bottom: 52px; }
  /* three rows: Expand/Collapse with Download, the search, the incident list with Show IDs */
  .toolbar { margin-top: 20px; }
  .tool-pair { display: contents; }
  .seg, .search, #incident { flex: 1 1 100%; }
  .seg { order: 1; flex: 1 1 auto; }
  .dl-menu { order: 2; }
  .search { order: 3; }
  #incident { order: 4; flex: 1 1 0; min-width: 0; }
  .check { order: 5; flex: 0 0 auto; }
  .seg button { flex: 1; }
  .search input, #incident { width: 100%; }
  /* download cards stack, the file-type tile beside the text */
  .formats { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 22px; }
  .format { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 2px; padding: 14px 16px; }
  .format .ftype { grid-row: span 3; margin: 1px 0 0; }
  .format-desc { margin-bottom: 0; }
  .format-foot { margin-top: 6px; padding-top: 0; border-top: 0; }
  .fig { padding: 20px 16px; }
  .mock-text { padding: 14px; font-size: 15px; }
  .detail { width: 100vw; border-left: 0; }
  .detail-body { padding: 18px 16px 40px; }
  .case-title { padding-right: 70px; }
}
@media (max-width: 720px) {
  body.detail-open { overflow: hidden; }
}
@media (max-width: 520px) {
  .topnav a[data-nav="download"] { display: none; }
}
/* the main button on its own row, the other two as an even pair below it */
@media (max-width: 500px) {
  .buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; margin-inline: auto; }
  .buttons .btn-primary { grid-column: 1 / -1; }
}
@media (max-width: 400px) {
  .topnav a[data-nav="cite"] { display: none; }
  .dl-menu > summary { gap: 0; width: var(--control); padding: 0; justify-content: center; }
  .dl-menu > summary .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dl-menu > summary .chev { display: none; }
}
@media (max-width: 340px) {
  .topnav a { padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
@media (forced-colors: active) {
  .tech-cell, .cell.sub, .badge { border: 1px solid CanvasText; }
  .hl { border-bottom: 2px solid CanvasText; }
}
