/* The Transfer Ledger: one stylesheet, mobile-first */
:root {
  --paper: #F7F3EA;
  --paper-deep: #EFE8D9;
  --card: #FBF8F1;
  --ink: #1E1B18;
  --ink-soft: #4A443D;
  --muted: #6B6358;
  --green: #1F4D3A;
  --green-dark: #163829;
  --green-tint: #E3EBE4;
  --rule: #D9D1C1;
  --rule-strong: #BDB3A0;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --measure: 70ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--green); color: #fff; padding: var(--s2) var(--s4); z-index: 10; }
.skip:focus { left: var(--s4); top: var(--s4); color: #fff; }

h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.1rem); margin: 0 0 var(--s4); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 1.95rem); margin: var(--s7) 0 var(--s3); padding-top: var(--s4); border-top: 1px solid var(--rule); scroll-margin-top: var(--s5); }
h3 { font-size: 1.25rem; margin: var(--s5) 0 var(--s2); }
p, ul, ol { margin: 0 0 var(--s4); }
li { margin-bottom: var(--s2); }
strong { font-weight: 700; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--s4); }

/* Masthead */
.topline { border-bottom: 1px solid var(--rule); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.04em; }
.topline .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s4); padding-top: var(--s2); padding-bottom: var(--s2); }
.masthead { text-align: center; padding: var(--s5) 0 var(--s3); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand svg { width: 52px; height: 52px; flex: none; }
.brand-name { font-family: var(--serif); font-size: clamp(1.7rem, 1.2rem + 2.6vw, 2.8rem); font-weight: 600; letter-spacing: -0.01em; line-height: 1.05; }
.tagline { margin: var(--s2) 0 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 1.02rem; }
.rule-double { border-top: 3px double var(--ink); border-bottom: 1px solid var(--rule); height: 6px; }
.sitenav ul { list-style: none; margin: 0; padding: var(--s2) 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--s1); }
.sitenav li { margin: 0; }
.sitenav a { display: block; padding: var(--s2) var(--s3); color: var(--ink); text-decoration: none; font-size: 0.9rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.sitenav a:hover, .sitenav a[aria-current="page"] { color: var(--green); box-shadow: inset 0 -2px 0 var(--green); }
.navbar { border-bottom: 1px solid var(--rule); }

/* Breadcrumbs */
.crumbs { font-size: 0.88rem; color: var(--muted); margin: var(--s5) 0 0; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: var(--s1); color: var(--rule-strong); }

/* Page layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); padding: var(--s5) 0 var(--s7); }
.article { min-width: 0; max-width: var(--measure); }
.article > header { margin-bottom: var(--s5); }
.kicker { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--green); margin: 0 0 var(--s2); }
.dek { font-family: var(--serif); font-size: 1.22rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 var(--s4); }
.byline { font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: var(--s2) 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }

/* Table of contents */
.toc { border: 1px solid var(--rule); background: var(--card); padding: var(--s3) var(--s4); font-size: 0.95rem; }
.toc summary { cursor: pointer; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
.toc ol { margin: var(--s3) 0 0; padding-left: 1.3em; }
.toc li { margin-bottom: var(--s1); line-height: 1.4; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover, .toc a.is-active { color: var(--green); text-decoration: underline; }
.toc a.is-active { font-weight: 600; }

/* Quick answer */
.answer { border: 1px solid var(--green); border-left-width: 6px; background: var(--green-tint); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.answer .label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green); margin-bottom: var(--s2); display: block; }
.answer p { margin: 0; font-size: 1.08rem; }
.answer p + p { margin-top: var(--s2); }

/* Data panel */
.panel { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); margin: var(--s5) 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: var(--s2) 0; border-bottom: 1px solid var(--rule); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.stat { padding: var(--s4) var(--s3) var(--s4) 0; border-bottom: 1px solid var(--rule); margin: 0; }
.stat:nth-child(odd) { border-right: 1px solid var(--rule); }
.stat:nth-child(even) { padding-left: var(--s4); }
.stat dt { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.3; }
.stat dd { margin: var(--s1) 0 0; font-family: var(--serif); font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3.2rem); font-weight: 600; line-height: 1; color: var(--green); font-variant-numeric: lining-nums tabular-nums; }
.stat dd small { display: block; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-soft); font-weight: 400; margin-top: var(--s2); line-height: 1.35; }
.panel-foot { font-size: 0.85rem; color: var(--muted); padding: var(--s2) 0; margin: 0; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s4) 0 var(--s5); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.95rem; font-variant-numeric: tabular-nums; background: transparent; }
caption { caption-side: top; text-align: left; font-family: var(--serif); font-style: italic; color: var(--ink-soft); padding: var(--s2) 0; font-size: 0.98rem; }
th, td { padding: var(--s2) var(--s2); text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
thead th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); border-bottom: 1px solid var(--ink); vertical-align: bottom; }
td.num { text-align: right; white-space: nowrap; }
th.num { text-align: right; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }
tr.hl { background: var(--green-tint); }
.bar { display: block; height: 6px; max-width: 100%; background: var(--green); margin: 0 0 4px auto; }
.table-note { font-size: 0.88rem; color: var(--muted); margin-top: calc(-1 * var(--s3)); }
.table-simple table { min-width: 0; }

