/*
 * Minutes in a Second: the site's only stylesheet. Tokens and components follow DESIGN.md
 * (from documentation/design-bible.html, draft 3); change the two together. No colour appears
 * outside the token blocks below.
 */

/* ------------------------------------------------------------------ Tokens */

:root {
  color-scheme: light;
  --desk: #F3F3F6;
  --sheet: #FFFFFF;
  --ink: #1B1A22;
  --ink-2: #45424F;
  --ink-3: #625E6E;
  --rule: #DCDAE3;
  --violet: #5230A6;
  --violet-soft: #EDE8FA;
  --on-violet: #FFFFFF;
  --mark: #FFE45E;
  --on-mark: #1B1A22;
  --carried: #1C6A3F;
  --carried-soft: #E3F2E8;
  --lost: #B0232B;
  --lost-soft: #FBE7E7;
  --deferred: #875800;
  --deferred-soft: #FAEFD9;
  --noted: #355880;
  --noted-soft: #E6EDF6;

  --sans: "Overpass", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --t-display: clamp(2.5rem, 2rem + 2.4vw, 3.5rem);
  --t-h1: clamp(2rem, 1.7rem + 1.4vw, 2.5rem);
  --t-h2: clamp(1.5rem, 1.4rem + 0.5vw, 1.75rem);
  --t-decision: clamp(1.25rem, 1.2rem + 0.25vw, 1.375rem);
  --t-body: 1.125rem;
  --t-small: 0.9375rem;
  --t-label: 0.8125rem;

  --gutter: clamp(16px, 5vw, 40px);
  --shell: 64rem;
  --measure: 34rem;
  --margin: 5.5rem;
  --r-sheet: 4px;
  --r-stamp: 2px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --desk: #111016;
    --sheet: #1A1921;
    --ink: #EEECF4;
    --ink-2: #C2BECD;
    --ink-3: #9B96A9;
    --rule: #2E2C38;
    --violet: #B7A3F6;
    --violet-soft: #2A2344;
    --on-violet: #16131F;
    --mark: #D8BD3C;
    --on-mark: #17150F;
    --carried: #72D19C;
    --carried-soft: #18301F;
    --lost: #FF8F87;
    --lost-soft: #3A1A1C;
    --deferred: #F1B75A;
    --deferred-soft: #33260F;
    --noted: #93B7E3;
    --noted-soft: #1A2636;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --desk: #111016;
  --sheet: #1A1921;
  --ink: #EEECF4;
  --ink-2: #C2BECD;
  --ink-3: #9B96A9;
  --rule: #2E2C38;
  --violet: #B7A3F6;
  --violet-soft: #2A2344;
  --on-violet: #16131F;
  --mark: #D8BD3C;
  --on-mark: #17150F;
  --carried: #72D19C;
  --carried-soft: #18301F;
  --lost: #FF8F87;
  --lost-soft: #3A1A1C;
  --deferred: #F1B75A;
  --deferred-soft: #33260F;
  --noted: #93B7E3;
  --noted-soft: #1A2636;
}

/* Set on body, not :root, so it overrides whichever theme block applies. */
@media (prefers-contrast: more) {
  body {
    --ink-3: var(--ink-2);
    --rule: var(--ink-3);
  }
}

/* ------------------------------------------------------------------ Base */

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink-2);
  font: 400 var(--t-body)/1.6 var(--serif);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 700; line-height: 1.3; }

p, ul, ol { margin: 0; }

