/* ═══════════════════════════════════════════════════════════════════════
   STATE OF SAN ANDREAS — GENERAL LAW
   Design language: a bound statute book, read in two rooms.

   VELLUM   (light) — paper, ink, gold leaf.
   CHAMBERS (dark)   — a reading room after hours: slate walls, brass light.

   Signature element: every citation renders as an engraved plate — inset
   in Vellum (pressed into paper), lit from below in Chambers (brass catching
   lamplight) — the one place this design spends its boldness.

   Severity (felony/misdemeanor/etc.) is carried by a tinted left rule +
   a faint wash, never a solid pastel fill — that's what keeps every card
   readable in both themes without a second set of "tint" colors to maintain.
   ═══════════════════════════════════════════════════════════════════════ */

:root{
  /* ── brand constants: identical in both themes ── */
  --gold:        #B0832E;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --header-h: 64px;
  --search-h: 56px;
  --sidebar-w: 296px;

  /* ── code-family spine colors (light-mode values; dark overrides below) ── */
  --c-sapc:  #6E0E0E;
  --c-satc:  #1C3D6E;
  --c-sahsc: #0E4A3B;
  --c-safc:  #7A2E6E;
  --c-sabcc: #8A3B0B;
  --c-saac:  #52525B;
  --c-safg:  #2F5233;
  --c-saec:  #4A3B6E;
  --c-salec: #1F4E5F;

  /* ── severity accent (foreground only — used as border/text, never a fill) ── */
  --t-capital: #A31515;
  --t-f1:      #B5341E;
  --t-f2:      #A8590F;
  --t-f3:      #8C6A12;
  --t-sjf:     #6B6A18;
  --t-ma:      #2C56A0;
  --t-mb:      #1A6E58;
  --t-mc:      #2C7A3E;
  --t-traf:    #51596A;
  --t-reg:     #6B6B75;
  --t-def:     #2E4566;

  /* ═══ VELLUM (light) ═══ */
  --bg:            #F7F4EC;
  --bg-sunk:       #EFEADB;
  --surface:       #FFFFFF;
  --surface-raised:#FFFEFB;
  --surface-wash:  #F6F2E7;
  --border:        #DDD5BE;
  --border-soft:   #E9E3D1;
  --ink:           #16202E;
  --ink-2:         #28384C;
  --body:          #2B2722;
  --mute:          #6E6657;
  --faint:         #847A64;
  --gold-text:     #8A6422;
  --shadow-1: 0 1px 2px rgba(40,30,10,0.05), 0 1px 1px rgba(40,30,10,0.04);
  --shadow-2: 0 8px 22px rgba(35,26,10,0.09), 0 2px 6px rgba(35,26,10,0.06);
  --shadow-3: 0 18px 44px rgba(20,16,8,0.16);
  --plate-shadow: inset 0 1px 2px rgba(20,14,4,0.18), inset 0 -1px 0 rgba(255,255,255,0.6);
  --callout-bg:   #FBF3E2;
  --callout-fg:   #6B4E16;
  --mark-bg:      #F0D9A0;
  --mark-fg:      #3B2C0C;
  --header-bg:    #121A26;
  --header-bg-2:  #1C2A3D;
  --header-fg:    #F4EFE2;
  --header-line:  rgba(176,131,46,0.4);
  --scrim:        rgba(15,18,24,0.45);
  --row-stripe:   rgba(20,16,8,0.022);
  --severity-wash-alpha: 0.05;

  color-scheme: light;
}

