/* ==========================================================================
   bgpmap — looking-glass stylesheet
   Hand-written, no framework. Editorial/instrument feel: paper, hairlines,
   tabular figures, one accent colour.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Type stacks: high quality system faces, no webfont download */
  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-mono: "Cascadia Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  /* Light palette — warm paper / ink */
  --paper: #f6f3ec;
  --paper-2: #efeae0;
  --surface: #fffdf9;
  --surface-2: #faf7f1;
  --ink: #17150f;
  --ink-2: #443e33;
  --muted: #6e6759;
  --faint: #928a7a;
  --rule: #ded7c9;
  --rule-strong: #c9c0ad;

  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --accent-hover: #17406f;
  --accent-soft: rgba(31, 79, 143, 0.08);
  --accent-ring: rgba(31, 79, 143, 0.28);

  --ok: #256b46;
  --ok-soft: rgba(37, 107, 70, 0.1);
  --warn: #9a5b12;
  --warn-soft: rgba(154, 91, 18, 0.1);
  --bad: #9c3320;
  --bad-soft: rgba(156, 51, 32, 0.1);
  --route: #bc3b22;

  /* Elevation: very soft, paper-like */
  --shadow-1: 0 1px 2px rgba(23, 21, 15, 0.05);
  --shadow-2: 0 1px 3px rgba(23, 21, 15, 0.06), 0 8px 24px -12px rgba(23, 21, 15, 0.14);
  --shadow-3: 0 2px 6px rgba(23, 21, 15, 0.07), 0 18px 40px -18px rgba(23, 21, 15, 0.2);

  /* Geometry */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* Rhythm */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;

  --measure: 42rem;   /* prose column */
  --mid: 52rem;       /* landing column */
  --wide: 62rem;      /* data column */

  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #151412;
  --paper-2: #1b1a17;
  --surface: #1f1e1b;
  --surface-2: #262420;
  --ink: #efeadf;
  --ink-2: #d2ccbf;
  --muted: #9b9486;
  --faint: #7d7668;
  --rule: #35322c;
  --rule-strong: #474338;

  --accent: #7ba4de;
  --accent-ink: #12110f;
  --accent-hover: #9dbce8;
  --accent-soft: rgba(123, 164, 222, 0.12);
  --accent-ring: rgba(123, 164, 222, 0.4);

  --ok: #6fbc8d;
  --ok-soft: rgba(111, 188, 141, 0.14);
  --warn: #d79b4f;
  --warn-soft: rgba(215, 155, 79, 0.14);
  --bad: #e07f68;
  --bad-soft: rgba(224, 127, 104, 0.14);
  --route: #e3684c;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 3px rgba(0, 0, 0, 0.35), 0 10px 26px -14px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 2px 8px rgba(0, 0, 0, 0.4), 0 20px 44px -20px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.35rem + 2.2vw, 2.65rem);
  letter-spacing: -0.022em;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
}

h3 {
  font-size: 1.02rem;
  letter-spacing: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-ring);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: currentColor;
}

code,
kbd,
samp,
pre,
.mono,
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

code {
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--sp-4);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--r-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--sp-2);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   3. Shell: header, main, footer
   -------------------------------------------------------------------------- */

.shell-head {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--rule);
  background-color: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

/* Fallback for engines without color-mix */
@supports not (background-color: color-mix(in srgb, red 50%, blue)) {
  .shell-head {
    background-color: var(--paper);
  }
}

.shell-head__inner {
  width: min(var(--wide), calc(100% - 2 * var(--sp-5)));
  margin-left: auto;
  margin-right: auto;
  height: 3.75rem;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.12em;
  border: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand:hover {
  color: var(--ink);
}

.brand__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--route);
  margin-left: 0.2em;
  align-self: center;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}

.nav__link {
  border: 0;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 0.9rem;
}

.nav__link:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.nav__link[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  flex: none;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
  background: var(--surface-2);
}

.icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

/* Sun shows in dark mode, moon in light mode */
.icon-btn .icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-btn .icon-sun {
  display: block;
}

html[data-theme="dark"] .icon-btn .icon-moon {
  display: none;
}

.shell-main {
  flex: 1 0 auto;
  width: min(var(--wide), calc(100% - 2 * var(--sp-5)));
  margin-left: auto;
  margin-right: auto;
  padding-top: var(--sp-7);
  padding-bottom: var(--sp-8);
}

