/* =====================================================================
   Plumbline Report — design system

   Direction: surveying instruments, not newsprint. A plumb line hangs
   still; movement is what you measure against it. The vertical line is
   the organising device throughout.

   Palette is drawn from a plumb bob and a drafting sheet: blued steel,
   cool chalk white, brass, verdigris. Deliberately cool where the
   obvious choice would be warm cream.
   ===================================================================== */

:root {
  /* Ink and ground */
  --ink:        #1A1F2B;   /* blued steel, cool near-black */
  --ink-soft:   #48505F;   /* secondary text */
  --ink-faint:  #7C8494;   /* captions, meta */
  --paper:      #F2F3F1;   /* cool chalk white — a drafting sheet */
  --card:       #FFFFFF;
  --line:       #D7DAD6;   /* graduations */
  --line-soft:  #E7E9E6;

  /* Accents — used sparingly */
  --brass:      #B08341;   /* the bob. Today. Primary action. */
  --brass-deep: #8A6528;
  --verdigris:  #2E6F6B;   /* confirmed / true */
  --alert:      #A33A2E;

  /* Type */
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --ui:      "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --data:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Scale */
  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.98rem, 0.95rem + 0.15vw, 1.06rem);
  --step-1:  clamp(1.20rem, 1.12rem + 0.4vw, 1.42rem);
  --step-2:  clamp(1.55rem, 1.38rem + 0.8vw, 2.05rem);
  --step-3:  clamp(2.05rem, 1.70rem + 1.6vw, 3.10rem);

  --gutter: 2.25rem;   /* width reserved for the plumb line */
  --radius: 3px;       /* instruments are machined, not rounded */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:       #E8EAE7;
    --ink-soft:  #A8B0BD;
    --ink-faint: #767E8C;
    --paper:     #14171F;
    --card:      #1B1F29;
    --line:      #2E3440;
    --line-soft: #242935;
    --brass:     #D3A15A;
    --brass-deep:#E0B679;
    --verdigris: #5AA6A0;
    --alert:     #D8776A;
  }
}
:root[data-theme="dark"] {
  --ink: #E8EAE7; --ink-soft: #A8B0BD; --ink-faint: #767E8C;
  --paper: #14171F; --card: #1B1F29; --line: #2E3440; --line-soft: #242935;
  --brass: #D3A15A; --brass-deep: #E0B679; --verdigris: #5AA6A0; --alert: #D8776A;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p  { margin: 0 0 1em; max-width: 62ch; }

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

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

.shell { max-width: 68rem; margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: 44rem; }

/* Numerals must align down a column — daily tallies are read vertically. */
.num, .pct, td.num { font-family: var(--data); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--data);
  font-size: var(--step--1);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.7rem;
}

.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 54ch; }
.muted { color: var(--ink-faint); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* -------------------------------------------------------------- masthead */
.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.masthead__inner {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 4rem; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: flex; align-items: center; gap: 0.6rem;
  margin-right: auto; white-space: nowrap;
}
/* The wordmark carries a miniature of the page's organising device. */
.wordmark__line {
  display: block; width: 1px; height: 1.5rem;
  background: linear-gradient(var(--line), var(--brass));
  position: relative; flex: none;
}
.wordmark__line::after {
  content: ""; position: absolute; bottom: -3px; left: -2px;
  width: 5px; height: 5px; background: var(--brass);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.masthead__nav { display: flex; gap: 1.35rem; font-size: var(--step--1); }
.masthead__nav a { white-space: nowrap; }
.masthead__nav a { color: var(--ink-soft); text-decoration: none; }
.masthead__nav a:hover, .masthead__nav a[aria-current="page"] { color: var(--ink); }
.masthead__nav a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--brass); }

/* ============================================================ PLUMB LINE
   The signature element. A vertical thread down the left gutter, one tick
   per day of the panel. Breaks in the line are days the panellist did not
   vote — the brief is explicit that a missed day is a gap, never a
   carried-forward vote, so the gap must be visible. The brass bob marks
   today and hangs at the bottom, because a plumb line hangs down.
   ==================================================================== */
.plumb { display: grid; grid-template-columns: var(--gutter) 1fr; }

