/* Portable reading theme, based on Trees' orbit-closures/history.html.
   Load after the site's CSS. Navigation is adapted by reading-nav.js. */
:root {
  color-scheme: light;
  --bg:#fff; --surface:#fff; --paper:#fff; --ink:#222; --fg:#222;
  --muted:#666; --rule:#e6e6e6; --line:#e6e6e6;
  --accent:#338bde; --accent-ink:#2667a8; --accent-soft:rgba(51,139,222,.07);
  --body:14px; --small:12.5px; --h1:20px; --h2:16px; --h3:14px;
}
html { font-size:14px; }
body { margin:0; background:#fff; color:var(--ink); font:var(--body)/1.6 "Times New Roman",Times,serif; }
body main,body main.prose,body main.hub,body main.page {
  box-sizing:border-box; width:100%; max-width:820px; min-width:0;
  margin:0 auto; padding:24px 20px 40px; overflow-wrap:anywhere;
}
main h1 { font:600 var(--h1)/1.4 "Times New Roman",Times,serif; margin:4px 0 6px; }
main h2,main summary h2 { font:600 var(--h2)/1.4 "Times New Roman",Times,serif; margin:26px 0 10px; }
main h3,main h4 { font:600 var(--h3)/1.4 "Times New Roman",Times,serif; }
main p,main li,main summary,main .lead { font-family:inherit; font-size:var(--body); }
main .small,main caption,main figcaption,main .disclosure-context { font-size:var(--small); color:var(--muted); }
main a { color:var(--accent-ink); }
main section+section { border-top:1px solid var(--rule); }
main .stmt,main .claim,main .card { margin:14px 0; padding:10px 14px; border:1px solid var(--rule); border-radius:6px; background:#fff; box-shadow:none; }
main :is(.proposition,.prop-card,.stmt.target,.lemma,.corollary),
main :is(.stmt,.claim,.card)[data-kind="lemma"],
main :is(.stmt,.claim,.card)[data-kind="prop"],
main :is(.stmt,.claim,.card)[data-kind="proposition"],
main :is(.stmt,.claim,.card)[data-kind="corollary"] { background:rgba(51,139,222,.07); border:0; border-radius:6px; padding:12px 16px; }
main .setting,main .definition,main .def-box,main .notation-block,main .claim.def,
main :is(.stmt,.claim,.card)[data-kind="def"],
main :is(.stmt,.claim,.card)[data-kind="definition"],
main :is(.stmt,.claim,.card)[data-kind="setup"],
main :is(.stmt,.claim,.card)[data-kind="notation"] { background:rgba(92,184,125,.10); border:0; border-radius:6px; padding:10px 14px; }
main .example,main .claim.ex,
main :is(.stmt,.claim,.card)[data-kind="ex"],
main :is(.stmt,.claim,.card)[data-kind="example"] { background:rgba(255,213,79,.12); border:0; border-radius:6px; padding:10px 14px; }
main .proof-step,main li.proof-step,main .proof>ol>li,main .step-argument>ol>li {
  background:#fff; border:1px solid var(--rule); border-radius:6px; padding:12px 16px; margin:12px 0;
}
main .statement-group { background:none; border:0; box-shadow:none; }
main .step-argument,main .step-sources,main details.proof { background:none; border:0; border-radius:0; padding:0; }
main .step-argument>summary,main .step-sources>summary,main details.proof>summary { font:inherit; color:var(--muted); padding:3px 0; }
main details.step>summary,main .definitions-toggle>summary { list-style:none; }
main details.step>summary::-webkit-details-marker,main .definitions-toggle>summary::-webkit-details-marker { display:none; }
main details.step>summary h2::before { content:none; }
main .tag,main .prop-status { background:none; padding:0; border:0; border-radius:0; }
main .quote,main .summary,main .remark { border:0; border-left:2px solid var(--rule); background:none; padding-left:14px; }
main figure { margin:18px 0; }
main figure img { max-width:100%; height:auto; }
main figcaption { margin-top:6px; line-height:1.5; }
main table { width:100%; max-width:100%; border-collapse:collapse; font-family:inherit; }
main th,main td { padding:8px 10px; text-align:left; vertical-align:top; border:0; border-bottom:1px solid var(--rule); }
main caption { text-align:left; font-weight:600; margin-bottom:6px; }
main .table-scroll,main .tablewrap,main .table-wrap,main .dsscroll,main .katex-display,main pre { max-width:100%; overflow-x:auto; overflow-y:hidden; }
main .katex { overflow-wrap:normal; font-size:1.1em; }
/* Reserve a gutter for equation numbers inside the equation's own scroller. */
main .katex-display:not(.leqno)>.katex:has(>.katex-html>.tag) {
  width:max-content; min-width:100%; box-sizing:border-box; padding-right:3.5em;
}
main .katex-display:not(.leqno)>.katex>.katex-html>.tag { right:-3.5em; }
main .grid>*,main .two>*,main .cols>*,main .cornell>* { min-width:0; }
main input,main select,main textarea,main button { font-family:inherit; }
main .pager { display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; margin-top:26px; padding-top:12px; border:0; border-top:1px solid var(--rule); background:none; }
main .pager a { border:0; border-radius:0; background:none; padding:0; }
/* A genuine history timeline, when the page calls for it. */
.tl { position:relative; margin:20px 0; padding-left:26px; }
.tl::before { content:""; position:absolute; left:8px; top:6px; bottom:6px; width:2px; background:var(--rule); }
.tl .ev { position:relative; margin-bottom:26px; }
.tl .ev::before { content:""; position:absolute; left:-24px; top:7px; width:12px; height:12px; box-sizing:border-box; border:2px solid var(--muted); border-radius:50%; background:#fff; }
.tl .ev.main::before { left:-26px; top:5px; width:16px; height:16px; background:var(--accent); border-color:var(--accent); }
.tl .yr { font-weight:600; color:var(--accent-ink); }
.tl .ctx .yr { color:var(--muted); }
/* Before reading-nav.js runs: a page-level nav already sits where the sidebar will be, and the main column waits
   for the scripts (math, navigation), so following a link never paints a bare list or raw TeX. Without scripts the
   column appears after 1.5 s. */
html:not(.reading-ready) body:has(> nav[data-reading-nav]) { padding-left:250px; }
html:not(.reading-ready) body > nav[data-reading-nav] { position:fixed; inset:0 auto 0 0; z-index:80; box-sizing:border-box; width:250px; padding:60px 10px 24px; overflow:hidden; background:#fff; border-right:1px solid var(--rule); font:14px/1.45 "Times New Roman",Times,serif; }
html:not(.reading-ready) body > nav[data-reading-nav]::before { content:"Home"; position:absolute; top:0; left:0; right:0; box-sizing:border-box; min-height:52px; padding:8px 14px; display:flex; align-items:center; border-bottom:1px solid var(--rule); font-weight:600; color:var(--ink); }
html:not(.reading-ready) body > nav[data-reading-nav] :is(ul,li) { display:block; list-style:none; margin:0; padding:0; }
html:not(.reading-ready) body > nav[data-reading-nav] :is(a,summary) { display:block; box-sizing:border-box; min-height:36px; padding:8px 10px; border-left:2px solid transparent; border-radius:4px; color:var(--muted); text-decoration:none; list-style:none; }
html:not(.reading-ready) body > nav[data-reading-nav] [aria-current="page"] { background:rgba(51,139,222,.07); border-left-color:#338bde; color:var(--ink); font-weight:600; }
html:not(.reading-ready) body > nav[data-reading-nav] details>ul { margin:2px 0 8px 12px; padding-left:8px; border-left:1px solid var(--rule); }
html:not(.reading-ready) body > nav[data-reading-nav] li>ul { margin:2px 0 8px 12px; padding-left:8px; border-left:1px solid var(--rule); }
html:not(.reading-ready) body:has(> nav[data-reading-nav]) > main { opacity:0; animation:reading-reveal 0s linear 1.5s forwards; }
@keyframes reading-reveal { to { opacity:1; } }
/* One persistent navigation source, moved into this shell without cloning. */
body.reading-has-sidebar { padding-left:250px; }
.reading-sidebar { position:fixed; inset:0 auto 0 0; z-index:80; box-sizing:border-box; width:250px; height:100vh; height:100dvh; display:flex; flex-direction:column; background:#fff; border-right:1px solid var(--rule); font:14px/1.45 "Times New Roman",Times,serif; }
.reading-sidebar * { box-sizing:border-box; }
.reading-sidebar-top { display:flex; align-items:center; gap:12px; min-height:52px; padding:8px 14px; border-bottom:1px solid var(--rule); }
.reading-sidebar-top a { color:var(--ink); text-decoration:none; font-weight:600; }
.reading-menu { display:none; margin-left:auto; min-height:36px; padding:6px 10px; border:1px solid var(--rule); border-radius:6px; background:#fff; color:var(--ink); font:inherit; cursor:pointer; }
.reading-sidebar-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:8px 10px 24px; }
.reading-sidebar-body :is(nav,ul,ol,.inner,.row,.subrow,.subtabs,.tabs) { display:block; position:static; width:auto; min-width:0; max-width:100%; margin:0; padding:0; list-style:none; border:0; background:#fff; box-shadow:none; font:inherit; white-space:normal; }
.reading-sidebar-body [hidden] { display:none; }
.reading-sidebar-body li { list-style:none; margin:0; padding:0; }
.reading-sidebar-body :is(a,button,summary,.on) { display:block; width:100%; margin:0; padding:8px 10px; min-height:36px; border:0; border-left:2px solid transparent; border-radius:4px; background:none; color:var(--muted); font:inherit; text-align:left; white-space:normal; overflow-wrap:anywhere; text-decoration:none; box-shadow:none; }
.reading-sidebar-body :is(a,button,summary):hover { background:#f5f8fb; color:var(--ink); }
.reading-sidebar-body :is([aria-current="page"],a.here,.on) { background:rgba(51,139,222,.07); border-left-color:#338bde; color:var(--ink); font-weight:600; text-decoration:none; }
.reading-sidebar-body :is(details>ul,details>div,li>ul,[data-reading-subnav]) { margin:2px 0 8px 12px; padding-left:8px; border-left:1px solid var(--rule); }
.reading-sidebar-body .reading-utilities { margin-top:8px; padding-top:8px; border-top:1px solid var(--rule); }
.reading-sidebar :is(a,button,summary):focus-visible { outline:2px solid #338bde; outline-offset:-2px; }
/* Graphs retain their scientific canvas rather than inheriting a prose width. */
body main#stage,body main#space { max-width:none; margin:0; padding:0; overflow-wrap:normal; }
@media(max-width:899px) {
  html:not(.reading-ready) body:has(> nav[data-reading-nav]) { padding-left:0; }
  html:not(.reading-ready) body > nav[data-reading-nav] { position:sticky; inset:auto; top:0; width:100%; height:53px; padding:0; border-right:0; border-bottom:1px solid var(--rule); }
  html:not(.reading-ready) body > nav[data-reading-nav] > * { display:none; }
  html:not(.reading-ready) body > nav[data-reading-nav]::before { border-bottom:0; }
  body.reading-has-sidebar { padding-left:0; }
  .reading-sidebar { position:sticky; inset:auto; top:0; width:100%; height:auto; border-right:0; border-bottom:1px solid var(--rule); }
  .reading-sidebar-top { border-bottom:0; }
  .reading-menu { display:block; }
  .reading-sidebar-body { display:none; position:absolute; top:100%; left:0; width:min(300px,100vw); max-height:calc(100dvh - 60px); border:1px solid var(--rule); border-left:0; background:#fff; box-shadow:4px 8px 16px rgba(0,0,0,.08); }
  .reading-sidebar.is-open .reading-sidebar-body { display:block; }
  .reading-sidebar-body :is(a,button,summary) { min-height:44px; }
}
@media(max-width:600px) {
  :root { --body:16px; --small:14px; --h3:16px; }
  body { line-height:1.65; }
  body main,body main.prose,body main.hub,body main.page { padding-left:16px; padding-right:16px; }
  main .grid,main .two,main .cols,main .cornell { grid-template-columns:minmax(0,1fr); }
  main input,main select,main textarea,main button { font-size:16px; }
  main summary { padding-top:8px; padding-bottom:8px; }
}

/* Disclosures are marker-free; native keyboard and focus behavior remain. */
summary { list-style:none; cursor:pointer; }
summary::-webkit-details-marker { display:none; }
summary::marker { content:""; }
main .definitions-toggle,main .hypotheses-toggle { margin:20px 0 28px; }
main .definitions-toggle+.hypotheses-toggle { margin-top:28px; }
main .hypotheses-toggle { background:rgba(165,154,202,.13); border-radius:6px; padding:10px 14px; }
main .hypotheses { background:none; padding-top:10px; }
main .object-knowls { margin:18px 0; }
main .knowl-label { color:var(--muted); margin:0 0 6px; }
main .knowl-buttons { display:flex; flex-wrap:wrap; gap:8px 16px; }
main .knowl-trigger { color:var(--accent-ink); border:0; border-bottom:1px dotted currentColor; background:none; padding:2px 0; font:inherit; cursor:pointer; }
main .knowl-trigger[aria-expanded="true"] { border-bottom-style:solid; }
main .knowl-content { margin:12px 0; }
main .knowl-content[hidden] { display:none; }
summary:focus-visible,.knowl-trigger:focus-visible { outline:2px solid #338bde; outline-offset:3px; }

main .table-scroll,main .katex-display { position:relative; }

/* Definition items remain colored when collapsed, like hypotheses. */
main .definition-list { margin:20px 0 28px; }
main .definition-item { background:rgba(92,184,125,.10); border-radius:6px; padding:10px 14px; margin:10px 0; }
main .definition-item>.knowl-trigger { display:block; width:100%; text-align:left; border:0; color:var(--ink); }
main .definition-item>.knowl-trigger::first-line { text-decoration:underline dotted; text-underline-offset:4px; }
main .definition-item>.knowl-content { margin:14px 0 0; }
main .definition-list+.hypotheses-toggle { margin-top:28px; }
main .proof-breakdown { margin-top:28px; padding-top:4px; }
main .step-contribution { margin:12px 0; }
main .step-contribution>summary { color:var(--muted); }
/* Definitions as one closed green bar, like Hypotheses; its numbered items are white inside it. */
main .definitions-toggle { background:rgba(92,184,125,.10); border-radius:6px; padding:10px 14px; }
main .definitions { padding-top:6px; }
main .definitions>.definition-item { background:#fff; margin:8px 0; }
/* Equation knowls (equation-knowls.js): a defined symbol inside a formula opens its definition below the block. */
main .katex [data-knowl] { cursor:pointer; border-bottom:1px dotted rgba(38,103,168,.5); }
main .katex [data-knowl]:hover,main .katex [data-knowl][aria-expanded="true"] { color:var(--accent-ink); background:rgba(51,139,222,.10); border-bottom:1px solid var(--accent-ink); }
main .katex [data-knowl]:focus-visible { outline:2px solid #338bde; outline-offset:2px; }
main .knowl-panel { margin:12px 0; }
main .knowl-close { display:block; margin:8px 0 0 auto; border:0; background:none; color:var(--accent-ink); font:inherit; cursor:pointer; padding:2px 0; }
main .knowl-hint { color:var(--muted); margin:6px 0 0; }
/* A self-contained open gap: statement, why it is open, where it is used. */
main .gap-statement { background:#fff; border:1px solid var(--rule); border-radius:6px; padding:10px 14px; margin:14px 0; }
main .gap-statement>ul { padding-left:20px; }
/* A whole section closed by default: its heading and one-line gist stay visible. */
main .section-toggle>summary { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 14px; margin:26px 0 10px; }
main .section-toggle>summary h2 { margin:0; }
main .section-toggle>summary .section-gist { color:var(--muted); }
main .section-toggle>summary::after { content:"show"; margin-left:auto; color:var(--accent-ink); }
main .section-toggle[open]>summary::after { content:"hide"; }
/* Subtabs (tabs.js), e.g. one per proof route. */
main .tablist { display:flex; flex-wrap:wrap; gap:0 4px; margin-top:18px; border-bottom:1px solid var(--rule); }
main .tablist [role="tab"] { border:0; border-bottom:2px solid transparent; background:none; padding:8px 12px; margin-bottom:-1px; font:inherit; color:var(--muted); cursor:pointer; }
main .tablist [role="tab"][aria-selected="true"] { color:var(--ink); border-bottom-color:var(--accent); font-weight:600; }
main .tablist [role="tab"]:hover { color:var(--ink); }
main .tablist [role="tab"]:focus-visible { outline:2px solid #338bde; outline-offset:-2px; }
main [role="tabpanel"] { padding-top:6px; }
/* An attempt-tree snapshot in place of a contribution note. */
main .tree-snap figure { margin:8px 0 4px; }
main .tree-snap img { display:block; width:100%; height:auto; border:1px solid var(--rule); border-radius:6px; }
/* User preference: explicit key questions in light-red boxes. */
main .question{background:#fff1f1;border:1px solid #e5b2b2;color:#382525}main .question>strong{color:#8b3038}.flow,.dependencies{font-size:var(--small)}.tablist button{font:inherit;background:#fff;color:var(--ink)}.tablist button[aria-selected=true]{background:#edf4fb;border-color:#aac4dc}
