/* Agentic Research Directory - editorial directory styles.
   Paper-white, dark ink, hairline rules, one deep teal accent.
   Serif for headings and long-form prose; system sans for UI. No webfonts, no build step. */

/* ------------------------------------------------------------------ tokens */

:root {
  /* Colour. Contrast on --paper: ink 16:1, ink-soft 8.6:1, muted 5.9:1, teal 7.4:1. */
  --paper: #fbfaf7;
  --surface: #ffffff;
  --panel: #f4f2ec;
  --ink: #1b1d20;
  --ink-soft: #45484d;
  --muted: #5e6166;
  --rule: #e3dfd5;
  --rule-strong: #cbc5b8;
  --teal: #0d5c57;          /* the single accent */
  --teal-dark: #08423e;
  --teal-tint: #e7f0ee;
  --teal-line: #b9d2ce;
  --warn: #7a4209;
  --warn-tint: #f7efe0;
  --warn-line: #e2cfae;
  --err: #8a1f1f;
  --ok: #1d5c33;
  --ok-tint: #e6f0e7;
  --ok-line: #bcd6bf;

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.8125rem;   /* 13px  meta, badges */
  --fs-sm: 0.875rem;    /* 14px  secondary UI */
  --fs-base: 1rem;      /* 16px  UI body */
  --fs-md: 1.125rem;    /* 18px  prose, lede */
  --fs-lg: 1.3125rem;   /* 21px  card titles, h2 */
  --fs-xl: 1.625rem;    /* 26px  page titles (mobile) */
  --fs-2xl: clamp(1.75rem, 1.35rem + 1.6vw, 2.25rem); /* page titles */

  /* Spacing rhythm (4px base) */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem;  --s6: 2rem;   --s7: 3rem;    --s8: 4rem;

  --radius: 4px;
  --tap: 2.75rem;       /* 44px minimum touch target */
  --measure: 42rem;     /* comfortable reading width */
  --wrap: 68rem;
}

/* -------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; height: auto; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s5); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.22;
  letter-spacing: -0.005em;
}
h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s3); }
h2 { font-size: var(--fs-lg); margin: var(--s6) 0 var(--s2); }
h3 { font-size: var(--fs-md); margin: var(--s5) 0 var(--s2); }

p { margin: 0 0 var(--s3); }

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--teal-dark); text-decoration-thickness: 2px; }

code, pre { font-family: var(--mono); font-size: 0.875em; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 2px;
}
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s4); top: -4rem; z-index: 10;
  background: var(--ink); color: #fff; padding: var(--s2) var(--s4);
  border-radius: var(--radius); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s2); color: #fff; }

/* ----------------------------------------------------------- header/footer */

.site-head { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-head-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s2) var(--s5); padding-top: var(--s2); padding-bottom: var(--s2);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: var(--tap);
  font-family: var(--serif); font-size: 1.1875rem; font-weight: 600; letter-spacing: 0.005em;
  color: var(--ink); text-decoration: none;
}
.wordmark:hover { color: var(--teal-dark); text-decoration: none; }
.wordmark-mark {
  width: 0.7rem; height: 0.7rem; flex: none;
  background: var(--teal); border-radius: 1px; transform: rotate(45deg);
}

.site-nav { display: flex; flex-wrap: wrap; gap: 0 var(--s1); }
.site-nav a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s3);
  color: var(--ink-soft); text-decoration: none; font-size: var(--fs-sm); font-weight: 500;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--teal-dark); border-bottom-color: var(--rule-strong); }
.site-nav a.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.nav-count {
  display: inline-block; min-width: 1.4rem; margin-left: 0.35rem; padding: 0 0.4rem;
  background: var(--teal); color: #fff; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600; line-height: 1.35rem; text-align: center;
}

main { display: block; padding-top: var(--s6); padding-bottom: var(--s8); }

