/* ZM Acts Intelligence — colour system derived from the Zambian flag:
   green (the field, dominant), orange (the eagle / copper), red (the
   freedom struggle) and black (the people). Black and white do real
   structural work here (ink/ground), not just decoration — the accents are
   green/orange/red. Light-theme accents sit close to the literal flag hex
   values; dark-theme accents are brighter, contrast-safe variants of the
   same three hues (tested against WCAG AA on every background this
   session). The CSS var names retain the SA port's blue/green/gold/red
   labels so the chart slots that read them by name keep working; the
   values are the Zambian hues. */

:root {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #f0f2f5;
  --border-color: #d0d7de;
  --text-primary: #1f2328;   /* flag black */
  --text-secondary: #57606a;
  --text-muted: #5d6570;
  --accent-blue: #00A651;
  --accent-green: #198A00;
  --accent-gold: #EF7D00;
  --accent-red: #D10909;
  --accent: var(--accent-blue);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 20px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-primary: #0d1017;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --border-color: #30363d;
    --text-primary: #e6edf3;  /* flag white */
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #2BC06D;
    --accent-green: #4CC35B;
    --accent-gold: #FF9A3D;
    --accent-red: #F04438;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0d1017;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --border-color: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #2BC06D;
  --accent-green: #4CC35B;
  --accent-gold: #FF9A3D;
  --accent-red: #F04438;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] { color-scheme: light; }

@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html, body { height: 100%; }
/* Nothing may scroll the PAGE sideways. Wide content (the timeline ribbon,
   the sector heatmap, tables) scrolls inside its own container instead —
   those set overflow-x themselves. A stray long token or an over-wide grid
   otherwise drags the whole document, and every page then has a bottom
   scrollbar that has nothing to do with the content the reader wants. */
html, body { max-width: 100%; overflow-x: hidden; }
/* Long unbroken strings (URNs, citations, OCR runs) are the usual culprit —
   let them wrap rather than force the layout wider. */
body { overflow-wrap: break-word; }
body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }

/* ── Site header ────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 105.6px; width: auto; }
/* Logo swap: same three-block pattern as the token overrides above
   (explicit [data-theme] wins over prefers-color-scheme, which wins over
   the light-mode default) — proven working pattern, same as the fix
   applied to the old actintel earlier tonight. */
.brand__logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__logo-light { display: none; }
  :root:not([data-theme="light"]) .brand__logo-dark { display: block; }
}
:root[data-theme="dark"] .brand__logo-light { display: none; }
:root[data-theme="dark"] .brand__logo-dark { display: block; }
.brand__slogan {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}
.site-nav a:hover { background: var(--bg-card); color: var(--text-primary); }
.site-nav a[aria-current="page"] { color: var(--accent-blue); background: var(--bg-card); }

/* ── Page layout ────────────────────────────────────────────────────── */
.page-header { padding: 28px 0 20px; }
.page-title {
  font-family: "Spectral", Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.page-subtitle { color: var(--text-secondary); font-size: 13.5px; margin: 0; }

/* ── Stat tiles (Dashboard) ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 20px 0 32px;
}
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.stat-card b {
  display: block;
  font-family: "Spectral", serif;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-card i {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Search box ─────────────────────────────────────────────────────── */
.search-box { position: relative; margin: 0 0 8px; max-width: 640px; }
.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--accent-blue); }

/* ── Cards / results ────────────────────────────────────────────────── */
.section-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 28px 0 12px;
}
.results { display: flex; flex-direction: column; gap: 10px; }

/* ── Abbreviations reference ───────────────────────────────────────── */
.abbr-list { display: flex; flex-direction: column; margin-bottom: 20px; }
.abbr-row {
  display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 16px;
  padding: 7px 0; border-bottom: 1px solid var(--border-color); font-size: 12.5px;
}
.abbr-row:last-child { border-bottom: none; }
.abbr-row__abbr { font-weight: 600; color: var(--accent-blue); }
.abbr-row__full { color: var(--text-secondary); }
@media (max-width: 600px) {
  .abbr-row { grid-template-columns: 1fr; gap: 2px; }
}