a {
  color: var(--violet);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

/* Emphasis inside reading text stays in the reading face. */
strong, b { color: var(--ink); font-weight: 600; }

/* The skip link focuses <main> (tabindex="-1"); it is a target, not a control. */
main:focus { outline: none; }

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

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

svg.icon {
  width: 1.125em;
  height: 1.125em;
  flex: none;
  vertical-align: -0.2em;
}

code, .mono { font-family: var(--mono); font-size: 0.9em; font-variant-numeric: tabular-nums; }

.label {
  font: 600 var(--t-label)/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sr-only {
  position: absolute;
  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: var(--gutter);
  top: -100px;
  z-index: 10;
  background: var(--violet);
  color: var(--on-violet);
  padding: 10px 16px;
  border-radius: var(--r-sheet);
  font: 700 var(--t-small) var(--sans);
  text-decoration: none;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }

.shell {
  width: 100%;
  max-width: calc(var(--shell) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack { display: grid; gap: 24px; align-content: start; }

/* ------------------------------------------------------------------ The marks */

/* Highlighter (bible 2, 8.1). A real stroke overshoots the letters: top padding carries the
   band above the cap height without moving the line, and the band stops short of the box's
   bottom, so a headline that wraps shows one stroke per line with paper between them.
   Search matches use plain <mark>, styled the same. */
mark,
.hl {
  color: var(--on-mark);
  background: linear-gradient(var(--mark), var(--mark)) no-repeat 0 0 / 100% 88%;
  padding: 0.14em 0.18em 0;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Stamps: always a word, never only a colour. */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font: 600 0.75rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--violet);
  border: 3px double currentColor;
  border-radius: var(--r-stamp);
  padding: 5px 7px 3px;
}
.stamp.carried { color: var(--carried); }
.stamp.lost { color: var(--lost); }
.stamp.deferred { color: var(--deferred); }
.stamp.noted { color: var(--noted); }
.stamp .date { font-weight: 400; letter-spacing: 0.06em; }

/* Page notes are small text, so links carry their own 24px target (WCAG 2.5.8). */
.margin-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  min-width: 24px;
  font: 400 var(--t-label)/1.3 var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
}
a.margin-note { text-decoration: underline; text-underline-offset: 3px; }
a.margin-note:hover { color: var(--violet); }
/* No source page: a warning triangle in the page note's place, "No citation recorded". */
.no-cite { display: inline-flex; align-items: center; min-height: 24px; color: var(--ink-2); cursor: help; }
.no-cite .icon { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ Header */

.site-head {
  border-bottom: 1px solid var(--rule);
  background: var(--desk);
}

.site-head-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 16px;
}

.wordmark {
  font: 400 1.375rem/1 var(--sans);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-block;
  padding-block: 11px;  /* a 44px target around the 22px line */
}
.wordmark b { font-weight: 800; color: var(--ink); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  font: 500 var(--t-small) var(--sans);
}
.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--violet);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* ------------------------------------------------------------------ Page scaffolding */

.page {
  padding-block: 32px 72px;
  display: grid;
  gap: 32px;
  /* minmax(0, 1fr): wide content scrolls in its own box instead of widening the page. */
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}

.page-head {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 46rem;
}
.page-head .lede {
  font-size: 1.1875rem;
  color: var(--ink-2);
  max-width: var(--measure);
}
.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  max-width: 46rem;
}

.front-h { font-size: var(--t-display); line-height: 1.05; max-width: 16ch; }

.empty {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: 16px 20px;
  max-width: 46rem;
}

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: clamp(16px, 3vw, 28px);
}

/* ------------------------------------------------------------------ Buttons and fields */

.btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font: 700 var(--t-small)/1.1 var(--sans);
  border-radius: var(--r-sheet);
  border: 2px solid var(--violet);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.btn-primary { background: var(--violet); color: var(--on-violet); }