.plumb__rail {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.plumb__rail::before {                 /* the thread */
  content: ""; position: absolute; top: 0; bottom: 1.6rem;
  left: 50%; width: 1px; margin-left: -0.5px;
  background: var(--line);
}

.plumb__tick {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.plumb__tick::before {                 /* graduation mark */
  content: ""; width: 9px; height: 1px; background: var(--line);
}
.plumb__tick--voted::before { width: 13px; height: 1px; background: var(--ink-soft); }
/* A gap masks the thread rather than drawing on it: absence, shown as absence. */
.plumb__tick--gap::before { width: 0; }
.plumb__tick--gap::after {
  content: ""; position: absolute; left: 50%; margin-left: -2px;
  width: 3px; top: 0; bottom: 0; background: var(--paper);
}

.plumb__bob {                          /* today */
  position: relative; z-index: 2;
  width: 14px; height: 18px; flex: none;
  background: linear-gradient(160deg, var(--brass-deep), var(--brass));
  clip-path: polygon(50% 100%, 0 22%, 50% 0, 100% 22%);
  transform-origin: 50% -400%;
}
@media (prefers-reduced-motion: no-preference) {
  /* A plumb bob settles. One motion moment, and it is the metaphor itself. */
  .plumb__bob--settling { animation: settle 1.9s cubic-bezier(.22,.9,.28,1) both; }
}
@keyframes settle {
  0%   { transform: rotate(3.2deg); }
  30%  { transform: rotate(-1.9deg); }
  55%  { transform: rotate(1.05deg); }
  75%  { transform: rotate(-0.5deg); }
  90%  { transform: rotate(0.2deg); }
  100% { transform: rotate(0); }
}

@media (max-width: 46rem) {
  .plumb { grid-template-columns: 1.4rem 1fr; }
  :root { --gutter: 1.4rem; }
}

@media (max-width: 34rem) {
  .masthead__inner { gap: 0.5rem 1rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
  .wordmark { margin-right: 0; flex-basis: 100%; }
  .masthead__nav { flex-basis: 100%; gap: 1rem; justify-content: flex-start; }
  /* Side-by-side actions become a stack; a full-width primary is easier to hit. */
  .btn { justify-content: center; }
}

/* ------------------------------------------------------------- day sheet */
.day { padding: 2.5rem 0 3rem; }
.day__date { font-family: var(--display); font-size: var(--step-2); margin: 0 0 0.15rem; }
.day__meta {
  font-family: var(--data); font-size: var(--step--1);
  color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 0.35rem 1rem;
  margin-bottom: 2rem;
}
.day__question {
  font-family: var(--display); font-size: var(--step-1);
  max-width: 34ch; margin: 0 0 1.25rem;
}

/* --------------------------------------------------------------- ballot */
.ballot { list-style: none; margin: 0 0 1.75rem; padding: 0; display: grid; gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ballot__item { background: var(--card); }
.ballot__label {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.95rem 1.1rem; cursor: pointer;
  transition: background 120ms ease;
}
.ballot__label:hover { background: color-mix(in srgb, var(--brass) 6%, var(--card)); }
.ballot__input { position: absolute; opacity: 0; width: 0; height: 0; }
.ballot__input:focus-visible + .ballot__label { outline: 2px solid var(--brass); outline-offset: -2px; }
.ballot__input:checked + .ballot__label { background: color-mix(in srgb, var(--brass) 11%, var(--card)); }

.ballot__swatch { width: 3px; height: 1.5rem; border-radius: 1px; flex: none; background: var(--line); }
.ballot__name { font-weight: 450; }
.ballot__mark {
  margin-left: auto; width: 1.05rem; height: 1.05rem; flex: none;
  border: 1px solid var(--line); border-radius: 50%; position: relative;
}
.ballot__input:checked + .ballot__label .ballot__mark { border-color: var(--brass); }
.ballot__input:checked + .ballot__label .ballot__mark::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brass);
}
/* Ranked mode reuses the same markup; the mark shows the preference number. */
.ballot__mark--rank { border-radius: 2px; font-family: var(--data); font-size: 0.7rem;
  display: grid; place-items: center; color: var(--brass); }

/* -------------------------------------------------------------- buttons */
.btn {
  font-family: var(--ui); font-size: var(--step-0); font-weight: 500;
  padding: 0.72rem 1.4rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.btn--primary { background: var(--brass); color: #17130C; border-color: var(--brass-deep); }
.btn--primary:hover { background: var(--brass-deep); color: #FFF8EC; }
.btn--quiet { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--quiet:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --------------------------------------------------------------- locked */
/* Votes lock once saved. The interface must read as a record, not a form. */
.locked {
  border: 1px solid var(--line); border-left: 2px solid var(--verdigris);
  background: var(--card); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; max-width: 34rem;
}
.locked__head {
  font-family: var(--data); font-size: var(--step--1);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--verdigris);
  margin-bottom: 0.4rem;
}
.locked__choice { font-family: var(--display); font-size: var(--step-1); }

/* ---------------------------------------------------------------- panel */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.35rem 1.5rem;
}
.grid { display: grid; gap: 1rem; }
@media (min-width: 46rem) { .grid--2 { grid-template-columns: 1fr 1fr; } }

/* ----------------------------------------------------------- two toplines
   The brief: never render one topline without the other. The gap between
   raw and matched IS the attrition signal, so the layout pairs them and
   labels the difference rather than burying it.
   ------------------------------------------------------------------- */
.toplines { display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 46rem) { .toplines { grid-template-columns: 1fr 1fr; } }
.topline { background: var(--card); padding: 1.35rem 1.5rem; }
.topline__kind {
  font-family: var(--data); font-size: var(--step--1);
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint);
}
.topline__note { font-size: var(--step--1); color: var(--ink-faint); margin: 0.35rem 0 1.1rem; max-width: 34ch; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.bar__row { display: grid; grid-template-columns: 5.5rem 1fr 3.4rem; align-items: center; gap: 0.75rem; }
.bar__name { font-size: var(--step--1); }
.bar__track { display: block; height: 7px; background: var(--line-soft); border-radius: 1px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--ink-soft); border-radius: 1px; }
.bar__pct { font-family: var(--data); font-variant-numeric: tabular-nums;
  font-size: var(--step--1); text-align: right; }
.bar__pct--suppressed { color: var(--ink-faint); }

/* ----------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th, .table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line-soft); text-align: left; }
.table th { font-family: var(--data); text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 500; color: var(--ink-faint); }
.table td.num, .table th.num { text-align: right; }

/* ----------------------------------------------------------------- forms */
.field { display: grid; gap: 0.35rem; margin-bottom: 1.1rem; max-width: 26rem; }
.field label { font-size: var(--step--1); color: var(--ink-soft); }
.field input, .field select {
  font: inherit; font-size: var(--step-0); color: var(--ink);
  padding: 0.6rem 0.75rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field input:focus-visible { border-color: var(--brass); }
.field__hint { font-size: var(--step--1); color: var(--ink-faint); }

.notice { border-left: 2px solid var(--brass); padding: 0.7rem 1rem;
  background: var(--card); border-radius: var(--radius); font-size: var(--step--1); margin-bottom: 1.25rem; }
.notice--error { border-left-color: var(--alert); color: var(--ink); }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); margin-top: 4rem; padding: 2rem 0 3rem;
  font-size: var(--step--1); color: var(--ink-faint); }
.footer a { color: var(--ink-soft); }
.footer__cols { display: grid; gap: 1.5rem; }
/* Attribution line, held apart from the footer's own navigation. */
.footer__colophon {
  margin-top: 1.75rem; padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}
@media (min-width: 46rem) { .footer__cols { grid-template-columns: 2fr 1fr 1fr; } }

/* ==================================================================== ADMIN
   Back of house. Deliberately a different colour temperature from the
   public site - verdigris rather than brass - so it is never ambiguous
   which side of the product you are looking at.
   ==================================================================== */
.admin { background: var(--paper); }

.adminbar { background: var(--ink); color: var(--paper); border-bottom: 2px solid var(--verdigris); }
.adminbar__inner { display: flex; align-items: center; gap: 1.25rem; min-height: 3.4rem; flex-wrap: wrap; }
.adminbar__mark {
  font-family: var(--display); font-weight: 600; font-size: 1.02rem;
  color: var(--paper); text-decoration: none; white-space: nowrap;
}
.adminbar__mark span { color: var(--verdigris); }
.adminbar__nav { display: flex; gap: 1.1rem; font-size: var(--step--1); margin-right: auto; }
.adminbar__nav a { color: color-mix(in srgb, var(--paper) 72%, transparent); text-decoration: none; white-space: nowrap; }
.adminbar__nav a:hover { color: var(--paper); }
.adminbar__nav a[aria-current="page"] { color: var(--paper); box-shadow: inset 0 -1px 0 var(--verdigris); }
.adminbar__out { display: flex; align-items: center; gap: 0.75rem; }
.adminbar__who { font-family: var(--data); font-size: 0.72rem; color: color-mix(in srgb, var(--paper) 55%, transparent); white-space: nowrap; }
.adminbar .btn--quiet { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 30%, transparent); }
.adminbar .btn--quiet:hover { color: var(--ink); background: var(--paper); }

.btn--sm { padding: 0.35rem 0.7rem; font-size: var(--step--1); }
.btn--go { background: var(--verdigris); color: #F2F7F6; border-color: var(--verdigris); }
.btn--go:hover { filter: brightness(1.12); }

.admin-head { padding: 2.25rem 0 1.25rem; }
.admin-head h1 { font-size: var(--step-2); margin-bottom: 0.25rem; }

.statrow { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; }
@media (min-width: 40rem) { .statrow { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--card); padding: 1rem 1.15rem; }
.stat__n { font-family: var(--data); font-size: var(--step-2); font-variant-numeric: tabular-nums; display: block; }
.stat__l { font-size: var(--step--1); color: var(--ink-faint); }

.pill { font-family: var(--data); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.16rem 0.45rem; border-radius: 2px; border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
.pill--open { border-color: var(--verdigris); color: var(--verdigris); }
.pill--draft { border-color: var(--brass); color: var(--brass-deep); }
.pill--closed, .pill--archived, .pill--suspended { border-color: var(--ink-faint); color: var(--ink-faint); }
.pill--ai { border-color: var(--verdigris); color: var(--verdigris); }

/* --- AI proposal review ------------------------------------------------
   The verification list is the primary output, not a footnote. A proposal
   is a draft with a stated confidence, and the interface says so before it
   shows a single pre-filled field. */
.proposal { border: 1px solid var(--line); border-left: 3px solid var(--verdigris);
  background: var(--card); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.75rem; }
.proposal__head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.proposal__kind { font-family: var(--data); font-size: var(--step--1); text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--verdigris); }
.verify { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.verify li { display: grid; grid-template-columns: 1.1rem 1fr; gap: 0.6rem; font-size: var(--step--1); align-items: start; }
.verify input { margin-top: 0.25rem; }
.problems { border-left: 2px solid var(--alert); background: var(--card); padding: 0.85rem 1.1rem;
  border-radius: var(--radius); margin-bottom: 1.5rem; }
.problems ul { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: var(--step--1); }

.optlist { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.optlist li { display: flex; align-items: center; gap: 0.6rem; font-size: var(--step--1); }
.optlist .sw { width: 3px; height: 1.1rem; border-radius: 1px; flex: none; }

.formgrid { display: grid; gap: 0 1.25rem; }
@media (min-width: 46rem) { .formgrid { grid-template-columns: 1fr 1fr; } }
.formgrid .field { max-width: none; align-content: start; }
/* Grid items stretch by default, so a field without hint text would grow a
   tall input to match its neighbour that has one. */
.field input, .field select, .field textarea { align-self: start; }
.field--wide { grid-column: 1 / -1; }
.field textarea { font: inherit; font-size: var(--step-0); color: var(--ink); padding: 0.6rem 0.75rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }


/* ------------------------------------------------------- verification steps
   Two gates, shown as a list rather than a wizard: a panellist can complete
   them in either order, and seeing both at once makes the remaining work
   obvious. */
.steps { list-style: none; margin: 2.25rem 0 0; padding: 0; display: grid; gap: 1.75rem; }
.step { display: grid; grid-template-columns: 1.4rem 1fr; gap: 1rem; align-items: start; }
.step__mark {
  width: 0.85rem; height: 0.85rem; margin-top: 0.42rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); position: relative;
}
.step--done .step__mark { border-color: var(--verdigris); background: var(--verdigris); }
.step--done .step__mark::after {
  content: ""; position: absolute; left: 3px; top: 1px;
  width: 3px; height: 6px; border: solid var(--card);
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.step__title { font-family: var(--display); font-size: var(--step-1); margin: 0 0 0.3rem; }
.step--done .step__title { color: var(--ink-soft); }
.step__note { font-size: var(--step--1); color: var(--ink-soft); margin: 0 0 0.85rem; max-width: 46ch; }

/* A one-time code is read off a screen and typed in - give it room. */
.code-input {
  font-family: var(--data); font-size: 1.3rem; letter-spacing: 0.35em;
  text-align: center;
}


/* ---------------------------------------------------------------- legal
   Long-form policy text. Wider measure than an article, tighter headings,
   so a reader can scan for the section that applies to them. */
.legal { padding-bottom: 4rem; }
.legal h2 {
  font-size: var(--step-1); margin: 2.4rem 0 0.6rem;
  padding-top: 1.4rem; border-top: 1px solid var(--line-soft);
}
.legal h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1.5rem; }
.legal h3 { font-size: var(--step-0); font-weight: 600; font-family: var(--ui); margin: 1.3rem 0 0.4rem; }
.legal p { color: var(--ink-soft); }
.legal strong { color: var(--ink); }
.legal ul { color: var(--ink-soft); max-width: 62ch; padding-left: 1.1rem; margin: 0 0 1em; }
.legal li { margin-bottom: 0.45rem; }
.legal code { font-family: var(--data); font-size: 0.86em; }