.card {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s;
}
.card:hover { border-color: var(--accent-blue); }
.card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card__title { font-family: "Spectral", serif; font-weight: 600; font-size: 16px; margin: 0; color: var(--text-primary); }
.card__citation { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex: none; }
.card__summary {
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; margin: 8px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-muted); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; font-weight: 600; flex: none;
}
.pill--in-force { background: color-mix(in srgb, var(--accent-green) 14%, transparent); color: var(--accent-green); }
.pill--repealed { background: color-mix(in srgb, var(--accent-red) 14%, transparent); color: var(--accent-red); }
.pill--amended { background: color-mix(in srgb, var(--accent-gold) 14%, transparent); color: var(--accent-gold); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.empty { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 40px 0; }
.loading { text-align: center; color: var(--text-muted); font-size: 12px; padding: 30px 0; }

.error-state { text-align: center; padding: 30px 0; }
.error-state__msg { color: var(--text-secondary); font-size: 13px; margin: 0 0 12px; }
.error-state__retry {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-blue); background: transparent; color: var(--accent-blue);
  cursor: pointer;
}
.error-state__retry:hover { background: var(--accent-blue); color: #fff; }

/* ── Chips (small breakdown counts) ────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary);
}
.chip b { font-variant-numeric: tabular-nums; color: var(--text-primary); }

/* ── Horizontal bar list (severity bands, sectors) ─────────────────── */
.bar-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 28px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 4px; font-size: 12px; }
.bar-row__label { color: var(--text-secondary); }
.bar-row__n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-primary); text-align: right; }
.bar-row__track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--bg-card); overflow: hidden; }
.bar-row__fill { height: 100%; background: var(--accent-blue); border-radius: 999px; }

/* ── Structured penalty tables (offence_section / severity_tier rows) ─ */
.penalty-group {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow);
}
.penalty-group__title {
  font-family: "Spectral", serif; font-weight: 600; font-size: 15px;
  display: block; text-decoration: none; color: var(--text-primary); margin-bottom: 2px;
}
.penalty-group__title:hover { color: var(--accent-blue); }
.penalty-group__meta { font-size: 11px; color: var(--text-muted); margin: 0 0 10px; }
.penalty-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 7px 0; border-top: 1px solid var(--border-color); font-size: 12.5px;
}
.penalty-row:first-of-type { border-top: none; }
.penalty-row__desc { color: var(--text-secondary); }
.penalty-row__val { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; text-align: right; flex: none; }
.penalty-row__tag {
  font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600;
  margin-left: 8px; color: var(--accent-gold); vertical-align: middle;
}

/* ── Cross-references (Act Reader Cites/Cited By, analytics page) ───── */
.xref-list { display: flex; flex-direction: column; margin-bottom: 8px; }
.xref-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 8px 0; border-top: 1px solid var(--border-color); font-size: 12.5px;
}
.xref-row:first-child { border-top: none; }
.xref-row__name { color: var(--text-primary); text-decoration: none; }
.xref-row__name:hover { color: var(--accent-blue); }
.xref-row__name--unresolved { color: var(--text-muted); font-style: italic; }
.xref-row__meta { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.xref-row__n {
  font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums;
  flex: none; background: var(--bg-card); border-radius: 999px; padding: 2px 9px; font-size: 11px;
}
.xref-more { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Filter bar (Obligations / Exceptions) ─────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.filter-btn {
  font-family: inherit; font-size: 11.5px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-color); background: var(--bg-secondary);
  color: var(--text-secondary); cursor: pointer; transition: border-color .12s, color .12s;
}
.filter-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.filter-btn[aria-pressed="true"] {
  border-color: var(--accent-blue); color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 10%, transparent); font-weight: 600;
}
.filter-btn b { font-variant-numeric: tabular-nums; }

/* ── Clause list (obligation / exception rows) ─────────────────────── */
.clause-list { display: flex; flex-direction: column; gap: 10px; }
.clause {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 14px 16px;
  border-left: 3px solid var(--border-color);
}
.clause--obligation { border-left-color: var(--accent-blue); }
.clause--prohibition { border-left-color: var(--accent-red); }
.clause--permission { border-left-color: var(--accent-green); }
.clause__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.clause__act { font-size: 11.5px; color: var(--text-muted); text-decoration: none; }
.clause__act:hover { color: var(--accent-blue); }
.clause__text { font-size: 12.5px; line-height: 1.65; color: var(--text-primary); margin: 0; }
.clause__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 9px; letter-spacing: .05em; text-transform: uppercase; font-weight: 600;
  padding: 2px 7px; border-radius: 3px; background: var(--bg-card); color: var(--text-secondary);
}
.tag--type { color: var(--accent-blue); }
.tag--muted { color: var(--text-muted); font-style: italic; text-transform: none; letter-spacing: 0; }