.btn-primary:hover { background: color-mix(in srgb, var(--violet) 86%, var(--ink)); }
.btn-secondary { background: transparent; color: var(--violet); }
.btn-secondary:hover { background: var(--violet-soft); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--violet); padding-inline: 6px; }
.btn-quiet:hover { text-decoration: underline; }
.btn-sm { padding-inline: 14px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.field { display: grid; gap: 6px; }

input[type="date"],
input[type="search"],
input[type="text"],
select {
  min-height: 48px;
  padding: 0 14px;
  font: 400 1rem var(--sans);
  color: var(--ink);
  background: var(--sheet);
  border: 2px solid var(--rule);
  border-radius: var(--r-sheet);
  min-width: 0;
  /* Forced colours (Windows high contrast) drop the border colour change; this outline shows. */
  outline: 2px solid transparent;
}
input[type="date"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--violet);
  outline: 3px solid var(--violet-soft);
  outline-offset: 2px;
}
input::placeholder { color: var(--ink-3); }

input[type="checkbox"] { accent-color: var(--violet); width: 20px; height: 20px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  border: 0;
  padding: 0;
  margin: 0;
}
.filter-info { font: 400 var(--t-small) var(--sans); color: var(--ink-2); }
.filters-inline { display: grid; gap: 12px; }

/* ------------------------------------------------------------------ Tags */

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font: 400 var(--t-label)/1 var(--mono);
  color: var(--ink-2);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-stamp);
  padding: 6px 8px 4px;
  text-decoration: none;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
a.tag:hover { border-color: var(--violet); color: var(--violet); }
.tag .count { color: var(--ink-3); margin-left: 8px; }

/* ------------------------------------------------------------------ Meeting sheet (bible 8.2) */

.meeting-sheet {
  display: grid;
  gap: 24px;
  max-width: 46rem;
}

.meeting-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}
.meeting-head h1 { font-size: var(--t-h2); line-height: 1.15; }

/* Decision line (bible 8.3): headline first in the markup. On phones the marks (outcome
   stamp, page note) follow the detail; from 640px they sit in a left margin, where minute
   books keep their references. */
.decisions { list-style: none; padding: 0; display: grid; }
.decision {
  display: grid;
  gap: 6px 20px;
  padding-block: 18px;
  border-top: 1px solid var(--rule);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "detail" "marks";
  scroll-margin-top: 24px;
}
.decisions .decision:first-child { border-top: 0; padding-top: 4px; }
.decision-head {
  grid-area: head;
  font-size: var(--t-decision);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.decision-detail { grid-area: detail; color: var(--ink-2); }
.decision .marks {
  grid-area: marks;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  align-content: start;
}
@media (min-width: 640px) {
  .decisions .decision {
    grid-template-columns: var(--margin) minmax(0, var(--measure));
    grid-template-areas: "marks head" "marks detail";
  }
  .decisions .decision .marks { flex-direction: column; align-items: flex-start; padding-top: 4px; }
}

/* One highlight per view: a shared link to a decision moves the highlighter there, and the
   stroke sweeps across its headline (bible 10). */
.decisions:has(.decision:target) mark.hl {
  background: none;
  padding: 0;
  color: inherit;
}
.decision:target .hl-target {
  color: var(--on-mark);
  background: linear-gradient(var(--mark), var(--mark)) no-repeat 0 0 / 100% 88%;
  padding: 0.14em 0.18em 0;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  .decision:target .hl-target { animation: sweep 400ms var(--ease) both; }
  @keyframes sweep { from { background-size: 0% 88%; } to { background-size: 100% 88%; } }
}

/* Other notable items and tech notes: rendered markdown under the decisions. Their headings
   are h2 (Minutes.notes_markdown), sections beside Decisions, set at the size of a subhead. */
.notes { border-top: 1px solid var(--rule); padding-top: 20px; max-width: none; }
.prose.notes h2 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; letter-spacing: 0; margin-top: 8px; }
.notes > * { max-width: var(--measure); }
@media (min-width: 640px) { .notes { padding-left: calc(var(--margin) + 20px); } }

/* Page strip (bible 8.4): one tick per page (or group of pages); sources highlighted.
   A tick never gets narrower than 2px. The gap is 3px while every tick can still be 3px wide,
   then shrinks to whatever leaves the ticks 3px, down to none: 120 ticks at 360px (290px of
   strip) touch and are 2.4px each. A percentage gap is a share of the strip's width. */
