:root {
  --paper: #F7F4EE; --card: #FFFDF8; --ink: #1D1C1A; --ink2: #3F3C36; --muted: #5E5A52; --faint: #A39C8E;
  --rule: #DDD6C8; --rule2: #EEE8DC; --line: #CFC7B6; --fill: #F1ECE2; --warn-bg: #FBEBD6; --warn-fg: #5A3410;
  --s4: #1F4E79; --s5: #8E5BAA; --s3: #227F70; --od: #7C776D; --link: #1F4E79; --bar: #5E5A52;
  --serif: 'Newsreader', Georgia, serif; --sans: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161513; --card: #1F1E1B; --ink: #EDE8DD; --ink2: #CFC9BC; --muted: #A59E90; --faint: #6E685D;
    --rule: #34312C; --rule2: #2A2824; --line: #45413A; --fill: #2A2824; --warn-bg: #3A2A16; --warn-fg: #F2CF9F;
    --s4: #6FA3D6; --s5: #C69BDD; --s3: #5BC0AE; --od: #A8A296; --link: #8DBBE6; --bar: #A59E90; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161513; --card: #1F1E1B; --ink: #EDE8DD; --ink2: #CFC9BC; --muted: #A59E90; --faint: #6E685D;
  --rule: #34312C; --rule2: #2A2824; --line: #45413A; --fill: #2A2824; --warn-bg: #3A2A16; --warn-fg: #F2CF9F;
  --s4: #6FA3D6; --s5: #C69BDD; --s3: #5BC0AE; --od: #A8A296; --link: #8DBBE6; --bar: #A59E90; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }

/* header */
.top { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.top .in { max-width: 1360px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.brand b { font: 600 22px/1.1 var(--serif); letter-spacing: -0.01em; }
.brand span { font: 11px var(--mono); color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex-grow: 1; }
.nav a { padding: 10px 14px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); font-weight: 500; }
.search { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; height: 44px; background: var(--card); min-width: 200px; flex: 0 1 240px; }
.search input { border: 0; background: transparent; font: inherit; font-size: 14px; outline: none; flex-grow: 1; color: var(--ink); min-width: 0; }
.search svg { stroke: var(--muted); flex-shrink: 0; }
.results { position: absolute; top: 48px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; max-height: 360px; overflow: auto; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.results a { display: block; padding: 10px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule2); font-size: 14px; }
.results a:hover, .results a.on { background: var(--fill); }
.theme { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.theme svg { stroke: var(--ink); }

main { max-width: 1360px; margin: 0 auto; padding: 28px 24px 72px; display: flex; flex-direction: column; gap: 28px; }
h1 { margin: 0; font: 600 44px/1.08 var(--serif); letter-spacing: -0.015em; }
h2.k { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h2.t { margin: 0; font-size: 18px; font-weight: 600; }
.lede { margin: 0; max-width: 760px; color: var(--ink2); font-size: 17px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; }
.ruled { border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.grow { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero { display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: flex-end; }
.hero > div { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stats { margin: 0; flex: 1 1 420px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; border-top: 2px solid var(--ink); padding-top: 12px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font: 600 30px/1.2 var(--serif); }
.stats dd small { display: block; font: 11px var(--sans); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { border-color: var(--ink); }
.chip[aria-pressed="false"] { background: var(--fill); color: var(--muted); }
.chip.solid[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.flab { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* timeline */
.tl { overflow-x: auto; }
.tl .inner { min-width: 980px; display: flex; flex-direction: column; gap: 8px; }
.tr { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 12px; }
.tr.lane { padding: 8px 0; border-top: 1px solid var(--rule2); }
.lab { display: flex; flex-direction: column; gap: 2px; }
.lab b { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lab span { font-size: 12px; color: var(--muted); }
.track { position: relative; }
.ph { position: absolute; height: 18px; border-radius: 3px; border: 1px solid var(--faint); background: var(--fill); font-size: 11px; line-height: 16px; padding: 0 6px; overflow: hidden; white-space: nowrap; color: var(--ink); }
.ph.dash { border-style: dashed; background: transparent; }
.vline { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--ink); }
.mbar { position: absolute; bottom: 0; background: var(--bar); }
.yt { position: absolute; font: 11px var(--mono); color: var(--muted); border-left: 1px solid var(--line); padding-left: 3px; top: 0; }
.wbar { position: absolute; height: 12px; min-width: 4px; padding: 0; border: 0; border-radius: 2px; cursor: pointer; }
.wbar[aria-current="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.wbar:hover { filter: brightness(1.15); }
.pmark { position: absolute; top: 8px; width: 10px; height: 10px; margin-left: -5px; padding: 0; cursor: pointer; background: var(--ink); border: 0; }
.pmark.opinion { background: transparent; border: 2px solid var(--ink); border-radius: 50%; }
.pmark.speculation { background: transparent; border: 2px dashed var(--ink); transform: rotate(45deg); }
.tip { position: fixed; pointer-events: none; z-index: 20; background: var(--ink); color: var(--paper); font-size: 12px; padding: 6px 8px; border-radius: 4px; max-width: 320px; }

/* labels */
.lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.lbl i { width: 9px; height: 9px; display: inline-block; background: var(--ink); }
.lbl.opinion i { background: transparent; border: 2px solid var(--ink); border-radius: 50%; }
.lbl.speculation i { background: transparent; border: 2px dashed var(--ink); transform: rotate(45deg); }
.lbl.record i { outline: 2px solid var(--ink); outline-offset: 1px; }
.item { border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--card); }
.item.empty { border-style: dashed; color: var(--muted); font-size: 14px; }

/* tables */
.tbox { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--rule2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--ink); }

/* witness */
.badge { font: 500 14px var(--mono); padding: 3px 10px; border-radius: 4px; color: #fff; }
.months { display: flex; flex-wrap: wrap; gap: 20px; }
.mon { display: flex; flex-direction: column; gap: 6px; }
.mon b { font-size: 13px; }
.cal { display: grid; grid-template-columns: repeat(7, 40px); gap: 3px; }
.cal span.h { font-size: 11px; color: var(--muted); text-align: center; }
.cal button, .cal span.d { height: 40px; border-radius: 6px; font: 13px var(--mono); position: relative; padding: 0; }
.cal span.d { color: var(--faint); display: flex; align-items: center; justify-content: center; }
.cal button { border: 1px solid var(--line); background: var(--fill); cursor: pointer; color: var(--ink); }
.cal button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.cal button.warn { border: 2px solid #B5651D; }
.dots { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); display: flex; gap: 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; }
.daybox { flex: 1 1 260px; min-width: 0; border-left: 2px solid var(--ink); padding-left: 16px; display: flex; flex-direction: column; gap: 8px; }
.pdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.warnbox { margin: 0; font-size: 13px; padding: 8px 10px; background: var(--warn-bg); border-radius: 6px; color: var(--warn-fg); }
.body p { margin: 0 0 12px; max-width: 76ch; }
.body .pn { font: 11px var(--mono); color: var(--muted); margin-right: 6px; }
.body blockquote { margin: 4px 0 16px; padding: 14px 18px; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; font: 18px/1.55 var(--serif); max-width: 76ch; }
.body blockquote footer { margin-top: 8px; font: 12px var(--sans); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pager { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; background: var(--card); cursor: pointer; }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 500; }
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* day */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 760px; }
.week > * { padding: 8px 4px; border-radius: 6px; text-align: center; font: 12px var(--mono); color: var(--faint); text-decoration: none; }
.week a { background: var(--card); border: 1px solid var(--rule); color: var(--ink); }
.week .cur { background: var(--ink); color: var(--paper); }
.steps { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--rule); }
.steps li { padding: 0 0 14px 18px; position: relative; }
.steps li .pdot { position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; }

/* sources */
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.ladder li { border-top: 4px solid var(--ink); background: var(--card); padding: 14px 16px; border-radius: 0 0 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.ladder li.q { border-top-color: var(--od); }
.ladder li.c { border-top-color: #B5651D; }
.ladder { margin: 0; padding: 0; list-style: none; }
.ychart { display: grid; gap: 6px; align-items: end; height: 160px; border-bottom: 1px solid var(--line); }
.ychart .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.ychart .seg { width: 100%; }
.seg.fact { background: var(--ink); }
.seg.opinion { background: repeating-linear-gradient(45deg, var(--ink) 0 2px, transparent 2px 6px); border: 1px solid var(--ink); }
.seg.speculation { background: transparent; border: 1px dashed var(--ink); }
.seg.other { background: var(--faint); }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 500; }
footer.site { border-top: 1px solid var(--rule); padding-top: 16px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* phone */
.ylist { margin: 0; padding: 0; list-style: none; display: none; }
.ylist li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--rule); }
.ylist .spark { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; align-items: end; height: 24px; }
.ylist .spark i { background: var(--bar); min-height: 1px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font: 12px var(--mono); }
@media (max-width: 760px) {
  main { padding: 20px 16px 56px; }
  .top .in { padding: 10px 16px; }
  h1 { font-size: 30px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl { display: none; }
  .ylist { display: block; }
  .search { min-width: 0; flex: 1 1 100%; }
  .cal { grid-template-columns: repeat(7, 40px); }
}

.stats.inl { flex: none; border: 0; padding: 0; }
.ph { cursor: default; }
.ph.short1, .ph.short2 { overflow: visible; }
.ph.short1 span { position: absolute; right: 100%; padding-right: 6px; }
.ph.short2 span { position: absolute; left: 100%; padding-left: 6px; }

/* chronicle */
.era { position: relative; padding: 6px 0 0; }
.eratrack { position: relative; height: 38px; border-bottom: 1px solid var(--line); }
.eray { position: absolute; bottom: 0; background: var(--bar); }
.eray:hover { background: var(--ink); }
.eralabs { position: relative; height: 22px; }
.eralabs a { position: absolute; top: 4px; font-size: 11px; white-space: nowrap; color: var(--muted); border-left: 1px solid var(--line); padding-left: 4px; text-decoration: none; }
.eralabs a:hover { color: var(--ink); }
.chron { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; align-items: start; }
.rail { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.rail ol { margin: 0; padding: 0; list-style: none; }
.rail a { display: grid; grid-template-columns: 40px 64px auto; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 4px; color: var(--ink); text-decoration: none; font: 12px var(--mono); min-height: 24px; }
.rail a i { height: 6px; background: var(--bar); border-radius: 1px; }
.rail a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.rail a[aria-current="true"] i { background: var(--paper); }
.rail a[aria-current="true"] .muted { color: var(--paper); }
.stream { display: flex; flex-direction: column; }
.yh { position: sticky; top: 64px; z-index: 2; margin: 18px 0 0; padding: 10px 0 8px; background: var(--paper); border-bottom: 2px solid var(--ink); font: 600 30px/1.1 var(--serif); display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; scroll-margin-top: 64px; }
.mh { margin: 14px 0 4px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.crow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule2); scroll-margin-top: 130px; }
.crow.hit { background: var(--fill); }
.cdate { display: flex; flex-direction: column; }
.cdate a { color: var(--ink); font-weight: 500; }
.cbody { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ent { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ent > div { flex-basis: 100%; }
.ent.phase { border-left: 3px solid var(--ink); padding-left: 10px; }
.wchip { display: inline-flex; gap: 6px; align-items: baseline; color: var(--ink); text-decoration: none; font-weight: 500; border-left: 4px solid var(--c); padding-left: 8px; }
.wchip:hover { text-decoration: underline; }
.gap { margin: 8px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 6px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 760px) {
  .chron { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .crow { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .yh { top: 0; font-size: 24px; }
  .eralabs a:nth-child(2), .eralabs a:nth-child(5) { display: none; }
}

/* witness intro */
.who { display: flex; flex-direction: column; gap: 14px; }
.whop { margin: 0; font: 400 19px/1.5 var(--serif); color: var(--ink); max-width: 760px; }
.wdl { margin: 0; display: flex; flex-direction: column; }
.wrow { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.wrow dt { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.wrow dd { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.wrow dd p { margin: 0; }
.wl { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wl li { line-height: 1.5; }
.acc { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--ink2); white-space: nowrap; }
.fn { font-size: 11px; vertical-align: super; margin-left: 2px; text-decoration: none; }
.tag { font-family: var(--mono, monospace); font-size: 11px; color: var(--muted); }
.wrefs ol { margin: 8px 0 0; padding-left: 24px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .wrow { grid-template-columns: 1fr; gap: 4px; } }
