/* Rhett Precedent: Rhett's design system (odysseus-for-legal docs/technical/08-design-system.md).
   Monochrome: the accent is black (--red is black, it is the accent slot, not an error colour);
   real errors use --color-error. Inter for body and UI, Hanken Grotesk for titles.
   Never invent a colour or a font size: colours are the tokens below, and every font-size is
   one of the 15 type tokens, written as calc(token * var(--text-scale)) as in Rhett itself. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Inter-Regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Inter-Medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Inter-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/HankenGrotesk-500.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/HankenGrotesk-600.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/HankenGrotesk-700.woff2") format("woff2"); }

:root {
  /* colour: the eight palette colours */
  --bg: #eeeeee;
  --panel: #ffffff;
  --code-bg: #e8e8e8;
  --red: #000000;            /* the accent slot: black */
  --color-muted: #4c4546;
  --color-muted-alt: #7e7576;
  --hl-bg: #f9f9f9;
  --surface-card: #f3f3f3;
  /* foreground and border */
  --fg: #1c1c1c;
  --border: #dcd7d7;
  /* semantic colours (state only) */
  --color-error: #d92d20;
  --color-success: #2e9e5b;
  --color-warning: #d99a00;

  --accent: var(--red);
  /* search-term highlight and state tints, mixed from the tokens above */
  --mark: color-mix(in srgb, var(--color-warning) 26%, var(--panel));
  --tint-success: color-mix(in srgb, var(--color-success) 12%, var(--panel));
  --tint-warning: color-mix(in srgb, var(--color-warning) 14%, var(--panel));
  --tint-error: color-mix(in srgb, var(--color-error) 9%, var(--panel));
  --line-warning: color-mix(in srgb, var(--color-warning) 45%, var(--panel));
  --line-error: color-mix(in srgb, var(--color-error) 40%, var(--panel));
  --divider: rgba(207, 196, 197, 0.35);

  /* type */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Hanken Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-scale: 1.125;
  --fs-label-sm: 6px;  --fs-label-md: 7px;  --fs-label-lg: 9px;
  --fs-body-sm: 11px;  --fs-body-md: 13px;  --fs-body-lg: 16px;
  --fs-title-sm: 20px; --fs-title-md: 24px; --fs-title-lg: 29px;
  --fs-heading-sm: 36px; --fs-heading-md: 43px; --fs-heading-lg: 53px;
  --fs-display-sm: 65px; --fs-display-md: 79px; --fs-display-lg: 96px;
  --t-body-sm: calc(var(--fs-body-sm) * var(--text-scale));
  --t-body-md: calc(var(--fs-body-md) * var(--text-scale));
  --t-body-lg: calc(var(--fs-body-lg) * var(--text-scale));
  --t-title-sm: calc(var(--fs-title-sm) * var(--text-scale));
  --t-title-md: calc(var(--fs-title-md) * var(--text-scale));
  --t-title-lg: calc(var(--fs-title-lg) * var(--text-scale));
  --t-heading-sm: calc(var(--fs-heading-sm) * var(--text-scale));

  /* shape */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;
  --shadow-composer: 0 12px 16px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.18);
  --tap: 40px;
}

/* The 15 type tokens, exactly as specified (1x, not scaled). */
.ty-label-sm { font: 500 6px/1.35 var(--font-body) !important; letter-spacing: 0.01em; }
.ty-label-md { font: 500 7px/1.35 var(--font-body) !important; letter-spacing: 0.01em; }
.ty-label-lg { font: 500 9px/1.35 var(--font-body) !important; letter-spacing: 0.01em; }
.ty-body-sm { font: 400 11px/1.45 var(--font-body) !important; letter-spacing: 0.015em; }
.ty-body-md { font: 400 13px/1.45 var(--font-body) !important; }
.ty-body-lg { font: 400 16px/1.5 var(--font-body) !important; }
.ty-title-sm { font: 500 20px/1.25 var(--font-display) !important; letter-spacing: -0.006em; }
.ty-title-md { font: 600 24px/1.18 var(--font-display) !important; letter-spacing: -0.011em; }
.ty-title-lg { font: 600 29px/1.18 var(--font-display) !important; letter-spacing: -0.011em; }
.ty-heading-sm { font: 600 36px/1.1 var(--font-display) !important; letter-spacing: -0.016em; }
.ty-heading-md { font: 700 43px/1.1 var(--font-display) !important; letter-spacing: -0.016em; }
.ty-heading-lg { font: 700 53px/1.05 var(--font-display) !important; letter-spacing: -0.022em; }
.ty-display-sm { font: 700 65px/1.05 var(--font-display) !important; letter-spacing: -0.022em; }
.ty-display-md { font: 700 79px/1.05 var(--font-display) !important; letter-spacing: -0.022em; }
.ty-display-lg { font: 700 96px/1.05 var(--font-display) !important; letter-spacing: -0.022em; }