html[data-theme="dark"]{
  /* spines stay readable on dark slate: lift the darkest few */
  --c-sapc:  #D2685D;
  --c-satc:  #6F95D4;
  --c-sahsc: #3F9A7C;
  --c-safc:  #C07AB6;
  --c-sabcc: #C77B3D;
  --c-saac:  #9498A4;
  --c-safg:  #6FA37A;
  --c-saec:  #8C7FC9;
  --c-salec: #5FA8BF;

  --t-capital: #E0726A;
  --t-f1:      #E08A6A;
  --t-f2:      #D9A05D;
  --t-f3:      #CBB259;
  --t-sjf:     #B6B468;
  --t-ma:      #7FA6E0;
  --t-mb:      #5FBFA0;
  --t-mc:      #76C589;
  --t-traf:    #A5ADBC;
  --t-reg:     #9C9CA8;
  --t-def:     #8FAAD4;

  /* ═══ CHAMBERS (dark) ═══ */
  --bg:            #11151C;
  --bg-sunk:       #0B0E13;
  --surface:       #1A2029;
  --surface-raised:#202733;
  --surface-wash:  #1E2530;
  --border:        #2E3744;
  --border-soft:   #242C38;
  --ink:           #F1EEE4;
  --ink-2:         #E2DCC9;
  --body:          #CDD2DB;
  --mute:          #8B93A0;
  --faint:         #717A89;
  --gold:          #D9A646;
  --gold-text:     #E2B459;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 10px 26px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.35);
  --shadow-3: 0 22px 52px rgba(0,0,0,0.55);
  --plate-shadow: inset 0 1px 1px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(217,166,70,0.06), 0 0 14px rgba(217,166,70,0.05);
  --callout-bg:   #241D11;
  --callout-fg:   #E7C988;
  --mark-bg:      #5B4419;
  --mark-fg:      #F6E3B0;
  --header-bg:    #0A0D12;
  --header-bg-2:  #141A22;
  --header-fg:    #F1EEE4;
  --header-line:  rgba(217,166,70,0.28);
  --scrim:        rgba(0,0,0,0.6);
  --row-stripe:   rgba(255,255,255,0.025);
  --severity-wash-alpha: 0.10;

  color-scheme: dark;
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
html{ background: var(--bg); }
body{
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}
a{ color: inherit; text-decoration: none; }
::selection{ background: var(--mark-bg); color: var(--mark-fg); }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a:focus-visible, button:focus-visible, input:focus-visible{
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

code{ font-family: var(--mono); }

/* ═══════════════════════ HEADER ═══════════════════════ */

.site-header{
  position: sticky; top:0; z-index:40;
  background: var(--header-bg);
  background-image: linear-gradient(165deg, var(--header-bg) 0%, var(--header-bg-2) 100%);
  border-bottom: 1px solid var(--header-line);
}
.header-inner{
  height: var(--header-h);
  display:flex; align-items:center; gap:14px;
  padding: 0 22px;
  max-width: 1440px; margin: 0 auto;
}
.nav-toggle{
  display:none;
  width:36px; height:36px; border:none; background:transparent; cursor:pointer;
  flex-direction:column; justify-content:center; align-items:center; gap:5px;
  flex-shrink:0;
}
.nav-toggle span{ width:20px; height:1.6px; background:var(--gold); display:block; border-radius:1px; }

/* The halo was a literal brass rgba(176,131,46,0.18) and stayed gold after the
   seal itself turned blue. color-mix keeps it locked to whatever --gold is. */
.seal{ color: var(--gold); flex-shrink:0; display:flex; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--gold) 20%, transparent)); }
.seal-svg{ width:30px; height:30px; }

.header-text{ display:flex; flex-direction:column; line-height:1.15; }
.header-title{
  font-family: var(--serif); font-weight:600; font-size:18px; color: var(--header-fg);
  letter-spacing:0.01em;
}
.header-subtitle{
  font-family: var(--sans); font-weight:500; font-size:10.5px; letter-spacing:0.1em;
  text-transform:uppercase;
  /* 10.5px uppercase at 0.85 opacity was 4.4:1 on brass and 3.6:1 once --gold
     became the accent blue — the accent is a fill colour, not a text colour.
     --ov-accent-text is the lifted blue meant for text (7.3:1 here); the
     legacy --gold is the standalone fallback, now at full opacity. */
  color: var(--ov-accent-text, var(--gold));
  margin-top:2px;
}
.header-meta{
  margin-left:auto; font-family: var(--mono); font-size:11.5px;
  /* 0.45 opacity put this at ~3.9:1. --ov-text-muted is the de-emphasis step
     that is still a measured 4.9:1, which is the whole reason it exists. The
     fallback is --header-fg rather than --faint: --faint is tuned for light
     page surfaces and only reaches 4.1:1 against the dark header plate. */
  color: var(--ov-text-muted, var(--header-fg));
  white-space:nowrap;
}