.strip { display: grid; gap: 10px; margin: 0; }
.strip-pages {
  display: grid;
  grid-template-columns: repeat(var(--ticks, 30), minmax(0, 1fr));
  column-gap: clamp(0px, (100% - var(--ticks, 30) * 3px) / max(var(--ticks, 30) - 1, 1), 3px);
  height: 34px;
}
.strip-pages span { background: var(--rule); border-radius: 1px; }
.strip-pages span.src {
  background: var(--mark);
  outline: 1px solid color-mix(in srgb, var(--on-mark) 30%, transparent);
}
.strip-cap {
  display: flex;
  justify-content: space-between;
  gap: 4px 12px;
  flex-wrap: wrap;
  font: 400 var(--t-label) var(--mono);
  color: var(--ink-3);
}
/* Page numbers are small text links, so each carries its own 24px box (bible 11). */
.strip-cap a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 2px;
}
.strip-cap a:hover { color: var(--violet); }
@media (prefers-reduced-motion: no-preference) {
  .strip-pages span { transform-origin: bottom; animation: rise 600ms var(--ease) both; }
  .strip-pages span:nth-child(3n) { animation-delay: 60ms; }
  .strip-pages span:nth-child(3n+1) { animation-delay: 120ms; }
  @keyframes rise { from { transform: scaleY(0.2); } to { transform: scaleY(1); } }
}

/* Check notice (bible 8.5). */
.check {
  background: var(--violet-soft);
  border-radius: var(--r-sheet);
  padding: 14px 16px;
  font-size: var(--t-small);
  color: var(--ink);
  display: grid;
  gap: 10px;
}
.check a { color: var(--violet); }
.check details summary {
  cursor: pointer;
  color: var(--violet);
  min-height: 24px;
  font-family: var(--sans);
  font-weight: 700;
}
.check details ul { margin-top: 8px; padding-left: 1.1rem; display: grid; gap: 6px; }
.check details p { margin-top: 8px; }
.check .removed { color: var(--ink-2); }

.meeting-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: center;
  justify-content: space-between;
}

/* ------------------------------------------------------------------ Meeting blocks (bible 8.9) */

.meeting-blocks { display: grid; gap: 16px; max-width: 46rem; }

.meeting-block {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: 16px 20px;
  display: grid;
  gap: 10px;
  scroll-margin-top: 24px;
}
.meeting-block-head { font: 600 var(--t-small)/1.3 var(--sans); letter-spacing: 0; }
.meeting-block-head a {
  color: var(--ink-2);
  text-decoration: none;
  display: inline-block;
  padding-block: 3px;  /* a 24px target */
}
.meeting-block-head a:hover { color: var(--violet); text-decoration: underline; }
.block-decisions { list-style: none; padding: 0; display: grid; gap: 8px; }
.block-decisions li { font: 700 1.0625rem/1.3 var(--sans); color: var(--ink); }
.meeting-block .more {
  font: 400 var(--t-small)/1.3 var(--sans);
  display: inline-block;
  padding-block: 3px;  /* a 24px target */
  justify-self: start;
}
.block-note { font-size: var(--t-small); color: var(--ink-3); }

/* Council picker (home). */
.picker { display: flex; flex-wrap: wrap; gap: 8px; max-width: 46rem; }
.picker button {
  font: 500 var(--t-small) var(--sans);
  color: var(--ink-2);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.picker button:hover { border-color: var(--violet); color: var(--violet); }
.picker button[aria-pressed="true"] {
  border-color: var(--violet);
  color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet);
}
.picker-empty { max-width: 46rem; }

/* ------------------------------------------------------------------ Reading text */