.site-foot {
  border-top: 1px solid var(--rule); background: var(--panel);
  color: var(--ink-soft); font-size: var(--fs-sm);
}
.site-foot-inner {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s5);
  padding-top: var(--s6); padding-bottom: var(--s6);
}
.site-foot p { max-width: 38rem; }
.foot-brand { font-family: var(--serif); font-size: var(--fs-md); font-weight: 600; color: var(--ink); margin-bottom: var(--s2); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 0 var(--s4); margin-bottom: var(--s2); }
.foot-nav a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; }
.site-foot a { color: var(--teal-dark); }
.last-update { font-size: var(--fs-xs); color: var(--muted); }

/* ------------------------------------------------------------ page headers */

.masthead, .intro { max-width: 48rem; margin-bottom: var(--s5); }
.masthead h1 { margin-bottom: var(--s2); }
.lede { font-family: var(--serif); font-size: var(--fs-md); line-height: 1.5; color: var(--ink-soft); max-width: var(--measure); margin-bottom: var(--s2); }
.masthead-note { color: var(--muted); font-size: var(--fs-sm); max-width: var(--measure); margin: 0; }

.fineprint { font-size: var(--fs-xs); color: var(--muted); }
.fineprint a { color: var(--teal-dark); }

/* ------------------------------------------------------------------ forms */

.field { margin: 0; display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.field label {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; color: var(--ink-soft);
}
.field input, .field select, .field textarea, .search-box input {
  font: inherit; font-size: var(--fs-base); color: var(--ink); width: 100%;
  min-height: var(--tap); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 0.5rem 0.65rem;
}
.field textarea { min-height: 8rem; line-height: 1.5; resize: vertical; }
.field select { padding-right: 2rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.search-box input:focus-visible {
  outline: 3px solid var(--teal); outline-offset: 0; border-color: var(--teal);
}

button, .button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--teal); color: #fff; border: 1px solid var(--teal); border-radius: var(--radius);
}
button:hover, .button-link:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
button.danger { background: var(--surface); color: var(--err); border-color: var(--err); }
button.danger:hover { background: var(--err); color: #fff; }
button.linklike {
  min-height: var(--tap); background: none; border: none; color: var(--teal);
  text-decoration: underline; text-underline-offset: 0.18em; padding: 0 var(--s1);
  font-size: var(--fs-sm); font-weight: 500;
}
button.linklike:hover { color: var(--teal-dark); background: none; }
.reset { font-size: var(--fs-sm); font-weight: 500; }

/* -------------------------------------------------------- browse / finder */

.finder {
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  padding: var(--s4) 0 var(--s3); margin-bottom: var(--s5);
}
.search-row { margin-bottom: var(--s3); }
.search-label {
  display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: var(--s2);
}
.search-box { display: flex; gap: var(--s2); max-width: 46rem; }
.search-box input {
  flex: 1 1 auto; min-width: 0; min-height: 3rem; font-size: var(--fs-md); padding: 0.55rem 0.8rem;
}
.search-box button { min-height: 3rem; padding: 0 var(--s5); font-size: var(--fs-base); flex: none; }

.type-nav { display: flex; align-items: baseline; gap: var(--s2) var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.type-nav-label {
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.type-nav ul { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.type-nav a {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 var(--s3);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-soft); text-decoration: none;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 99px;
}
.type-nav a:hover { color: var(--teal-dark); border-color: var(--teal); }
.type-nav a.is-current { background: var(--teal); border-color: var(--teal); color: #fff; }

.refine { margin-top: var(--s2); }
.refine > summary {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2);
  min-height: var(--tap); cursor: pointer; list-style: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--teal-dark);
}
.refine > summary::-webkit-details-marker { display: none; }
.refine > summary::before {
  content: ""; width: 0.45rem; height: 0.45rem; margin-right: 0.15rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
.refine[open] > summary::before { transform: rotate(45deg); }
.refine-hint { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.refine-count {
  background: var(--teal-tint); color: var(--teal-dark); border: 1px solid var(--teal-line);
  border-radius: 99px; padding: 0 var(--s2); font-size: var(--fs-xs);
}

.filters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: var(--s4) var(--s4); align-items: end;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s4); margin: var(--s2) 0 var(--s3);
}
.filters-actions { display: flex; gap: var(--s4); align-items: center; margin: 0; }

/* ---------------------------------------------------------------- results */

.results-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--s1) var(--s5); margin-bottom: var(--s3);
}
.result-line { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin: 0; }
.legend { margin: 0; max-width: 36rem; }

