:root {
  --paper: #f5f0e6; --sheet: #fffdf8; --ink: #1d2330; --soft: #4b5263; --faint: #8a8f99; --rule: #e2d9c8;
  --inf: #c8500a; --inf-l: #fce6d6; --stated: #0062a0; --stated-l: #dcebf6; --hedge: #b07800; --hedge-l: #fff0c7;
  --fix: #007a5e; --fix-l: #dcf1ea; --writer: #5b2c8f; --writer-l: #ece3f5; --slate: #2e3440;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16130f; --sheet: #1f1b16; --ink: #ece6da; --soft: #bdb4a4; --faint: #8c8475; --rule: #3a332a;
    --inf: #f08a4b; --inf-l: #3d2416; --stated: #5fa8e0; --stated-l: #16283a; --hedge: #e0b04a; --hedge-l: #3a2f12;
    --fix: #3cc4a0; --fix-l: #123128; --writer: #b18be0; --writer-l: #2a1f3a; --slate: #d8d2c6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16130f; --sheet: #1f1b16; --ink: #ece6da; --soft: #bdb4a4; --faint: #8c8475; --rule: #3a332a;
  --inf: #f08a4b; --inf-l: #3d2416; --stated: #5fa8e0; --stated-l: #16283a; --hedge: #e0b04a; --hedge-l: #3a2f12;
  --fix: #3cc4a0; --fix-l: #123128; --writer: #b18be0; --writer-l: #2a1f3a; --slate: #d8d2c6; color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.62 Charter, "Bitstream Charter", "Iowan Old Style", Georgia, Cambria, serif; }
.ui, nav.toc, button, select, input, .meta, .chip, table.t, .num, .legend, .tag { font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif; }
a { color: var(--stated); }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82em; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; }
nav.toc { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 34px 18px 20px 22px; border-right: 1px solid var(--rule); }
nav.toc .t { font-family: Georgia, serif; font-weight: 700; font-size: 18px; line-height: 1.25; margin-bottom: 4px; }
nav.toc .s { font-size: 12.5px; color: var(--soft); margin-bottom: 22px; }
nav.toc a { display: block; color: var(--soft); text-decoration: none; font-size: 14px; padding: 5px 10px; border-left: 3px solid transparent; }
nav.toc a:hover { color: var(--ink); }
nav.toc a.on { color: var(--ink); border-left-color: var(--inf); background: var(--sheet); }
nav.toc .bottom { margin-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
main { padding: 28px 40px 70px; min-width: 0; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  nav.toc { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
  nav.toc .t, nav.toc .s { width: 100%; margin-bottom: 4px; }
  nav.toc a { border-left: 0; border-bottom: 2px solid transparent; padding: 3px 7px; font-size: 13px; }
  nav.toc a.on { border-bottom-color: var(--inf); }
  main { padding: 18px 16px 50px; }
}
section { margin: 0 0 56px; }
h1 { font-family: Georgia, serif; font-size: clamp(30px, 4.6vw, 50px); line-height: 1.08; letter-spacing: -.01em; margin: 12px 0 14px; }
h2 { font-family: Georgia, serif; font-size: 29px; line-height: 1.2; margin: 0 0 10px; }
h3 { font-family: Georgia, serif; font-size: 19px; margin: 22px 0 8px; }
.eyebrow { font-family: "Trebuchet MS", sans-serif; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--inf); font-weight: 700; }
.prose { max-width: 760px; }
.prose p { margin: 0 0 14px; }
.tag { display: inline-block; font-size: 12.5px; color: var(--soft); border: 1px solid var(--rule); padding: 3px 10px; background: var(--sheet); }
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); margin: 26px 0 10px; }
.ledger div { padding: 14px 16px 14px 0; }
.ledger div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.ledger b { display: block; font-family: Georgia, serif; font-size: 30px; line-height: 1.1; }
.ledger span { font-family: "Trebuchet MS", sans-serif; font-size: 13.5px; color: var(--soft); }
@media (max-width: 760px) { .ledger { grid-template-columns: 1fr 1fr; } .ledger div:nth-child(3) { padding-left: 0; border-left: 0; } }
.sheet { background: var(--sheet); border: 1px solid var(--rule); padding: 20px 22px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.ui-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; font-family: "Trebuchet MS", sans-serif; font-size: 13.5px; }
select, input { font-size: 14px; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); padding: 6px 9px; border-radius: 0; max-width: 100%; }
.pills { display: inline-flex; border: 1px solid var(--slate); }
.pills button { border: 0; background: transparent; color: var(--ink); padding: 5px 11px; font-size: 13px; cursor: pointer; }
.pills button.on { background: var(--slate); color: var(--sheet); }
.dl { display: inline-block; background: var(--slate); color: var(--sheet); text-decoration: none; padding: 9px 16px; font-family: "Trebuchet MS", sans-serif; font-size: 14px; font-weight: 700; }
.dl.ghost { background: transparent; color: var(--ink); border: 1px solid var(--slate); }
.theme { border: 1px solid var(--rule); background: var(--sheet); color: var(--soft); padding: 4px 9px; font-size: 12.5px; cursor: pointer; }

