/* Riverbank Surgery — A personal account
   Standalone reading site. Self-contained: no external fonts or assets.
   Palette driven by custom properties; a data-theme="dark" reading mode. */

:root {
  --paper:      #f6f3ec;   /* warm off-white */
  --paper-edge: #efeadf;
  --ink:        #23201b;   /* near-black, warm */
  --ink-soft:   #4c463c;
  --ink-faint:  #6b6455;   /* darkened from #7a7264, which was 4.29:1 on paper — under AA */
  --rule:       #d8d0c0;
  --accent:     #7a5c2e;   /* muted bronze */
  --quote-bar:  #c9a24b;
  --btn-bg:     #23201b;
  --btn-ink:    #f6f3ec;
  --surface:    #fffdf8;
  --shadow:     0 1px 2px rgba(35,32,27,.05), 0 12px 40px rgba(35,32,27,.08);
  --measure:    38rem;

  /* source-status badge colours (fg text + subtle tint), low-saturation to sit on warm paper */
  --status-documented-fg: #3d6b4f;  --status-documented-bg: rgba(61,107,79,.10);
  --status-public-fg:     #3f5c7a;  --status-public-bg:     rgba(63,92,122,.10);
  --status-personal-fg:   #7a5c2e;  --status-personal-bg:   rgba(122,92,46,.10);
  --status-private-fg:    #5d5470;  --status-private-bg:    rgba(93,84,112,.10);
  --status-disputed-fg:   #9a4b32;  --status-disputed-bg:   rgba(154,75,50,.10);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --paper:      #17150f;
  --paper-edge: #100e09;
  --ink:        #ece6da;
  --ink-soft:   #c4bcac;
  --ink-faint:  #8f8674;
  --rule:       #35301f;
  --accent:     #d7b063;
  --quote-bar:  #c9a24b;
  --btn-bg:     #ece6da;
  --btn-ink:    #17150f;
  --surface:    #1e1b14;
  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 16px 48px rgba(0,0,0,.45);

  --status-documented-fg: #8fc7a5;  --status-documented-bg: rgba(143,199,165,.12);
  --status-public-fg:     #9db8d6;  --status-public-bg:     rgba(157,184,214,.12);
  --status-personal-fg:   #d7b063;  --status-personal-bg:   rgba(215,176,99,.12);
  --status-private-fg:    #b3a8cc;  --status-private-bg:    rgba(179,168,204,.14);
  --status-disputed-fg:   #d69a83;  --status-disputed-bg:   rgba(214,154,131,.14);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.02rem, 0.96rem + 0.35vw, 1.2rem);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* subtle paper gradient at the edges */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--surface), transparent 60%),
    linear-gradient(var(--paper), var(--paper-edge));
  pointer-events: none;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: .6rem 1rem;
  border-radius: 0 0 .4rem 0;
  font-family: var(--sans);
  font-size: .9rem;
  z-index: 20;
}
.skip-link:focus { left: 0; }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead__inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.masthead__place {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.masthead__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.btn {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .01em;
  line-height: 1;
  padding: .55rem .85rem;
  border-radius: .45rem;
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, opacity .12s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule);
}
.btn--ghost:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ---------- Letter ---------- */
main { display: block; }

.letter {
  max-width: var(--measure);
  margin: clamp(2.4rem, 6vw, 4.5rem) auto clamp(3rem, 6vw, 5rem);
  padding: 0 clamp(1.15rem, 5vw, 1.75rem);
}

.letter__head { text-align: center; margin-bottom: clamp(2.2rem, 5vw, 3.2rem); }

.kicker {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}
.letter__title {
  font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0;
}
.byline {
  margin: .9rem 0 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
}
.byline strong { font-weight: 600; color: var(--ink); }
.dateline {
  margin: .35rem 0 0;
  font-family: var(--sans);
  font-size: .82rem;
  letter-spacing: .05em;
  color: var(--ink-faint);
}
.circulation-note {
  margin: 1.6rem auto 0;
  max-width: 30rem;
  font-size: .9rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: .95rem 0;
}