.shell-main--narrow {
  width: min(var(--measure), calc(100% - 2 * var(--sp-5)));
}

.shell-main--mid {
  width: min(var(--mid), calc(100% - 2 * var(--sp-5)));
}

.shell-foot {
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.shell-foot__inner {
  width: min(var(--wide), calc(100% - 2 * var(--sp-5)));
  margin-left: auto;
  margin-right: auto;
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-6);
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.shell-foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.shell-foot a {
  border-bottom-color: transparent;
  color: var(--muted);
}

.shell-foot a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent-ring);
}

/* --------------------------------------------------------------------------
   4. Text helpers
   -------------------------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: var(--sp-4);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--rule-strong);
}

.lede {
  margin-top: var(--sp-4);
  color: var(--ink-2);
  font-size: 1.06rem;
  max-width: 38rem;
  text-wrap: pretty;
}

.fine {
  color: var(--muted);
  font-size: 0.875rem;
}

.muted {
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   5. Search
   -------------------------------------------------------------------------- */

.search {
  margin-top: var(--sp-5);
}

.search__row {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
}

.search__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 0.85rem;
  width: 1.02rem;
  height: 1.02rem;
  color: var(--faint);
  pointer-events: none;
}

.search__input,
.input {
  width: 100%;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: 0.72rem 0.9rem;
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search__input {
  padding-left: 2.5rem;
  padding-right: 3.2rem;
  font-size: 1rem;
}

.search__input::placeholder,
.input::placeholder {
  color: var(--faint);
}

.search__input:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search__hint {
  position: absolute;
  right: 0.6rem;
  display: none;
  padding: 0.12rem 0.42rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  pointer-events: none;
}

@media (min-width: 45rem) and (hover: hover) {
  .search__hint {
    display: block;
  }
  .search__field:focus-within .search__hint {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.72rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
  border-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.btn svg {
  width: 1em;
  height: 1em;
  flex: none;
}

.btn--quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn--quiet:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn--sm {
  padding: 0.32rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  box-shadow: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.btn-row--spaced {
  margin-top: var(--sp-5);
}

/* --------------------------------------------------------------------------
   7. Home
   -------------------------------------------------------------------------- */

.hero {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-6);
}

.hero h1 {
  max-width: 34ch;
}

.hero__note {
  margin-top: var(--sp-4);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.chips__label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: var(--sp-1);
}

.chip {
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 0.28rem 0.75rem;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  box-shadow: var(--shadow-1);
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.explainer {
  margin-top: var(--sp-7);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--rule);
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  counter-reset: step;
}

.explainer__item {
  counter-increment: step;
}

.explainer__item h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: var(--sp-2);
}

.explainer__item h3::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--route);
  letter-spacing: 0.05em;
}

.explainer__item p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   8. Page head (results pages)
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--rule);
}

.page-head h1 {
  font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.1rem);
}

.page-head h1 code {
  font-size: 0.82em;
  font-weight: 600;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ok {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--ok-soft);
}

.badge--warn {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}

.badge--bad {
  color: var(--bad);
  border-color: var(--bad);
  background: var(--bad-soft);
}

.badge--plain::before {
  display: none;
}

/* --------------------------------------------------------------------------
   9. Stats
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  margin: var(--sp-5) 0 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.stats > div {
  padding: 0.8rem 1rem;
  border-right: 1px solid var(--rule);
}

.stats > div:last-child {
  border-right: 0;
}

.stats dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.stats dd {
  margin: 0.3rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  word-break: break-word;
}

.stats dd.is-small {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   10. Cards / graph panel
   -------------------------------------------------------------------------- */

.card {
  margin-top: var(--sp-6);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}

.card__head h2 {
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0;
}

.card__title-note {
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 400;
  margin-left: 0.45rem;
}

.card__body {
  padding: var(--sp-4);
}

.card__foot {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
}

.graph {
  margin: var(--sp-6) 0 0;
}

.graph__stage {
  background: var(--surface-2);
  overflow: auto;
  padding: var(--sp-4);
  max-height: 34rem;
  overscroll-behavior: contain;
}

/* The diagram sits on the surface like a plotted plate; its grid lives inside
   the SVG so a PNG export keeps it. */
