/* =========================================================================
   Retail Wage Law — treatise design system
   A university-press / law-treatise reading experience.
   Self-hosted system-font stack (no network fonts; the build environment
   blocks external font CDNs). Themed via CSS custom properties.
   ========================================================================= */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Charter, "Bitstream Charter", "Source Serif Pro", Georgia, Cambria, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --nav-w: 18rem;
  --toc-w: 15rem;
  --measure: 34rem;
  --sn-w: 13rem;
  --sn-gap: 1.6rem;

  /* Light theme — "Mercantile": warm-white paper, cool ink, deep teal-green
     accent (the retail edition's signature; distinct from the academic
     edition's oxblood), with clear blue links. */
  --paper: #fcfbf7;
  --paper-2: #f1efe6;
  --ink: #1b1d1d;
  --ink-soft: #404442;
  --muted: #6a6e69;
  --rule: #e4e1d4;
  --accent: #0f5e51;
  --accent-soft: #157a69;
  --link: #1d5fa6;
  --link-visited: #5b4f86;
  --mark: #fdeeb3;
  --shadow: rgba(20, 30, 28, 0.09);

  --cb-case: #1f5a5a;
  --cb-statute: #5a3a86;
  --cb-reg: #2f5f8f;
  --cb-pointer: #2e6b3e;
  --cb-pitfall: #9a3324;
  --cb-key: #0f5e51;
  --cb-caution: #8a6d1f;
  --cb-example: #555049;
  --cb-history: #6d675d;
  --cb-note: #555049;
}

html[data-theme="dark"] {
  --paper: #14171a;
  --paper-2: #1d2127;
  --ink: #e8e6dd;
  --ink-soft: #c4c3b8;
  --muted: #94968d;
  --rule: #2e333a;
  --accent: #4ec9b4;
  --accent-soft: #6fd9c6;
  --link: #84b4ff;
  --link-visited: #c1b3e0;
  --mark: #534a14;
  --shadow: rgba(0, 0, 0, 0.4);

  --cb-case: #6fc3c3;
  --cb-statute: #b79ce6;
  --cb-reg: #8bb8e6;
  --cb-pointer: #7ec98e;
  --cb-pitfall: #e6927f;
  --cb-key: #4ec9b4;
  --cb-caution: #d9bd6a;
  --cb-example: #b8b1a4;
  --cb-history: #9a9486;
  --cb-note: #b8b1a4;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --paper: #14171a; --paper-2: #1d2127; --ink: #e8e6dd; --ink-soft: #c4c3b8;
    --muted: #94968d; --rule: #2e333a; --accent: #4ec9b4; --accent-soft: #6fd9c6;
    --link: #84b4ff; --link-visited: #c1b3e0; --mark: #534a14; --shadow: rgba(0,0,0,.4);
    --cb-case:#6fc3c3; --cb-statute:#b79ce6; --cb-reg:#8bb8e6; --cb-pointer:#7ec98e;
    --cb-pitfall:#e6927f; --cb-key:#4ec9b4; --cb-caution:#d9bd6a; --cb-example:#b8b1a4;
    --cb-history:#9a9486; --cb-note:#b8b1a4;
  }
}

* { box-sizing: border-box; }