.prose {
  max-width: var(--measure);
  color: var(--ink-2);
  display: grid;
  gap: 14px;
}
.prose h2 { font-size: 1.375rem; margin-top: 16px; }
.prose h3 { font-size: 1.125rem; margin-top: 8px; }
.prose h4 { font-size: 1rem; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 10px; }
.prose ul ul, .prose ol ul { margin-top: 6px; gap: 6px; }
.prose li::marker { color: var(--ink-3); }
/* rendering.py marks items that open with a bold title as li.titled (older summaries'
   Details section); only that title is set in the headline face. */
.prose li.titled > strong:first-child,
.prose li.titled > p:first-child > strong:first-child {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.3;
  color: var(--ink);
}
.prose a { overflow-wrap: anywhere; }
.prose blockquote {
  margin: 0;
  padding-left: 16px;
  border-left: 2px solid var(--rule);
  font-style: italic;
}
.prose table { border-collapse: collapse; font-size: var(--t-small); display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 6px 12px 6px 0; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--rule); width: 100%; }

/* ------------------------------------------------------------------ Pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 46rem;
  font: 400 var(--t-small) var(--mono);
}
.pagination-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pagination-link,
.pagination-current,
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sheet);
}
.pagination-link { color: var(--violet); text-decoration: none; border: 1px solid var(--rule); background: var(--sheet); }
.pagination-link:hover { border-color: var(--violet); }
.pagination-current { color: var(--ink); background: var(--sheet); border: 2px solid var(--ink-3); font-weight: 600; }
.pagination-ellipsis { color: var(--ink-3); }

/* ------------------------------------------------------------------ Councils */

.org-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-width: 46rem;
  border-top: 1px solid var(--rule);
}
.org-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name arrow" "meta arrow";
  align-items: center;
  gap: 2px 16px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 150ms var(--ease);
}
.org-row:hover { background: var(--sheet); }
.org-row:hover .org-name { color: var(--violet); }
.org-name { grid-area: name; font: 700 var(--t-decision)/1.25 var(--sans); }
.org-meta { grid-area: meta; font: 400 var(--t-label) var(--mono); color: var(--ink-3); }
.org-row > svg { grid-area: arrow; color: var(--ink-3); width: 20px; height: 20px; }

/* ------------------------------------------------------------------ Topics */

.topic-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.topic-list .tag { font-size: var(--t-small); min-height: 44px; padding: 0 14px; }

/* ------------------------------------------------------------------ Timeline (margin column) */