/* decorative divider between head and body */
.letter__head::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 2px;
  margin: clamp(1.8rem, 4vw, 2.6rem) auto 0;
  background: var(--quote-bar);
}

.letter__body > p {
  margin: 0 0 1.35rem;
  hyphens: auto;
}

.salutation {
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 1.6rem !important;
}

/* graceful drop cap on the first real paragraph */
.salutation + p::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: .82;
  padding: .06em .1em 0 0;
  color: var(--accent);
  font-weight: 600;
}

.pull-quote {
  margin: 2.2rem 0;
  padding: .2rem 0 .2rem 1.4rem;
  border-left: 3px solid var(--quote-bar);
}
.pull-quote p {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink);
}

/* Emphasises a passage where it actually appears in the letter, rather than
   lifting it out as a pull-quote higher up the page. The words are unchanged —
   only the presentation is emphasised. */
.letter__body > p.highlight {
  margin: 1.9rem 0;
  padding: 1.15rem 1.3rem;
  border-left: 3px solid var(--quote-bar);
  border-radius: 0 .4rem .4rem 0;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: 1.08rem;
  color: var(--ink);
}

.signature {
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}
.signature__name {
  margin: 0;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--ink);
}
.signature__date {
  margin: .25rem 0 0;
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .05em;
  color: var(--ink-faint);
}

/* ---------- Colophon ---------- */
.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.8rem clamp(1rem, 5vw, 2rem);
  text-align: center;
}
.colophon p {
  margin: 0;
  font-family: var(--sans);
  font-size: .84rem;
  color: var(--ink-faint);
}
a {
  color: var(--accent);
  text-underline-offset: .16em;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--ink); }

/* ---------- Cross-page navigation (added for the multi-page site) ---------- */
.masthead__lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem 1.3rem;
}
.masthead__brand {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
}
.masthead__brand:hover { color: var(--ink); }

.masthead__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .1rem .95rem;
  font-family: var(--sans);
}
.masthead__nav a {
  font-size: .82rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.masthead__nav a:hover { color: var(--ink); }
.masthead__nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--quote-bar);
}

/* ---------- Wider reading column for reference pages ---------- */
.letter--wide { --measure: 44rem; }

/* generic prose blocks on the reference pages */
.prose > p { margin: 0 0 1.2rem; }
.prose > p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose ul:last-child { margin-bottom: 0; }
.prose li { margin: 0 0 .5rem; line-height: 1.6; }

/* ---------- Callout (e.g. "The central distinction") ---------- */
.callout {
  margin: 2.2rem 0;
  padding: 1.05rem 1.3rem;
  border-left: 3px solid var(--quote-bar);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  border-radius: 0 .4rem .4rem 0;
}
.callout__label {
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .45rem;
}

/* Neutral variant, for advisory notes that should not carry the emphasis of a
   gold callout — e.g. "this page is context, not a decision". */
.callout--quiet {
  border-left-color: var(--rule);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}
.callout--quiet .callout__label { color: var(--ink-faint); }
.callout p:last-child { margin: 0; }
.callout p { margin: 0 0 .6rem; font-size: 1.04rem; line-height: 1.6; }

/* ---------- Source-status badge ---------- */
.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  /* A badge must never be wider than what contains it. Without this the longest label
     sets a min-content width that a card grid cannot shrink below, and the whole page
     scrolls sideways on a narrow phone. */
  max-width: 100%;
  padding: .32rem .5rem;
  border-radius: .3rem;
  color: var(--badge-fg, var(--ink-soft));
  background: var(--badge-bg, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-fg, var(--ink-faint)) 32%, transparent);
}
.badge--documented { --badge-fg: var(--status-documented-fg); --badge-bg: var(--status-documented-bg); }
.badge--public     { --badge-fg: var(--status-public-fg);     --badge-bg: var(--status-public-bg); }
/* "Not yet decided" — outstanding at the review date. Distinct from Disputed: the
   parties disagreeing is not the same as no decision-maker having ruled. */