.active-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
  margin: 0 0 var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--rule);
}
.active-filters-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.active-filters ul { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.25rem; max-width: 100%;
  padding: 0 var(--s2) 0 var(--s3); font-size: var(--fs-sm); color: var(--teal-dark); text-decoration: none;
  background: var(--teal-tint); border: 1px solid var(--teal-line); border-radius: 99px;
}
.filter-pill:hover { border-color: var(--teal); color: var(--teal-dark); }
.filter-pill-k { color: var(--ink-soft); }
.filter-pill-x { font-size: 1.1rem; line-height: 1; padding: 0 0.2rem; }

/* Resource list: hairline-separated rows scale from a handful to hundreds. */
.case-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.case-row { border-bottom: 1px solid var(--rule); padding: var(--s5) 0; }
.case-row article { max-width: 52rem; }
.case-row h2 { margin: var(--s1) 0 var(--s2); font-size: var(--fs-lg); line-height: 1.25; }
.case-row h2 a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.case-row h2 a:hover { color: var(--teal-dark); text-decoration: underline; text-decoration-thickness: 1px; }
.case-summary {
  margin: 0 0 var(--s3); color: var(--ink-soft); max-width: var(--measure);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) 0;
  margin: 0; font-size: var(--fs-xs); color: var(--muted);
}
.kicker-item::before { content: "\00b7"; padding: 0 0.5em; color: var(--rule-strong); }
.type-tag {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal);
  text-decoration: none; padding: var(--s1) 0;
}
.type-tag:hover { text-decoration: underline; }

.case-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4);
  margin: var(--s3) 0 0; font-size: var(--fs-xs); color: var(--muted);
}
.source-count { font-weight: 600; color: var(--ink-soft); }
.checked { color: var(--muted); }

/* Chips: disciplines and tasks (descriptive, not evidence). */
.chips { display: inline-flex; flex-wrap: wrap; gap: var(--s1); margin: 0; }
.chip {
  display: inline-block; font-size: 0.75rem; line-height: 1.5; color: var(--ink-soft);
  background: var(--panel); border: 1px solid var(--rule); border-radius: 99px; padding: 0 0.55rem;
}
.chip-task { background: var(--surface); }

