@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; } /* the app's own words; keeps I, l and 1 apart in "I-983" and "214.2(f)(9)(i)" */
@font-face { font-family: "Literata"; src: url("fonts/literata-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; } /* the regulation's words; both fonts are served from here, so the page calls no other site */

:root {
  color-scheme: light dark;
  --page: #eef1f6; --surface: #ffffff; --sunken: #f5f7fb;
  --ink: #12213a; --muted: #55647c; --line: #d5dbe6;
  --accent: #4534c9; --accent-soft: #ecebfb; --on-accent: #ffffff;
  --good: #14734f; --good-soft: #e6f4ee;
  --warn: #8a5200; --warn-soft: #fff3d9; --warn-line: #e3b04b;
  --bad: #b3261e; --bad-soft: #fdecea;
  --mark: #ffe58a;
  --shadow: 0 1px 2px rgb(18 33 58 / 6%), 0 8px 24px rgb(18 33 58 / 6%);
  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d1422; --surface: #151e30; --sunken: #111a2b;
    --ink: #e8edf6; --muted: #9eabc2; --line: #2b3852;
    --accent: #a5b0ff; --accent-soft: #232a55; --on-accent: #0d1422;
    --good: #6fd3a8; --good-soft: #143326;
    --warn: #f0c36a; --warn-soft: #3a2c0c; --warn-line: #8a6a1e;
    --bad: #ff9a92; --bad-soft: #3d1614;
    --mark: #6b5600;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, label { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 5; background: var(--ink); color: var(--page); padding: 8px 14px; border-radius: 6px; transition: top .15s var(--ease); }
.skip:focus { top: 12px; }
kbd { font: inherit; font-size: .85em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }

.topbar { max-width: 1180px; margin: 0 auto; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { flex: none; white-space: nowrap; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 17px; letter-spacing: -.01em; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--page); font-family: var(--serif); font-size: 19px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.open-full { font-size: 14px; }
.service-status { min-width: 0; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; transition: color .2s, border-color .2s; }
.service-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .2s; }
.service-status[data-ready=true] .dot { background: var(--good); }
.service-status[data-ready=false] { color: var(--warn); border-color: var(--warn-line); }
.service-status[data-ready=false] .dot { background: var(--warn-line); }
.service-status:disabled { cursor: progress; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 28px 48px; }
.ask { max-width: 820px; }
h1 { margin: 0 0 10px; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.1; font-weight: 700; letter-spacing: -.025em; text-wrap: balance; }
.lede { margin: 0 0 22px; max-width: 62ch; color: var(--muted); font-size: 18px; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.composer textarea { display: block; width: 100%; min-height: 76px; max-height: 320px; resize: vertical; border: 0; border-radius: 16px 16px 0 0; background: transparent; padding: 18px 20px 8px; font-size: 20px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--muted); opacity: .7; }
.composer textarea:focus { outline: 0; }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px 12px 14px; }
.visa { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 3px; border: 0; border-radius: 10px; background: var(--sunken); min-width: 0; }
.visa label { position: relative; }
.visa input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.visa span { display: block; min-width: 44px; padding: 6px 10px; border-radius: 8px; text-align: center; font-size: 14.5px; font-weight: 550; color: var(--muted); font-variant-numeric: tabular-nums; transition: background .15s, color .15s, box-shadow .15s; }
.visa input:hover + span { color: var(--ink); }
.visa input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(18 33 58 / 18%); }
.visa input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.as-of { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--muted); }
.as-of input { min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.primary { position: relative; margin-left: auto; min-width: 88px; min-height: 40px; padding: 8px 22px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 16px; transition: filter .15s, transform .1s; }
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:disabled { cursor: progress; color: transparent; }
.primary:disabled::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid var(--on-accent); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.hint { margin: 10px 4px 0; font-size: 14px; color: var(--muted); }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.examples > span { font-size: 14px; color: var(--muted); margin: 0 2px 0 4px; }
.examples button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 14.5px; transition: background .15s, border-color .15s; }
.examples button:hover { background: var(--surface); border-color: var(--accent); }

.error { max-width: 820px; margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--bad); border-radius: 10px; background: var(--bad-soft); color: var(--bad); }

