/* JCStream — public-records mirror.
   Editorial dark theme: warm gray, no gradients, no glass, no glow.
   Reference points: The Marshall Project, ProPublica, Texas Tribune, Documented NY. */

:root {
  --bg:           #14181f;
  --bg-soft:      #181d25;
  --surface:      #1c2128;
  --surface-hi:   #232932;
  --border:       #2a313c;
  --border-hi:    #3b4350;

  --fg:           #ecedef;
  --fg-soft:      #c3c7cf;
  --fg-muted:     #939aa6;
  --fg-dim:       #7c828f;     /* lifted from #5a606d for WCAG AA on dim text */

  --accent:       #d4915c;     /* muted amber, used sparingly */
  --accent-hi:    #e8a978;
  --danger:       #df6b6b;     /* felony — lightened for AA on its tinted chip */
  --danger-deep:  #d65a5a;
  --warn:         #c0883a;     /* warning text, banner */
  --misd:         #6c97c4;     /* misdemeanor — slate blue, NOT orange */
  --family:       #c79a6a;     /* family/domestic — its own muted tone, not homicide-red */
  --ok:           #6aa572;

  --radius:       8px;
  --radius-sm:    5px;

  --masthead-h:   54px;
  --monthnav-h:   34px;

  --font-sans:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif:   Charter, "Bitstream Charter", "Sitka Text", Cambria, "Source Serif Pro", Georgia, serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
/* Cross-document view transitions (Chrome/Safari) — a soft cross-fade between
   the roster and a detail page; degrades to a normal navigation everywhere. */
@view-transition { navigation: auto; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0; top: -3rem;
  z-index: 100;
  background: var(--accent); color: #14181f;
  padding: 0.5rem 0.85rem; border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700; font-size: 0.85rem; text-decoration: none;
}
.skip-link:focus { top: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

body {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }
a.plain, a.plain:hover { color: inherit; text-decoration: none; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ===== Top bar (masthead, sticky) ===== */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.masthead-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: var(--masthead-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.masthead .brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.masthead .brand:hover { text-decoration: none; }
.masthead .running {
  color: var(--fg-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.masthead .spacer { flex: 1; }
.masthead .nav-link {
  color: var(--fg-soft);
  font-size: 0.84rem;
}
.masthead .nav-link:hover { color: var(--fg); }

/* Month chip-nav (second sticky row) — leaner: small text links, right-edge fade. */
.month-nav {
  position: sticky;
  top: var(--masthead-h);
  z-index: 19;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}
.month-nav-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.4rem 1.25rem;
  height: var(--monthnav-h);
  display: flex;
  gap: 0.85rem;
  align-items: center;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.month-nav-inner::-webkit-scrollbar { height: 0; }
.month-nav .chip {
  flex: 0 0 auto;
  font-size: 0.76rem;
  color: var(--fg-muted);
  text-decoration: none;
  scroll-snap-align: start;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.month-nav .chip strong { color: var(--fg-soft); margin-left: 0.2rem; font-weight: 700; }
.month-nav .chip:hover { color: var(--fg); text-decoration: underline; }

/* ===== Page ===== */
.page {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 5rem;
}
/* The inmate detail page is one column of text + a table — a wide measure
   reads badly and makes the bio labels/values look adrift. Constrain it. */
body.detail .page { max-width: 62rem; }
body.detail .month-nav { display: none; }

/* ===== Disclaimer banner (front-loaded, not footer) ===== */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1.05rem;
  background: rgba(192,136,58,.06);
  border: 1px solid rgba(192,136,58,.25);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--fg-soft);
}
.banner strong { color: var(--warn); }

/* ===== Hero ===== */
.hero {
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.hero .stat {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 0.4rem;
  font-variant-numeric: tabular-nums;
}
.hero .stat-label {
  color: var(--fg-soft);
  font-size: 1.02rem;
  margin: 0;
}
.hero .meta {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ===== Section headings ===== */
.section-h {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}
.section-h h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.section-h .pill {
  background: transparent;
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--fg-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.section-h .grow { flex: 1; }
.section-h .meta { color: var(--fg-muted); font-size: 0.78rem; }

/* ===== Month section ===== */
.month {
  margin-top: 2rem;
  scroll-margin-top: calc(var(--masthead-h) + var(--monthnav-h) + 0.5rem);
}
.month > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.6rem 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  user-select: none;
}
.month > summary::-webkit-details-marker { display: none; }
.month > summary::after {
  content: "▾";
  color: var(--fg-dim);
  margin-left: auto;
  font-size: 0.9rem;
  transition: transform 120ms;
}
.month[open] > summary::after { transform: rotate(180deg); }
.month > summary:hover { color: var(--fg); }
.month > summary h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.month > summary .count {
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* "Crimes of <Month>" — one collapsible line. Summary shows the top 4
   inline; expanding reveals the full count grid. Keeps months compact. */
details.coms { margin: 0.5rem 0 0.9rem; }
details.coms > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0;
  user-select: none;
}
details.coms > summary::-webkit-details-marker { display: none; }
details.coms > summary::after {
  content: "▾";
  color: var(--fg-dim);
  font-size: 0.8rem;
}
details.coms[open] > summary::after { content: "▴"; }
.coms-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.coms-top { font-size: 0.68rem; }            /* small chips (reuse .chap colors) */
.coms-top strong, .coms-grid strong { margin-left: 0.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.coms-more { font-size: 0.72rem; color: var(--fg-dim); }
.coms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  margin-top: 0.55rem;
}
.coms-grid .chap { font-size: 0.66rem; }

/* Filter bar (revealed by JS; hidden by default so JS-off users see no
   broken control). */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.84rem;
  color: var(--fg-soft);
}
.filter-bar label { display: inline-flex; align-items: center; gap: 0.4rem; }
.filter-bar select,
.filter-bar input[type="search"] {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font: inherit;
}
.filter-bar input[type="search"] { min-width: 14rem; }
.filter-bar .filter-count { color: var(--fg-muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* Search-results dropdown (type-ahead over search.json). */
.search-wrap { position: relative; }
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 25;
  width: max-content;
  min-width: 20rem;
  max-width: min(28rem, 90vw);
  max-height: 22rem;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  padding: 0.25rem;
}
.search-results .sr-empty { padding: 0.5rem 0.6rem; color: var(--fg-muted); font-size: 0.85rem; }
.sr-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
}
.sr-item:hover, .sr-item:focus-visible { background: rgba(110,168,255,.10); text-decoration: none; }
.sr-item .sr-tier {
  grid-row: span 2;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  width: 1.2rem; text-align: center;
  border-radius: 3px;
  padding: 1px 0;
}
.sr-tier.sr-felony      { background: rgba(168,72,72,.20);  color: #c98a8a; }
.sr-tier.sr-misdemeanor { background: rgba(79,111,149,.20); color: #9ab4d3; }
.sr-tier.sr-x           { background: rgba(138,144,156,.16); color: var(--fg-soft); }
.sr-item .sr-name { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item .sr-charge { font-size: 0.74rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.02em; }
.card-inmate.is-filtered-out { display: none; }
details.month.is-empty { display: none; }

/* ===== Cards ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.65rem;
  align-items: start;          /* don't stretch short cards to match a tall one */
  margin-top: 0.5rem;
  container-type: inline-size;  /* card internals respond to the grid's own width */
}
/* Narrow column (e.g. one-card-wide on a phone): tighten the card a touch. */
@container (max-width: 24rem) {
  .card-inmate { padding: 0.55rem 0.6rem; gap: 0.55rem; }
  .card-inmate .name { padding-right: 2.2rem; }
  .card-inmate .charge { font-size: 0.9rem; }
  .tier-corner { top: 0.4rem; right: 0.4rem; }
  .tier-tip { left: 0; right: auto; }
}
.card-inmate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  position: relative;          /* tooltip anchor; no overflow:hidden so the
                                  tier-badge tooltip can escape the card */
}
.card-inmate:hover { border-color: var(--border-hi); }
.thumb {
  width: 48px;
  height: 60px;
  flex: 0 0 auto;
  background: var(--surface-hi);
  border-radius: 3px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.03em;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Faceless, neutral — a designed "no photo" state, not a colored feature. */
.thumb.thumb-placeholder { color: var(--fg-dim); }

.card-inmate .meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
/* Name leads (full white), one line; reserves only the width of the compact
   corner badge ("FEL ×3" ≈ 2.6rem). */
.card-inmate .name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--fg);
  margin: 0;
  padding-right: 2.4rem;       /* clears the compact corner badge ("F ×2") */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-inmate .name a:hover { text-decoration: underline; }
/* The charge: bold, uppercase, vivid color by offense category. We show the
   clean CATEGORY ("DRUG POSSESSION", "OVI / DUI"), not HCSO's raw string. */
.card-inmate .charge {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.18;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--cat, var(--fg));
  margin: 0;
}
.card-inmate .charge .ct-count {
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: none;
  color: var(--fg-muted);
  white-space: nowrap;
}
/* Plain (untinted) id chip — just a quiet mono line, a link to the record. */
.card-inmate .id-chip {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-dim);
  text-decoration: none;
  margin-top: 0.1rem;
}
.card-inmate .id-chip:hover { color: var(--fg-muted); text-decoration: underline; }
/* ===== ONE color system — offense category drives every colored element ====
   Each category class sets a single --cat hue; .charge / .chap / .id-chip all
   consume it (text = the hue, tints via color-mix). The felony/misdemeanor
   tier badge is a separate, deliberately-muted axis (maroon vs. slate-blue)
   so it never competes with the category hue.

   Category palette (severity-feel, but each category has ONE fixed color):
     violence (2903/2907) ... red      drugs (2925) ........ violet
     weapons (2923) ......... orange   theft/fraud (2913) .. teal
     property (2911) ........ amber    family/domestic ..... rose
     low-severity (traffic) . slate
*/
/* One --cat hue per offense category. Any element with a charge-*/chap-*/cat-*
   class gets it; consumers fall back gracefully via var(--cat, default). */
.charge-2903, .chap-2903, .cat-2903     { --cat: #ef6b6b; }   /* violence / sex */
.charge-2907, .chap-2907, .cat-2907     { --cat: #ef6b6b; }
.charge-2923, .chap-2923, .cat-2923     { --cat: #e0934a; }   /* weapons */
.charge-2911, .chap-2911, .cat-2911     { --cat: #d6a85c; }   /* burglary / property */
.charge-2913, .chap-2913, .cat-2913     { --cat: #5fccaa; }   /* theft / fraud */
.charge-2925, .chap-2925, .cat-2925     { --cat: #c79ae0; }   /* drugs */
.charge-family, .chap-family, .cat-family { --cat: #dd8aa0; } /* family / domestic */
.charge-traffic, .chap-traffic, .cat-traffic { --cat: #9aa0ac; } /* traffic / other */

/* detail-page bio uses <code class="id-felony|id-misdemeanor"> — keep tier-tinted there */
code.id-felony      { color: var(--danger); }
code.id-misdemeanor { color: var(--misd); }

/* Tier badge — felony / misdemeanor. Muted maroon / slate so it doesn't fight
   the vivid category hues. This is the only place tier color appears. */
.tier {
  display: inline-block;
  position: relative;          /* tooltip anchor */
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  white-space: nowrap;
  cursor: default;
}
.tier-felony      { background: rgba(168,72,72,.20);  color: #c98a8a; border: 1px solid rgba(168,72,72,.40); }
.tier-misdemeanor { background: rgba(79,111,149,.20); color: #9ab4d3; border: 1px solid rgba(79,111,149,.40); }
.tier-other       { background: rgba(138,144,156,.16); color: var(--fg-soft); border: 1px solid var(--border-hi); }

/* Tier badge pinned to the top-right corner of each card. No z-index: it's
   position:absolute so it already paints above the card's (non-positioned)
   text, and giving it a z-index would create a stacking context that traps
   the tooltip below the *next* card's badge. */
.card-inmate > .tier.tier-corner {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
}
/* Hover/focus tooltip on the tier badge: compact list of this inmate's charges
   (ORC code · degree · offense). Pure CSS — vanishes on mouseout. */
.tier-tip {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 5px);
  z-index: 50;
  display: none;
  width: max-content;
  min-width: 13rem;
  max-width: min(22rem, calc(100vw - 2rem));   /* never clip on a phone */
  padding: 0.4rem 0.55rem;
  background: var(--bg-soft);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-soft);
  white-space: normal;
  line-height: 1.5;
  text-align: left;
}
.tier:hover .tier-tip,
.tier:focus-visible .tier-tip,
.tier:focus-within .tier-tip { display: block; }
.tier-tip .tip-head { display: block; color: var(--fg); font-weight: 800; margin-bottom: 0.25rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--border); }
.tier-tip .tip-row { display: block; }
.tier-tip .tip-row b { color: var(--fg); font-weight: 700; }

/* Chapter / category pill — used on the detail-page hero, the chapter-mix,
   and the crimes-of-month grid. Same --cat hue. */
.chap {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cat, var(--fg-soft));
  background: color-mix(in srgb, var(--cat, var(--fg-soft)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, var(--fg-soft)) 28%, transparent);
}

/* Public-commentary section on inmate pages */
.comments { margin-top: 2rem; }
.comment-policy {
  background: rgba(192,136,58,.05);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  margin: 0 0 1rem;
  font-size: 0.82rem;
}
.comment-policy strong { color: var(--warn); }

/* Compact legend below the filter bar. */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin: -0.2rem 0 1.5rem;
  align-items: center;
}
.legend .swatch { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--cat, var(--fg-muted)); flex: 0 0 auto; }
.legend .tier { line-height: 1; }

/* ===== Recent Activity (different from main roster) ===== */
.recent-activity {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 2rem;
}
.recent-activity .section-h { margin-top: 0.2rem; border-bottom-color: var(--border-hi); }
.recent-activity .cards {
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.55rem;
}
.recent-activity .card-inmate { padding: 0.6rem; background: var(--surface-hi); }
.recent-activity .card-inmate .thumb { width: 46px; height: 58px; font-size: 0.85rem; }
.recent-activity .card-inmate .name { font-size: 0.87rem; }
.recent-activity .card-inmate .charge { font-size: 0.78rem; }
.recent-activity .event-line {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.68rem; margin-bottom: 0.2rem;
}
.recent-activity .event-line time {
  color: var(--fg-dim); font-family: var(--font-mono); font-size: 0.68rem;
}
.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tag-booked   { background: rgba(214,90,90,.16); color: var(--danger); border: 1px solid rgba(214,90,90,.35); }
.tag-released { background: rgba(106,165,114,.16); color: var(--ok); border: 1px solid rgba(106,165,114,.35); }
.tag-updated  { background: rgba(192,136,58,.16); color: var(--warn); border: 1px solid rgba(192,136,58,.35); }
.released-name { color: var(--fg-muted); text-decoration: line-through; }

/* ===== Open-data activity lists ===== */
.cfs { list-style: none; padding: 0; margin: 0; }
.cfs li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
.cfs li:last-child { border-bottom: 0; }
.cfs time { color: var(--fg-dim); font-family: var(--font-mono); font-size: 0.76rem; }
.cfs-disposition { color: var(--warn); font-weight: 600; font-size: 0.8rem; }

/* ===== Inmate detail page ===== */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb span[aria-hidden] { margin: 0 0.35rem; color: var(--fg-dim); }

.inmate-hero {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.inmate-hero .record-name {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin: 0 0 0.4rem;
  letter-spacing: -0.015em;
  font-weight: 700;
  line-height: 1.05;
}
.inmate-hero .alert {
  display: block;
  color: var(--warn);
  background: rgba(192,136,58,.06);
  border-left: 3px solid var(--warn);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin: 0 0 0.85rem;
}
/* Photo demoted: small, unframed, captioned — public record, not a portrait. */
.inmate-hero .record-photo {
  margin: 1.25rem 0 0;
  max-width: 120px;
}
.inmate-hero .record-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}
.inmate-hero .record-photo figcaption {
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-top: 0.3rem;
}
.tier-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.bio {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  column-gap: 1.5rem;
  row-gap: 0.3rem;
  font-size: 0.9rem;
  max-width: 30rem;
  margin: 0.9rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.bio dt {
  color: var(--fg-muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  align-self: baseline;
  padding-top: 0.1rem;
}
.bio dd { margin: 0; color: var(--fg); }
.chapter-mix { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.85rem; font-size: 0.85rem; }
.chapter-mix strong { margin-left: 0.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }

table.charges {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.86rem;
}
table.charges thead th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
table.charges tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.charges tbody tr:last-child td { border-bottom: 0; }
.orc-code { font-family: var(--font-mono); }
.orc-title { color: var(--fg-muted); font-size: 0.78rem; }
.source { font-size: 0.78rem; color: var(--fg-muted); margin-top: 1.25rem; }
.muted { color: var(--fg-muted); font-size: 0.85rem; }

.statute-context { display: grid; gap: 0.65rem; margin-bottom: 1.25rem; }
.statute {
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.statute-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.statute-title { color: var(--fg-soft); font-weight: 500; }
.statute-meta { font-size: 0.83rem; color: var(--fg-soft); display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; }
.statute-meta strong { color: var(--fg); font-variant-numeric: tabular-nums; }

/* ===== Lightbox (single shared, JS-driven; `hidden` attr toggled) ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox[hidden] { display: none; }
.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.82);
  border: 0; padding: 0; margin: 0;
  cursor: zoom-out;
}
.lightbox-figure {
  position: relative;
  z-index: 1;
  width: min(340px, 86vw);
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 0.6rem;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.lightbox-figure img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 4px; background: var(--surface-hi); }
.lightbox-figure figcaption { padding: 0.6rem 0.4rem 0.2rem; font-size: 0.82rem; color: var(--fg-soft); text-align: center; }
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem; z-index: 2;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  color: var(--fg);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: var(--surface-hi); color: var(--fg); border-color: var(--accent); }

/* ===== Back-to-top ===== */
.back-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 15;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  color: var(--fg-soft);
  text-decoration: none;
  font-size: 1.1rem;
  opacity: 0.55;
}
.back-to-top:hover { opacity: 1; color: var(--fg); border-color: var(--accent); text-decoration: none; }

/* ===== Footer ===== */
footer.site {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer.site a { color: var(--fg-soft); }

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--fg-muted);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
}
.empty h3 { color: var(--fg); margin: 0 0 0.3rem; font-size: 1rem; }

/* ===== Stats page ===== */
.statbars { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.3rem 0 0.5rem; }
.statbar {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr minmax(4rem, max-content);
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}
.statbar-label { color: var(--fg-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statbar-track { background: var(--surface-hi); border-radius: 3px; height: 0.85rem; overflow: hidden; }
.statbar-fill { display: block; height: 100%; background: var(--accent); min-width: 1px; border-radius: 3px; }
.statbar-fill[class*="cat-"] { background: color-mix(in srgb, var(--cat, var(--accent)) 75%, transparent); }
.statbar-val { font-variant-numeric: tabular-nums; color: var(--fg); text-align: right; }
.statbar-val small { color: var(--fg-muted); font-weight: 400; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
@media (max-width: 640px) {
  .cols2 { grid-template-columns: 1fr; }
  .statbar { grid-template-columns: minmax(6rem, 9rem) 1fr minmax(3rem, max-content); gap: 0.4rem; font-size: 0.78rem; }
}

/* ===== Homepage roster-size delta + sparkline ===== */
.roster-trend {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0.4rem 0 0;
  font-size: 0.82rem; color: var(--fg-muted);
  flex-wrap: wrap;
}
.roster-trend .delta-up   { color: var(--danger); font-weight: 600; }
.roster-trend .delta-down { color: var(--ok); font-weight: 600; }
.roster-trend .delta-flat { color: var(--fg-muted); }
.sparkline { display: inline-block; vertical-align: middle; }
.sparkline polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.sparkline circle { fill: var(--accent); }

/* ===== Legal notice banner / footnotes ===== */
.banner { display: block; }
.banner p { margin: 0 0 0.5rem; line-height: 1.55; }
.banner p:last-child { margin-bottom: 0; }
.banner strong { color: var(--fg); font-weight: 700; }
.banner-fine { font-size: 0.8rem; color: var(--fg-muted); }
.banner-fine a { color: var(--fg-soft); }
.footer-legal { flex-basis: 100%; font-size: 0.72rem; color: var(--fg-dim); line-height: 1.5; }
.footer-legal strong { color: var(--fg-muted); }
.record-legal { font-size: 0.78rem; color: var(--fg-muted); line-height: 1.5; margin: 0 0 0.85rem; }
.record-legal strong { color: var(--fg-soft); }
h2.legal-anchor { scroll-margin-top: 4.5rem; margin-top: 2.4rem; padding-top: 0.8rem; border-top: 1px solid var(--border-hi); }

/* ===== Homepage dispatch map (optional — Leaflet loaded from a CDN) ===== */
.dispatch-map-section { margin: 0 0 1.6rem; }
.cfs-map {
  height: 360px;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  background: #1b212b;
  overflow: hidden;
  position: relative;
  isolation: isolate;          /* keep Leaflet's z-index stack below the sticky masthead */
}
.cfs-map.cfs-map-failed { height: auto; }
.cfs-map .leaflet-container { background: #1b212b; font: inherit; }
.cfs-map .leaflet-popup-content { font-size: 0.82rem; line-height: 1.4; margin: 0.5rem 0.7rem; }
.cfs-map .leaflet-control-attribution { font-size: 0.62rem; }
.map-legend {
  display: flex; align-items: center; gap: 0.3rem 0.9rem; flex-wrap: wrap;
  font-size: 0.72rem; color: var(--fg-muted); margin: 0.4rem 0 0;
}
.map-legend a { color: var(--fg-soft); }
.map-key { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; vertical-align: middle; margin-right: 0.1rem; }
.map-key-cfs { background: #d4915c; }
.map-key-shooting { background: #ef6b6b; }
@media (max-width: 720px) { .cfs-map { height: 280px; } }

/* ===== Print ===== */
@media print {
  :root { --bg: #fff; --bg-soft: #fff; --surface: #fff; --surface-hi: #f4f4f4;
          --border: #ccc; --border-hi: #bbb; --fg: #111; --fg-soft: #333;
          --fg-muted: #555; --fg-dim: #777; }
  html, body { background: #fff; color: #111; }
  .masthead, .month-nav, .back-to-top, .filter-bar, .legend, .lightbox,
  .comments, .tier-tip, footer.site, .dispatch-map-section { display: none !important; }
  .page { max-width: 100%; padding: 0; }
  details.month, details.coms { open: true; }
  details[open] > summary::after, details > summary::after { display: none; }
  details:not([open]) > * { display: revert !important; }   /* expand all on print */
  a { color: #111; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.7em; color: #555; }
  .card-inmate, section.card, .statute, table.charges { break-inside: avoid; border-color: #ccc; }
  .cards { display: block; }
  .card-inmate { display: flex; margin: 0 0 0.25rem; padding: 0.3rem 0; border: 0; border-bottom: 1px solid #ddd; }
  .thumb { display: none; }
  .tier, .id-chip, .chap { border: 1px solid #999; color: #111 !important; background: #fff !important; }
  .charge { color: #111 !important; }
}

/* ===== Mobile ===== */
@media (max-width: 720px) {
  .masthead-inner { padding: 0.7rem 0.85rem; }
  .month-nav-inner { padding: 0.4rem 0.85rem; }
  .month-nav { top: 50px; }
  .month { scroll-margin-top: 6.5rem; }
  .anchor { scroll-margin-top: 6.5rem; }
  .page { padding: 1rem 0.85rem 4rem; }
  .inmate-hero { grid-template-columns: 1fr; }
  .inmate-hero .photo { width: 60%; max-width: 180px; margin: 0 auto; }
  .bio { grid-template-columns: 1fr; }
  .bio dt { margin-top: 0.4rem; }
  table.charges { font-size: 0.8rem; }
  table.charges thead th, table.charges tbody td { padding: 0.45rem 0.55rem; }
}
