/* Layout concept: a working reference binder. Wide display type on top, a narrow reading
   column for prose, and "clause cards" for every legal rule, each with its citation in mono. */
:root {
  --paper: #f2f4f6;
  --sheet: #ffffff;
  --ink: #15202b;
  --ink-2: #44515e;
  --rule: #d5dbe1;
  --tag: #f1c232;         /* key-tag yellow, used as a highlighter only */
  --tag-ink: #3b2f00;
  --deep: #1d5b57;        /* links, primary actions */
  --deep-ink: #ffffff;
  --ok: #2f7d4f;
  --warn: #a86a00;
  --bad: #b03a2e;
  --chip: #e6ebef;
  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --measure: 68ch;
  --wide: 1180px;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f161d; --sheet: #16202a; --ink: #e8edf1; --ink-2: #a9b5c0; --rule: #2a3742;
    --tag: #e7b923; --tag-ink: #1d1600; --deep: #5fb8b0; --deep-ink: #0b1514;
    --ok: #6cc28f; --warn: #e3a743; --bad: #ec7a6c; --chip: #22303b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f161d; --sheet: #16202a; --ink: #e8edf1; --ink-2: #a9b5c0; --rule: #2a3742;
  --tag: #e7b923; --tag-ink: #1d1600; --deep: #5fb8b0; --deep-ink: #0b1514;
  --ok: #6cc28f; --warn: #e3a743; --bad: #ec7a6c; --chip: #22303b; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
img { max-width: 100%; }
a { color: var(--deep); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; font-stretch: 112%; }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 750; font-stretch: 108%; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: 20px; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 2.5rem; }
.prose { max-width: var(--measure); display: grid; gap: 1rem; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: .35rem; }
.eyebrow { font-family: var(--display); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 60ch; }
.mark { background: linear-gradient(transparent 58%, var(--tag) 58%, var(--tag) 92%, transparent 92%); color: inherit; padding-inline: .1em; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
.mono { font-family: var(--mono); font-size: .85em; }
.num { font-variant-numeric: tabular-nums; }

/* Header */
.top { background: var(--sheet); border-bottom: 1px solid var(--rule); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 60px; flex-wrap: wrap; padding-block: .5rem; }
.brand { font-family: var(--display); font-weight: 800; font-stretch: 115%; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.brand-tag { width: 14px; height: 22px; background: var(--tag); border-radius: 3px 3px 7px 7px; position: relative; flex: none; }
.brand-tag::after { content: ''; position: absolute; top: 4px; left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--sheet); }
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; font-family: var(--display); font-size: .9rem; font-weight: 600; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--deep); text-decoration: underline; }
@media (max-width: 760px) { .nav { margin-left: 0; gap: .8rem; font-size: .85rem; } }

/* Hero */
.hero { padding-block: 3.2rem 2.4rem; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.page-head { padding-block: 2.6rem 1.8rem; border-bottom: 1px solid var(--rule); background: var(--sheet); }
.crumbs { font-family: var(--display); font-size: .8rem; color: var(--ink-2); display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); }

/* Sections */
.section { padding-block: 3rem; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; font-size: .95rem; padding: .7rem 1.1rem; border-radius: var(--r); border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--chip); text-decoration: none; }
.btn-primary { background: var(--deep); border-color: var(--deep); color: var(--deep-ink); }
.btn-primary:hover { background: var(--deep); filter: brightness(1.08); }
.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; }

/* Index grids */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.tile { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem 1.2rem; display: grid; gap: .45rem; align-content: start; text-decoration: none; color: var(--ink); min-width: 0; }
a.tile:hover { border-color: var(--deep); }
.tile h3 { font-size: 1.05rem; }
.tile p { font-size: .95rem; color: var(--ink-2); }
.tile .kind { font-family: var(--display); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--deep); font-weight: 700; }