.theme-toggle{
  flex-shrink:0; width:32px; height:32px; border-radius:50%;
  /* both borders were literal brass and outlived the remap */
  border:1px solid var(--header-line);
  /* was a literal white overlay, which worked only because the header plate was
     dark in both of the old themes. --surface-wash inverts with the theme, so
     the button still reads on the light theme's light header. */
  background: var(--surface-wash);
  color: var(--gold); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  margin-left: 12px; transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover{ background: var(--ov-surface-active, rgba(255,255,255,0.1)); border-color: var(--gold); transform: translateY(-1px); }
.theme-toggle .icon-moon{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display:block; }

.search-bar{
  background: var(--bg-sunk);
  border-bottom:1px solid var(--border);
  padding: 10px 22px;
  position:relative;
}
.search-inner{
  max-width: 1440px; margin:0 auto;
  display:flex; align-items:center; gap:10px;
  background: var(--surface);
  border:1px solid var(--border);
  border-radius:9px;
  padding: 9px 14px;
  height: 38px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* focus glow followed --gold's old brass value, not --gold */
.search-inner:focus-within{ border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.search-icon{ color: var(--mute); flex-shrink:0; }
#searchInput{
  border:none; outline:none; background:transparent; flex:1;
  font-family: var(--sans); font-size:14px; color: var(--body);
  height:100%;
}
#searchInput::placeholder{ color: var(--faint); }
.search-clear{
  border:none; background:transparent; cursor:pointer; color:var(--mute);
  font-size:20px; line-height:1; padding:0 4px;
}
.search-results{
  position:absolute; left:50%; transform:translateX(-50%);
  top: calc(100% + 4px);
  width:calc(100% - 44px); max-width:1396px;
  background: var(--surface-raised);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow: var(--shadow-3);
  max-height: 70vh; overflow-y:auto;
  z-index:50;
  padding:6px;
}
.sr-item{
  display:block; width:100%; text-align:left;
  padding:10px 12px; border-radius:8px; cursor:pointer; border:none; background:none;
  font-family: var(--sans);
}
.sr-item:hover, .sr-item.active{ background: var(--surface-wash); }
.sr-code{ font-family: var(--mono); font-size:11px; color: var(--mute); }
.sr-title{ font-family: var(--serif); font-size:14.5px; font-weight:600; color: var(--ink); margin-top:1px; }
.sr-snippet{ font-size:12.5px; color: var(--mute); margin-top:3px; line-height:1.4; }
.sr-snippet mark, .sr-title mark{ background: var(--mark-bg); color:var(--mark-fg); border-radius:2px; padding:0 1px; }
.sr-empty{ padding:18px 14px; color:var(--mute); font-size:14px; text-align:center; }
.sr-more{ padding:8px 14px; color:var(--mute); font-size:12px; text-align:center; border-top:1px solid var(--border-soft); margin-top:4px; }

/* ═══════════════════════ SHELL / LAYOUT ═══════════════════════ */

.app-shell{
  display:flex;
  max-width:1440px; margin:0 auto;
  min-height: calc(100vh - var(--header-h) - var(--shell-search-h, var(--search-h)));
}
.app-shell[hidden]{ display:none; }

.sidebar{
  width: var(--sidebar-w); flex-shrink:0;
  border-right: 1px solid var(--border);
  padding: 18px 10px 60px;
  position: sticky; top: calc(var(--header-h) + var(--shell-search-h, var(--search-h)));
  height: calc(100vh - var(--header-h) - var(--shell-search-h, var(--search-h)));
  overflow-y: auto;
}
.sidebar-section{ padding: 0 6px 10px; }
.sidebar-divider{ height:1px; background:var(--border-soft); margin: 6px 14px 10px; }

.sidebar-link{
  display:flex; align-items:center; gap:8px;
  padding: 9px 10px; border-radius:8px;
  font-family: var(--sans); font-size:13.5px; font-weight:600; color: var(--ink-2);
  transition: background 0.12s ease;
}
.sidebar-link:hover{ background: var(--surface-wash); }
.sidebar-link.active{ background: var(--header-bg); color: var(--header-fg); }

.code-group{ margin-bottom: 2px; }
.code-group-header{
  display:flex; align-items:center; gap:9px;
  width:100%; text-align:left; border:none; background:none; cursor:pointer;
  padding: 9px 10px; border-radius:8px;
  font-family: var(--sans); font-size:13px; font-weight:700; color: var(--ink);
  transition: background 0.12s ease;
}
.code-group-header:hover{ background: var(--surface-wash); }
.code-swatch{ width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.code-group-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.code-group-count{ font-family: var(--mono); font-size:10.5px; color: var(--faint); }
.code-group-chev{ font-size:10px; color: var(--faint); transition: transform 0.15s ease; flex-shrink:0; }
.code-group.open .code-group-chev{ transform: rotate(90deg); }

.chapter-list{ display:none; padding-left: 22px; margin: 1px 0 6px; }
.code-group.open .chapter-list{ display:block; }
.chapter-link{
  display:block; padding: 6px 10px; border-radius:7px;
  font-size:12.5px; color: var(--mute); line-height:1.35;
  transition: background 0.12s ease, color 0.12s ease;
}
.chapter-link:hover{ background: var(--surface-wash); color: var(--ink-2); }
.chapter-link.active{ background: var(--surface-wash); color: var(--ink); font-weight:600; box-shadow: inset 2px 0 0 var(--gold); }

/* ═══════════════════════ MAIN CONTENT ═══════════════════════ */

.main{ flex:1; min-width:0; padding: 40px 44px 110px; }

/* ─ overview / cover ─ */
.cover{ max-width: 760px; }
.cover-kicker{
  font-family: var(--sans); font-size:11px; font-weight:700; letter-spacing:0.14em;
  color: var(--gold-text); text-transform:uppercase; margin-bottom:12px;
}
.cover-title{
  font-family: var(--serif); font-size: clamp(34px, 4.6vw, 48px); font-weight:600;
  color: var(--ink); line-height:1.06; margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.cover-sub{ font-family: var(--serif); font-style:italic; font-size:16px; color: var(--mute); margin: 0 0 20px; }
.cover-stat-line{
  font-family: var(--mono); font-size:12px; color: var(--faint);
  padding-bottom:22px; margin-bottom:26px; border-bottom: 2px solid var(--gold);
}
.cover-lede{ font-family: var(--serif); font-size:16.5px; line-height:1.68; color: var(--body); margin-bottom: 38px; }
.cover-lede strong{ color: var(--ink); }
.cover-lede a{ color: var(--gold-text); border-bottom: 1px solid currentColor; }

.code-cards{ display:grid; grid-template-columns: repeat(2, 1fr); gap:14px; margin-bottom: 42px; }
.code-card{
  display:block; border-radius:12px; padding:17px 19px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--gold));
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.code-card:hover{ box-shadow: var(--shadow-2); transform: translateY(-2px); }
.code-card-abbr{ font-family: var(--mono); font-size:11px; font-weight:600; color: var(--accent, var(--gold)); letter-spacing:0.05em; }
.code-card-name{ font-family: var(--serif); font-size:16.5px; font-weight:600; color: var(--ink); margin: 4px 0 6px; }
.code-card-desc{ font-size:12.5px; color: var(--mute); line-height:1.5; }
.code-card-count{ font-family: var(--mono); font-size:11px; color: var(--faint); margin-top:10px; }

.howto-box{
  background: var(--surface-wash); border:1px solid var(--border); border-radius:12px;
  padding: 19px 21px; font-size:13.5px; color: var(--body); line-height:1.6;
}
.howto-box b{ color: var(--ink); }
.howto-box a{ color: var(--gold-text); border-bottom: 1px solid currentColor; }

/* ─ section headers (chapter / code family) ─ */
.section-eyebrow{
  font-family: var(--sans); font-size:10.5px; font-weight:700; letter-spacing:0.12em;
  text-transform:uppercase; color: var(--accent, var(--gold-text)); margin-bottom:5px;
}
.section-eyebrow a{ text-decoration: underline; text-decoration-color: currentColor; opacity: 0.85; }
.code-hero{
  padding-bottom: 24px; margin-bottom: 30px; border-bottom: 3px solid var(--accent, var(--gold));
}
.code-hero-name{ font-family: var(--serif); font-size: clamp(28px, 3.6vw, 38px); font-weight:600; color: var(--ink); margin: 2px 0 9px; letter-spacing:-0.01em; }
.code-hero-desc{ font-family: var(--serif); font-style:italic; font-size:15px; color: var(--mute); }

.chapter-header{ margin: 42px 0 20px; padding-top: 6px; }
.chapter-header:first-of-type{ margin-top: 0; }
.chapter-eyebrow{ font-family: var(--sans); font-size:10.5px; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color: var(--accent, var(--gold-text)); margin-bottom:4px; }
.chapter-name{ font-family: var(--serif); font-size:21px; font-weight:600; color: var(--ink-2); }
.chapter-rule{ height:1px; background: linear-gradient(90deg, var(--border) 0%, transparent 100%); margin-top:11px; }

/* ═══════════════════════ ENTRY CARDS ═══════════════════════ */

.entry{ margin-bottom: 22px; scroll-margin-top: 130px; }

.entry-card{
  position: relative;
  border-radius: 12px; overflow:hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent, var(--gold));
  box-shadow: var(--shadow-1);
}

/* ── header row: citation plate · title ............ severity pill ── */
.entry-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  padding: 16px 20px 14px;
}
.entry-head-left{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.entry-code{
  font-family: var(--mono); font-size:12px; font-weight:600; color: var(--family-accent, var(--gold-text));
  background: var(--surface-wash);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  box-shadow: var(--plate-shadow);
  letter-spacing: 0.01em;
  display:inline-block;
  width: fit-content;
}
.entry-title{
  font-family: var(--serif); font-size:18px; font-weight:600; color: var(--ink);
  line-height:1.3;
}
.entry-pill{
  flex-shrink:0; font-family: var(--sans); font-size:10px; font-weight:700; letter-spacing:0.06em;
  text-transform:uppercase; color: var(--accent, var(--gold-text));
  background: color-mix(in srgb, var(--accent, var(--gold)) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 35%, var(--border));
  border-radius: 999px; padding: 5px 11px; white-space:nowrap; margin-top:1px;
}

/* ── consequence band: the two numbers a reader scans for first ── */
.entry-stats{
  display:flex; flex-wrap:wrap; gap: 28px;
  padding: 13px 20px;
  background: var(--surface-wash);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.entry-stat{ display:flex; flex-direction:column; gap:1px; }
.entry-stat-label{ font-family: var(--sans); font-size:9.5px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color: var(--mute); }
.entry-stat-value{ font-family: var(--serif); font-size:15.5px; font-weight:600; color: var(--ink); }
.entry-stat-sub{ font-family: var(--mono); font-size:10.5px; color: var(--mute); margin-top:1px; }

/* ── procedural line: plain sentence, not mono-coded ── */
.entry-proc{
  font-family: var(--sans); font-size:12px; color: var(--mute); line-height:1.6;
  padding: 11px 20px 0;
}
.entry-proc b{ color: var(--ink-2); font-weight:600; }
.entry-proc .dot{ color: var(--faint); margin: 0 7px; }

/* ── statute text: the actual content, given room to be read ── */
.entry-def{
  font-family: var(--serif); font-size:15px; color: var(--body); line-height:1.68;
  padding: 14px 20px 4px;
}
/* a statute's text keeps its own paragraphs and list lines */
.entry-def--statute{ white-space: pre-line; }

.entry-section{ padding: 4px 20px 0; }
.entry-section + .entry-section{ margin-top:2px; }
.entry-section-label{
  font-family: var(--sans); font-size:9.5px; font-weight:700; letter-spacing:0.09em;
  color: var(--accent, var(--gold-text)); text-transform:uppercase; margin: 14px 0 6px;
}

.subvariants{ margin: 4px 0 2px; padding-left:14px; border-left: 2px solid var(--border); }
.subvariant{ margin-bottom:10px; }
.subvariant-label{ font-family: var(--serif); font-size:14px; font-weight:700; color: var(--ink-2); }
.subvariant-meta{ font-family: var(--sans); font-size:11.5px; color: var(--mute); margin-top:2px; }

.entry-enh-list{ margin:0; padding:0; list-style:none; }
.entry-enh-list li{
  font-family: var(--serif); font-size:13.5px; color: var(--body); line-height:1.6;
  padding-left: 16px; position:relative; margin-bottom:4px;
}
.entry-enh-list li::before{
  content:''; position:absolute; left:0; top:9px; width:6px; height:6px; border-radius:50%;
  background: var(--accent, var(--gold-text));
}

.entry-also{
  font-family: var(--sans); font-size:12px; color: var(--mute); line-height:1.7;
}
.entry-also b{ color: var(--ink-2); font-weight:600; }
.entry-also .row{ margin-bottom:3px; }

.entry-note{ font-family: var(--serif); font-style:italic; font-size:12.5px; color: var(--mute); line-height:1.55; }

.entry-foot{ padding: 4px 20px 18px; }

/* ═══════════════════════ TITLE 0 ═══════════════════════ */

.t0-callout{
  display:flex; border-radius:10px; overflow:hidden; margin: 20px 0 32px;
  border:1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.t0-callout-bar{ width:4px; background: var(--gold); flex-shrink:0; }
.t0-callout-text{ background:var(--callout-bg); padding:15px 19px; font-family: var(--serif); font-style:italic; font-size:14.5px; color:var(--callout-fg); line-height:1.62; }

.t0-chapter{ margin-top:36px; }
.t0-chapter-num{ font-family: var(--sans); font-size:10.5px; font-weight:700; letter-spacing:0.12em; color: var(--gold-text); text-transform:uppercase; }
.t0-chapter-name{ font-family: var(--serif); font-size:23px; font-weight:600; color: var(--ink-2); margin: 2px 0 15px; }

.def-entry{ margin: 13px 0 4px; }
.def-term{ font-family: var(--sans); font-size:14px; font-weight:700; color: var(--ink); margin-bottom:2px; }
.def-body{ font-family: var(--serif); font-size:14.5px; color: var(--body); line-height:1.64; }

.t0-subhead{ font-family: var(--sans); font-size:10px; font-weight:700; letter-spacing:0.1em; color: var(--gold-text); text-transform:uppercase; margin: 22px 0 7px; }

.ref-table{ width:100%; border-collapse:collapse; margin: 15px 0; font-size:13px; border-radius:8px; overflow:hidden; box-shadow: var(--shadow-1); }
.ref-table th{ background: var(--header-bg); color: var(--header-fg); font-family: var(--sans); font-weight:700; font-size:11px; text-align:left; padding:9px 13px; letter-spacing:0.02em; }
.ref-table td{ padding:8px 13px; border-bottom:1px solid var(--border-soft); font-family: var(--serif); background: var(--surface); color: var(--body); }
.ref-table td:first-child{ font-family: var(--sans); font-weight:600; color: var(--ink-2); }
.ref-table tr:nth-child(even) td{ background: var(--row-stripe); }

/* ═══════════════════════ MISC UI ═══════════════════════ */

.to-top{
  position: fixed; bottom: 28px; right: 28px; z-index:30;
  width:44px; height:44px; border-radius:50%;
  background: var(--header-bg); color: var(--header-fg); border:1px solid var(--header-line); cursor:pointer;
  font-size:18px; box-shadow: var(--shadow-3);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.to-top.show{ opacity:1; pointer-events:auto; }
.to-top:hover{ transform: translateY(-3px); }

.no-results{ padding: 60px 0; text-align:center; color: var(--mute); font-family: var(--serif); font-size:16px; }

.nav-scrim{
  display:none; position:fixed; inset:0; background: var(--scrim); z-index:35;
}

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */

@media (max-width: 880px){
  .nav-toggle{ display:flex; }
  .header-subtitle{ display:none; }
  .sidebar{
    position: fixed; top:0; left:0; height:100vh; z-index:45;
    background: var(--bg); width: 280px;
    transform: translateX(-100%); transition: transform 0.22s ease;
    padding-top: 90px;
    box-shadow: var(--shadow-3);
  }
  .sidebar.open{ transform: translateX(0); }
  .nav-scrim.show{ display:block; }
  .main{ padding: 28px 20px 90px; }
  .code-cards{ grid-template-columns: 1fr; }
  .search-bar{ padding: 10px 14px; }
  .search-results{ width: calc(100% - 28px); }
  .entry-title{ font-size:15.5px; }
  .entry-head{ flex-direction:column; gap:10px; padding:14px 16px 12px; }
  .entry-pill{ align-self:flex-start; }
  .entry-stats{ padding:11px 16px; gap:20px; }
  .entry-proc{ padding:10px 16px 0; }
  .entry-def{ padding:12px 16px 4px; font-size:14.5px; }
  .entry-section{ padding:4px 16px 0; }
  .entry-foot{ padding:4px 16px 16px; }
  .header-meta{ display:none; }
}

/* ═══════════════════════ ASK THE LAW (AI chatbot) ═══════════════════════ */

.ask-page{ max-width: 720px; }
.ask-disclaimer{
  font-family: var(--serif); font-style:italic; font-size:13.5px; color: var(--mute);
  line-height:1.55; margin: 10px 0 22px; padding: 12px 16px; background: var(--surface-wash);
  border-radius:10px; border:1px solid var(--border);
}
.ask-thread{
  min-height: 220px; max-height: 52vh; overflow-y:auto;
  display:flex; flex-direction:column; gap:14px;
  padding: 4px 2px 16px;
  margin-bottom: 16px;
}
.ask-empty{ color: var(--mute); font-family: var(--serif); font-style:italic; font-size:14px; padding: 30px 0; text-align:center; }

.ask-msg{ display:flex; }
.ask-msg--user{ justify-content:flex-end; }
.ask-msg--ai{ justify-content:flex-start; flex-direction:column; align-items:flex-start; gap:6px; }

.ask-bubble{
  max-width: 85%; padding: 11px 15px; border-radius: 14px;
  font-family: var(--sans); font-size:14px; line-height:1.55;
}
.ask-msg--user .ask-bubble{
  background: var(--header-bg); color: var(--header-fg); border-bottom-right-radius:4px;
}
.ask-bubble--ai{
  background: var(--surface); border:1px solid var(--border); color: var(--body);
  border-bottom-left-radius:4px; font-family: var(--serif); font-size:14.5px;
}
.ask-bubble--ai p{ margin: 0 0 10px; line-height:1.55; }
.ask-bubble--ai p:last-child{ margin-bottom:0; }
.ask-bubble--ai strong{ color: var(--ink); font-weight:700; }
.ask-bubble--ai em{ font-style:italic; }
.ask-bubble--ai code{
  font-family: var(--mono); font-size:0.92em; background: var(--surface-wash);
  border:1px solid var(--border); border-radius:4px; padding:1px 5px;
}
.ask-md-list{ margin: 0 0 10px; padding-left: 20px; }
.ask-md-list:last-child{ margin-bottom:0; }
.ask-md-list li{ margin-bottom: 4px; line-height:1.5; }
.ask-bubble--thinking{ color: var(--mute); font-style:italic; }

.ask-cites{ display:flex; flex-wrap:wrap; gap:6px; padding-left:2px; }
.ask-cite-pill{
  font-family: var(--mono); font-size:10.5px; font-weight:600; color: var(--gold-text);
  background: var(--surface-wash); border:1px solid var(--border); border-radius:5px; padding:2px 7px;
  display:inline-block;
}
.ask-cite-pill--link{
  cursor:pointer; transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.ask-cite-pill--link:hover{
  background: color-mix(in srgb, var(--gold) 14%, var(--surface-wash));
  border-color: color-mix(in srgb, var(--gold) 45%, var(--border));
  transform: translateY(-1px);
}

.ask-form{ display:flex; gap:10px; }
.ask-form input{
  flex:1; font-family: var(--sans); font-size:14px; color: var(--ink);
  background: var(--surface); border:1px solid var(--border); border-radius:10px; padding:11px 14px;
}
.ask-form input:focus{ outline:none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.ask-form button{
  /* was a literal #fff. --header-bg is a light surface in the Oceanview light
     theme, so white-on-white made this button's label disappear; --header-fg is
     the foreground that is guaranteed to pair with it in every theme. */
  font-family: var(--sans); font-size:14px; font-weight:700; color: var(--header-fg);
  background: var(--header-bg); border:none; border-radius:10px; padding:11px 22px; cursor:pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.ask-form button:hover:not(:disabled){ background: var(--header-bg-2); }
.ask-form button:disabled{ opacity:0.5; cursor:default; }

@media (max-width: 600px){
  .ask-bubble{ max-width:92%; }
  .ask-thread{ max-height: 44vh; }
}