/* Badges: workflow level + the two independent evidence dimensions. */
.signals { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%;
  font-size: var(--fs-xs); line-height: 1.35; padding: 0.2rem 0.55rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-soft); cursor: help;
}
.badge-k { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.badge-level { border-color: var(--ink-soft); color: var(--ink); }
.badge-code {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  background: var(--ink); color: #fff; border-radius: 2px; padding: 0 0.3rem; margin-left: -0.25rem;
}
.badge-level.is-na { border-style: dashed; border-color: var(--rule-strong); color: var(--muted); }
.badge-level.is-na .badge-code { background: var(--rule-strong); color: var(--ink); }
.badge-ev { background: var(--teal-tint); border-color: var(--teal-line); color: var(--teal-dark); }
.badge.ov-independently-reproduced { background: var(--ok-tint); color: var(--ok); border-color: var(--ok-line); }
.badge.ov-independently-reproduced .badge-k { color: var(--ok); }
.badge.ov-author-reported { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.badge.ov-author-reported .badge-k { color: var(--warn); }

/* ------------------------------------------------------------- empty state */

.empty-state {
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  padding: var(--s5) var(--s5) var(--s4); background: var(--surface); max-width: 46rem;
}
.empty-state h2 { margin-top: 0; }
.empty-state-quiet { background: var(--panel); }

/* ------------------------------------------------------------ detail page */

.crumb { margin-bottom: var(--s4); font-size: var(--fs-sm); }
.crumb ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.crumb li { min-width: 0; }
.crumb li + li::before { content: "/"; padding: 0 0.55em; color: var(--rule-strong); }
.crumb a { display: inline-block; padding: var(--s1) 0; }
.crumb [aria-current] { color: var(--muted); }

.case {
  display: grid; grid-template-columns: minmax(0, 1fr) 20rem;
  grid-template-areas: "head aside" "body aside";
  grid-template-rows: auto 1fr; gap: 0 var(--s7);
}
.case-head { grid-area: head; padding-bottom: var(--s5); border-bottom: 1px solid var(--rule); }
.case-head h1 { margin-top: var(--s2); overflow-wrap: anywhere; }
.case-head .lede { margin-bottom: var(--s4); }
.case-aside { grid-area: aside; align-self: start; display: grid; gap: var(--s4); }
.case-body { grid-area: body; min-width: 0; }

.prose { font-family: var(--serif); font-size: var(--fs-md); line-height: 1.65; max-width: var(--measure); }
.prose section { margin-top: var(--s5); }
.prose h2 {
  font-size: var(--fs-lg); margin: 0 0 var(--s2); padding-bottom: var(--s1); border-bottom: 1px solid var(--rule);
}
.prose p { margin: 0 0 var(--s3); }
.prose ul { padding-left: 1.2rem; }
.prose .fineprint { font-family: var(--sans); }

.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s4); font-size: var(--fs-sm);
}
.panel h2 {
  margin: 0 0 var(--s3); font-family: var(--sans); font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft);
}
.panel h3 { margin: var(--s4) 0 var(--s2); font-family: var(--sans); font-size: var(--fs-sm); font-weight: 700; }
.count-muted { font-weight: 400; color: var(--muted); }
.evidence-box { border-top: 3px solid var(--teal); }

.meta-dl, .evidence-dl { margin: 0; }
.meta-dl dt, .evidence-dl dt {
  font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s3);
}
.meta-dl dt:first-child, .evidence-dl dt:first-child { margin-top: 0; }
.meta-dl dd, .evidence-dl dd { margin: 0.1rem 0 0; color: var(--ink); }
.evidence-note { border-left: 3px solid var(--teal-line); padding-left: var(--s3); margin: var(--s3) 0; color: var(--ink-soft); }

.source-list { margin: 0; padding-left: 1.2rem; }
.source-list li { margin-bottom: var(--s3); padding-left: var(--s1); }
.source-list a { overflow-wrap: anywhere; }
.source-list li.primary > a { font-weight: 600; }
.source-kind { display: block; font-size: var(--fs-xs); color: var(--muted); }

/* --------------------------------------------------------------- comments */

.comments {
  margin-top: var(--s7); padding-top: var(--s5); border-top: 2px solid var(--ink); max-width: 46rem;
}
.comments > h2 { margin-top: 0; }
.comment-list { list-style: none; margin: 0 0 var(--s5); padding: 0; }
.comment-list li { border-top: 1px solid var(--rule); padding: var(--s4) 0; }
.comment-meta { margin: 0 0 var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.comment-meta strong { color: var(--ink); }
.comment-body { font-family: var(--serif); font-size: var(--fs-md); }
.comment-body p { margin: 0 0 var(--s2); }
.comment-compose {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s4) var(--s5) var(--s3); margin-top: var(--s4);
}
.comment-compose h3 { margin-top: 0; }
.comment-form { max-width: 40rem; }
.comment-form .field { margin-bottom: var(--s4); }
.comment-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0 var(--s4); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.notice {
  border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--radius);
  padding: var(--s3) var(--s4); background: var(--surface); font-size: var(--fs-sm);
}
.notice.ok { border-left-color: var(--ok); }
.notice.err { border-left-color: var(--err); }

