/* One stylesheet, no framework, no web fonts and no scripts: the page renders
   at once on a slow connection and reads correctly in either theme. The same
   rules serve every project site; only the accent and the opening exhibit
   change. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d1d9e0;
  --good: #1a7f37;
  --bad: #cf222e;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  /* this project's colour */
  --accent: #955a00;
  --accent-soft: #fff1d0;
  --on-accent: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #151b23;
    --fg: #e6edf3;
    --fg-muted: #9198a1;
    --border: #3d444d;
    --good: #3fb950;
    --bad: #f85149;
    /* the accent is light here, so text on it is dark */
    --accent: #e3a83a;
    --accent-soft: #2e2210;
    --on-accent: #2a1800;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 56px 0 44px;
}

h1 {
  margin: 0 0 6px;
  font-size: 2.6rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.tagline {
  margin: 0 0 22px;
  font-size: 1.3rem;
  line-height: 1.45;
  color: var(--fg-muted);
  max-width: 36ch;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.badges img { height: 20px; }

.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.94rem;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }

main { padding: 8px 0 72px; }

section { padding-top: 46px; scroll-margin-top: 72px; }

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 { font-size: 1.06rem; margin: 26px 0 6px; }

p { margin: 14px 0; }
li { margin: 6px 0; }

pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  font: 13.5px/1.55 var(--mono);
  margin: 14px 0;
}

code { font-family: var(--mono); font-size: 0.9em; }
p code, li code, td code, dt code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
pre code { background: none; border: 0; padding: 0; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; background: var(--bg-soft); }
.num td:not(:first-child), .num th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A wide table scrolls inside its own box on a phone, rather than widening
   the whole page and making every line scroll sideways. */
.table-scroll { overflow-x: auto; margin: 16px 0; }
.table-scroll table { margin: 0; min-width: 520px; }
/* Numeric tables have short cells, so they may shrink to fit a phone; only
   if even that is too wide does the box scroll. */
.table-scroll table.num, .table-scroll table.fit { min-width: 0; }
table.fit code { overflow-wrap: anywhere; }

.note {
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  padding: 12px 16px;
  margin: 18px 0;
  border-radius: 0 6px 6px 0;
}
.note p { margin: 6px 0; }

figure { margin: 22px 0; }
figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
figcaption { margin-top: 8px; font-size: 0.9rem; color: var(--fg-muted); }

dl { margin: 16px 0; }
dt { font-weight: 600; margin-top: 16px; }
dd { margin: 4px 0 0; color: var(--fg); }

footer {
  border-top: 1px solid var(--border);
  padding: 26px 0 50px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}
footer a { color: var(--fg-muted); text-decoration: underline; }

/* ---- navigation ------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--fg);
  flex: none;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand img { width: 26px; height: 26px; display: block; }

/* The link row scrolls sideways on a narrow screen rather than wrapping into
   a second row and pushing the page content down. */
.nav-links {
  display: flex;
  gap: 16px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: var(--fg-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--fg); text-decoration: none; border-bottom-color: var(--accent); }

/* ---- header lock-up --------------------------------------------------- */

.hero { display: flex; align-items: flex-start; gap: 18px; }
.hero-logo { width: 72px; height: 72px; flex: none; }

@media (max-width: 600px) {
  header { padding: 38px 0 32px; }
  h1 { font-size: 1.9rem; }
  .tagline { font-size: 1.1rem; }
  .nav-links { gap: 13px; }
  .nav-links a { font-size: 0.86rem; }
  .hero { gap: 13px; }
  .hero-logo { width: 52px; height: 52px; }
}

/* ---- the opening exhibit: the one bold element on the page ------------- */

.exhibit { margin: 22px 0 6px; }
.exhibit figure { margin: 0 0 16px; }
.exhibit figcaption { margin: 0 0 8px; font-size: 0.92rem; font-weight: 600; color: var(--fg); }

/* Five real rows: the label each message was given, and what its neighbours
   voted. A struck-through label is a wrong one. */
.ledger { margin: 0; }
.ledger td:first-child { width: 46%; }
.ledger s { color: var(--fg-muted); text-decoration-thickness: 2px; text-decoration-color: var(--bad); }
.ledger .vote { font-weight: 600; }
.ledger .outcome { font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.ledger .fixed { color: var(--good); }
.ledger .broken { color: var(--bad); }
.ledger tr.cost { background: color-mix(in srgb, var(--bad) 7%, var(--bg)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ledger tr { display: block; padding: 10px 2px; border-bottom: 1px solid var(--border); }
  .ledger td { display: block; width: auto; padding: 2px 0; border: 0; }
  .ledger td:first-child { width: auto; font-weight: 600; }
  .ledger td[data-label]::before { content: attr(data-label) ": "; color: var(--fg-muted); font-weight: 400; }
}
