/* Common Interest Computing — public site
   Visual language borrowed from public accountability documents:
   audit statements, committee papers, ledgers. Figures are set as an
   account, because the argument is about money leaving an organisation. */

:root {
  --paper:       #f5f6f6;
  --paper-sunk:  #eceeee;
  --ink:         #1a2028;
  --muted:       #5e6668;
  --faint:       #8d9496;
  --rule:        #d9dcdc;
  --rule-strong: #b6bcbd;

  /* Ledger semantics. Debit is money leaving; credit is what ownership
     returns. Used on figures only, never as decoration. */
  --debit:       #8c2f24;
  --credit:      #1f5d43;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'IBM Plex Sans', -apple-system, system-ui, sans-serif;

  --measure:      38rem;  /* text line length, ~66ch at this size */
  --measure-wide: 54rem;  /* the page column: hero, ledger, prose all align here */
  --nav-max:      68rem;  /* nav bar runs wider than the page column */

  /* Legacy aliases so existing page-level styles keep working */
  --text: var(--ink);
  --text-muted: var(--muted);
  --text-faint: var(--faint);
  --bg: var(--paper);
}

*, *::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: 19px;
  line-height: 1.6;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: #dfe4e2; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}
.skip-link:focus {
  position: static;
  display: inline-block;
  padding: 6px 10px;
  background: var(--ink);
  color: var(--paper);
}

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

/* ------- Navigation ------- */

.nav-bar {
  border-bottom: 1px solid var(--rule-strong);
  background: var(--paper);
}

.site-nav {
  max-width: var(--nav-max);
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.nav-toggle { display: none; }

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.nav-links a {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--ink);
  border-bottom-color: var(--rule-strong);
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

.home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  padding: 4px;
  margin-right: 2px;
  border-radius: 3px;
}
.home-icon:hover { color: var(--muted); background: var(--paper-sunk); }
.home-icon svg { display: block; }

.breadcrumb {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .sep { color: var(--faint); margin: 0 6px; }
.breadcrumb .current { color: var(--ink); font-weight: 500; }

/* ------- Hero ------- */

.hero-wrap {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 92px 28px 36px;
}

.hero-bg, .hero-overlay { display: none; }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin: 0 0 22px;
  max-width: 22ch;
  color: var(--ink);
  text-wrap: balance;
}

.hero-subtitle {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 400;
  color: var(--muted);
  margin: 0;
  max-width: 46ch;
  line-height: 1.55;
}

/* ------- Main typography ------- */

main {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 36px 28px 104px;
}

/* Line length lives on the text, so the column edge stays put */
main > p,
main > ul,
main > ol,
main > blockquote,
main > .figure-note {
  max-width: var(--measure);
}

main h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.14;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
  max-width: 20ch;
}

main h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 60px 0 14px;
  letter-spacing: -0.008em;
  max-width: 26ch;
}

main h3 {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  margin: 38px 0 10px;
  color: var(--ink);
}

main h4 {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin: 28px 0 8px;
}

main p { margin: 0 0 1.15em; }

main strong { font-weight: 600; color: var(--ink); }
main em { font-style: italic; }

main a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}
main a:hover, main a:focus { text-decoration-color: var(--debit); }

main ul, main ol { margin: 0 0 1.2em; padding-left: 1.3em; }
main li { margin-bottom: 0.45em; }
main li::marker { color: var(--faint); }

main blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 1.2em;
  border-left: 2px solid var(--rule-strong);
  color: var(--muted);
  font-style: italic;
}

main hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 60px 0;
}

/* Standfirst: one paragraph carrying the page's argument */
.lede {
  font-size: 1.24rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.4em;
  max-width: 44ch;
}

/* ------- The ledger -------
   Rows, not cards. Figure right-aligned in its own column, the way an
   account statement sets an amount. Source reference sits under the
   label, because every number on this site has to be checkable. */

.ledger {
  max-width: var(--measure-wide);
  margin: 40px auto 48px;
  padding: 0 28px;
}

.ledger-head {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 16px 28px;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--rule);
}

.ledger-row .what {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.4;
  margin: 0;
  max-width: 44ch;
}

.ledger-row .amount {
  margin: 0;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--debit);
  text-align: right;
  white-space: nowrap;
}

.ledger-row.is-credit .amount { color: var(--credit); }