/* note reader */
.reader { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 0; border: 1px solid var(--rule); background: var(--sheet); }
@media (max-width: 900px) { .reader { grid-template-columns: 1fr; } }
.reader > div { padding: 18px 20px; }
.reader .session { border-right: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 55%, var(--sheet)); }
.turn { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--rule); font-style: italic; }
.meta { font-size: 12.5px; color: var(--soft); }
.claims { list-style: none; padding: 0; margin: 10px 0 0; }
.claims li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px dotted var(--rule); }
.claims li .m { width: 11px; height: 11px; margin-top: 7px; }
.claims li.inf .m { background: var(--inf); } .claims li.ok .m { background: var(--stated); } .claims li.hedged .m { background: var(--hedge); }
.claims li.inf .c { color: var(--inf); }
.claims li.hedged .c { font-style: italic; }
.votes { display: flex; gap: 3px; margin-top: 6px; }
.votes i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--faint); display: inline-block; }
.votes i.y { background: var(--inf); border-color: var(--inf); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--soft); margin: 10px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.raw { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--rule); padding: 10px 12px; font-size: 12.5px; max-height: 230px; overflow: auto; margin-top: 8px; }
.peers { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; margin-top: 10px; }
.peer { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 6px; align-items: center; font-family: "Trebuchet MS", sans-serif; font-size: 12.5px; cursor: pointer; padding: 3px 6px; border: 1px solid transparent; background: none; color: var(--ink); text-align: left; }
.peer:hover, .peer.on { border-color: var(--slate); }
.peer .bar { height: 8px; background: var(--rule); position: relative; }
.peer .bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--inf); }

/* charts */
svg text { fill: var(--ink); font-family: "Trebuchet MS", sans-serif; }
svg .soft { fill: var(--soft); }
.cap { font-size: 14.5px; color: var(--soft); margin: 8px 0 0; }
.tipbox { position: fixed; z-index: 60; pointer-events: none; background: var(--slate); color: var(--sheet); font: 12.5px/1.4 "Trebuchet MS", sans-serif; padding: 6px 9px; max-width: 290px; opacity: 0; transition: opacity .12s; }

/* figures, tables, files */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plate { background: var(--sheet); border: 1px solid var(--rule); padding: 10px; cursor: zoom-in; }
.plate img { width: 100%; height: 175px; object-fit: contain; background: #fff; }
.plate p { font-size: 13.5px; color: var(--soft); margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
dialog { border: 1px solid var(--rule); padding: 0; max-width: min(1200px, 96vw); background: var(--sheet); color: var(--ink); }
dialog::backdrop { background: rgba(20, 16, 10, .72); }
dialog .in { padding: 16px 18px; }
dialog img { width: 100%; background: #fff; }
.close { float: right; }
.scroll { overflow-x: auto; }
table.t { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.t th, table.t td { padding: 4px 9px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--rule); }
table.t thead tr:first-child th { border-top: 2px solid var(--ink); }
table.t thead tr:last-child th { border-bottom: 1px solid var(--ink); }
table.t tbody tr:last-child td { border-bottom: 2px solid var(--ink); }
table.t td.n { text-align: right; font-variant-numeric: tabular-nums; }
.filelist { max-height: 520px; overflow: auto; border: 1px solid var(--rule); background: var(--sheet); }
.fl { display: grid; grid-template-columns: minmax(0, 1fr) 190px 72px 86px; gap: 10px; padding: 6px 12px; border-bottom: 1px dotted var(--rule); font: 13px "Trebuchet MS", sans-serif; align-items: center; }
.fl code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.fl .k { color: var(--soft); font-size: 12px; } .fl .z { color: var(--faint); text-align: right; font-size: 12px; }
.fl .a { display: flex; gap: 9px; justify-content: flex-end; }
.fl .a button, .fl .a a { border: 0; background: none; padding: 0; color: var(--stated); text-decoration: underline; cursor: pointer; font-size: 12.5px; }
@media (max-width: 760px) { .fl { grid-template-columns: minmax(0, 1fr) 70px; } .fl .k, .fl .z { display: none; } }
pre.view { max-height: 70vh; overflow: auto; background: var(--paper); border: 1px solid var(--rule); padding: 12px; font-size: 12px; white-space: pre; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 8px 0 8px 30px; position: relative; border-bottom: 1px dotted var(--rule); }
.checks li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 12px; height: 12px; background: var(--fix); }
.limits dt { font-family: Georgia, serif; font-weight: 700; margin-top: 12px; }
.limits dd { margin: 2px 0 0; color: var(--soft); }
footer { border-top: 1px solid var(--rule); padding: 22px 0 0; font: 13px "Trebuchet MS", sans-serif; color: var(--faint); }