.badge--undecided  { --badge-fg: var(--status-public-fg);     --badge-bg: var(--status-public-bg); }
.badge--personal   { --badge-fg: var(--status-personal-fg);   --badge-bg: var(--status-personal-bg); }
.badge--private    { --badge-fg: var(--status-private-fg);    --badge-bg: var(--status-private-bg); }
/* "Another organisation's position" — a third party's own stated view, as distinct from a
   document merely recording what that body did. Reuses the private-record colour, which the
   taxonomy change left unused. */
.badge--other {
  --badge-fg: var(--status-private-fg);
  --badge-bg: var(--status-private-bg);
  /* The only label long enough to need two lines on a phone; the other three never wrap. */
  white-space: normal;
  line-height: 1.25;
}
.badge--disputed   { --badge-fg: var(--status-disputed-fg);   --badge-bg: var(--status-disputed-bg); }
/* Taxonomy split of the old "Document" label: official documents (green, authoritative)
   and contemporaneous records created at the time (blue, the village-record colour). */
.badge--official        { --badge-fg: var(--status-documented-fg); --badge-bg: var(--status-documented-bg); white-space: normal; line-height: 1.25; }
.badge--contemporaneous { --badge-fg: var(--status-public-fg);     --badge-bg: var(--status-public-bg);     white-space: normal; line-height: 1.25; }
/* "Commercial evidence withheld" — reviewed but not published. Reuses the private tint; long, so it wraps. */
.badge--withheld {
  --badge-fg: var(--status-private-fg);
  --badge-bg: var(--status-private-bg);
  white-space: normal;
  line-height: 1.25;
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 2.6rem 0 0; padding: 0; }
.timeline__entry {
  position: relative;
  padding: 0 0 1.9rem 1.5rem;
  border-left: 2px solid var(--rule);
}
.timeline__entry::before {
  content: "";
  position: absolute;
  left: -6px;
  top: .38rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--quote-bar);
  box-shadow: 0 0 0 3px var(--paper);
}
.timeline__entry:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .7rem;
  margin-bottom: .4rem;
}
.timeline__date {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.timeline__title {
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.005em;
  margin: 0 0 .5rem;
}
.timeline__body { margin: 0 0 .65rem; }
.evidence {
  font-family: var(--sans);
  font-size: .82rem;
  line-height: 1.55;
  color: var(--ink-faint);
  margin: 0;
}
.evidence__label {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: .35rem;
}
.evidence a { font-family: var(--sans); }

/* ---------- Resource groups ---------- */
.resource-group { margin: 2.4rem 0 0; }
.resource-group__title {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
}
.resource-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.resource-list > li { margin: 0; }
.resource-list a { font-weight: 600; }
.resource-desc {
  display: block;
  font-family: var(--sans);
  font-size: .86rem;
  line-height: 1.5;
  color: var(--ink-faint);
  margin-top: .2rem;
}

/* ---------- Page meta + disclaimer ---------- */
.updated {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--ink-faint);
  margin: 2.6rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
.colophon .disclaimer {
  max-width: 44rem;
  margin: .85rem auto 0;
  font-style: italic;
  line-height: 1.6;
}

/* ---------- Nav labels ----------
   Each link's text is the full label. On narrow screens the .nav-extra words are
   hidden, leaving the short label. Written this way deliberately: if the
   stylesheet ever fails to load or is served stale, the link still reads as the
   full correct label rather than a doubled one. */
@media (max-width: 900px) {
  .nav-extra { display: none; }
  .nav-wide-only { display: none; }
}

/* ---------- Hero (Home) ---------- */
.hero { text-align: center; }
.hero__lede {
  margin: 1.4rem auto 0;
  max-width: 34rem;
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin-top: 1.8rem;
}
.btn--lg { font-size: .92rem; padding: .75rem 1.2rem; }

/* ---------- Current-status banner ---------- */
.status-banner {
  margin: 0 auto clamp(2rem, 5vw, 3rem);
  max-width: 46rem;
  padding: .95rem 1.2rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--quote-bar);
  border-radius: 0 .45rem .45rem 0;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.status-banner__label {
  display: block;
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .3rem;
}
.status-banner p { margin: 0; font-size: .98rem; line-height: 1.55; }

/* ---------- Card grids ---------- */
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}
/* three-up variant for short signpost cards */
.card-grid--three { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.card__title { margin: 0; font-size: 1.14rem; font-weight: 600; line-height: 1.3; }
.card__title a { text-decoration: none; }
.card__title a:hover { text-decoration: underline; }
.card p { margin: 0; font-size: .96rem; line-height: 1.55; color: var(--ink-soft); }
.card .evidence { margin-top: auto; padding-top: .3rem; }

/* On-page contents list, for long reference pages. */
.toc { margin: 1.6rem 0; }
.toc p { margin: 0 0 .5rem; font-family: var(--sans); font-size: .84rem; }
.toc ul { margin: 0; padding-left: 1.2rem; }
.toc li { margin: 0 0 .3rem; font-family: var(--sans); font-size: .88rem; }

/* Jump links must clear the sticky masthead. */
/* A jump link must land clear of the sticky masthead, or the heading it points at
   sits hidden underneath it. The masthead wraps, so its height steps with viewport
   width: measured worst case is 199px below 500px, 158px from 500px, and 124px from
   1100px. These offsets are those measurements plus a little breathing room. */
:root { --jump-offset: 13rem; }
@media (min-width: 500px)  { :root { --jump-offset: 10.5rem; } }
@media (min-width: 1100px) { :root { --jump-offset: 8.75rem; } }
.section__title[id], [id^="q"].quote-block { scroll-margin-top: var(--jump-offset); }

/* ---------- Section headings on reference pages ---------- */
.section { margin: clamp(2.4rem, 5vw, 3.4rem) 0 0; }
.section__title {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
}
.section__intro { margin: 0 0 1.3rem; color: var(--ink-soft); }

/* ---------- Tables ---------- */
/* Wrapped in .table-scroll so a wide table scrolls inside its own container and
   never makes the page body scroll sideways. */
.table-scroll {
  overflow-x: auto;
  margin: 1.3rem 0;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  min-width: 24rem;
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.5;
}
.table-scroll th,
.table-scroll td {
  text-align: left;
  vertical-align: top;
  padding: .6rem .8rem .6rem 0;
  border-bottom: 1px solid var(--rule);
}
.table-scroll th {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom-color: var(--ink-faint);
  white-space: nowrap;
}
.table-scroll td:first-child { white-space: nowrap; padding-right: 1.4rem; }
.table-scroll tr:last-child td { border-bottom: 0; }
/* The quotation-summary table carries long prose, so let its first column wrap. */
.table-scroll--wide td:first-child { white-space: normal; min-width: 18rem; }

/* ---------- Quote block with attribution ---------- */
.quote-block {
  margin: .9rem 0;
  padding: .1rem 0 .1rem 1.15rem;
  border-left: 3px solid var(--quote-bar);
}
/* The numbered quotations are cited by anchor (e.g. .../#q15), so make the
   landing target unmistakable when one is followed. */
.quote-block:target {
  background: color-mix(in srgb, var(--quote-bar) 12%, transparent);
  border-left-width: 5px;
  border-radius: 0 .4rem .4rem 0;
  padding: .7rem 1rem .7rem 1.15rem;
  /* No scroll-margin-top here: it is set once, above, from --jump-offset. Repeating
     it with a literal value silently overrode that and hid the target under the header. */
}
.quote-block p { margin: 0; font-size: 1.06rem; line-height: 1.55; font-style: italic; }
.quote-block cite {
  display: block;
  margin-top: .45rem;
  font-family: var(--sans);
  font-size: .78rem;
  font-style: normal;
  color: var(--ink-faint);
}

.quote-block__num {
  display: block;
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .35rem;
}

/* ---------- "Why this matters" ---------- */
.why { margin: .8rem 0; font-size: .96rem; line-height: 1.6; color: var(--ink-soft); }
.why__label {
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: .15rem;
}

/* ---------- Related evidence disclosure ---------- */
.related-evidence {
  margin: .8rem 0 0;
  border-top: 1px solid var(--rule);
  padding-top: .6rem;
}
.related-evidence > summary {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: .15rem 0;
}
.related-evidence > summary:hover { color: var(--ink); }
.related-evidence > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.related-evidence ul { margin: .6rem 0 0; padding-left: 1.1rem; }
.related-evidence li { margin: 0 0 .4rem; font-family: var(--sans); font-size: .85rem; }

/* ---------- Source-document cards ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.doc-card {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.doc-card__title { margin: 0 0 .3rem; font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.doc-card__meta {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-faint);
  margin: 0 0 .55rem;
}
.doc-card__desc { margin: 0 0 .7rem; font-size: .96rem; line-height: 1.55; }
.doc-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .9rem;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
}

/* ---------- Update entries (Latest Status) ---------- */
.update-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem; }
.update-entry { padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.update-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.update-entry__date {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.update-entry__title { margin: .3rem 0 .5rem; font-size: 1.16rem; font-weight: 600; line-height: 1.3; }
.update-entry p { margin: 0 0 .6rem; }

/* ---------- Pending / no-link marker ---------- */
.pending {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* ---------- Evidence figure (scanned extract + transcript) ---------- */
.evidence-figure { margin: 1.1rem 0; }
.evidence-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: .4rem;
  background: #fff;
}
.evidence-figure figcaption {
  margin-top: .55rem;
  font-family: var(--sans);
  font-size: .82rem;
  line-height: 1.5;
  color: var(--ink-faint);
}
.transcript { margin: .7rem 0 0; }
.transcript > summary {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: .15rem 0;
}
.transcript > summary:hover { color: var(--ink); }
.transcript > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.transcript__body {
  margin-top: .6rem;
  padding: .9rem 1.1rem;
  border-left: 2px solid var(--rule);
  font-size: .95rem;
  line-height: 1.6;
}
.transcript__body p { margin: 0 0 .7rem; }
.transcript__body p:last-child { margin: 0; }

/* ---------- Featured evidence emphasis ---------- */
.timeline__entry--featured {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-radius: 0 .5rem .5rem 0;
  padding-top: .9rem;
  padding-right: 1.1rem;
  padding-bottom: 1.4rem;
}

/* ---------- Comparator cases (wider NHS context) ---------- */
.comparator-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.4rem; }
.comparator {
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--rule);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.comparator__eyebrow {
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 .4rem;
}
.comparator__title { margin: 0 0 .25rem; font-size: 1.16rem; font-weight: 600; line-height: 1.3; }
.comparator__where {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-faint);
  margin: 0 0 .7rem;
}
.comparator__summary { margin: 0 0 .9rem; font-size: .98rem; line-height: 1.6; }
.comparator__block { margin: 0 0 .85rem; font-size: .96rem; line-height: 1.6; }
.comparator__label {
  display: block;
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .15rem;
}
.comparator__block--limit { color: var(--ink-soft); }
.comparator__block--limit .comparator__label { color: var(--status-disputed-fg); }
.comparator__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  list-style: none;
  margin: .9rem 0 0;
  padding: 0;
}
.comparator__tags li {
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: .25rem;
  padding: .2rem .45rem;
}