.ledger-row .src {
  grid-column: 1 / -1;
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--faint);
  margin: 2px 0 0;
  letter-spacing: 0.01em;
}
.ledger-row .src a { color: var(--faint); text-decoration-color: var(--rule-strong); }
.ledger-row .src a:hover { color: var(--muted); }

.ledger-foot {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 14px;
  margin: 0;
}

/* Links in the blocks that sit outside <main> */
.ledger-foot a,
.cta p a,
.sources a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}
.ledger-foot a:hover,
.cta p a:hover,
.sources a:hover { text-decoration-color: var(--debit); }

/* ------- Figure callout: a single number inside running prose ------- */

.figure-note {
  margin: 34px 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--debit);
}
.figure-note .n {
  display: block;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: clamp(1.8rem, 4.4vw, 2.5rem);
  font-weight: 300;
  letter-spacing: -0.022em;
  line-height: 1.05;
  color: var(--debit);
  margin-bottom: 6px;
}
.figure-note.is-credit { border-left-color: var(--credit); }
.figure-note.is-credit .n { color: var(--credit); }
.figure-note p { margin: 0 0 0.5em; font-size: 1.02rem; }
.figure-note .src {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--faint);
  margin: 0;
}
.figure-note .src a { color: var(--faint); }

/* ------- Pull statement: the turn in the argument ------- */

.turn {
  margin: 56px 0;
  padding: 26px 0 24px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.turn p {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
  line-height: 1.3;
  font-weight: 400;
  letter-spacing: -0.012em;
  margin: 0;
  max-width: 28ch;
  text-wrap: balance;
}

/* ------- Sources list ------- */

.sources {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 28px 88px;
}
.sources h2 {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-strong);
}
.sources ol {
  max-width: var(--measure);
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  padding-left: 1.4em;
}
.sources li { margin-bottom: 0.7em; }
.sources a { color: var(--muted); text-underline-offset: 2px; }
.sources a:hover { color: var(--ink); }

/* ------- Call to action ------- */

.cta {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 28px 88px;
}
.cta-inner {
  border-top: 2px solid var(--ink);
  padding-top: 24px;
}
.cta h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.008em;
}
.cta p {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 44ch;
}
.button {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--ink);
}
.button:hover, .button:focus { background: #2b333c; color: var(--paper); }
.button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
  margin-left: 8px;
}
.button.secondary:hover, .button.secondary:focus {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

/* ------- Onward links between pages ------- */

.next-steps {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 28px 96px;
}
.next-steps ul { list-style: none; margin: 0; padding: 0; }
.next-steps li { border-top: 1px solid var(--rule); }
.next-steps li:last-child { border-bottom: 1px solid var(--rule); }
.next-steps a {
  display: block;
  padding: 16px 0;
  text-decoration: none;
  color: var(--ink);
}
.next-steps a:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.next-steps .t {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
}
.next-steps .d {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ------- Tables ------- */

.table-wrap { overflow-x: auto; margin: 1.5em 0; }

main table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
}

main th, main td {
  text-align: left;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

main th {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
}

main tbody tr:last-child td { border-bottom: none; }
main td:last-child, main th:last-child { text-align: right; padding-right: 0; }

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

footer {
  border-top: 1px solid var(--rule-strong);
  margin-top: 0;
}

footer > * {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 26px 28px;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--faint);
}

/* ------- Mobile ------- */

@media (max-width: 680px) {
  body { font-size: 17px; }
  .site-nav { padding: 16px 20px; gap: 10px; }
  .nav-links { gap: 13px; }
  .nav-links a { font-size: 0.78rem; }
  .hero-wrap { padding: 52px 20px 28px; }
  .hero h1 { max-width: none; }
  main { padding: 28px 20px 72px; }
  main h2 { margin-top: 46px; max-width: none; }
  .ledger, .sources, .cta, .next-steps { padding-left: 20px; padding-right: 20px; }
  .breadcrumb { white-space: normal; overflow: visible; }
  .ledger-row { grid-template-columns: 1fr; gap: 6px; }
  .ledger-row .amount { text-align: left; }
  .ledger-row .what { max-width: none; }
  footer > * { padding: 22px 20px; }
}

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

@media print {
  .nav-bar, .nav-links, footer, .cta, .next-steps { display: none; }
  body { background: white; color: black; font-size: 11pt; }
  main, .hero-wrap, .ledger, .sources { max-width: none; padding: 0; }
  .ledger-row .amount, .figure-note .n { color: black; }
}