/* --- base ------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 400 var(--t-body-md)/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--fg); margin: 0; }
p { margin: 0; }
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--color-muted-alt); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--red); color: var(--red); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
mark { background: var(--mark); color: inherit; padding: 0 0.1em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 50; background: var(--red); color: var(--panel); padding: 10px 16px; border-radius: var(--r-md); text-decoration: none; font-weight: 500; }
.skip-link:focus { top: 12px; color: var(--panel); }
.muted { color: var(--color-muted); }
.nowrap { white-space: nowrap; }
.meta-line { color: var(--color-muted); font-size: var(--t-body-md); line-height: 1.45; }
.eyebrow { font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin: 0; }
.count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 0 7px;
  border-radius: var(--r-pill); background: var(--surface-card); color: var(--color-muted);
  font: 500 var(--t-body-sm)/1.6 var(--font-body); font-variant-numeric: tabular-nums;
}
.count-strong { background: var(--red); color: var(--panel); }
.tag {
  display: inline-flex; align-items: center; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--surface-card); border: 1px solid var(--border); color: var(--color-muted);
  font: 500 var(--t-body-sm)/1.6 var(--font-body); letter-spacing: 0.01em; vertical-align: 0.1em;
}

/* --- buttons and fields ---------------------------------------------------------------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r-md);
  border: 1px solid var(--red); background: var(--red); color: var(--panel);
  font: 500 var(--t-body-md)/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
button:hover, .btn-primary:hover { background: var(--fg); border-color: var(--fg); color: var(--panel); }
button:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--red); border-color: var(--red); color: var(--panel); }
.btn-ghost { background: var(--panel); border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { background: var(--surface-card); border-color: var(--border); color: var(--fg); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--color-muted); }
.btn-quiet:hover { background: var(--surface-card); border-color: transparent; color: var(--fg); }
.btn-sm { padding: 0 14px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: var(--t-body-md); }
.btn.is-busy, button.is-busy { opacity: 0.75; cursor: progress; }
.btn.is-busy::before, button.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
button.linklike {
  min-height: 0; padding: 0 2px; background: none; border: none; color: var(--color-muted);
  font: inherit; text-decoration: underline; text-underline-offset: 0.18em;
}
button.linklike:hover { color: var(--red); background: none; }

input:where(:not([type=hidden]):not([type=checkbox]):not([type=radio])), select, textarea {
  min-height: var(--tap); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--panel); color: var(--fg); font: 400 var(--t-body-md)/1.45 var(--font-body); max-width: 100%;
}
textarea { padding: 12px 14px; }
input::placeholder, textarea::placeholder { color: var(--color-muted-alt); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); border-radius: var(--r-md); }
select { padding-right: 32px; cursor: pointer; }
form.inline { display: inline; }

/* --- header ---------------------------------------------------------------------------------- */
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "brand search nav account";
  align-items: center; gap: 12px 24px;
}
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); text-decoration: none; color: var(--fg); }
.brand:hover { color: var(--fg); }
.brand-mark { width: 20px; height: auto; display: block; }
.brand-name { font: 600 var(--t-body-lg)/1.25 var(--font-display); letter-spacing: -0.006em; white-space: nowrap; }
.header-search {
  grid-area: search; display: flex; align-items: center; gap: 6px; max-width: 620px; width: 100%;
  background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 3px 4px 3px 12px;
}
.header-search:focus-within { background: var(--panel); border-color: var(--red); }
.header-search .search-icon { color: var(--color-muted-alt); flex: none; }
.header-search input[type=search] { flex: 1; min-width: 0; border: none; background: transparent; padding: 0 4px; min-height: 36px; font-size: var(--t-body-md); }
.header-search input[type=search]:focus-visible { outline: none; }
.send-btn { width: var(--tap); min-width: var(--tap); padding: 0; border-radius: 50%; min-height: var(--tap); height: var(--tap); flex: none; }
.header-search .send-btn { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
.site-nav { grid-area: nav; display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-md);
  color: var(--color-muted); font: 500 var(--t-body-md)/1 var(--font-body); text-decoration: none;
}
.nav-link:hover { background: var(--surface-card); color: var(--fg); }
.nav-link[aria-current="page"] { background: var(--surface-card); color: var(--fg); font-weight: 600; }
.account { grid-area: account; display: flex; align-items: center; gap: 10px; justify-self: end; }
.account-name { font-weight: 500; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--red); color: var(--panel); font: 600 var(--t-body-md)/1 var(--font-display); flex: none;
}

/* --- page frame ------------------------------------------------------------------------------- */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px; }
.container.narrow { max-width: 560px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title { font: 600 var(--t-body-lg)/1.25 var(--font-display); letter-spacing: -0.006em; }
.sub-title { display: flex; align-items: center; gap: 8px; font: 600 var(--t-body-md)/1.45 var(--font-display); margin: 24px 0 10px; }
.page-head { margin: 8px 0 24px; max-width: 760px; }
.page-title { font: 600 var(--t-title-lg)/1.18 var(--font-display); letter-spacing: -0.011em; margin-bottom: 8px; }
.page-lede { color: var(--color-muted); font-size: var(--t-body-md); line-height: 1.45; }
.empty {
  list-style: none; text-align: center; padding: 40px 24px; border: 1px dashed var(--border);
  border-radius: var(--r-xl); background: var(--panel); color: var(--color-muted);
}
.empty-title { font: 600 var(--t-body-lg)/1.5 var(--font-display); color: var(--fg); margin-bottom: 4px; }
.empty-inline { color: var(--color-muted); padding: 12px 0; }
.notice {
  background: var(--tint-warning); border: 1px solid var(--line-warning); border-radius: var(--r-lg);
  padding: 12px 16px; color: var(--fg); margin: 16px 0; line-height: 1.5;
}
.notice-error { background: var(--tint-error); border-color: var(--line-error); }
.notice p + p { margin-top: 8px; }

/* chips: court, date and citation lines */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; max-width: 100%; padding: 2px 10px;
  border-radius: var(--r-pill); background: var(--surface-card); color: var(--color-muted);
  font: 500 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.01em;
}
.chip-court { color: var(--fg); font-weight: 600; }
.chip-cite { font-variant-numeric: tabular-nums; }
.chip-outline { background: transparent; border: 1px solid var(--border); }
.chip-strong { background: var(--red); color: var(--panel); }
.chip-strong a { color: var(--panel); text-decoration-color: var(--panel); }
.chip-remove {
  min-height: 24px; width: 24px; padding: 0; margin-right: -6px; border: none; border-radius: 50%;
  background: transparent; color: inherit; font-size: var(--t-body-md);
}
.chip-remove:hover { background: var(--fg); border: none; }

