/* Visual language modelled on the Cloudflare dashboard: Inter, a quiet grey canvas, white panels with 1px borders,
   small radii, blue links and buttons, orange only as the accent mark. Light and dark themes. */
:root {
  --bg: #f5f6f7; --panel: #ffffff; --panel-2: #fafafa; --ink: #1d1d1d; --ink-2: #313131; --muted: #62666a; --line: #dedfe0; --line-2: #ebecee;
  --accent: #0051c3; --accent-hover: #003681; --accent-ink: #ffffff; --orange: #f6821f; --orange-ink: #ffffff;
  --mark: #fff0b3; --hl: #fff8e1; --ok: #1e7a3c; --warn: #bd2d2d; --appeal: #b23b2e;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: var(--sans);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 6px; --radius-sm: 4px; --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161718; --panel: #1f2022; --panel-2: #26282b; --ink: #e9eaec; --ink-2: #d5d7da; --muted: #9ea3a8; --line: #33363a; --line-2: #2a2d31;
    --accent: #6ea8ff; --accent-hover: #9cc3ff; --accent-ink: #0b1b33; --mark: #5a4a00; --hl: #2b2715; --appeal: #e07a6f;
  }
}
:root[data-theme="dark"] {
  --bg: #161718; --panel: #1f2022; --panel-2: #26282b; --ink: #e9eaec; --ink-2: #d5d7da; --muted: #9ea3a8; --line: #33363a; --line-2: #2a2d31;
  --accent: #6ea8ff; --accent-hover: #9cc3ff; --accent-ink: #0b1b33; --mark: #5a4a00; --hl: #2b2715; --appeal: #e07a6f;
}

* { box-sizing: border-box; }
html { font-size: 13.5px; -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.45; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
code { font-family: var(--mono); font-size: .88em; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 4px; }
h1, h2, h3 { font-family: var(--sans); font-weight: 600; line-height: 1.3; margin: 0 0 .5rem; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; margin-top: 1.4rem; } h3 { font-size: 1rem; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; height: 50px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: var(--orange); color: var(--orange-ink); border-radius: var(--radius); font-weight: 700; font-size: .95rem; margin: 0; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; height: 100%; }
.top nav a { text-decoration: none; color: var(--muted); padding: 0 12px; display: flex; align-items: center; height: 50px; border-bottom: 2px solid transparent; font-weight: 500; font-size: .93rem; }
.top nav a:hover { color: var(--ink); text-decoration: none; }
.top nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.foot { padding: 20px 20px 40px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); margin-top: 48px; }

main { padding-top: 24px; min-height: 60vh; }
.hero { text-align: center; padding: 36px 0 12px; }
.hero h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; }
.hero p { color: var(--muted); max-width: 660px; margin: 0 auto 20px; font-size: .95rem; }
.hero.compact { padding: 8px 0 4px; }

/* search + controls */
form.search { display: flex; gap: 8px; align-items: stretch; margin: 0 auto 10px; max-width: 780px; }
form.search input[type=search] { flex: 1; font: inherit; font-size: 1rem; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
input, select, textarea, button { font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent) !important; }
.btn { font: inherit; font-weight: 500; font-size: .93rem; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--muted); color: var(--ink); }
.btn.small { padding: 4px 10px; font-size: .82rem; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .5; cursor: default; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: center; margin: 8px auto 20px; max-width: 980px; font-size: .86rem; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.filters select, .filters input { font: inherit; font-size: .86rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); max-width: 180px; }
.hint { font-size: .84rem; color: var(--muted); text-align: center; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.examples a { font-size: .82rem; text-decoration: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; color: var(--ink-2); }
.examples a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* result cards */
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 8px 0 12px; color: var(--muted); font-size: .86rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.02rem; }
.card h3 a { text-decoration: none; color: var(--accent); }
.card h3 a:hover { text-decoration: underline; }
.meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.meta .kind { text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 5px; line-height: 1.6; background: var(--panel-2); }
.cite { font-size: .86rem; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cite .c { background: var(--panel-2); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: var(--radius-sm); color: var(--ink-2); }
.passage { white-space: pre-wrap; font-size: .95rem; line-height: 1.6; color: var(--ink-2); }
.passage.clamp { max-height: 7.8em; overflow: hidden; position: relative; }
.passage.clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4em; background: linear-gradient(transparent, var(--panel)); }
.more { font-size: .84rem; margin-top: 6px; }
.heading-tag { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }

/* opinion page */
.op-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.op-head h1 { font-size: 1.3rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.op-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.op-side { position: sticky; top: 66px; max-height: calc(100vh - 90px); overflow: auto; font-size: .86rem; }
.op-side h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.op-side ul { list-style: none; padding: 0; margin: 0; }
.op-side li { margin: 0 0 6px; }
.op-side a { text-decoration: none; }
.op-side a:hover { text-decoration: underline; }
.op-text { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); }
.chunk { position: relative; padding: 4px 0 12px; scroll-margin-top: 80px; border-radius: var(--radius-sm); }
.chunk.hl { background: var(--hl); outline: 2px solid var(--orange); padding: 8px; }
.chunk h2 { margin-top: 18px; font-size: 1.08rem; }
.chunk .pg { float: right; font-size: .7rem; color: var(--muted); font-family: var(--mono); margin-left: 8px; }
.chunk .pg a { color: inherit; text-decoration: none; }
.chunk .pg a:hover { text-decoration: underline; }
.chunk .tools { font-size: .76rem; margin-top: 2px; }
.chunk .tools a, .chunk .tools button { font: inherit; color: var(--muted); background: none; border: none; padding: 0; margin-right: 10px; cursor: pointer; text-decoration: none; }
.chunk .tools a:hover, .chunk .tools button:hover { color: var(--accent); }
.fn { font-size: .88rem; color: var(--muted); }
.fn .passage { font-size: .88rem; }