html { font-size: 18px; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.62;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:visited { color: var(--link-visited); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 .4rem 0;
}
.skip-link:focus { left: 0; }

/* ---- Header --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  height: 3.4rem; padding: 0 1.2rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: var(--sans); font-weight: 700; font-size: 1.02rem;
  letter-spacing: .01em; color: var(--ink); white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark { color: var(--accent); font-family: var(--serif); font-size: 1.2rem; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.tool-link {
  font-family: var(--sans); font-size: .82rem; color: var(--ink-soft);
  padding: .35rem .6rem; border-radius: .35rem;
}
.tool-link:hover { background: var(--paper-2); text-decoration: none; color: var(--accent); }
.theme-toggle, .nav-toggle {
  font-family: var(--sans); background: none; border: 1px solid var(--rule);
  color: var(--ink-soft); width: 2rem; height: 2rem; border-radius: .35rem; cursor: pointer;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.nav-toggle { display: none; }

/* ---- Layout --------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); }

.site-nav {
  border-right: 1px solid var(--rule);
  background: var(--paper);
  height: calc(100vh - 3.4rem); position: sticky; top: 3.4rem; overflow: auto;
}
.site-nav-inner { padding: 1.4rem 1rem 3rem 1.2rem; }

.content { padding: 2.4rem clamp(1rem, 4vw, 3rem) 4rem; min-width: 0; }
.prose { max-width: var(--measure); margin-inline: auto; }

.toc-rail { display: none; }

@media (min-width: 88rem) {
  .layout.has-toc { grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w); }
  .toc-rail {
    display: block; position: sticky; top: 3.4rem; align-self: start;
    height: calc(100vh - 3.4rem); overflow: auto;
    padding: 2.6rem 1.1rem 2rem; border-left: 1px solid var(--rule);
  }
}

/* ---- Navigation tree ------------------------------------------------------ */
.nav-parts, .nav-chapters { list-style: none; margin: 0; padding: 0; }
.nav-part > details { margin-bottom: .5rem; }
.nav-part summary {
  cursor: pointer; font-family: var(--sans); font-size: .78rem; line-height: 1.3;
  padding: .35rem .3rem; border-radius: .3rem; list-style: none; color: var(--ink-soft);
}
.nav-part summary::-webkit-details-marker { display: none; }
.nav-part summary:hover { color: var(--accent); }
.nav-part-num { display: block; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; font-size: .68rem; }
.nav-part-title { font-weight: 600; }
.nav-chapters { margin: .15rem 0 .6rem .2rem; border-left: 1px solid var(--rule); }
.nav-chapter a {
  display: flex; gap: .45rem; font-family: var(--sans); font-size: .8rem;
  color: var(--ink-soft); padding: .28rem .5rem; border-radius: .3rem; line-height: 1.35;
}
.nav-chapter a:hover { background: var(--paper-2); color: var(--ink); text-decoration: none; }
.nav-ch-num { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.nav-chapter.is-current > a { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.nav-chapter.is-forthcoming a { color: var(--muted); }

/* ---- Breadcrumb ----------------------------------------------------------- */
.breadcrumb {
  font-family: var(--sans); font-size: .76rem; color: var(--muted);
  margin-bottom: 1.6rem; max-width: var(--measure); margin-inline: auto;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.crumb-sep { opacity: .5; }

/* ---- Chapter head --------------------------------------------------------- */
.chapter-head { margin-bottom: 2.2rem; }
.part-label {
  font-family: var(--sans); font-size: .74rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .6rem;
}
.chapter-title {
  font-size: 2.1rem; line-height: 1.16; margin: 0 0 .9rem; font-weight: 600;
  letter-spacing: -0.01em;
}
.chapter-summary {
  font-size: 1.02rem; color: var(--ink-soft); font-style: italic;
  border-left: 3px solid var(--accent); padding-left: 1rem; margin: 0;
}
.usewhen {
  font-family: var(--sans); font-style: normal; font-weight: 700; font-size: .66rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  vertical-align: 1px; margin-right: .15rem;
}

/* ---- Prose typography ----------------------------------------------------- */
.prose p { margin: 0 0 1.1rem; }
.prose > p:first-of-type { font-size: 1.02rem; }
.prose h2, .prose h3, .prose h4 {
  font-weight: 600; line-height: 1.25; scroll-margin-top: 4.5rem; position: relative;
}
.prose h2 { font-size: 1.5rem; margin: 2.6rem 0 1rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.prose h3 { font-size: 1.18rem; margin: 1.9rem 0 .7rem; }
.prose h4 { font-size: 1.02rem; margin: 1.4rem 0 .5rem; font-variant: small-caps; letter-spacing: .02em; color: var(--ink-soft); }
.sec-num { color: var(--accent); font-weight: 700; font-feature-settings: "tnum"; margin-right: .4rem; }
.anchor {
  position: absolute; left: -1.3rem; opacity: 0; color: var(--muted);
  font-family: var(--sans); text-decoration: none; padding-right: .4rem;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor { opacity: 1; }

.prose blockquote {
  margin: 1.2rem 0; padding: .2rem 0 .2rem 1.3rem; border-left: 3px solid var(--rule);
  color: var(--ink-soft); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.prose li { margin: .3rem 0; }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--paper-2); padding: .1em .35em; border-radius: .25em; }
.prose pre { background: var(--paper-2); padding: 1rem; border-radius: .5rem; overflow: auto; border: 1px solid var(--rule); }
.prose pre code { background: none; padding: 0; }
.prose strong { font-weight: 700; }

.prose table { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-size: .92rem; }
.prose th, .prose td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose thead th { font-family: var(--sans); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--rule); }

/* ---- Citations & cross-references ----------------------------------------- */
.cite {
  font-style: italic; color: var(--accent); text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 50%, transparent);
}
.cite:hover { color: var(--accent-soft); border-bottom-style: solid; text-decoration: none; }
.cite-missing, .xref-missing { color: #fff; background: #b00; padding: 0 .3em; border-radius: .2em; font-style: normal; }
.xref { border-bottom: 1px solid color-mix(in srgb, var(--link) 35%, transparent); }
.xref:hover { text-decoration: none; border-bottom-color: var(--link); }

/* ---- Side-notes (Tufte) --------------------------------------------------- */
.sn-ref {
  font-family: var(--sans); color: var(--accent); cursor: pointer;
  font-size: .7em; vertical-align: super; line-height: 0; font-weight: 700; padding: 0 .1em;
}
.sn-toggle { display: none; }
.sidenote {
  display: none;
  font-family: var(--sans); font-size: .76rem; line-height: 1.45; color: var(--ink-soft);
}
.sidenote .sn-num { color: var(--accent); font-weight: 700; }
.sn-toggle:checked + .sidenote {
  display: block; margin: .6rem 0; padding: .7rem .9rem;
  background: var(--paper-2); border-left: 2px solid var(--accent); border-radius: 0 .3rem .3rem 0;
}

@media (min-width: 80rem) {
  .sidenote {
    display: block; float: right; clear: right; width: var(--sn-w);
    margin-right: calc(-1 * (var(--sn-w) + var(--sn-gap))); margin-bottom: 1rem;
    padding-left: .2rem; border-left: none; background: none;
  }
  .sn-toggle:checked + .sidenote { background: none; border-left: none; padding: 0 0 0 .2rem; margin: 0 calc(-1 * (var(--sn-w) + var(--sn-gap))) 1rem 0; }
  .sn-ref { cursor: default; }
}

/* ---- Callout boxes -------------------------------------------------------- */
.callout {
  margin: 1.5rem 0; padding: 1rem 1.1rem .4rem; border-radius: .5rem;
  border: 1px solid var(--rule); border-left: 4px solid var(--cb-note);
  background: color-mix(in srgb, var(--cb-note) 6%, var(--paper));
  font-size: .95rem;
}
.callout p:last-child { margin-bottom: .6rem; }
.callout-title { font-family: var(--sans); font-size: .92rem; font-weight: 600; margin: 0 0 .6rem; color: var(--ink); }
.callout-kind {
  display: inline-block; font-size: .64rem; letter-spacing: .07em; text-transform: uppercase;
  font-weight: 700; color: #fff; background: var(--cb-note); padding: .12em .5em; border-radius: .3em;
  margin-right: .5em; vertical-align: 1px;
}
.cb-case { border-left-color: var(--cb-case); background: color-mix(in srgb, var(--cb-case) 7%, var(--paper)); }
.cb-case .callout-kind { background: var(--cb-case); }
.cb-statute { border-left-color: var(--cb-statute); background: color-mix(in srgb, var(--cb-statute) 7%, var(--paper)); }
.cb-statute .callout-kind { background: var(--cb-statute); }
.cb-reg { border-left-color: var(--cb-reg); background: color-mix(in srgb, var(--cb-reg) 7%, var(--paper)); }
.cb-reg .callout-kind { background: var(--cb-reg); }
.cb-pointer { border-left-color: var(--cb-pointer); background: color-mix(in srgb, var(--cb-pointer) 7%, var(--paper)); }
.cb-pointer .callout-kind { background: var(--cb-pointer); }
.cb-pitfall { border-left-color: var(--cb-pitfall); background: color-mix(in srgb, var(--cb-pitfall) 8%, var(--paper)); }
.cb-pitfall .callout-kind { background: var(--cb-pitfall); }
.cb-key { border-left-color: var(--cb-key); background: color-mix(in srgb, var(--cb-key) 7%, var(--paper)); }
.cb-key .callout-kind { background: var(--cb-key); }
.cb-caution { border-left-color: var(--cb-caution); background: color-mix(in srgb, var(--cb-caution) 9%, var(--paper)); }
.cb-caution .callout-kind { background: var(--cb-caution); }
.cb-example { border-left-color: var(--cb-example); background: color-mix(in srgb, var(--cb-example) 6%, var(--paper)); }
.cb-example .callout-kind { background: var(--cb-example); }
.cb-history { border-left-color: var(--cb-history); background: color-mix(in srgb, var(--cb-history) 6%, var(--paper)); }
.cb-history .callout-kind { background: var(--cb-history); }

/* ---- In-page ToC rail ----------------------------------------------------- */
.toc-rail-title { font-family: var(--sans); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .6rem; }
.toc-rail-list { list-style: none; margin: 0; padding: 0; font-family: var(--sans); font-size: .78rem; line-height: 1.4; border-left: 1px solid var(--rule); }
.toc-rail-list li { margin: .1rem 0; }
.toc-rail-list a { display: block; padding: .2rem .6rem; color: var(--muted); border-left: 2px solid transparent; margin-left: -1px; }
.toc-rail-list a:hover { color: var(--accent); text-decoration: none; }
.toc-rail-list .toc-l3 a { padding-left: 1.3rem; font-size: .74rem; }
.toc-rail-list a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---- Cited authorities + prev/next ---------------------------------------- */
.cited-authorities { max-width: var(--measure); margin: 3rem auto 0; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.cited-head { font-family: var(--sans); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .7rem; border: none; padding: 0; }
.cited-authorities ul { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.cited-authorities li { margin: .4rem 0; padding-left: 1.1rem; text-indent: -1.1rem; }

.prevnext { display: flex; gap: 1rem; max-width: var(--measure); margin: 2.6rem auto 0; }
.pn { flex: 1; display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: .5rem; font-family: var(--sans); }
.pn:hover { border-color: var(--accent); text-decoration: none; }
.pn.next { text-align: right; }
.pn-dir { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pn-title { font-size: .9rem; color: var(--ink); }
.pn-empty { border: none; }

/* ---- Apparatus pages ------------------------------------------------------ */
.page-head { max-width: var(--measure); margin: 0 auto 2rem; }
.page-head h1 { font-size: 2rem; margin: 0 0 .6rem; }
.page-lede { color: var(--ink-soft); font-size: 1.02rem; }
.apparatus-page .prose, .front-page .prose { max-width: 44rem; }

.toc-part { max-width: 46rem; margin: 0 auto 2.2rem; }
.toc-part-title { font-size: 1.4rem; border-top: 2px solid var(--accent); padding-top: .8rem; margin: 0 0 .4rem; }
.toc-part-num { color: var(--accent); font-family: var(--sans); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; display: block; }
.toc-part-summary { color: var(--ink-soft); font-style: italic; margin: 0 0 1rem; }
.toc-chapter-list { list-style: none; padding: 0; margin: 0; }
.toc-chapter { padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.toc-chapter > a { font-size: 1.05rem; }
.toc-ch-num { display: inline-block; min-width: 2rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-ch-summary { margin: .3rem 0 0 2rem; font-size: .86rem; color: var(--muted); }
.ch-badge { font-family: var(--sans); font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; padding: .12em .5em; border-radius: .3em; vertical-align: 2px; }
.ch-badge.written { background: color-mix(in srgb, var(--cb-pointer) 18%, var(--paper)); color: var(--cb-pointer); }
.ch-badge.forthcoming { background: var(--paper-2); color: var(--muted); }

/* Table of Authorities */
.toa-group { max-width: 46rem; margin: 0 auto 2rem; }
.toa-group h2 { font-size: 1.3rem; border-bottom: 2px solid var(--accent); padding-bottom: .3rem; }
.authority { padding: .8rem 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 4.5rem; }
.authority:target { background: color-mix(in srgb, var(--mark) 60%, transparent); border-radius: .3rem; padding-inline: .6rem; }
.auth-cite { font-weight: 600; margin: 0 0 .3rem; }
.auth-holding { color: var(--ink-soft); font-size: .92rem; margin: 0 0 .4rem; }
.auth-foot { font-family: var(--sans); font-size: .76rem; color: var(--muted); margin: 0; }
.auth-back a { color: var(--muted); }
.src { color: var(--link); }

.vbadge { font-family: var(--sans); font-size: .64rem; padding: .12em .5em; border-radius: .3em; text-transform: uppercase; letter-spacing: .04em; }
.vbadge.v-full { background: color-mix(in srgb, var(--cb-pointer) 20%, var(--paper)); color: var(--cb-pointer); }
.vbadge.v-web { background: color-mix(in srgb, var(--cb-reg) 18%, var(--paper)); color: var(--cb-reg); }
.vbadge.v-pending { background: var(--paper-2); color: var(--muted); }

/* Glossary / timeline / bibliography */
.glossary dt { font-weight: 700; margin-top: 1rem; }
.glossary dd { margin: .2rem 0 0; color: var(--ink-soft); }
.timeline { list-style: none; padding: 0; max-width: 44rem; margin: 0 auto; }
.tl-event { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.tl-date { font-family: var(--sans); font-weight: 700; color: var(--accent); font-size: .9rem; }
.tl-title { font-weight: 600; margin: 0; }
.tl-note { color: var(--ink-soft); font-size: .9rem; margin: .2rem 0 0; }
.bibliography { max-width: 44rem; margin: 0 auto; }
.bibliography li { margin: .6rem 0; }

.forthcoming-note {
  font-style: italic; color: var(--ink-soft); background: var(--paper-2);
  border-left: 3px solid var(--rule); padding: 1rem 1.2rem; border-radius: 0 .4rem .4rem 0;
}
.forthcoming .planned, .forthcoming .related ul { font-family: var(--sans); font-size: .92rem; }

/* ---- Home / landing ------------------------------------------------------- */
.home .prose { max-width: 50rem; }
.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero h1 { font-size: 2.8rem; line-height: 1.08; margin: 0 0 .6rem; letter-spacing: -.02em; }
.hero .subtitle { font-size: 1.25rem; color: var(--ink-soft); font-style: italic; margin: 0 auto 1.4rem; max-width: 36rem; }
.cardgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.card { border: 1px solid var(--rule); border-radius: .6rem; padding: 1.1rem; background: var(--paper); }
.card h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.card p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.btnrow { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; margin: 1.4rem 0; }
.btn { font-family: var(--sans); font-weight: 600; font-size: .9rem; padding: .65rem 1.2rem; border-radius: .4rem; border: 1px solid var(--accent); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-soft); text-decoration: none; }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; }

/* ---- Search --------------------------------------------------------------- */
.search-ui { max-width: 44rem; margin: 0 auto; }
.search-box { width: 100%; font-family: var(--sans); font-size: 1rem; padding: .8rem 1rem; border: 1px solid var(--rule); border-radius: .5rem; background: var(--paper); color: var(--ink); }
.search-box:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.search-status { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: .6rem 0; }
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.search-results .sr-kind { font-family: var(--sans); font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.search-results .sr-title { font-size: 1.05rem; display: block; }
.search-results .sr-snip { color: var(--ink-soft); font-size: .88rem; margin: .2rem 0 0; }
mark { background: var(--mark); color: inherit; }

/* ---- Authorities: enriched grounding records ------------------------------ */
.auth-limit, .auth-retail { font-size: .88rem; margin: .25rem 0; }
.auth-limit { color: var(--muted); }
.auth-limit .lbl, .auth-retail .lbl {
  font-family: var(--sans); font-size: .6rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .1em .45em; border-radius: .3em; margin-right: .45em;
  vertical-align: 1px; color: #fff; white-space: nowrap;
}
.auth-limit .lbl { background: var(--cb-pitfall); }
.auth-retail .lbl { background: var(--accent); }
.auth-retail { color: var(--ink-soft); }
.auth-pins { list-style: none; padding: 0; margin: .4rem 0 .2rem; }
.auth-pins li { font-size: .84rem; color: var(--ink-soft); border-left: 2px solid var(--rule); padding: .1rem 0 .1rem .7rem; margin: .35rem 0; font-style: italic; }
.auth-pins .pin-cite { font-style: normal; color: var(--muted); font-family: var(--sans); font-size: .76rem; }
.retail-flag {
  font-family: var(--sans); font-size: .6rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding: .08em .45em; border-radius: .3em; margin-left: .4em; vertical-align: 2px;
}

/* ---- Calculators ---------------------------------------------------------- */
.calc-intro { max-width: var(--measure); margin: 0 auto 1.6rem; }
.calc {
  max-width: 48rem; margin: 0 auto 2rem; border: 1px solid var(--rule);
  border-radius: .7rem; background: var(--paper); overflow: hidden;
}
.calc-head { padding: 1rem 1.2rem; background: color-mix(in srgb, var(--accent) 8%, var(--paper)); border-bottom: 1px solid var(--rule); }
.calc-head h2 { margin: 0; font-size: 1.15rem; border: none; padding: 0; }
.calc-head p { margin: .3rem 0 0; font-size: .86rem; color: var(--ink-soft); }
.calc-body { padding: 1.2rem; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem 1.1rem; }
.calc-field { display: flex; flex-direction: column; gap: .3rem; }
.calc-field label { font-family: var(--sans); font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.calc-field .hint { font-family: var(--sans); font-size: .72rem; color: var(--muted); font-weight: 400; }
.calc-field input, .calc-field select {
  font-family: var(--sans); font-size: .95rem; padding: .5rem .6rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: .4rem; width: 100%;
}
.calc-field input:focus, .calc-field select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.calc-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.calc-btn {
  font-family: var(--sans); font-weight: 600; font-size: .88rem; cursor: pointer;
  padding: .55rem 1.1rem; border-radius: .4rem; border: 1px solid var(--accent);
  background: var(--accent); color: #fff;
}
.calc-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.calc-btn.ghost { background: none; color: var(--accent); }
.calc-btn.ghost:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.calc-out { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px dashed var(--rule); }
.calc-figure {
  font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.calc-figure .unit { font-size: .9rem; color: var(--muted); font-weight: 400; }
.calc-subfigure { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin: .2rem 0 0; }
.calc-breakdown { list-style: none; padding: 0; margin: 1rem 0 0; font-family: var(--sans); font-size: .86rem; }
.calc-breakdown li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--rule); }
.calc-breakdown li.total { font-weight: 700; color: var(--ink); border-bottom: none; border-top: 2px solid var(--rule); margin-top: .2rem; padding-top: .5rem; }
.calc-breakdown .v { font-variant-numeric: tabular-nums; }
.calc-verdict { font-family: var(--sans); font-size: .92rem; padding: .7rem .9rem; border-radius: .4rem; margin-top: .8rem; }
.calc-verdict.ok { background: color-mix(in srgb, var(--cb-pointer) 12%, var(--paper)); color: var(--cb-pointer); border: 1px solid color-mix(in srgb, var(--cb-pointer) 30%, transparent); }
.calc-verdict.risk { background: color-mix(in srgb, var(--cb-pitfall) 12%, var(--paper)); color: var(--cb-pitfall); border: 1px solid color-mix(in srgb, var(--cb-pitfall) 30%, transparent); }
.calc-verdict.warn { background: color-mix(in srgb, var(--cb-caution) 14%, var(--paper)); color: var(--cb-caution); border: 1px solid color-mix(in srgb, var(--cb-caution) 30%, transparent); }
.calc-disclaimer {
  font-family: var(--sans); font-size: .76rem; color: var(--muted);
  background: var(--paper-2); border-radius: .4rem; padding: .7rem .9rem; margin-top: 1rem;
}
.calc-assumptions { font-size: .86rem; color: var(--ink-soft); }
.calc-assumptions summary { font-family: var(--sans); font-size: .78rem; color: var(--accent); cursor: pointer; }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); background: var(--paper-2); margin-top: 2rem; }
.footer-inner { max-width: 52rem; margin: 0 auto; padding: 1.6rem 1.5rem; font-size: .82rem; color: var(--muted); }
.footer-disclaimer { font-family: var(--sans); }
.footer-meta { font-family: var(--sans); margin-bottom: 0; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 60rem) {
  .nav-toggle { display: inline-block; }
  .layout, .layout.has-toc { grid-template-columns: 1fr; }
  .site-nav {
    position: fixed; top: 3.4rem; left: 0; width: min(20rem, 84vw); z-index: 30;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 2px 0 16px var(--shadow);
  }
  body.nav-open .site-nav { transform: translateX(0); }
  body.nav-open::after { content: ""; position: fixed; inset: 3.4rem 0 0; background: rgba(0,0,0,.3); z-index: 20; }
  .tool-link { display: none; }
  .header-tools .tool-link:nth-child(4) { display: inline; }
}

@media (max-width: 30rem) {
  html { font-size: 17px; }
  .chapter-title { font-size: 1.7rem; }
  .hero h1 { font-size: 2.1rem; }
}

/* ---- Print ---------------------------------------------------------------- */
@media print {
  .site-header, .site-nav, .toc-rail, .prevnext, .nav-toggle, .theme-toggle, .header-tools, .skip-link { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .content { padding: 0; }
  .prose, .page-head, .cited-authorities { max-width: 100%; }
  .sidenote { display: block !important; float: none; width: auto; margin: .4rem 0; font-size: 9pt; color: #333; border-left: 2px solid #ccc; padding-left: .6rem; }
  .callout { border: 1px solid #999; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .prose h2 { break-after: avoid; }
}