.timeline { display: grid; max-width: 56rem; }
.timeline-year {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 16px 40px;
  padding-block: 24px;
  border-top: 1px solid var(--rule);
}
.timeline-year h2 { font: 600 var(--t-h2)/1.2 var(--mono); letter-spacing: 0; }
.timeline-months { display: grid; gap: 24px; min-width: 0; }
.timeline-month { display: grid; gap: 8px; }
.timeline-month h3 {
  font: 600 var(--t-label)/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.timeline-items { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline-item {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 16px;
  padding-block: 10px;
  border-bottom: 1px solid var(--rule);
}
.timeline-item time { font-size: var(--t-small); color: var(--ink-3); padding-top: 2px; }
.timeline-item a { font: 700 1.0625rem/1.3 var(--sans); color: var(--ink); text-decoration: none; }
.timeline-item a:hover { color: var(--violet); text-decoration: underline; }
.timeline-item .org { display: block; font: 400 var(--t-label) var(--mono); color: var(--ink-3); margin-top: 2px; }
@media (max-width: 640px) {
  .timeline-year { grid-template-columns: 1fr; gap: 12px; }
}

/* ------------------------------------------------------------------ Search (bible 8.7) */

.search-page-form { max-width: 40rem; }
.search-input-wrapper { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.search-input-wrapper input[type="search"] { flex: 1 1 14rem; font-size: var(--t-body); }

.search-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 32px 48px;
  align-items: start;
}
@media (max-width: 760px) { .search-layout { grid-template-columns: 1fr; } }

.search-results { display: grid; max-width: 40rem; }
.search-state { display: grid; gap: 10px; max-width: 40rem; }
.search-state h2 { font-size: 1.375rem; }
.search-info { font: 400 var(--t-label) var(--mono); color: var(--ink-3); }

/* A result is a decision line (bible 8.3): outside a meeting sheet its marks (outcome stamp,
   page note) also name the council and date, and from 640px they sit in the same left
   margin as on a meeting sheet. */
.result.decision { padding-block: 16px; }
.search-results .result:first-child { border-top: 0; padding-top: 0; }
.result .decision-head a { color: var(--ink); text-decoration: none; }
.result .decision-head a:hover { color: var(--violet); text-decoration: underline; }
.result .decision-detail { font-size: var(--t-small); }
.decision .where { font: 400 var(--t-label)/1.4 var(--mono); color: var(--ink-3); }
@media (min-width: 640px) {
  .search-results .result {
    grid-template-columns: var(--margin) minmax(0, var(--measure));
    grid-template-areas: "marks head" "marks detail";
  }
  .search-results .result .marks { flex-direction: column; align-items: flex-start; padding-top: 4px; }
}

/* Filters panel (partials/filters.html) */
.filters-container { display: grid; gap: 20px; }
.filters-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filters-header h2 { font: 600 var(--t-label)/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.filters-actions { display: flex; align-items: center; gap: 8px; }
.filter-count {
  font: 600 var(--t-label) var(--mono);
  background: var(--violet);
  color: var(--on-violet);
  border-radius: var(--r-stamp);
  padding: 2px 6px 0;
}
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 24px;
  font: 500 var(--t-small) var(--sans);
  color: var(--violet);
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-icon {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  color: var(--ink-2);
  cursor: pointer;
}
.btn-icon svg { width: 20px; height: 20px; transition: transform 150ms var(--ease); }
.filters-body { display: grid; gap: 20px; }
.filter-group { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.filter-group legend { padding: 0; margin-bottom: 8px; }
.date-range-inputs { display: grid; grid-template-columns: 1fr; gap: 6px; }
.date-range-inputs input { width: 100%; }
.filter-options { display: grid; gap: 2px; max-height: 16rem; overflow-y: auto; }
.filter-option { display: flex; align-items: center; gap: 10px; min-height: 32px; font: 400 var(--t-small) var(--sans); color: var(--ink-2); }
.filter-option label { cursor: pointer; }
.filter-loading { font: 400 var(--t-small) var(--sans); color: var(--ink-3); }
.filter-selected-count { text-transform: none; letter-spacing: 0; }
.filter-results-summary {
  display: grid;
  gap: 10px;
  font: 400 var(--t-small) var(--sans);
  color: var(--ink-2);
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}
.export-options { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) {
  .btn-icon { display: inline-grid; }
  .filters-container.collapsed .filters-body { display: none; }
  .filters-container:not(.collapsed) .btn-icon svg { transform: rotate(180deg); }
}

/* ------------------------------------------------------------------ Figures (insights) */

.figures { display: flex; flex-wrap: wrap; gap: 16px 56px; max-width: 46rem; }
.figure { display: grid; gap: 4px; }
.figure b {
  font: 800 var(--t-h1)/1 var(--sans);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.figure span { font: 600 var(--t-label) var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }

.chart { display: grid; gap: 14px; max-width: 46rem; }
.chart h2 { font-size: 1.375rem; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) 2.5rem;
  gap: 12px;
  align-items: center;
  font: 400 var(--t-small) var(--sans);
}
.bar a { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 24px; display: inline-flex; align-items: center; }
.bar a:hover { color: var(--violet); }
.bar-track { display: block; height: 10px; background: var(--rule); border-radius: 1px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--violet); }
.bar-value { font: 400 var(--t-label) var(--mono); color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

.columns-wrap { overflow-x: auto; }
.columns {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(2.75rem, 1fr);
  gap: 8px;
  align-items: end;
  height: 12rem;
  min-width: 34rem;
  border-bottom: 1px solid var(--ink-3);
}
.column { display: grid; grid-template-rows: auto 1fr; height: 100%; align-items: end; justify-items: center; gap: 4px; }
.column .value { font: 400 var(--t-label) var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.column .col-fill { width: 70%; background: var(--violet); border-radius: 1px 1px 0 0; }
.column-labels {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(2.75rem, 1fr);
  gap: 8px;
  min-width: 34rem;
  font: 400 var(--t-label)/1.3 var(--mono);
  color: var(--ink-3);
  text-align: center;
}

/* ------------------------------------------------------------------ Error and offline pages */

.error-page { display: grid; gap: 16px; max-width: 36rem; padding-block: 24px; }

/* ------------------------------------------------------------------ Footer */

.site-foot {
  border-top: 1px solid var(--rule);
  font-size: var(--t-small);
  color: var(--ink-3);
}
.site-foot-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 48px;
  padding-block: 28px calc(env(safe-area-inset-bottom, 0px) + 40px);
}
.foot-text { display: grid; gap: 12px; }
.foot-text p { max-width: 40rem; }
.foot-text .mono { font-size: var(--t-label); }
.foot-side { display: grid; gap: 12px; justify-items: end; align-content: start; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0 20px; justify-content: flex-end; font-family: var(--sans); }
.site-foot nav a { color: var(--ink-2); min-height: 32px; display: inline-flex; align-items: center; }
.site-foot nav a:hover { color: var(--violet); }

.theme-toggle {
  font: 600 var(--t-label) var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--violet); border-color: var(--violet); }

@media (max-width: 760px) {
  .site-foot-inner { grid-template-columns: 1fr; }
  .foot-side { justify-items: start; }
  .site-foot nav { justify-content: flex-start; }
}

/* ------------------------------------------------------------------ Motion and print */

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

@media print {
  /* Black ink on white paper whatever the screen theme (bible 12.3): wins over both dark
     blocks (same specificity, later in the file). */
  :root,
  :root[data-theme="dark"],
  :root:not([data-theme="light"]) {
    color-scheme: light;
    --desk: #FFFFFF;
    --sheet: #FFFFFF;
    --ink: #000000;
    --ink-2: #222222;
    --ink-3: #444444;
    --rule: #BBBBBB;
    --violet: #3B1F85;
    --violet-soft: #FFFFFF;
    --mark: #FFE45E;
    --on-mark: #000000;
    --carried: #000000;
    --lost: #000000;
    --deferred: #000000;
    --noted: #000000;
  }
  .site-head, .site-foot, .skip-link, .filter-bar, .filters-inline, .pagination, .picker,
  .meeting-foot .btns, .search-page-form, .filters-container { display: none !important; }
  body { background: #FFFFFF; color: var(--ink); font-size: 11pt; }
  .sheet, .meeting-block, .empty { border: 0; padding: 0; }
  .meeting-sheet { max-width: none; }
  .decision, .meeting-block { break-inside: avoid; }
  .check { border: 1px solid var(--rule); }
  .prose { max-width: none; color: var(--ink); }
  a { color: inherit; }
  /* Page notes print as "(minutes p. 22)", too wide for the 5.5rem margin, so on paper the
     marks follow the detail as they do on a phone. */
  .decisions .decision,
  .search-results .result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "detail" "marks";
  }
  .decisions .decision .marks,
  .search-results .result .marks { flex-direction: row; align-items: center; padding-top: 0; }
  .margin-note .arrow { display: none; }
  .decision .margin-note::before { content: "(minutes\00a0"; }
  .decision .margin-note::after { content: ")"; }
  .no-cite .icon { display: none; }
  .decision .no-cite::before { content: "(no citation recorded)"; font: 400 var(--t-label) var(--mono); }
  .strip-pages span { animation: none; }
}