/* treatment: the colour is a dot beside the word, so the text keeps its contrast */
.badge, .status {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: var(--r-pill);
  background: var(--surface-card); color: var(--fg); text-decoration: none; white-space: nowrap;
  font: 500 var(--t-body-sm)/1.6 var(--font-body); letter-spacing: 0.01em;
}
.badge::before, .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-muted-alt); flex: none; }
a.badge:hover { color: var(--fg); box-shadow: inset 0 0 0 1px var(--border); }
.badge-followed, .badge-affirmed, .status-positive { background: var(--tint-success); }
.badge-followed::before, .badge-affirmed::before, .status-positive::before { background: var(--color-success); }
.badge-distinguished, .status-caution { background: var(--tint-warning); }
.badge-distinguished::before, .status-caution::before { background: var(--color-warning); }
.badge-overruled, .badge-reversed, .status-negative { background: var(--tint-error); }
.badge-overruled::before, .badge-reversed::before, .status-negative::before { background: var(--color-error); }
.badge.active { box-shadow: inset 0 0 0 2px var(--red); }

/* --- home ------------------------------------------------------------------------------------- */
.hero { max-width: 760px; margin: 40px auto 48px; text-align: center; }
.pill-label {
  display: inline-flex; padding: 6px 14px; border-radius: var(--r-pill); background: var(--panel); border: 1px solid var(--border);
  font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted);
}
.hero-title { font: 600 var(--t-heading-sm)/1.1 var(--font-display); letter-spacing: -0.016em; margin: 18px 0 28px; }
.composer {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 9px;
  box-shadow: var(--shadow-composer); text-align: left;
}
.composer:focus-within { border-color: var(--red); }
.composer input[type=search], .composer textarea {
  display: block; width: 100%; border: none; background: transparent; padding: 12px 14px;
  font: 400 var(--t-body-lg)/24px var(--font-body); color: var(--fg); min-height: 52px; resize: vertical;
}
.composer textarea { min-height: 96px; max-height: 360px; }
.composer input[type=search]:focus-visible, .composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 2px 14px; flex-wrap: wrap; }
.composer-note { color: var(--color-muted); font-size: var(--t-body-sm); line-height: 1.45; flex: 1 1 200px; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tips { color: var(--color-muted); font-size: var(--t-body-sm); line-height: 1.8; max-width: 640px; margin: 18px auto 0; }
.tips code { background: var(--panel); border: 1px solid var(--border); white-space: nowrap; }
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.home-grid > .card { padding: 24px; }
.stat-line { color: var(--color-muted); font-size: var(--t-body-md); }
.stat-line strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.court-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.court-list li { break-inside: avoid; }
.court-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 4px 10px;
  border-radius: var(--r-md); text-decoration: none; color: var(--fg);
}
.court-list a:hover { background: var(--surface-card); color: var(--fg); }
.court-list .count { background: transparent; color: var(--color-muted); padding: 0; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { padding: 12px 0; border-top: 1px solid var(--divider); }
.recent-list li:first-child { border-top: none; padding-top: 0; }
.recent-title { font: 600 var(--t-body-md)/1.45 var(--font-display); text-decoration: none; display: inline-block; }
.recent-title:hover { text-decoration: underline; }
.recent-list .meta-line { font-size: var(--t-body-sm); margin-top: 2px; }

/* --- search ----------------------------------------------------------------------------------- */
.search-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { padding: 8px 8px 16px; position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow: auto; }
.filters-title {
  display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 10px; cursor: pointer; list-style: none;
  font: 600 var(--t-body-md)/1.45 var(--font-display);
}
.filters-title::-webkit-details-marker { display: none; }
.filters-title .chevron { margin-left: auto; color: var(--color-muted); transition: transform 0.15s ease; }
.filters[open] .filters-title .chevron { transform: rotate(180deg); }
.filters-body { padding: 0 2px; }
.facet-title { font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin: 18px 10px 6px; }
.facet { list-style: none; margin: 0; padding: 0; }
.facet a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 4px 10px;
  border-radius: var(--r-md); text-decoration: none; color: var(--fg); line-height: 1.35;
}
.facet a:hover { background: var(--surface-card); color: var(--fg); }
.facet a.active { background: var(--red); color: var(--panel); font-weight: 500; }
.facet a.active .count { background: color-mix(in srgb, var(--panel) 18%, var(--red)); color: var(--panel); }
.facet-inline { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; }
.facet-inline a { min-height: 32px; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px 4px 2px 12px; }
.facet-inline a .count { background: transparent; }
.filters .meta-line { padding: 0 10px; }
.clear-filters { padding: 16px 10px 0; }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.result-count { color: var(--color-muted); font-size: var(--t-body-md); }
.result-count strong { color: var(--fg); font-weight: 600; }
.browse-title { font: 600 var(--t-title-md)/1.18 var(--font-display); letter-spacing: -0.011em; margin: 0 0 8px; }
.facet-note { font-weight: 400; letter-spacing: 0; text-transform: none; }
.applied-filter { color: var(--color-muted); margin: 0 0 8px; }
.applied-filter strong { color: var(--fg); font-weight: 600; }
.year-range { display: flex; align-items: center; gap: 6px; margin: 0 10px 8px; }
.year-range-sep { color: var(--color-muted); }
.year-range select { flex: 1 1 0; min-width: 0; }
.result-q { overflow-wrap: anywhere; }
.sort-form { display: flex; align-items: center; gap: 8px; color: var(--color-muted); font-size: var(--t-body-md); }
.sort-form select { min-height: 36px; }
.allowance-note { color: var(--color-muted); font-size: var(--t-body-sm); margin: -4px 0 12px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.result { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 18px 20px; box-shadow: var(--shadow-card); transition: border-color 0.15s ease; }
.result:hover { border-color: var(--color-muted-alt); }
.result-heading { font: 600 var(--t-body-lg)/1.35 var(--font-display); letter-spacing: -0.006em; margin-bottom: 8px; }
.result-title { text-decoration: none; color: var(--fg); }
.result-title:hover { text-decoration: underline; color: var(--red); }
.result-title:visited { color: var(--color-muted); }
.snippet { margin-top: 10px; color: var(--fg); line-height: 1.55; }
.result-bench { margin-top: 8px; color: var(--color-muted); font-size: var(--t-body-sm); }
.within-form { display: flex; gap: 8px; margin: 24px 0 0; max-width: 560px; }
.within-form input[type=search] { flex: 1; min-width: 0; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 28px 0 0; }
.pager a, .pager-current {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: var(--fg);
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--surface-card); color: var(--fg); }
.pager-current { background: var(--red); border-color: var(--red); color: var(--panel); }
.search-limit { padding: 20px; }

