:root {
  color-scheme: light;
  --paper: #f9f6ef;
  --ink: #25231e;
  --muted: #645e53;
  --rule: #cec5b4;
  --accent: #8f3529;
  font: 16px/1.55 Georgia, serif;
  color: var(--ink);
  background: var(--paper);
}
body { width: min(1120px, 100% - 2rem); margin: 0 auto; }
.utility, nav, .actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.utility { justify-content: space-between; padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.utility, button, footer, #status, .paper-meta, .hint, label, input {
  font-family: system-ui, sans-serif;
  font-size: .84rem;
}
a { color: var(--accent); text-underline-offset: .2em; }
.view-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; }
.view-switch > * { padding: .35rem .65rem; text-decoration: none; }
.view-switch button { border: 0; border-radius: 0; color: var(--accent); }
.view-switch button:hover, .view-switch button:focus-visible { text-decoration: underline; }
.view-switch [aria-current] { background: var(--ink); color: var(--paper); }
button { color: inherit; background: transparent; cursor: pointer; border: 1px solid var(--rule); border-radius: 3px; padding: .35rem .75rem; }
button:hover { border-color: var(--accent); }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1 { margin: .48em 0 0; text-align: center; font-size: clamp(2.6rem, 9vw, 6rem); line-height: 1; letter-spacing: -.055em; }
header > p { margin: .65rem 0 1.5rem; text-align: center; color: var(--muted); font-style: italic; }
header { border-bottom: 4px double var(--ink); }
#status { margin: .8rem 0; color: var(--muted); min-height: 1.4em; }
#edition { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 315px), 1fr)); gap: 2rem 1.6rem; }
section { padding: .65rem 0 0; border-top: 2px solid var(--ink); min-width: 0; }
section h2 { margin: 0 0 .8rem; font: 700 .84rem/1.4 system-ui, sans-serif; color: var(--accent); text-transform: uppercase; letter-spacing: .09em; }
article + article { border-top: 1px solid var(--rule); margin-top: 1.15rem; padding-top: 1.05rem; }
h3 { margin: 0; font-size: 1.4rem; line-height: 1.16; overflow-wrap: anywhere; }
article p { margin: .6rem 0; overflow-wrap: anywhere; }
.paper-meta, .hint, footer { color: var(--muted); }
.paper-meta { display: flex; gap: .65rem; flex-wrap: wrap; }
details summary { cursor: pointer; }
footer { margin: 2rem 0; padding-top: .7rem; border-top: 1px solid var(--rule); }
dialog { color: inherit; background: var(--paper); border: 1px solid var(--rule); padding: 1.3rem; width: min(650px, 100% - 4rem); }
dialog::backdrop { background: #25231e80; }
dialog h2 { margin-top: 0; }
.tree-help { margin: -.45rem 0 .85rem; color: var(--muted); font-size: .9rem; }
.tree-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .85rem; }
.tree-tools label { display: flex; align-items: center; gap: .35rem; }
#filter { flex: 1; box-sizing: border-box; min-width: min(100%, 180px); padding: .5rem; }
#choices { max-height: min(48vh, 480px); overflow: auto; padding: .35rem; border-block: 1px solid var(--rule); }
.tree-root, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { margin: .25rem 0 .4rem .75rem; padding-left: .85rem; border-left: 1px solid var(--rule); }
.tree-children > .tree-item { position: relative; }
.tree-children > .tree-item::before { content: ''; position: absolute; left: -.85rem; top: 1rem; width: .7rem; border-top: 1px solid var(--rule); }
.tree-row { display: flex; align-items: center; gap: .4rem; min-height: 2rem; padding: .18rem .45rem; }
.tree-branch { background: #efe9dd; border-radius: 4px; margin: .25rem 0; }
.has-selection > .tree-branch { background: #eee1d2; }
.tree-branch label { font-weight: 650; }
.tree-leaf:hover { background: #eee9e0; }
.tree-row label { display: flex; align-items: baseline; gap: .35rem; flex: 1; min-width: 0; cursor: pointer; }
.tree-row input, .tree-tools input[type=checkbox] { accent-color: var(--accent); }
.tree-row small { color: var(--muted); margin-left: auto; }
.tree-disclosure { flex: 0 0 1.45rem; padding: 0; border: 0; font-size: 1rem; color: var(--accent); }
.tree-disclosure span { display: inline-block; }
.tree-disclosure[aria-expanded=true] span { transform: rotate(90deg); }
.tree-count { color: var(--muted); font: .75rem system-ui, sans-serif; white-space: nowrap; }
.tree-leaf a, #topic-nav, #pages { font: .82rem/1.5 system-ui, sans-serif; }
.tree-leaf a { white-space: nowrap; margin-left: .25rem; }
.actions { margin-top: .85rem; }
.actions { justify-content: flex-end; }
button[type=submit] { color: white; background: var(--accent); }
#topic-error { color: var(--accent); }
[hidden] { display: none !important; }
section h2 a { color: inherit; text-decoration: none; }
section h2 a:hover { text-decoration: underline; }
.subheading { color: var(--muted); font-style: italic; line-height: 1.35; }
#browse-edition { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .65rem 1.2rem; padding: .9rem 0 .2rem; }
.edition-switch { display: flex; gap: .3rem; }
.edition-switch [aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
#available { flex: 1; min-width: min(100%, 15rem); font: .83rem/1.5 system-ui, sans-serif; }
#available summary { display: list-item; padding: .35rem 0; color: var(--accent); cursor: pointer; }
#ready-links { display: flex; gap: .4rem .85rem; flex-wrap: wrap; padding: .3rem 0; }
.topic-ready { font: .69rem system-ui, sans-serif; color: #426244; white-space: nowrap; }
.story-context { font-size: .92rem; line-height: 1.45; }
.story-context strong { margin-right: .2rem; }
.evidence-kind, .new-paper {
  display: inline-block; border-radius: 3px; padding: .1em .4em;
  background: #eee1d2; color: #683027; font: 600 .73rem/1.4 system-ui, sans-serif;
}
.new-paper { margin-bottom: .35rem; }
.paper-category { color: var(--accent); font: 600 .78rem system-ui, sans-serif; }
.save-paper { padding: .15rem .45rem; }
.save-paper[aria-pressed=true] { background: #eee1d2; color: #683027; }
#edition-tools { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding: .75rem 0 .15rem; }
#edition-tools label, #last-checked, #reading-status { font: .83rem system-ui, sans-serif; }
#edition-tools label { display: flex; align-items: center; gap: .35rem; }
#edition-tools input { accent-color: var(--accent); }
#last-checked, #reading-status { color: var(--muted); }
#reading-status:empty { display: none; }
.reading-grid { grid-column: 1 / -1; display: grid; gap: 1.35rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 315px), 1fr)); }
.reading-grid article { border-top: 1px solid var(--rule); padding-top: .8rem; margin-top: 0; }
.illustration {
  position: relative; display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 2 / 1; margin: .7rem 0; background: #ede5d6; color: var(--muted);
  font: .75rem system-ui, sans-serif;
}
.illustration img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.image-credit { position: absolute; bottom: .35rem; right: .35rem; background: var(--paper); padding: .2rem .35rem; }
#topic-nav { display: flex; flex-wrap: wrap; align-items: start; gap: .7rem 1.4rem; margin: 1rem 0; }
#topic-nav details { flex: 1; min-width: min(100%, 190px); }
.subtopic-links { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .5rem; }
.topic-page h1 { font-size: clamp(2.3rem, 7vw, 4.8rem); overflow-wrap: anywhere; }
.topic-page #edition { display: block; }
.topic-page section { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 315px), 1fr)); gap: 1.5rem; }
.topic-page article { border-top: 1px solid var(--rule); padding-top: .8rem; margin-top: 0; }
#pages { margin-top: 1rem; }