/* Callouts */
.note { background: var(--card); border: 1px solid var(--rule); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.note h3, .note h4 { margin-top: 0; font-size: 1.1rem; }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }
.note.warn { border-left: 4px solid var(--ink); }
.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 1.9em; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 0.95em; height: 0.95em; border: 1.5px solid var(--green); background: var(--card); }
.checklist li::after { content: ""; position: absolute; left: 0.3em; top: 0.55em; width: 0.35em; height: 0.6em; border: solid var(--green); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--rule); padding: var(--s3) 0; }
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; list-style-position: outside; }
.faq details p { margin: var(--s2) 0 0; }

/* Related + sources */
.related { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 2px solid var(--ink); margin: var(--s4) 0; }
.related a { display: block; padding: var(--s4) 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.related a:hover .rt { color: var(--green); text-decoration: underline; }
.related .rt { display: block; font-family: var(--serif); font-size: 1.18rem; font-weight: 600; line-height: 1.3; }
.related .rd { display: block; font-size: 0.93rem; color: var(--ink-soft); margin-top: var(--s1); }
.sources ol { font-size: 0.93rem; padding-left: 1.3em; }
.sources li { word-break: break-word; }

/* Footer */
.footer { border-top: 3px double var(--ink); background: var(--paper-deep); font-size: 0.92rem; color: var(--ink-soft); padding: var(--s6) 0 var(--s5); }
.footer .cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
.footer h2 { font-size: 1rem; border: 0; padding: 0; margin: 0 0 var(--s2); font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: var(--s1); }
.footer a { color: var(--ink); }
.independence { font-weight: 600; color: var(--ink); }
.footer .fine { border-top: 1px solid var(--rule-strong); margin-top: var(--s5); padding-top: var(--s3); font-size: 0.85rem; }

.map { width: 100%; height: 320px; border: 1px solid var(--rule); }
.center { text-align: center; }
.err { padding: var(--s8) 0; max-width: 60ch; margin: 0 auto; text-align: center; }
.err .big { font-family: var(--serif); font-size: 5rem; color: var(--green); line-height: 1; margin: 0; }

@media (min-width: 768px) {
  body { font-size: 1.1rem; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { border-right: 1px solid var(--rule); border-bottom: 0; padding: var(--s4) var(--s4); }
  .stat:nth-child(even) { padding-left: var(--s4); }
  .stat:first-child { padding-left: 0; }
  .stat:last-child { border-right: 0; }
  .related { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); }
  .footer .cols { grid-template-columns: 2fr 1fr 1fr; }
}

@media (min-width: 1024px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); gap: var(--s7); }
  .layout > .side { grid-column: 1; grid-row: 1; }
  .layout > .article { grid-column: 2; grid-row: 1; }
  .side .toc { position: sticky; top: var(--s5); border: 0; border-top: 2px solid var(--ink); background: transparent; padding: var(--s3) 0 0; max-height: calc(100vh - 48px); overflow-y: auto; }
  .side .toc summary { pointer-events: none; list-style: none; }
  .side .toc summary::-webkit-details-marker { display: none; }
  .side .toc ol { padding-left: 1.2em; }
  .side .toc li { border-bottom: 1px solid var(--rule); padding: var(--s1) 0 var(--s2); margin: 0; }
}

@media print {
  .sitenav, .toc, .topline { display: none; }
  body { background: #fff; }
}

.layout.single { grid-template-columns: minmax(0, 1fr); }
.layout.single > .article { grid-column: 1; }
.err-list { text-align: left; display: inline-block; }
.article a, .footer a { overflow-wrap: anywhere; }
.toc-inline { margin: var(--s5) 0; }
.side { display: none; }
@media (min-width: 1024px) {
  .side { display: block; }
  .toc-inline { display: none; }
}

/* long domains in emails and URLs must wrap on phones */
a[href^="mailto:"], a[href^="http"] { overflow-wrap: anywhere; } /* long domains */