/* --- a judgment ------------------------------------------------------------------------------- */
.document { max-width: 880px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.doc-header { padding: 28px 32px 20px; }
.doc-court { margin-bottom: 8px; }
.doc-title { font: 600 var(--t-title-lg)/1.18 var(--font-display); letter-spacing: -0.011em; overflow-wrap: anywhere; }
.doc-date { color: var(--color-muted); font-weight: 500; white-space: nowrap; }
.doc-citations { margin-top: 14px; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; margin: 18px 0 0; }
.doc-meta div { min-width: 0; }
.doc-meta dt { font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.doc-meta dd { margin: 2px 0 0; }
.description {
  margin: 18px 0 0; padding: 14px 16px; background: var(--surface-card); border-left: 3px solid var(--red);
  border-radius: 0 var(--r-lg) var(--r-lg) 0; font-size: var(--t-body-md); line-height: 1.5;
}
.doc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--divider); }
.docket-control { margin-left: auto; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.docket-add { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.docket-add input { width: 11rem; }
.section-label {
  font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted);
  margin: 0.6em 0 0.3em; white-space: normal;
}
/* Citations resolved in the judgment text link to the cited judgment (JT-7/8); a "Cited by"
   passage opens the citing judgment at that mention (JT-4): see .page-text below. */
.doc-sources { color: var(--color-muted); font-size: var(--t-body-sm); padding: 4px 8px; }
.doc-sources ul { margin: 6px 0 0; padding-left: 18px; }

/* the citations panel */
.citations { padding: 20px 24px; }
.citations-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.view-toggle { margin-left: auto; display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border-radius: var(--r-lg); }
.view-toggle button {
  min-height: 34px; padding: 0 14px; border: none; border-radius: var(--r-md); background: transparent; color: var(--color-muted);
}
.view-toggle button:hover { background: transparent; color: var(--fg); border: none; }
.view-toggle button.active { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.citation-summary { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--color-muted); }
.citation-summary strong { color: var(--fg); }
.by-court { margin-top: 6px; font-size: var(--t-body-sm); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); -webkit-overflow-scrolling: touch; }
.citation-table, .data-table { border-collapse: collapse; width: 100%; font-size: var(--t-body-md); }
.citation-table th, .citation-table td, .data-table th, .data-table td {
  text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--divider);
}
.citation-table th, .data-table th {
  background: var(--surface-card); color: var(--color-muted); font: 600 var(--t-body-sm)/1.45 var(--font-body);
  letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.citation-table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: none; }
.citation-table td.decision { min-width: 14rem; }
.citation-table td.passage { min-width: 18rem; max-width: 28rem; }
.citation-table code { white-space: nowrap; }
a.passage-link { color: var(--color-muted); text-decoration: none; font-size: var(--t-body-md); }
a.passage-link:hover { color: var(--fg); text-decoration: underline; }
#citation-graph { margin-top: 12px; }
#citation-graph svg { width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); display: block; }
#citation-graph .graph-label { font: 400 var(--t-body-sm)/1 var(--font-body); }
.citation-view[data-view="graph"] .meta-line { margin-top: 14px; }