.results { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 32px; scroll-margin-top: 16px; }
.answer-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 26px 28px 20px; }
@media (min-width: 900px) and (min-height: 640px) { #results .answer-card { position: sticky; top: 16px; } }
.answer-card h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; text-wrap: balance; }
.answer-context { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.tag { padding: 2px 9px; border-radius: 6px; background: var(--sunken); color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.answer-stale { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 14.5px; }
.answer-stale button { border: 0; background: none; padding: 0; color: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.results.is-stale .answer-text, .results.is-stale .evidence-panel { opacity: .55; transition: opacity .2s; }
.answer-note { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--warn-line); border-radius: 0 8px 8px 0; background: var(--warn-soft); color: var(--warn); font-size: 15px; }
.answer-text { font-size: 18.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 66ch; }
.sentence { border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color .15s; }
.sentence.lit { background: var(--accent-soft); }
.nowrap { white-space: nowrap; }
.sentence.flagged { text-decoration: underline wavy var(--warn-line); text-decoration-thickness: 1px; text-underline-offset: 5px; }
.citation { display: inline-block; min-width: 1.5em; margin: 0 1px; padding: 0 5px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: .78em; font-weight: 700; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: .12em; font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s; }
.citation:hover, .citation.lit { background: var(--accent); color: var(--on-accent); }
.answer-check { margin: 18px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14.5px; }
.answer-check.ok { background: var(--good-soft); color: var(--good); }
.answer-check ul { margin: 6px 0 0; padding-left: 18px; }
.answer-check li { margin: 3px 0; }
.answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; }
.quiet { min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14.5px; transition: border-color .15s, background .15s; }
.quiet:hover:not(:disabled) { border-color: var(--accent); }
.quiet[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.quiet:disabled { cursor: default; opacity: .7; }
#copy-answer { min-width: 116px; }
.feedback { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14.5px; color: var(--muted); }
.answer-footnote { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.answer-footnote strong { color: var(--ink); }

.evidence-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 4px 12px; }
.evidence-heading h2 { margin: 0; font-size: 16px; font-weight: 650; }
.evidence-heading span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.source-card { position: relative; margin: 0 0 14px; padding: 18px 20px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scroll-margin: 16px; transition: border-color .2s, box-shadow .2s; }
.source-card:focus { outline: 0; }
.source-card.lit { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.source-card.arrived { animation: arrive 1.1s var(--ease); }
.source-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.source-number { flex: none; min-width: 1.9em; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.source-title { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 650; }
.source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.cite-copy { padding: 1px 8px; border: 1px dashed var(--line); border-radius: 6px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s; }
.cite-copy:hover { border-color: var(--accent); background: var(--accent-soft); }
.badge { padding: 1px 8px; border-radius: 6px; font-size: 13.5px; background: var(--sunken); }
.badge.in_force { background: var(--good-soft); color: var(--good); }
.badge.proposed, .badge.withdrawn { background: var(--warn-soft); color: var(--warn); }
.source-link { margin-left: auto; font-size: 14px; white-space: nowrap; }
.passage { position: relative; overflow: hidden; font-family: var(--serif); font-size: 15.5px; line-height: 1.72; }
.passage p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; }
.passage p:last-child { margin-bottom: 0; }
.passage .parent-text { color: var(--muted); font-style: italic; }
.passage .child-text { padding-left: 16px; border-left: 2px solid var(--line); }
.passage .child-label { font-family: var(--sans); font-weight: 650; font-size: .92em; }
.passage mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.passage.collapsible { transition: height .32s var(--ease); }
.passage.collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.more { margin: 10px 0 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: 14.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.no-sources { margin: 0 4px; color: var(--muted); }

.empty-state { max-width: 820px; margin: 28px 0 0; padding: 18px 20px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.empty-state p { margin: 0; max-width: 64ch; }

.loading .answer-card, .loading .source-card { box-shadow: none; } /* the same grid as the results, so nothing jumps when the answer lands */
.loading-line { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--muted); }
.elapsed { font-variant-numeric: tabular-nums; min-width: 4ch; }
.spinner { flex: none; width: 16px; height: 16px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.bone { height: 14px; margin: 0 0 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken) 25%, var(--line) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.bone:last-child { margin-bottom: 0; }
.w100 { width: 100%; } .w90 { width: 90%; } .w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; } .w40 { width: 40%; }
.results.entering .answer-card, .results.entering .evidence-heading, .results.entering .source-card, .loading.entering { animation: rise .32s var(--ease) both; }
.results.entering .evidence-heading { animation-delay: .05s; }
.results.entering .source-card { animation-delay: calc(.08s + var(--i, 0) * .05s); }

.about { max-width: 820px; margin: 56px 0 0; }
.about h2 { margin: 0 0 12px; font-size: 18px; font-weight: 650; }
.about dl { display: grid; gap: 12px; margin: 0; }
.about dl > div { display: grid; grid-template-columns: 130px 1fr; gap: 16px; }
.about dt { color: var(--muted); font-size: 15px; }
.about dd { margin: 0; font-size: 15px; max-width: 66ch; }
footer { max-width: 1180px; margin: 0 auto; padding: 20px 28px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.back-to-answer { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4; padding: 10px 18px; border: 0; border-radius: 999px; background: var(--ink); color: var(--page); font-weight: 600; box-shadow: var(--shadow); animation: rise .25s var(--ease) both; }

@keyframes spin { to { transform: rotate(1turn); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes arrive { 0%, 40% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } }
.back-to-answer { animation-name: rise-centered; }
@keyframes rise-centered { from { opacity: 0; transform: translate(-50%, 8px); } }

.embedded .lede, .embedded .about, .embedded footer, .embedded .brand .mark { display: none; } /* inside the portfolio page: only the tool */
html.embedded { scrollbar-gutter: auto; }
.embedded h1 { font-size: 26px; }
.embedded .topbar { padding: 10px 16px; }
.embedded main { padding: 8px 16px 24px; }

@media (max-width: 899px) {
  .results { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  main { padding: 16px 16px 36px; }
  .lede { font-size: 16.5px; }
  .composer textarea { font-size: 18px; padding: 14px 16px 6px; }
  .composer-bar { padding: 8px 10px 10px; }
  .visa { width: 100%; }
  .visa label { flex: 1; }
  .visa span { min-width: 0; padding: 7px 4px; }
  .primary { min-height: 44px; }
  .answer-card { padding: 20px 18px 16px; }
  .answer-text { font-size: 17.5px; }
  .feedback { margin-left: 0; width: 100%; }
  .about dl > div { grid-template-columns: 1fr; gap: 2px; }
  #readiness-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .bone { animation: none; }
}
@media print {
  :root { --page: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #bbb; --accent: #000; --accent-soft: #eee; --shadow: none; }
  .topbar .top-right, .ask, .answer-actions, .more, .about, footer, .empty-state, .back-to-answer, .answer-stale, .skip { display: none !important; }
  main { padding: 0; }
  .results { display: block; margin: 0; }
  #results .answer-card { position: static; border: 0; padding: 0 0 16px; }
  .source-card { break-inside: avoid; }
  .passage { height: auto !important; }
  .passage.collapsed::after { display: none; }
  a { color: inherit; }
}