/* ── Pagination ────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 24px 0 0; }
.pager__btn {
  font-family: inherit; font-size: 12.5px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-secondary);
  color: var(--text-primary); cursor: pointer;
}
.pager__btn:hover:not(:disabled) { border-color: var(--accent-blue); color: var(--accent-blue); }
.pager__btn:disabled { opacity: .4; cursor: not-allowed; }
.pager__status { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Act graph ─────────────────────────────────────────────────────── */
.graph-canvas-wrap {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  height: 560px; overflow: hidden;
}
.graph-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 12px; }
.graph-legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-secondary); }
.graph-legend__item i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.graph-hint {
  font-size: 11.5px; color: var(--text-muted); text-align: center;
  margin: 10px 0 0; min-height: 1.4em;
}
@media (max-width: 640px) { .graph-canvas-wrap { height: 400px; } }

/* ── Inline explainer ("?" affordance + panel) ─────────────────────── */
.info {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 5px; flex: none;
  border-radius: 50%; border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-muted);
  font-size: 9px; font-weight: 600; font-style: normal; cursor: help;
  letter-spacing: 0; text-transform: none; vertical-align: middle;
}
.info:hover, .info:focus-visible { border-color: var(--accent-blue); color: var(--accent-blue); }
.info:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.info__panel {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px);
  z-index: 40; width: 290px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 5px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 11.5px; font-weight: 400; line-height: 1.5; text-align: left;
  color: var(--text-secondary); white-space: normal; letter-spacing: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.info:hover .info__panel, .info:focus-visible .info__panel {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
/* Near the right edge the centred panel would overflow the viewport; this
   variant anchors it to the badge's right instead. */
.info--right .info__panel { left: auto; right: 0; transform: translate(0, 4px); }
.info--right:hover .info__panel, .info--right:focus-visible .info__panel { transform: translate(0, 0); }
.info__panel b { color: var(--text-primary); font-size: 12px; }
.info__how { color: var(--text-muted); font-size: 10.5px; }
.info__caveat {
  color: var(--accent-gold); font-size: 10.5px;
  border-top: 1px solid var(--border-color); padding-top: 5px;
}
@media (prefers-reduced-motion: reduce) { .info__panel { transition: none; } }

/* ── Horizontal timeline ───────────────────────────────────────────── */
.wrap--wide { max-width: 1400px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: 0 0 14px; font-size: 11px; color: var(--text-secondary); }
.tl-legend__item { display: inline-flex; align-items: center; gap: 7px; }
.tl-legend__hint { margin-left: auto; color: var(--text-muted); font-style: italic; }
.tl-swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.tl-swatch--acts { background: var(--accent-blue); }
.tl-swatch--amend { background: var(--accent-gold); }
.tl-swatch--event { background: var(--accent-red); border-radius: 50%; }

.tl-scroll {
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  padding: 0 40px;
}
.tl-strip { position: relative; height: 470px; }

.tl-eras { position: absolute; inset: 0; }
.tl-era {
  position: absolute; top: 150px; bottom: 150px;
  border-left: 1px solid; border-right: 1px solid; border-radius: 3px;
  display: flex; flex-direction: column; justify-content: flex-start;
  padding-top: 6px; overflow: hidden;
}
.tl-era__name { font-size: 10.5px; font-weight: 600; color: var(--text-primary); padding-left: 7px; white-space: nowrap; }
.tl-era__years { font-size: 9px; color: var(--text-muted); padding-left: 7px; white-space: nowrap; }

/* Columns hang off a single shared baseline: new Acts grow UP from it,
   amendments grow DOWN. Absolute positioning against that one line is what
   makes the two directions actually comparable — an earlier flex version
   stacked both below the year axis, which read as one odd bar per year
   rather than a divergence around a common zero. */
.tl-cols { position: absolute; inset: 0; }
.tl-col { position: absolute; top: 0; width: 26px; height: 100%; cursor: default; }
.tl-col:hover .tl-col__acts, .tl-col:hover .tl-col__amend { filter: brightness(1.4); }
.tl-col__acts {
  position: absolute; bottom: 170px; left: 7px; width: 12px;
  background: var(--accent-blue); border-radius: 2px 2px 0 0; opacity: .85;
}
.tl-col__base {
  position: absolute; bottom: 169px; left: 0; width: 100%; height: 1px;
  background: var(--border-color);
}
.tl-col__amend {
  position: absolute; top: 301px; left: 7px; width: 12px;
  background: var(--accent-gold); border-radius: 0 0 2px 2px; opacity: .8;
}
.tl-col__year {
  position: absolute; top: 360px; left: 0; width: 100%; text-align: center;
  font-size: 9.5px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}

.tl-callouts { position: absolute; inset: 0; pointer-events: none; }
.tl-callout { position: absolute; width: 0; pointer-events: auto; }
.tl-callout__dot {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-red); left: -4px; top: 186px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-red) 22%, transparent);
}
.tl-callout__stem { position: absolute; left: -0.5px; width: 1px; background: var(--accent-red); opacity: .5; }
.tl-callout--high .tl-callout__stem { top: 96px; height: 92px; }
.tl-callout--low .tl-callout__stem { top: 191px; height: 92px; }
.tl-callout__card {
  position: absolute; left: -104px; width: 208px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 8px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.tl-callout--high .tl-callout__card { top: 10px; }
.tl-callout--low .tl-callout__card { top: 286px; }
.tl-callout__card b { font-size: 11px; color: var(--text-primary); line-height: 1.35; }
.tl-callout__card span { font-size: 10px; color: var(--text-secondary); line-height: 1.45; }

/* ── Heatmap (sector x decade) ─────────────────────────────────────── */
.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heatmap { display: grid; gap: 2px; min-width: 640px; }
.heatmap__corner { }
.heatmap__colhead, .heatmap__rowhead {
  font-size: 10px; color: var(--text-muted); display: flex; align-items: center;
}
.heatmap__colhead { justify-content: center; }
.heatmap__rowhead {
  padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.heatmap__cell {
  aspect-ratio: 1 / 1; min-height: 26px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; color: var(--text-primary); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-color);
}

/* ── Section amendment/repeal badges (Act Reader) ──────────────────── */
.provision--amended { border-left: 3px solid var(--accent-gold); padding-left: 12px; }
.provision--repealed { border-left: 3px solid var(--accent-red); padding-left: 12px; }

.amend-badge {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  font-size: 9px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin-left: 8px; cursor: help;
  vertical-align: middle; font-variant-numeric: tabular-nums;
}
.amend-badge--amended {
  background: color-mix(in srgb, var(--accent-gold) 16%, transparent); color: var(--accent-gold);
}
.amend-badge--repealed {
  background: color-mix(in srgb, var(--accent-red) 16%, transparent); color: var(--accent-red);
}
.amend-badge:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* Hover/focus panel. Positioned above the badge and pinned to its left edge;
   `white-space: normal` because the badge itself is uppercase+letter-spaced
   and those would otherwise inherit into the panel text. */
.amend-badge__panel {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30;
  min-width: 240px; max-width: 380px; padding: 10px 12px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 11.5px; font-weight: 400; letter-spacing: 0; text-transform: none;
  line-height: 1.55; color: var(--text-secondary); white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.amend-badge:hover .amend-badge__panel,
.amend-badge:focus-visible .amend-badge__panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) { .amend-badge__panel { transition: none; } }

/* Audit banner: states coverage honestly at the top of an Act. */
.amend-audit {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 10px 14px; margin: 0 0 18px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 11.5px; color: var(--text-secondary);
}
.amend-audit__dot { display: inline-flex; align-items: center; gap: 6px; }
.amend-audit__dot i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ── "Who holds power" (Check Exposure doors) ──────────────────────── */
.power-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.power-row {
  display: grid; grid-template-columns: minmax(110px, 170px) 1fr; gap: 12px;
  font-size: 11.5px; padding: 5px 0; border-bottom: 1px solid var(--border-color);
}
.power-row:last-child { border-bottom: none; }
.power-row__actor { font-weight: 600; color: var(--accent-gold); }
.power-row__verbs { color: var(--text-secondary); }
@media (max-width: 600px) { .power-row { grid-template-columns: 1fr; gap: 2px; } }

/* ── Pagination ─────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 28px 0; }
.pagination button, .pagination span {
  font-family: inherit; font-size: 13px; padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .pagination__current { color: var(--text-muted); border: none; background: none; }

/* ── Act detail / reader ────────────────────────────────────────────── */
.detail__back {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted);
  text-decoration: none; margin-bottom: 20px;
}
.detail__back:hover { color: var(--accent-blue); }
.detail__head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.detail__title { font-family: "Spectral", serif; font-weight: 600; font-size: 26px; margin: 0; text-wrap: balance; }
.detail__meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.detail__summary { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); max-width: 68ch; }