/* loading: the citations panel arrives after the page (htmx) */
.citations-pending .loading-line { display: flex; align-items: center; gap: 10px; color: var(--color-muted); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--red); animation: spin 0.8s linear infinite; flex: none; }
.skeleton { display: grid; gap: 10px; margin-top: 16px; }
.skeleton span { display: block; height: 12px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--surface-card) 0%, var(--bg) 50%, var(--surface-card) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton span:nth-child(2) { width: 82%; }
.skeleton span:nth-child(3) { width: 64%; }
.htmx-request.citations-pending { cursor: progress; }
/* a thin bar along the top while a submitted search or Trace is on its way */
body.is-loading::before {
  content: ""; position: fixed; top: 0; left: 0; z-index: 60; height: 2px; width: 40%; background: var(--red);
  animation: progress 1.2s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* --- the judgment as pages, with reading tools and case details beside it ----------------------- */
.container.reader-page { max-width: 1440px; }
.reader { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 880px; margin: 0 auto; }
.reader > * { min-width: 0; }
.reader-head { padding: 24px 28px 20px; }
.reader-right { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.side-card { padding: 16px 18px; }
.side-title { font: 600 var(--t-body-md)/1.45 var(--font-display); margin: 0 0 10px; }
.side-meta { margin: 0; display: grid; gap: 8px; }
.side-meta div { min-width: 0; }
.side-meta dt { font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.side-meta dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.reader .doc-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0; padding: 0; border: none; }
.reader .doc-actions .btn { width: 100%; justify-content: center; }
.reader .docket-control { margin: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.reader .docket-add { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.reader .docket-add input { width: 100%; }
.reader .in-docket .chip { max-width: 100%; }
.side-count { margin: 0 0 8px; color: var(--color-muted); }
.side-count strong { color: var(--fg); font-weight: 600; }
.side-citations .chips { margin-bottom: 10px; }
.side-link { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; }
.reader-tools > summary { display: flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; list-style: none; margin: 0; }
.reader-tools > summary::-webkit-details-marker { display: none; }
.reader-tools .chevron { margin-left: auto; color: var(--color-muted); transition: transform 0.15s ease; }
.reader-tools[open] .chevron { transform: rotate(180deg); }
.find { margin: 8px 0 14px; }
.find-label { display: block; font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 6px; }
.find-row { display: flex; gap: 6px; }
.find-row input { flex: 1; min-width: 0; }
.find-step { width: var(--tap); min-width: var(--tap); padding: 0; font-size: var(--t-body-lg); }
.find-status { color: var(--color-muted); font-size: var(--t-body-sm); min-height: 1.45em; margin-top: 6px; }
.page-nav ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.page-nav a {
  display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: var(--fg);
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.page-nav a:hover { background: var(--surface-card); color: var(--fg); }
.page-nav a[aria-current="page"] { background: var(--red); border-color: var(--red); color: var(--panel); }
.outline { margin-top: 6px; }
.outline .facet-title { margin-left: 0; }
.outline ol { list-style: none; margin: 0; padding: 0; }
.outline a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 2px 8px; border-radius: var(--r-md); text-decoration: none; color: var(--fg); }
.outline a:hover { background: var(--surface-card); color: var(--fg); }
.reader-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.reader-main > * { min-width: 0; }
/* one column (tablet, phone): the title, the reading tools, the pages, then details and actions */
.reader-head { order: 1; }
.reader-left { order: 2; }
.reader-main { order: 3; }
.reader-right { order: 4; }

/* a page: a white sheet, the court's page in reading type. The text is structured
   (judgments/pages.py render_pages): the cause title as a block of centred, left and
   right-set lines, headings, and paragraphs, numbered ones with a hanging number. */
/* JT-16: the column template and min-width keep a sheet inside its track. Without them the implicit
   `auto` column took the sheet's min-content width, which an unbreakable run ("underSection113B",
   a row of '=' signs, a URL) pushed past the column: the sheet ran under the right rail. */
.doc-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.page {
  min-width: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.04);
  padding: 48px 56px 20px; scroll-margin-top: 88px;
}
.page-text {
  max-width: 70ch; margin: 0 auto; font: 400 var(--t-body-lg)/1.65 var(--font-body); color: var(--fg);
  overflow-wrap: anywhere; text-align: left; hyphens: manual; word-spacing: normal;
}
.page-text p { margin: 0 0 0.8em; }
.page-text > :last-child { margin-bottom: 0; }
.page-text .para { white-space: pre-line; }
.page-text .para-num, .page-text .para-list { padding-left: 2.75em; text-indent: -2.75em; }
.page-text .para-list { margin-left: 1.5em; }
.page-text .para-no { display: inline-block; min-width: 2.75em; text-indent: 0; font-variant-numeric: tabular-nums; }
.page-text .para-num > .para-no { font-weight: 600; }
.cause-title { margin: 0 0 1.6em; padding-bottom: 1.2em; border-bottom: 1px solid var(--divider); }
.page-text .cause-title .ct { margin: 0 0 0.15em; }
.cause-title .ct-centre { text-align: center; }
.cause-title .ct-heading {
  font: 600 var(--t-body-md)/1.65 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-muted); scroll-margin-top: 96px;
}
.page-text .cause-title .ct-heading, .page-text .cause-title .ct-text { margin: 0.8em 0 0.4em; }
.cause-title .ct-role, .cause-title .ct-role-tag { text-align: right; font-style: italic; }
.cause-title .ct-party { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1em; }
.cause-title .ct-role-tag { margin-left: auto; }
.cause-title .ct-text { text-align: left; }
.chunk-anchor { scroll-margin-top: 96px; }
.page-text .section-label { display: block; margin: 0 0 0.6em; scroll-margin-top: 96px; }
.text-heading { font: 600 var(--t-body-lg)/1.65 var(--font-display); letter-spacing: 0.01em; scroll-margin-top: 96px; }
.page-text .text-heading { margin: 1.2em 0 0.5em; }
.page-text .text-heading.is-decision { text-align: center; letter-spacing: 0.12em; text-transform: uppercase; margin: 0.4em 0 1em; }
.page-text > .text-heading:first-child, .page-text > .chunk-anchor:first-child + .text-heading { margin-top: 0; }
.page:has(.chunk-anchor:target) { border-color: var(--red); }
.page-text a.cite-link { text-decoration: underline dotted; text-decoration-color: var(--color-muted-alt); }
.page-text a.cite-link:hover { text-decoration-style: solid; }
.page-text .cite-focus { outline: 2px solid var(--color-warning); background: var(--mark); scroll-margin-top: 30vh; border-radius: 2px; }
.page-foot {
  max-width: 70ch; margin: 28px auto 0; padding-top: 12px; border-top: 1px solid var(--divider);
  text-align: center; color: var(--color-muted); font-size: var(--t-body-sm); font-variant-numeric: tabular-nums;
}
.page-text .trace-hit { background: var(--mark); box-shadow: -8px 0 0 var(--mark), 8px 0 0 var(--mark); border-radius: 2px; scroll-margin-top: 30vh; }
a.passage-open { display: block; color: inherit; text-decoration: none; border-radius: var(--r-md); }
a.passage-open:hover blockquote, a.passage-open:focus-visible blockquote { border-left-color: var(--fg); background: var(--hl-bg); }
mark.find-hit { background: color-mix(in srgb, var(--color-warning) 45%, var(--panel)); }
mark.find-hit.is-current { background: var(--red); color: var(--panel); }

/* "Ask Compass about this judgment" (JT-5, static/compass.js): a question, then the paragraphs it
   found as "why" lines with a side marker (the colours of Compass's two columns); each one scrolls
   to its paragraph, highlighted (.trace-hit; the one chosen also gets a bar at its left edge). */
.compass-form { display: grid; gap: 8px; }
.compass-form textarea { width: 100%; min-height: 84px; max-height: 240px; resize: vertical; line-height: 1.45; }
.compass-form .btn { width: 100%; }
.compass-note { color: var(--color-muted); font-size: var(--t-body-sm); line-height: 1.45; }
.compass-status { color: var(--color-muted); font-size: var(--t-body-sm); line-height: 1.45; margin-top: 10px; }
.compass-status:empty { display: none; }
.compass-proposition { font-size: var(--t-body-sm); line-height: 1.45; color: var(--color-muted); margin-top: 8px; }
.compass-proposition strong { color: var(--fg); font-weight: 600; }
.compass-results { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
button.compass-hit {
  display: grid; gap: 2px; justify-items: start; width: 100%; min-height: var(--tap); padding: 8px 10px 8px 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--color-muted-alt); border-radius: var(--r-sm);
  background: var(--panel); color: var(--fg); text-align: left; white-space: normal;
  font: 400 var(--t-body-md)/1.45 var(--font-body);
}
button.compass-hit:hover { background: var(--surface-card); border-color: var(--border); color: var(--fg); }
button.compass-hit[data-stance="supports"] { border-left-color: var(--color-success); }
button.compass-hit[data-stance="against"] { border-left-color: var(--color-error); }
button.compass-hit[data-stance="position"] { border-left-color: var(--red); }
button.compass-hit[aria-current="true"] { background: var(--hl-bg); border-color: var(--fg); }
button.compass-hit[data-stance="supports"][aria-current="true"] { border-left-color: var(--color-success); }
button.compass-hit[data-stance="against"][aria-current="true"] { border-left-color: var(--color-error); }
.compass-hit-head { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
.compass-side { font: 600 var(--t-body-sm)/1.45 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }
.compass-where { color: var(--color-muted); font-size: var(--t-body-sm); font-variant-numeric: tabular-nums; }
.compass-why { display: block; }
.page-text .trace-hit.is-current-hit { box-shadow: -8px 0 0 var(--mark), 8px 0 0 var(--mark), -11px 0 0 var(--red); }
.page-text .is-current-hit:focus { outline: none; }

/* one column (tablet, phone): the rail's cards join the page's own order, so the case details
   and the Compass box come right after the title, before the reading tools and the text; the
   actions and citations stay after the text */
@media (max-width: 1279.98px) {
  .reader-right { display: contents; }
  .reader-right > .side-details { order: 2; }
  .reader-right > .compass-card { order: 3; }
  .reader-left { order: 4; }
  .reader-main { order: 5; }
  .reader-right > .side-actions, .reader-right > .side-citations { order: 6; }
}

@media (min-width: 1280px) {
  .reader {
    max-width: none; grid-template-columns: 236px minmax(0, 1fr) 300px; gap: 24px; align-items: start;
    grid-template-areas: "left head right" "left main right";
  }
  .reader-head { grid-area: head; }
  .reader-main { grid-area: main; }
  .reader-left, .reader-right {
    position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow: auto; align-self: start;
    scrollbar-width: thin;
  }
  .reader-left { grid-area: left; grid-row: 1 / span 2; }
  .reader-right { grid-area: right; grid-row: 1 / span 2; grid-template-columns: minmax(0, 1fr); }
  .reader-tools > summary { pointer-events: none; }
  .reader-tools > summary .chevron { display: none; }
}

/* --- Trace ------------------------------------------------------------------------------------ */
.trace { max-width: 1120px; margin: 0 auto; }
.trace-form { max-width: 820px; }
.quota { color: var(--fg); font-weight: 500; }
.trace-summary { color: var(--color-muted); margin: 24px 0 16px; }
.trace-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.column-title { display: flex; align-items: center; gap: 8px; font: 600 var(--t-body-lg)/1.25 var(--font-display); margin: 0 0 12px; }
.stance-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-muted-alt); flex: none; }
.trace-supports .stance-dot { background: var(--color-success); }
.trace-against .stance-dot { background: var(--color-error); }
.passage { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
.trace-supports .passage { border-top: 3px solid var(--color-success); }
.trace-against .passage { border-top: 3px solid var(--color-error); }
.passage-head { display: grid; gap: 8px; }
.passage-title { font: 600 var(--t-body-lg)/1.35 var(--font-display); text-decoration: none; }
.passage-title:hover { text-decoration: underline; }
.relevance { display: flex; align-items: center; gap: 10px; font-size: var(--t-body-sm); color: var(--color-muted); }
.relevance-label { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.relevance-value { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
meter { width: 120px; height: 6px; border-radius: var(--r-pill); background: var(--surface-card); border: none; -webkit-appearance: none; appearance: none; }
meter::-webkit-meter-bar { background: var(--surface-card); border: none; border-radius: var(--r-pill); height: 6px; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background: var(--red); border-radius: var(--r-pill); }
meter::-moz-meter-bar { background: var(--red); border-radius: var(--r-pill); }
.passage-note { font-style: italic; font-size: var(--t-body-sm); }
.treatment-line { display: flex; flex-wrap: wrap; gap: 6px; }
.passage .why { margin: 12px 0 0; color: var(--fg); line-height: 1.5; }
.passage blockquote {
  margin: 10px 0 0; padding: 10px 14px; background: var(--surface-card); border-left: 2px solid var(--red); border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--color-muted); font-size: var(--t-body-md); line-height: 1.55; max-height: 14rem; overflow: auto;
}
.passage .read-more { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--t-body-md); font-weight: 500; }
.passage.unseen { border-left: 3px solid var(--color-error); }
.passage .event-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.passage .meta-line { margin-top: 4px; font-size: var(--t-body-sm); }
.trace-neutral { margin-top: 12px; padding: 4px 18px; }
.trace-neutral summary { min-height: var(--tap); display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; list-style: none; }
.trace-neutral summary::-webkit-details-marker { display: none; }
.trace-neutral summary::before { content: "›"; color: var(--color-muted); transition: transform 0.15s ease; }
.trace-neutral[open] summary::before { transform: rotate(90deg); }
.trace-neutral ul { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 8px; }

/* --- dockets and status ----------------------------------------------------------------------- */
.dockets, .status-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dockets .page-head, .status-page .page-head { margin-bottom: 8px; }
.docket-scope { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--color-muted); }
.docket-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.docket-tabs a {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 8px 0 14px; border-radius: var(--r-pill);
  background: var(--panel); border: 1px solid var(--border); text-decoration: none; color: var(--fg); font-weight: 500;
}
.docket-tabs a:hover { background: var(--surface-card); color: var(--fg); }
.docket-tabs a.active { background: var(--red); border-color: var(--red); color: var(--panel); }
.docket-detail { padding: 20px 24px; }
.docket-detail .card-title { margin-bottom: 12px; }
.docket-updates .sub-title { margin-top: 8px; }
.status-page > .card { padding: 20px 24px; }
.status-page .card-title { margin-bottom: 12px; }
.data-table th.num, .data-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table tr.parked td { color: var(--color-muted); }
.run-succeeded { color: var(--color-success); font-weight: 500; }
.run-failed { color: var(--color-error); font-weight: 500; }
.run-running { color: var(--fg); font-weight: 500; }
.run-cancelled { color: var(--color-muted); }

/* --- sign-in ---------------------------------------------------------------------------------- */
.signin { margin: 40px auto; padding: 36px 32px 28px; text-align: center; }
.signin-logo { display: block; height: auto; margin: 0 auto 20px; }
.signin .signin-logo { width: 84px; }
.signin-title { font: 600 var(--t-title-md)/1.18 var(--font-display); letter-spacing: -0.011em; }
.signin-lede { color: var(--color-muted); margin-top: 10px; }
.signin-options { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin: 24px 0 16px; }
.signin-options form { display: flex; flex-direction: column; }
.signin-options .btn { width: 100%; }
.btn-mark { width: 13px; height: auto; filter: invert(1); }
.signin-note { color: var(--color-muted); font-size: var(--t-body-sm); line-height: 1.5; }
.signin .notice { text-align: left; }

/* the modal (anonymous pages) and its framed options (/signin/embed) */
.signin-modal {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 28px 24px 18px; background: var(--panel); color: var(--fg); box-shadow: var(--shadow-modal); text-align: center;
}
.signin-modal[open] { animation: modal-enter 0.2s ease-out both; }
.signin-modal::backdrop { background: rgba(0, 0, 0, 0.35); }
.signin-modal .signin-logo { width: 70px; margin-bottom: 14px; }
.modal-title { font: 600 var(--t-title-sm)/1.25 var(--font-display); letter-spacing: -0.006em; margin: 0 0 8px; }
.signin-modal-reason { color: var(--color-muted); margin: 0 0 6px; line-height: 1.5; }
.signin-modal-frame iframe { width: 100%; height: 204px; border: 0; display: block; }
.signin-modal-alt { font-size: var(--t-body-sm); margin: 4px 0 0; }
.modal-close {
  position: absolute; top: 10px; right: 10px; width: var(--tap); min-width: var(--tap); padding: 0; border-radius: 50%;
  background: transparent; border: none; color: var(--color-muted);
}
.modal-close:hover { background: var(--surface-card); color: var(--fg); border: none; }
.signin-embed { margin: 0; padding: 4px 2px; text-align: center; background: var(--panel); min-height: 0; }
.signin-embed .signin-options { margin: 8px 0 12px; }
.signin-embed .notice { text-align: left; margin: 4px 0 8px; }
@keyframes modal-enter { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* --- small screens ---------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .header-inner { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand nav account" "search search search"; }
  .site-nav { justify-self: end; }
  .header-search { max-width: none; }
  .search-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .filters { position: static; max-height: none; padding: 4px 8px; }
  .filters[open] { padding-bottom: 16px; }
  .facet a { min-height: var(--tap); }
  .facet-inline a { min-height: var(--tap); }
  .trace-columns { grid-template-columns: minmax(0, 1fr); }
  .site-header { position: static; }
}
@media (max-width: 900px) {
  .header-inner.no-search { grid-template-areas: "brand nav account"; }
}
@media (max-width: 640px) {
  .header-inner.no-search { grid-template-areas: "brand account" "nav nav"; }
  .header-inner { padding: 8px 16px 12px; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand account" "nav nav" "search search"; }
  .site-nav { justify-self: stretch; gap: 4px; margin: 0 -4px; }
  .account-name, .account .tag { display: none; }
  .container { padding: 20px 16px 64px; }
  .hero { margin: 16px auto 28px; }
  .hero-title { font-size: var(--t-title-lg); line-height: 1.18; letter-spacing: -0.011em; margin: 14px 0 20px; }
  .composer-bar { padding-left: 6px; }
  .composer-actions { width: 100%; }
  .composer-actions .btn-primary { flex: 1; }
  .home-grid > .card { padding: 18px 16px; }
  .court-list { columns: 1; }
  .result { padding: 16px; }
  .within-form { flex-direction: column; }
  .doc-header { padding: 20px 18px 16px; }
  .doc-title { font-size: var(--t-title-md); }
  .doc-meta { grid-template-columns: minmax(0, 1fr); }
  .docket-control { margin-left: 0; }
  .page { padding: 24px 18px 14px; }
  .page-text .para-num, .page-text .para-list { padding-left: 2.25em; text-indent: -2.25em; }
  .page-text .para-no { min-width: 2.25em; }
  .page-text .para-list { margin-left: 0.75em; }
  .reader-head { padding: 20px 18px 16px; }
  .citations, .docket-detail, .status-page > .card { padding: 16px; }
  .view-toggle { margin-left: 0; }
  .view-toggle button { min-height: var(--tap); }
  .page-title { font-size: var(--t-title-md); }
  .signin { margin: 16px auto; padding: 28px 20px 22px; }
  .pager-step { flex-basis: auto; }
  .relevance meter { flex: 1; min-width: 60px; }
  .header-search .send-btn { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); }
  .sort-form select { min-height: var(--tap); }
  .header-search input[type=search] { min-height: var(--tap); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .skeleton span { animation: none; }
  body.is-loading::before { animation: none; width: 100%; }
  .spinner, .btn.is-busy::before, button.is-busy::before { animation: none; }
}

/* Print ("Print it" or the browser's print): the judgment alone on A4, one sheet per page of
   the judgment (pages cut by length are sized to fit one, pages.py PAGE_TARGET), with a running
   footer: the case title (static/reader.js adds it from the page title) and "Page N of M". */
@page {
  size: A4;
  margin: 16mm 18mm 18mm;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 400 var(--t-body-sm)/1.45 var(--font-body); color: var(--color-muted); vertical-align: top; padding-top: 4mm; }
}
@media print {
  :root { --text-scale: 1; }
  html, body { background: var(--panel); }
  .site-header, .doc-actions, .doc-sources, .citations, .skip-link, .signin-modal, .reader-left, .reader-right,
  .page-foot, .find, .header-search { display: none !important; }
  .container, .container.reader-page { max-width: none; margin: 0; padding: 0; }
  .reader, .reader-main, .doc-text { display: block; max-width: none; margin: 0; padding: 0; }
  .card { border: none; box-shadow: none; border-radius: 0; }
  /* the judgment's own cause title heads the first sheet; the case title runs in the footer */
  .reader-head { display: none !important; }
  .page { border: none; border-radius: 0; box-shadow: none; padding: 0; margin: 0; break-after: page; }
  .page:last-child { break-after: auto; }
  .page-text { max-width: none; line-height: 1.45; orphans: 3; widows: 3; }
  .page-text .text-heading, .cause-title .ct-heading { break-after: avoid; }
  .page-text a.cite-link { color: inherit; text-decoration: none; }
  .page-text .cite-focus { outline: none; }
  mark.find-hit, mark.find-hit.is-current { background: none; color: inherit; }
}