/* tables and forms */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--panel-2); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.grid-form label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: 4px; font-weight: 500; }
.grid-form input, .grid-form select { font: inherit; font-size: .9rem; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); }

/* research */
.ask textarea { width: 100%; font: inherit; font-size: 1rem; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); min-height: 90px; resize: vertical; box-shadow: var(--shadow); }
.answer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; font-size: 1rem; line-height: 1.65; box-shadow: var(--shadow); }
.answer p { margin: 0 0 .8em; }
.answer ul, .answer ol { margin: 0 0 .8em 1.2em; }
.answer a.ref { text-decoration: none; font-size: .76rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 5px; vertical-align: super; }
.answer .cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--muted); }
@keyframes blink { to { visibility: hidden; } }
.answer.md h2, .answer.md h3, .answer.md h4 { margin: 1.1em 0 .4em; }
.answer.md h2 { font-size: 1.2rem; } .answer.md h3 { font-size: 1.05rem; } .answer.md h4 { font-size: 1rem; }
.answer.md blockquote { margin: .6em 0; padding: .2em 1em; border-left: 3px solid var(--line); color: var(--muted); }
.answer.md table { font-size: .88rem; margin: .8em 0; box-shadow: none; }
.answer.md pre { background: var(--panel-2); border: 1px solid var(--line-2); padding: 10px; border-radius: var(--radius-sm); overflow: auto; font-size: .84rem; }
.answer.md pre code { border: none; background: none; padding: 0; }
.answer.md a { text-decoration: underline; text-decoration-color: var(--line); }
.activity { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin: 12px 0; font-size: .86rem; }
.activity summary { cursor: pointer; color: var(--muted); }
.activity ol { margin: 8px 0 4px 1.2em; padding: 0; color: var(--muted); }
.activity li { margin: 2px 0; font-family: var(--mono); font-size: .78rem; }
.activity .note { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.sources { margin-top: 16px; }
.sources .card { padding: 10px 14px; margin-bottom: 8px; }
.sources .n { display: inline-block; min-width: 1.6em; text-align: center; font-family: var(--mono); font-size: .78rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-right: 6px; }

/* notices and badges */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--panel); border-radius: var(--radius-sm); font-size: .88rem; margin: 12px 0; }
.notice.appeal { border-left-color: var(--appeal); }
.notice.docket { border-left-color: var(--muted); }
.notice.docket.later { border-left-color: var(--orange); }
.notice ul.plain { list-style: none; padding: 0; margin: 6px 0 0; }
.notice ul.plain li { margin: 3px 0; }
.court-badge { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 600; letter-spacing: .02em; color: #fff; background: var(--appeal); white-space: nowrap; }
h1 .court-badge { font-size: .76rem; }
.error { color: var(--warn); }

/* about */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.stat span { font-size: .78rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin: 10px 0 4px; }
.bars div { flex: 1; background: var(--accent); opacity: .8; border-radius: 2px 2px 0 0; position: relative; }
.bars div:hover { opacity: 1; background: var(--orange); }
.bars div span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--muted); display: none; white-space: nowrap; }
.bars div:hover span { display: block; }
.years { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }

/* PDF viewer */
.pdf-bar { position: sticky; top: 50px; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.pdf-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pdf-page { position: relative; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 4px rgba(0,0,0,.08); max-width: 100%; }
.pdf-page canvas { display: block; max-width: 100%; height: auto !important; }
.pdf-page.hl { outline: 3px solid var(--orange); }
.pdf-num { position: absolute; top: 6px; right: 8px; font-size: .68rem; color: #999; font-family: var(--mono); }
@media (max-width: 640px) { .pdf-bar { top: 0; } }

.gate { max-width: 420px; margin: 60px auto; text-align: center; }
.gate input { font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); width: 100%; margin: 10px 0; background: var(--panel); color: var(--ink); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--radius); font-size: .88rem; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .op-layout { grid-template-columns: 1fr; }
  .op-side { position: static; max-height: none; }
  .op-text { padding: 16px; }
  .hero h1 { font-size: 1.6rem; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 0 12px; height: auto; }
  .brand { height: 48px; }
  .top nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; gap: 0; height: auto; }
  .top nav a { padding: 0 10px; height: 40px; white-space: nowrap; font-size: .9rem; }
  .hero { padding-top: 20px; }
  .hero h1 { font-size: 1.4rem; }
  form.search { flex-direction: column; }
  form.search .btn { width: 100%; }
  .filters { justify-content: flex-start; }
  .filters label { flex: 1 1 45%; }
  .filters select, .filters input { flex: 1; max-width: none; min-width: 0; }
  .card { padding: 12px 14px; }
  .chunk .pg { float: none; display: block; }
}