/* ---------- Site footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem clamp(1rem, 5vw, 2rem) 2.4rem;
  text-align: center;
}
.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1.4rem;
  margin-bottom: 1.2rem;
  font-family: var(--sans);
  font-size: .84rem;
}
.site-footer .disclaimer {
  max-width: 44rem;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: .84rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink-faint);
}
.site-footer .attribution {
  max-width: 44rem;
  margin: 1.1rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: .84rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.site-footer .updated {
  margin: 1rem 0 0;
  padding-top: 0;
  border-top: 0;
  text-align: center;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Print ---------- */
@media print {
  :root {
    --paper: #fff; --ink: #000; --ink-soft: #222; --ink-faint: #444; --rule: #bbb;
    --accent: #000; --quote-bar: #000;
  }
  body { background: #fff; font-size: 11.5pt; line-height: 1.5; }
  body::before { display: none; }
  .masthead, .colophon, .site-footer__nav, .skip-link { display: none !important; }
  .letter { margin: 0 auto; max-width: 34rem; }
  .pull-quote { break-inside: avoid; }
  .signature { break-inside: avoid; }
  .card, .doc-card, .status-banner, .timeline__entry, .update-entry { break-inside: avoid; }
  .letter__body > p.highlight {
    break-inside: avoid;
    background: none;
    border-left: 2px solid #000;
    padding: .2rem 0 .2rem .9rem;
  }
  .related-evidence[open] > summary { list-style: none; }
  .related-evidence { border-top-color: #bbb; }
  .table-scroll { overflow-x: visible; }
  .table-scroll table { font-size: 9.5pt; }
  .quote-block, .callout { break-inside: avoid; }
  .quote-block:target { background: none; border-left-width: 3px; }
  p { orphans: 3; widows: 3; }
  a { color: #000; text-decoration: none; }
}

/* ---------- Residents' Questions accordion ---------- */
/* Native <details>, so every answer is in the HTML and expandable without JavaScript.
   The script only adds expand-all/collapse-all and opening a deep-linked answer. */
.faq__controls {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.4rem 0 1.8rem;
}
.faq {
  border-top: 1px solid var(--rule);
  padding: .1rem 0;
}
.faq:last-of-type { border-bottom: 1px solid var(--rule); }
.faq__q {
  cursor: pointer;
  list-style: none;
  padding: .95rem 2rem .95rem 0;
  position: relative;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after {
  content: "+";
  position: absolute;
  right: .25rem;
  top: .8rem;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
}
.faq[open] > .faq__q::after { content: "\2212"; }
.faq__q:hover { color: var(--accent); }
.faq__q:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.faq__num { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.faq__a { padding: 0 0 1.3rem; max-width: var(--measure); }
.faq__a p { margin: 0 0 .85rem; line-height: 1.6; }
.faq__a ul, .faq__a ol { margin: 0 0 .9rem; padding-left: 1.2rem; }
.faq__a li { margin: 0 0 .45rem; line-height: 1.55; }
.faq__status { margin: 0 0 .7rem; }
.faq__evidence {
  margin: 1rem 0 0;
  padding: .75rem .9rem;
  border-left: 2px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
  border-radius: 0 .35rem .35rem 0;
}
.faq__evidence .evidence__label { margin: 0 0 .4rem; }
.faq__evidence ul { margin: 0; padding-left: 1.1rem; }
.faq__evidence li { margin: 0 0 .4rem; font-family: var(--sans); font-size: .85rem; line-height: 1.5; }
.faq__evidence li:last-child { margin-bottom: 0; }
/* A deep-linked answer must clear the sticky masthead, like the quotation anchors. */
.faq[id] { scroll-margin-top: var(--jump-offset); }
.faq:target > .faq__q { color: var(--accent); }

@media print {
  /* Print every answer, whether or not the reader expanded it. */
  .faq[open] > .faq__q::after, .faq > .faq__q::after { content: ""; }
  .faq__a { display: block !important; }
  .faq { break-inside: avoid; border-top-color: #bbb; }
  .faq:last-of-type { border-bottom-color: #bbb; }
  .faq__controls, .toc { display: none !important; }
}

/* ---------- Stats dashboard (internal, not linked from the site) ---------- */
.bar {
  display: inline-block;
  height: .55rem;
  min-width: 2px;
  max-width: 8rem;
  margin-right: .5rem;
  vertical-align: baseline;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}
/* Campaign description under its name in the stats table. */
.row-sub {
  display: block;
  margin-top: .15rem;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-faint);
}
/* A network row the stats dashboard flags as likely cloud-hosted or automated
   traffic (see isLikelyAutomated in functions/api/e.js). Muted, not hidden —
   the name and count stay fully readable, this only asks for more caution. */
.row--automated { opacity: .6; }
.row-flag {
  display: inline-block;
  margin-left: .3rem;
  font-size: .85em;
  cursor: help;
}

/* ---------- Small layout utilities ---------- */
/* These exist so no page needs an inline style="" attribute. The CSP sets
   style-src 'self', which forbids inline styles; two attributes were the only
   thing standing between this site and a policy with no escape hatches in it. */
.section__title--plain { border-bottom: 0; margin-bottom: .5rem; }
.prose--spaced { margin-top: 2.6rem; }

/* ---------- Merged evidence page ---------- */
/* A plain jump menu at the top of the page. Not sticky: the masthead already is,
   and stacking a second sticky bar makes anchored headings hard to clear. */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  font-family: var(--sans);
  font-size: .9rem;
  margin: 0 0 2.2rem;
  padding: .8rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.section-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
.section-nav a:hover { text-decoration: underline; }
.section-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-area { margin: 3.2rem 0 0; scroll-margin-top: var(--jump-offset); }
.ev-area__title {
  font-family: var(--sans);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--rule);
}
/* Deep-link targets clear the sticky masthead, like the FAQ and quotation anchors. */
.doc-card[id] { scroll-margin-top: var(--jump-offset); }
/* A way back to the letter, added to the card a reader deep-links into. */
.ev-return {
  display: inline-block;
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 600;
  margin: 0 0 .5rem;
  color: var(--accent);
  text-decoration: none;
}
.ev-return:hover { text-decoration: underline; }
/* The card a reader arrives at from the letter is briefly highlighted. */
.ev-target { animation: ev-flash 4s ease-out 1; }
.ev-target:focus { outline: none; }
@keyframes ev-flash {
  from { background: color-mix(in srgb, var(--quote-bar) 26%, transparent); }
  to   { background: transparent; }
}

/* ---------- Evidence markers in Dr Guilder's account ---------- */
/* A marked phrase is a quiet dotted underline, not a fact-check flag. Without
   JavaScript a documented marker is simply a link to its evidence card. */
.ev-mark {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
  text-underline-offset: .22em;
  cursor: help;
}
.ev-mark:hover { text-decoration-color: var(--ink); }
.ev-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.ev-mark--personal { text-decoration-style: dashed; }
/* Enhanced state: script.js makes each marker a button-like control. */
.ev-mark[role="button"] { cursor: pointer; }

/* Desktop popover and mobile bottom sheet share their inner styling. */
.ev-pop {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: .55rem;
  box-shadow: var(--shadow);
  padding: .85rem .95rem;
  line-height: 1.5;
}
.ev-pop__status { margin: 0 0 .5rem; }
.ev-pop__title { font-size: .95rem; font-weight: 600; margin: 0; }
.ev-pop__meta { font-size: .78rem; color: var(--ink-faint); margin: .15rem 0 0; }
.ev-pop__summary { font-size: .85rem; margin: .55rem 0 .7rem; }
.ev-pop__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.ev-pop__actions .btn { font-size: .8rem; padding: .4rem .7rem; }
.ev-pop__more { font-size: .78rem; color: var(--ink-faint); margin: .5rem 0 0; }

/* Desktop: floats next to the marker. Positioned by script. */
.ev-popover {
  position: absolute;
  z-index: 30;
  max-width: 22rem;
  width: max-content;
}
/* Mobile: a bottom sheet with a dimmed backdrop. */
.ev-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 40;
}
.ev-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  border-radius: .8rem .8rem 0 0;
  max-width: 34rem;
  margin: 0 auto;
  padding-bottom: calc(.95rem + env(safe-area-inset-bottom, 0px));
}
.ev-sheet__close {
  position: absolute;
  top: .5rem;
  right: .5rem;
}
@media print {
  /* A marker prints as its text; nothing floating is printed. */
  .ev-mark { text-decoration-color: #999; }
  .ev-popover, .ev-backdrop, .ev-sheet, .section-nav { display: none !important; }
}