.pdf-link { color: var(--accent-blue); text-decoration: none; font-weight: 600; border-bottom: 1px solid transparent; }
.pdf-link:hover { border-bottom-color: var(--accent-blue); }

.timeline { margin: 24px 0; display: flex; flex-direction: column; gap: 2px; }
.timeline__item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border-color); font-size: 12.5px; }
.timeline__item:last-child { border-bottom: none; }
.timeline__date { color: var(--text-muted); font-variant-numeric: tabular-nums; flex: none; width: 90px; }
.timeline__body { flex: 1; }
.timeline__body b { font-weight: 600; }

.provisions { display: flex; flex-direction: column; gap: 14px; }
.provision { border-left: 2px solid var(--border-color); padding-left: 14px; }
.provision__ref { font-size: 11px; color: var(--accent-blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.provision__title { font-family: "Spectral", serif; font-weight: 600; font-size: 14px; margin: 2px 0 6px; }
.provision__content { font-size: 12.5px; line-height: 1.7; max-width: 100%; overflow-x: auto; }
.provision__line { margin-bottom: 6px; }
.provision__line:last-child { margin-bottom: 0; }
.provision__table { border-collapse: collapse; margin: 6px 0 10px; font-size: 12px; }
.provision__table td { padding: 3px 10px 3px 0; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.provision__table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.provision__table tr:last-child td { border-bottom: none; }

@keyframes provision-highlight {
  from { background: color-mix(in srgb, var(--accent-blue) 10%, transparent); }
  to { background: transparent; }
}
.provision--highlight { animation: provision-highlight 2.5s ease-out; }

.flag {
  display: inline-block; font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 700; padding: 2px 6px; border-radius: 999px; margin-left: 4px; cursor: default;
}
.flag--repealed { background: color-mix(in srgb, var(--accent-red) 14%, transparent); color: var(--accent-red); }
.flag--amended { background: color-mix(in srgb, var(--accent-gold) 14%, transparent); color: var(--accent-gold); }

/* ── Role select (Check Exposure) ──────────────────────────────────── */
.role-select { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; font-size: 13px; color: var(--text-secondary); }
.role-select select {
  font-family: inherit; font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary);
}

/* ── Obligation cards / penalty rows ────────────────────────────────── */
.obligation-card, .penalty-row {
  display: block; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary);
  text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-color); margin-bottom: 6px;
}
a.obligation-card:hover, a.penalty-row:hover { border-left-color: var(--accent-blue); background: var(--bg-card); }
.penalty-row__figures { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.penalty-row__text { color: var(--text-muted); }

/* ── Doors (Check Exposure) ─────────────────────────────────────────── */
.doors { display: flex; flex-direction: column; gap: 20px; }
.door {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 18px 20px;
}
.door__title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 10px; }
.door--must .door__title { color: var(--accent-red); }
.door--must-not .door__title { color: var(--accent-red); }
.door--consequences .door__title { color: var(--accent-gold); }
.door--escape .door__title { color: var(--accent-green); }
.door__items { display: flex; flex-direction: column; gap: 10px; }
.severity-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
}
.severity-badge--high { background: color-mix(in srgb, var(--accent-red) 16%, transparent); color: var(--accent-red); }
.severity-badge--medium { background: color-mix(in srgb, var(--accent-gold) 16%, transparent); color: var(--accent-gold); }
.severity-badge--low { background: color-mix(in srgb, var(--accent-green) 16%, transparent); color: var(--accent-green); }
.integrity-flags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.integrity-flag {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border-color);
}

footer { text-align: center; font-size: 10.5px; color: var(--text-muted); margin-top: 60px; line-height: 1.7; }

@media (max-width: 700px) {
  .site-header { padding: 14px 16px; }
  .wrap { padding: 0 16px 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Theme toggle + cross-site link (site header) ──────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 11.5px; font-weight: 500;
  padding: 7px 13px; margin-left: 4px;
  border-radius: 999px; border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer;
  transition: border-color .12s, color .12s;
}
.theme-toggle:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
.theme-toggle__icon { width: 11px; height: 11px; border-radius: 50%; background: currentColor; flex: none; }
.site-nav__cross { color: var(--accent-green) !important; font-weight: 600; }