/* Clause cards (state law) */
.clauses { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.clause { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem 1.2rem 1rem; display: grid; gap: .55rem; align-content: start; min-width: 0; }
.clause .label { font-family: var(--display); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.clause .rule { font-family: var(--display); font-size: 1.12rem; font-weight: 700; line-height: 1.3; }
.clause .details { font-size: .95rem; color: var(--ink-2); }
.cite { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: .78rem; border-top: 1px dashed var(--rule); padding-top: .55rem; margin-top: .15rem; }
.cite a { overflow-wrap: anywhere; }
.chip { font-family: var(--display); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 3px; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.chip-primary { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip-secondary { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip-unverified { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--display); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); background: var(--paper); position: sticky; top: 0; }
td.state { font-family: var(--display); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.filter { font: inherit; font-family: var(--display); padding: .6rem .8rem; border: 1.5px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); width: min(100%, 320px); }

/* Tile map */
.tilemap { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; max-width: 720px; }
.tilemap a { aspect-ratio: 1; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: clamp(.6rem, 1.6vw, .9rem); text-decoration: none; border-radius: 4px; color: var(--ink); background: var(--chip); border: 1px solid transparent; }
.tilemap a:hover { border-color: var(--ink); }
.tilemap a[data-v="yes"] { background: var(--deep); color: var(--deep-ink); }
.tilemap a[data-v="varies"] { background: var(--tag); color: var(--tag-ink); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-family: var(--display); font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }

/* Tools */
.tool { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.4rem; display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 800px) { .tool { grid-template-columns: 1fr; } }
.field { display: grid; gap: .3rem; }
.field label { font-family: var(--display); font-weight: 600; font-size: .88rem; }
.field input, .field select, .field textarea { font: inherit; font-family: var(--display); padding: .6rem .7rem; border: 1.5px solid var(--rule); border-radius: var(--r); background: var(--paper); color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { border-color: var(--deep); outline: none; }
.fields { display: grid; gap: .9rem; }
.result { background: var(--paper); border-radius: var(--r); padding: 1.2rem; display: grid; gap: .8rem; align-content: start; }
.big { font-family: var(--display); font-weight: 800; font-stretch: 110%; font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; font-size: .93rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* Checklists */
.phase { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.2rem; padding-block: 1.1rem; border-top: 1px solid var(--rule); }
.phase:first-child { border-top: 0; }
@media (max-width: 640px) { .phase { grid-template-columns: 1fr; gap: .5rem; } }
.phase-when { font-family: var(--display); font-weight: 800; font-size: .95rem; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.checks label { display: grid; grid-template-columns: 1.3rem minmax(0, 1fr); gap: .55rem; align-items: start; cursor: pointer; }
.checks input { margin-top: .32rem; accent-color: var(--deep); width: 1rem; height: 1rem; }
.checks .who { font-family: var(--display); font-size: .72rem; font-weight: 700; color: var(--deep); text-transform: uppercase; letter-spacing: .06em; margin-left: .35rem; }
.progress { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--deep); width: 0; transition: width .2s; }

/* Script / template blocks */
.script { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); display: grid; min-width: 0; }
.script-head { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.script-body { padding: 1rem; white-space: pre-wrap; font-family: var(--body); font-size: .97rem; margin: 0; overflow-wrap: anywhere; }
.copy { font-family: var(--display); font-size: .8rem; font-weight: 700; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 4px; padding: .3rem .6rem; cursor: pointer; }

/* Glossary */
.letters { display: flex; flex-wrap: wrap; gap: .3rem; font-family: var(--display); font-weight: 700; }
.letters a { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--rule); border-radius: 4px; text-decoration: none; background: var(--sheet); }
.terms { display: grid; gap: 0; }
.term { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 1.2rem; padding-block: .9rem; border-top: 1px solid var(--rule); scroll-margin-top: 80px; }
.term dt { font-family: var(--display); font-weight: 700; }
.term dd { margin: 0; }
@media (max-width: 640px) { .term { grid-template-columns: 1fr; gap: .2rem; } }

/* Scorecard */
.q { display: grid; gap: .5rem; padding-block: 1rem; border-top: 1px solid var(--rule); }
.q-opts { display: flex; gap: .5rem; flex-wrap: wrap; }
.q-opts label { font-family: var(--display); font-size: .88rem; font-weight: 600; border: 1.5px solid var(--rule); border-radius: 999px; padding: .35rem .85rem; cursor: pointer; background: var(--sheet); }
.q-opts input { position: absolute; opacity: 0; pointer-events: none; }
.q-opts input:checked + span { color: var(--deep); }
.q-opts label:has(input:checked) { border-color: var(--deep); background: color-mix(in srgb, var(--deep) 10%, var(--sheet)); }
.q-opts label:has(input:focus-visible) { outline: 3px solid var(--tag); }

/* Lead box */
.lead { background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 1.6rem; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.6rem; }
.lead h2, .lead h3 { color: var(--paper); }
.lead .muted { color: color-mix(in srgb, var(--paper) 72%, var(--ink)); }
.lead a { color: var(--tag); }
.lead form { display: grid; gap: .6rem; align-content: start; }
.lead input, .lead select { font: inherit; font-family: var(--display); padding: .65rem .75rem; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--paper) 30%, var(--ink)); background: color-mix(in srgb, var(--paper) 8%, var(--ink)); color: var(--paper); width: 100%; }
.lead input::placeholder { color: color-mix(in srgb, var(--paper) 55%, var(--ink)); }
.lead .btn-primary { background: var(--tag); border-color: var(--tag); color: var(--tag-ink); justify-content: center; }
.lead .fine { font-size: .78rem; line-height: 1.45; }
.lead .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 800px) { .lead { grid-template-columns: 1fr; } .lead .row2 { grid-template-columns: 1fr; } }
.form-msg { font-family: var(--display); font-size: .9rem; min-height: 1.2em; }

/* Notice */
.notice { border-left: 4px solid var(--tag); background: var(--sheet); padding: .9rem 1.1rem; border-radius: 0 var(--r) var(--r) 0; font-size: .95rem; }

/* Footer */
.foot { border-top: 1px solid var(--rule); background: var(--sheet); padding-block: 2.5rem; margin-top: 3rem; font-size: .9rem; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1.5rem; }
.foot h4 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .5rem; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.byline { display: flex; gap: .9rem; align-items: start; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem 1.1rem; font-size: .93rem; max-width: var(--measure); }
.byline .avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--deep); color: var(--deep-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; flex: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .top, .foot, .lead, .btn-row { display: none !important; } body { background: #fff; color: #000; } }

/* Journal additions */
.skip { position: absolute; left: -999px; top: 0; background: var(--tag); color: var(--tag-ink); padding: .5rem .8rem; z-index: 50; }
.skip:focus { left: 8px; }
.nav .lang { border: 1.5px solid var(--rule); border-radius: 999px; padding: .1rem .7rem; }
.tile-empty { aspect-ratio: 1; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(.6rem, 1.6vw, .9rem); border-radius: 4px; border: 1px dashed var(--rule); color: var(--ink-2); }
.article-grid { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 3rem; align-items: start; }
@media (max-width: 900px) { .article-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.toc { position: sticky; top: 84px; }
@media (max-width: 900px) { .toc { position: static; } }
.toc ol { margin: .4rem 0 0; padding-left: 1.2em; display: grid; gap: .35rem; font-family: var(--display); font-size: .88rem; }
.article { font-size: 1.12rem; line-height: 1.7; }
.article h2 { margin-top: 1.4rem; scroll-margin-top: 84px; }
.article h3 { margin-top: .8rem; }
.article table { font-size: .93rem; display: block; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
.article blockquote { margin: 0; border-left: 4px solid var(--tag); padding: .4rem 1rem; background: var(--sheet); }
.article code { font-family: var(--mono); font-size: .85em; }
.ref a { font-family: var(--mono); font-size: .72em; text-decoration: none; padding: 0 .15em; }
.sources { border-top: 2px solid var(--ink); padding-top: 1rem; margin-top: 1.5rem; display: grid; gap: .8rem; }
.sources ol { font-size: .9rem; display: grid; gap: .45rem; padding-left: 1.4em; overflow-wrap: anywhere; }
.sources li:target { background: color-mix(in srgb, var(--tag) 30%, transparent); }
.q-group { border: 0; padding: 0; margin: 0 0 1.5rem; min-width: 0; }
.q-group legend { margin-bottom: .3rem; }
.sticky-result { position: sticky; top: 84px; align-content: start; }
@media (max-width: 800px) { .sticky-result { position: static; } }
@media (max-width: 760px) {
  .nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: .3rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
}
.faq { display: grid; gap: .3rem 0; margin: 0; }
.faq dt { font-family: var(--display); font-weight: 700; margin-top: .6rem; }
.faq dd { margin: 0; }