.graph__img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transform-origin: top center;
  transition: width 0.15s ease;
}

.graph__img.is-zoomed {
  max-width: none;
}

.graph__tools {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.graph__zoom {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}

.graph__zoom button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  min-width: 2rem;
}

.graph__zoom button:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.graph__zoom span {
  padding: 0.28rem 0.5rem;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 3.4rem;
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.legend i {
  width: 1.1rem;
  height: 0;
  border-top: 3px solid var(--rule-strong);
  border-radius: 2px;
  flex: none;
}

.legend i.is-route {
  border-top-color: var(--route);
}

.legend i.is-origin {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.legend i.is-prefix {
  width: 0.95rem;
  height: 0.7rem;
  border: 2px solid var(--warn);
  border-radius: 2px;
}

.graph__caption {
  margin-top: var(--sp-3);
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   11. Evidence rows
   -------------------------------------------------------------------------- */

.evidence {
  margin: 0;
}

.evidence__row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--rule);
}

.evidence__row:last-child {
  border-bottom: 0;
}

.evidence__row dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-top: 0.12rem;
}

.evidence__row dd {
  margin: 0;
  min-width: 0;
}

.evidence__value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.evidence__note {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: 0.84rem;
}

.as-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.as-path__hop {
  color: var(--ink);
}

.as-path__hop:last-child {
  color: var(--accent);
  font-weight: 600;
}

.as-path__sep {
  color: var(--route);
}

.origin-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.origin-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.origin-list .asn {
  font-family: var(--font-mono);
  font-weight: 600;
}

.origin-list .holder {
  color: var(--muted);
  font-size: 0.9rem;
}

.share-url {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.flag-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* --------------------------------------------------------------------------
   12. Choices
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.filter-bar .input {
  flex: 1 1 16rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.filter-bar__count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: auto;
}

.filter-bar__clear {
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom-color: transparent;
}

.filter-bar__clear:hover {
  color: var(--ink);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.pager__status {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.pager [aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

.group-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: var(--sp-6) 0 var(--sp-3);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.group-title .count {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--faint);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.option-grid li[hidden] {
  display: none;
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  box-shadow: var(--shadow-1);
}

.option:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option::after {
  content: "→";
  color: var(--faint);
  font-family: var(--font-sans);
}

.option:hover::after {
  color: var(--accent);
}

.empty-note {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   13. Prose (methodology)
   -------------------------------------------------------------------------- */

.prose {
  max-width: var(--measure);
}

.prose h2 {
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.prose p {
  margin-top: var(--sp-4);
  color: var(--ink-2);
  text-wrap: pretty;
}

.prose strong {
  color: var(--ink);
}

.prose code {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.85em;
}

.prose__foot {
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   14. Error / notice pages
   -------------------------------------------------------------------------- */

.notice {
  max-width: 36rem;
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-6);
}

.notice__code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--route);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   15. Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-5);
  z-index: 80;
  transform: translate(-50%, 0.5rem);
  padding: 0.5rem 0.95rem;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 48rem) {
  .shell-head__inner,
  .shell-main,
  .shell-main--narrow,
  .shell-main--mid,
  .shell-foot__inner {
    width: calc(100% - 2 * var(--sp-4));
  }

  .shell-main {
    padding-top: var(--sp-5);
    padding-bottom: var(--sp-7);
  }

  .nav__link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .search__row {
    flex-direction: column;
  }

  .search__input {
    padding-right: 0.9rem;
  }

  .stats > div {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .stats > div:last-child {
    border-bottom: 0;
  }

  .evidence__row {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }

  .graph__stage {
    max-height: 24rem;
    padding: var(--sp-2);
  }
}

@media (max-width: 30rem) {
  .nav__link--hide-sm {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   17. Print — snapshots are meant to be cited
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --paper: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --ink: #000;
    --ink-2: #222;
    --muted: #444;
    --rule: #bbb;
  }

  .shell-head,
  .search,
  .graph__tools,
  .btn,
  .toast {
    display: none !important;
  }

  .card,
  .stats {
    box-shadow: none;
    break-inside: avoid;
  }

  .graph__stage {
    max-height: none;
    background-image: none;
    overflow: visible;
  }

  a {
    border-bottom: 0;
    color: #000;
  }
}