/* --------------------------------------------------------- method/updates */

.method-section { max-width: 48rem; margin-bottom: var(--s6); }
.method-section > h2:first-child { margin-top: 0; padding-top: var(--s4); border-top: 1px solid var(--rule); }
.method-section p, .method-list { max-width: var(--measure); }
.method-list { padding-left: 1.3rem; }
.method-list li { margin-bottom: var(--s3); }
.method-dl { margin: var(--s3) 0 var(--s4); }
.method-dl dt { font-weight: 600; margin-top: var(--s3); }
.method-dl dd { margin: var(--s1) 0 0; color: var(--ink-soft); }
.callout {
  border-left: 4px solid var(--teal); background: var(--teal-tint);
  padding: var(--s3) var(--s4); margin-top: var(--s4); border-radius: 0 var(--radius) var(--radius) 0;
}
.status-strip {
  border: 1px solid var(--rule); border-top: 3px solid var(--teal); background: var(--surface);
  border-radius: var(--radius); padding: var(--s4) var(--s4) var(--s1); margin-bottom: var(--s6); max-width: 48rem;
}
.warn { color: var(--warn); }

.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.runs-table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.runs-table th, .runs-table td {
  border-bottom: 1px solid var(--rule); padding: var(--s2) var(--s3); text-align: left; vertical-align: top;
}
.runs-table th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); border-bottom-color: var(--rule-strong); white-space: nowrap; }
.runs-table .errors { color: var(--warn); font-size: var(--fs-xs); max-width: 18rem; word-break: break-word; }
.runs-table summary, details > summary { cursor: pointer; min-height: 2rem; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ admin */

.admin-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); }
.inline-form { margin: 0; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--s4); margin: var(--s5) 0 var(--s6); }
.card { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--teal); border-radius: var(--radius); padding: var(--s4); }
.card h2 { margin: 0; font-size: var(--fs-xl); }
.card p { margin: var(--s1) 0; font-size: var(--fs-sm); }

.tabs { display: flex; flex-wrap: wrap; gap: 0 var(--s4); border-bottom: 1px solid var(--rule); margin: var(--s4) 0 var(--s5); }
.tabs a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s1);
  text-decoration: none; color: var(--ink-soft); border-bottom: 2px solid transparent; text-transform: capitalize;
}
.tabs a:hover { color: var(--teal-dark); }
.tabs a.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 600; }

.pager { font-size: var(--fs-sm); color: var(--muted); }
.pager a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s2); }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-item { border-top: 1px solid var(--rule); padding: var(--s4) 0; max-width: 52rem; }
.admin-meta { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); overflow-wrap: anywhere; }
.admin-meta strong { color: var(--ink); }
.admin-body { margin: var(--s2) 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.admin-actions form { margin: 0; }
.admin-item code { overflow-wrap: anywhere; }

.admin-login { max-width: 24rem; }
.admin-login .field { margin-bottom: var(--s4); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 56rem) {
  .case { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "aside" "body"; grid-template-rows: none; }
  .case-aside { margin-top: var(--s5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }
  .site-foot-inner { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
}

@media (max-width: 40rem) {
  .wrap { padding: 0 var(--s4); }
  main { padding-top: var(--s5); }
  h1 { font-size: var(--fs-xl); }
  .site-head-inner { gap: 0; }
  .site-nav { margin-left: calc(-1 * var(--s3)); }
  .search-box button { padding: 0 var(--s4); }
  .refine-hint { display: none; }
  .filters { padding: var(--s3); }
  .filters-actions { grid-column: 1 / -1; }
  .case-row { padding: var(--s4) 0; }
  .comment-compose { padding: var(--s4) var(--s3) var(--s2); }
  .prose { font-size: 1.0625rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .site-nav, .finder, .comment-compose, .skip-link, .foot-nav { display: none; }
  body { background: #fff; }
  .case { display: block; }
  a { color: inherit; }
}
