/* Topology by Example: the site's only style sheet. Hand-written; no framework.
   Licence: Apache-2.0 (code), as the rest of the generator. */

:root {
  color-scheme: light dark;
  --bg: #fdfcf8;
  --fg: #1d1c1a;
  --muted: #595650;
  --rule: #d8d3c8;
  --rule-strong: #b3ad9f;
  --surface: #f3f0e7;
  --surface-2: #ebe6d9;
  --accent: #1c4c87;
  --accent-visited: #4d3a86;
  --focus: #c2410c;
  --false: #6b675f;
  --target: #fff1c2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wide: 72rem;
  --sidebar: 15.5rem;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --fg: #e7e4dc;
    --muted: #aaa59b;
    --rule: #34363c;
    --rule-strong: #4c4f57;
    --surface: #1d1f24;
    --surface-2: #262930;
    --accent: #8fbcf2;
    --accent-visited: #b9a6ef;
    --focus: #fb923c;
    --false: #a19c92;
    --target: #3b3520;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

main {
  display: block;
  padding: 1.5rem 1.25rem 3rem;
  min-width: 0;
}
main:focus { outline: none; }

/* ----- links and focus */

a { color: var(--accent); text-underline-offset: 0.15em; text-decoration-thickness: 0.06em; }
a:visited { color: var(--accent-visited); }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: 0.5rem; top: -3rem;
  background: var(--bg); color: var(--fg); padding: 0.4rem 0.8rem; z-index: 10;
  font-family: var(--sans); border: 2px solid var(--focus);
}
.skip:focus { top: 0.5rem; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ----- layout: a slim header, the sidebar menu, the page */

/* What only a script can drive is shown only with one (the inline script in each page's head adds
   the class "js" to <html> before the page is drawn); the fallbacks only without one. */
html:not(.js) .js-only, html.js .no-js-only { display: none !important; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--rule); background: var(--surface); font-family: var(--sans);
  padding: 0.55rem 1.25rem; position: relative;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--fg) !important; text-decoration: none; }
.brand:hover { text-decoration: underline; }
.menu-button, .menu-link { display: none; }

.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: calc(var(--sidebar) + var(--wide)); margin: 0 auto; }
.page { min-width: 0; }
/* pages of wide tables (the grid) use the whole window */
.wide-page .layout { max-width: none; }

.site-nav {
  position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.2rem 0.6rem 2rem 1.25rem; font-family: var(--sans); font-size: 0.92rem; line-height: 1.35;
  border-right: 1px solid var(--rule);
}
.site-nav ul { list-style: none; margin: 0 0 0.9rem; padding: 0; max-width: none; }
.site-nav li { margin: 0; }
.site-nav a { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
  padding: 0.22rem 0.5rem; border-radius: 4px; color: var(--fg); text-decoration: none; }
.site-nav a:visited { color: var(--fg); }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current] { color: var(--accent); font-weight: 600; }
.site-nav a[aria-current="page"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.nav-heading { margin: 0 0 0.25rem; padding: 0 0.5rem; font-size: 0.74rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); max-width: none; }
.nav-count { font-size: 0.8em; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.site-nav ul.nav-sub { margin: 0.1rem 0 0.3rem 0.6rem; padding-left: 0.4rem; border-left: 1px solid var(--rule); font-size: 0.86rem; }
.site-nav ul.nav-sub a { padding: 0.15rem 0.45rem; display: block; }
.site-nav ul.nav-home { margin-bottom: 1rem; }
.nav-close { font-size: 0.9rem; }
.site-nav:focus { outline: none; }

.quick-find { margin: 0 0 1rem; position: relative; }
.quick-find label { display: block; font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 0 0.5rem 0.25rem; }
.quick-find input, .list-filter input { width: 100%; background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 4px;
  padding: 0.35rem 0.55rem; font-family: var(--sans); font-size: 0.92rem; }
.site-nav ul.quick-find-results { margin: 0.3rem 0 0; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg);
  padding: 0.2rem; }
.quick-find-results a { display: block; }
.quick-find-results a:focus-visible { outline-offset: -2px; }
.qf-kind { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.qf-none { padding: 0.25rem 0.5rem; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--rule); color: var(--muted); font-family: var(--sans); font-size: 0.85rem;
  padding: 1rem 1.25rem 2rem;
}
.site-footer p { max-width: var(--measure); margin: 0.3rem 0; }

/* breadcrumbs and previous/next */
.crumbs { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:last-child { color: var(--accent); }
.prev-next { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2.5rem 0 0;
  padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.95rem; max-width: var(--wide); }
.prev-next a { display: block; max-width: 48%; text-decoration: none; }
.prev-next a:hover { text-decoration: underline; }
.prev-next .next { margin-left: auto; text-align: right; }
.pn-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* listings: filter box, groups, items */
.list-filter { max-width: 26rem; margin: 1rem 0 0.5rem; font-family: var(--sans); font-size: 0.9rem; }
.list-filter label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.filter-count { margin: 0.3rem 0 0; color: var(--muted); min-height: 1.4em; }
.group-count { font-family: var(--sans); font-size: 0.6em; font-weight: 400; color: var(--muted); vertical-align: 0.15em; margin-left: 0.3em; }
nav.letters { font-family: var(--sans); font-size: 0.9rem; word-spacing: 0.35em; max-width: var(--wide); }
h3.letter { font-family: var(--sans); font-size: 1rem; margin: 1rem 0 0.2rem; border-bottom: 1px solid var(--rule); }
ul.item-list { padding-left: 1.1rem; max-width: var(--wide); }
ul.item-list li { margin: 0.25rem 0; }
.item-note { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
[data-filter][hidden], [data-filter-group][hidden] { display: none; }
p.examples { margin: 0.4rem 0; }
.examples-label { font-weight: 600; }
ul.similar li { margin: 0.3rem 0; }

/* ----- text */

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; font-weight: 600; }
h1 { font-size: 2rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.45rem; margin: 2.2rem 0 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--rule); }
h3 { font-size: 1.15rem; margin: 1.6rem 0 0.4rem; }
h4 { font-size: 1rem; margin: 1rem 0 0.3rem; }
.prose h2 { border-top: none; padding-top: 0; margin-top: 1.8rem; }

p, ul, ol, dl { max-width: var(--measure); }
.prose { max-width: var(--measure); }
.prose table { max-width: 100%; }
li { margin: 0.15rem 0; }
code { font-family: var(--mono); font-size: 0.86em; }
.kind { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.kind code { text-transform: none; letter-spacing: 0; }
.aliases { color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); }
.statement { font-size: 1.15rem; border-left: 3px solid var(--rule-strong); padding: 0.2rem 0 0.2rem 1rem; }
.cites { font-size: 0.95rem; color: var(--muted); }
.codes { line-height: 2; }
.codes a { margin-right: 0.3em; }
var { font-style: italic; font-family: var(--serif); }
cite { font-style: italic; }

/* ----- mathematics (TeX typeset by MathJax in the browser) */

.math-display { display: block; margin: 0.9rem 0; overflow-x: auto; overflow-y: hidden; padding: 0.1rem 0; }
mjx-container { max-width: 100%; }
.noscript-note { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

/* ----- fact lists */

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 1rem 0 1.5rem;
  font-family: var(--sans); font-size: 0.92rem; max-width: var(--wide); }
dl.facts > div { display: contents; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
dl.facts code, .lean code, .theorems code { overflow-wrap: anywhere; }
.where { color: var(--muted); font-size: 0.9em; }

dl.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.6rem; margin: 1rem 0;
  font-family: var(--sans); max-width: var(--wide); }
dl.summary > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 0.5rem 0.8rem; }
dl.summary dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
dl.summary dd { margin: 0.15rem 0 0; font-size: 0.95rem; }
dl.summary strong { font-size: 1.2rem; }
.of { color: var(--muted); }
.pnum { font-family: var(--sans); font-size: 0.75em; color: var(--muted); vertical-align: 0.1em; }


/* ----- values */


.val { font-family: var(--sans); white-space: nowrap; }
.val-true { color: var(--fg); }
.val-false { color: var(--false); }
.val-unknown, .val-independent { font-weight: 600; }

.legend { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); border: 1px solid var(--rule);
  border-radius: 4px; padding: 0.4rem 0.8rem; margin: 1rem 0; max-width: var(--wide); }
.legend p { margin: 0.25rem 0; max-width: none; }
.legend .val { font-size: 1em; }
.legend-desc { color: var(--muted); }

/* ----- tables */

.table-scroll { position: relative; overflow-x: auto; max-width: 100%; margin: 0.8rem 0 1.2rem; border: 1px solid var(--rule); border-radius: 4px; }
.table-scroll:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; font-family: var(--sans); font-size: 0.9rem; line-height: 1.4; }
caption { caption-side: top; text-align: left; padding: 0.5rem 0.75rem; color: var(--muted); font-size: 0.85rem; }
th, td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; text-align: left; }
thead th { background: var(--surface); border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; font-weight: 600; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: none; }
table.detail { width: 100%; }
.prose table { border: 1px solid var(--rule); margin: 0.8rem 0; }

/* vertical column headers for property columns */
th.vh { padding: 0.4rem 0.2rem; text-align: center; vertical-align: bottom; }
th.vh > span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; font-weight: 600; }
th.vh a { text-decoration: none; }

.res { font-weight: 600; color: var(--fg); }
.res-refuted { color: var(--muted); }
.req { color: var(--muted); font-size: 0.9em; }

/* the matrix (grid) */
table.matrix th[scope="row"] { position: sticky; left: 0; background: var(--bg); z-index: 1; white-space: nowrap;
  box-shadow: 1px 0 0 var(--rule); }
table.matrix thead th.corner { position: sticky; left: 0; z-index: 2; text-align: left; vertical-align: bottom; }
table.matrix td.cell { text-align: center; padding: 0; white-space: nowrap; border-left: 1px solid var(--rule); }
table.matrix td.cell a { display: block; padding: 0.35rem 0.45rem; text-decoration: none; color: var(--fg); }
table.matrix td.cell a:hover { background: var(--surface-2); }
table.matrix td.v-false a { color: var(--false); }
/* the full grid: long space names wrap; the header row and the space column stay in view while the
   table scrolls inside its own box */
table.matrix th[scope="row"] { white-space: normal; min-width: 9rem; max-width: 17rem; }
.matrix-scroll { max-height: calc(100vh - 4rem); overflow: auto; }
.matrix-scroll table.matrix thead { position: sticky; top: 0; z-index: 3; background: var(--surface);
  box-shadow: 0 1px 0 var(--rule-strong); }
.matrix-scroll table.matrix thead tr { background: var(--surface); }
.matrix-scroll table.matrix thead th { background: var(--surface); }
.matrix-scroll table.matrix thead th.corner { background: var(--surface); z-index: 4; }
table.matrix colgroup.col-group { border-left: 2px solid var(--rule-strong); }
table.matrix tr.groups th.group { text-align: center; vertical-align: bottom; font-weight: 600; font-size: 0.8rem;
  white-space: normal; line-height: 1.25; padding: 0.35rem 0.3rem; border-left: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule); }
table.matrix tr.groups th.group a { text-decoration: none; }

/* the grid page: compact cells (the value in words for screen readers, the mark drawn here, with
   an empty text alternative where the browser supports one), foldable column groups, filters */
table.grid td { text-align: center; padding: 0; white-space: nowrap; border-left: 1px solid var(--rule); }
table.grid td a { display: block; padding: 0.35rem 0.45rem; text-decoration: none; color: var(--fg); }
table.grid td a:hover, table.grid td a:focus-visible { background: var(--surface-2); }
table.grid td i { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
table.grid td a::before { font-family: var(--sans); }
table.grid td.t a::before { content: "✓"; content: "✓" / ""; }
table.grid td.f a { color: var(--false); }
table.grid td.f a::before { content: "✗"; content: "✗" / ""; }
table.grid td.i a::before { content: "⊥"; content: "⊥" / ""; font-weight: 600; }
table.grid td.u a::before { content: "?"; content: "?" / ""; font-weight: 600; }
table.grid tr.groups th.group { position: relative; padding-right: 1.3rem; }
.group-toggle { position: absolute; right: 0.15rem; bottom: 0.25rem; border: 1px solid var(--rule-strong);
  background: var(--bg); color: var(--fg); border-radius: 3px; font: inherit; line-height: 1; padding: 0 0.25rem;
  cursor: pointer; }
table.grid tr.groups th.group.folded { padding-right: 1.3rem; }
table.grid tr.groups th.group.folded .group-name { display: none; }
table.grid .stub > * { visibility: hidden; }
table.grid .stub { min-width: 0.9rem; background: var(--surface); }
table.grid td.stub a { padding: 0.35rem 0.1rem; }
.grid-tools { font-family: var(--sans); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  align-items: flex-end; margin: 1rem 0 0.5rem; max-width: var(--wide); }
.grid-filter { min-width: 14rem; flex: 1 1 14rem; max-width: 22rem; }
.grid-filter label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.grid-filter input { width: 100%; background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 4px;
  padding: 0.3rem 0.5rem; font: inherit; color: var(--fg); }
.grid-conds { border: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.grid-conds legend { font-weight: 600; padding: 0; margin-bottom: 0.2rem; }
.grid-cond select { font: inherit; max-width: 14rem; }
.grid-tools .filter-count { flex-basis: 100%; }

ul.sources { font-family: var(--sans); font-size: 0.92rem; }
ul.premises { font-family: var(--sans); font-size: 0.95rem; }
ul.theorems li { margin: 0.3rem 0; }

/* ----- per-value sections on a space page */

.cell-detail, .result-detail { border-top: 1px solid var(--rule); margin-top: 1.2rem; padding-top: 0.2rem; scroll-margin-top: 1rem; }
.cell-detail:target, .result-detail:target { background: linear-gradient(to right, var(--target), transparent 60%); }
.cell-detail h3 .val { font-size: 0.8em; font-weight: 500; margin-left: 0.3em; }
.how { font-family: var(--sans); font-size: 0.95rem; }

/* ----- filters and the decide control (shown by site.js) */

.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: flex-start; font-family: var(--sans);
  font-size: 0.9rem; max-width: var(--wide); margin: 1rem 0 0.4rem; }
.filters fieldset { border: 1px solid var(--rule); border-radius: 4px; padding: 0.3rem 0.7rem 0.5rem; margin: 0; }
.filters legend { font-weight: 600; padding: 0 0.3rem; }
.filters label { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0.15rem 0.8rem 0.15rem 0; }
.f-props { display: flex; flex-wrap: wrap; }
.f-props label { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.f-props label > span { font-size: 0.85em; color: var(--muted); }
select, input, button { font: inherit; color: inherit; }
select { background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 0.1rem 0.3rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; margin: 0; }
.count { flex-basis: 100%; margin: 0; color: var(--muted); }

.decide { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 0.3rem 1rem 0.8rem;
  margin: 1rem 0; max-width: var(--wide); }
.decide h3 { margin-top: 0.6rem; }
.decide p { margin: 0.3rem 0; }
.toggles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; font-family: var(--sans); font-size: 0.92rem; }
.toggle { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 0.25rem 0.7rem; background: var(--bg); cursor: pointer; }
.toggle:has(input:checked) { border-color: var(--accent); }
.toggle-state { font-size: 0.85em; color: var(--muted); min-width: 2.6em; }
.decide-out { font-size: 1.02rem; min-height: 1.6em; }
.decide-out code { font-size: 0.95em; margin-right: 0.4em; }

/* ----- a study's combinations: impossible ones, those that occur, open ones */

.study section > p, .study .legend { max-width: var(--measure); }
ul.imp-list, ul.occ-list, ul.open-list { list-style: none; padding: 0; margin: 0.6rem 0 1rem; max-width: var(--wide); }
ul.imp-list li { margin: 0; padding: 0.4rem 0.2rem 0.4rem 0.8rem; border-left: 3px solid var(--rule-strong);
  margin-bottom: 0.35rem; scroll-margin-top: 1rem; }
ul.imp-list .combo, ul.open-list .combo { font-weight: 600; }
ol.chain { margin: 0.2rem 0 0; padding-left: 1.6rem; }
ol.chain li { margin: 0.1rem 0; }
ul.occ-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 0.4rem 0.8rem; }
ul.occ-list > li { margin: 0; padding: 0.35rem 0.7rem 0.45rem; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--bg); scroll-margin-top: 1rem; min-width: 0; }
ul.occ-list > li[hidden] { display: none; }
ul.occ-list p { margin: 0; max-width: none; }
.example { font-size: 1rem; }
.combo-values { font-family: var(--sans); font-size: 0.85rem; line-height: 1.45; margin-top: 0.15rem !important; }
.combo-values .has, .combo-values .lacks { display: block; }
.combo-values .lacks { color: var(--false); }
.combo-values .sign { display: inline-block; width: 1.1em; font-weight: 700; }
h3.occ-group, h4.occ-group { font-family: var(--sans); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 600; margin: 1.1rem 0 0.2rem; }
ul.open-list > li { border-left: 3px dashed var(--rule-strong); padding: 0.2rem 0 0.2rem 0.8rem; margin-bottom: 0.6rem; }
ul.open-list p { margin: 0.2rem 0; }
ul.open-list li.open-row { font-family: var(--sans); font-size: 0.9rem; }
li:target, ul.occ-list > li:target { background: var(--target); }
details.uses-list summary { cursor: pointer; font-family: var(--sans); font-size: 0.92rem; color: var(--accent); }
ul.imp-list.results p { margin: 0.1rem 0; }
ul.imp-list ol.chain li { border: none; padding: 0; margin: 0.1rem 0; }
ul.imp-list.results .result-so { color: var(--muted); font-size: 0.95rem; }

/* ----- a study's properties by strength: the diagram of implications (inline SVG; dag.py) */

section.hierarchy > p { max-width: var(--measure); }
figure.dag { margin: 0.8rem 0 0.6rem; }
/* the diagram keeps at least three quarters of its size (its text stays legible); narrower
   screens scroll it sideways inside its own box */
.dag-scroll { overflow-x: auto; max-width: 100%; }
svg.dag-svg { display: block; width: 100%; height: auto; max-width: var(--dag-w); min-width: calc(var(--dag-w) * 0.75);
  font-family: var(--sans); font-size: 14px; }
.dag-node rect { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 1; }
.dag-node text { fill: var(--fg); }
.dag-node.dag-isolated rect { stroke-dasharray: 4 3; }
a.dag-node:hover rect, a.dag-node:focus-visible rect { fill: var(--surface-2); stroke: var(--accent); stroke-width: 2; }
a.dag-node:hover text { fill: var(--accent); }
.dag-edge .dag-line { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.dag-edge .dag-head { fill: var(--muted); }
.dag-edge .dag-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.dag-edge.dag-chain .dag-line { stroke-dasharray: 5 4; }
.dag-edge.dag-pending { opacity: 0.55; }
a.dag-edge:hover .dag-line, a.dag-edge:focus-visible .dag-line { stroke: var(--accent); stroke-width: 2.6; }
a.dag-edge:hover .dag-head, a.dag-edge:focus-visible .dag-head { fill: var(--accent); }
a.dag-edge:focus-visible .dag-hit { stroke: var(--focus); stroke-opacity: 0.35; }
svg.dag-svg a:focus-visible { outline: none; }
.dag-note { font-size: 0.95rem; }
details.dag-list summary { cursor: pointer; font-family: var(--sans); font-size: 0.92rem; color: var(--accent); }
details.dag-list ul.imp-list { margin-top: 0.4rem; }

/* ----- the front page */

.hero h1 { font-size: 2.4rem; margin-bottom: 0.4rem; }
.lede { font-size: 1.15rem; max-width: var(--measure); }
.lede p { margin: 0.5rem 0; }
.hero .credit { max-width: var(--measure); margin: 0.5rem 0 0.8rem; }
ul.stats { list-style: none; padding: 0; margin: 1.2rem 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: var(--wide);
  font-family: var(--sans); font-size: 0.92rem; }
ul.stats li { margin: 0; }
ul.stats a { display: block; padding: 0.35rem 0.8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface);
  text-decoration: none; color: var(--fg); }
ul.stats a:hover { border-color: var(--accent); }
ul.stats strong { font-size: 1.05em; }
ul.pillar-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.8rem 1.4rem; max-width: var(--wide); margin: 0.8rem 0; }
ul.pillar-list li { margin: 0; }
ul.pillar-list p { margin: 0.2rem 0; font-size: 0.98rem; }
.pillar-title { font-weight: 600; font-size: 1.05rem !important; }
.lineage { color: var(--muted); font-size: 0.98rem; }
ul.cards, ul.study-cards, ol.study-overview { list-style: none; padding: 0; display: grid; gap: 0.7rem; max-width: var(--wide); margin: 0.8rem 0; }
ul.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
ul.study-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.card, .study-card { position: relative; margin: 0; padding: 0.75rem 1rem 0.8rem; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--surface); }
.card:hover, ul.study-cards .study-card:hover { border-color: var(--accent); }
.card p, .study-card p { margin: 0.3rem 0 0; font-size: 0.95rem; }
.card-link { font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.card-link:visited { color: var(--accent); }
/* the whole card is the link's target area; the link text alone is its name */
.card .card-link::after, ul.study-cards .card-link::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.card:focus-within, ul.study-cards .study-card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card .card-link:focus-visible, ul.study-cards .card-link:focus-visible { outline: none; }
.study-props { font-family: var(--sans); font-size: 0.85rem !important; color: var(--muted); }
.study-count { font-family: var(--sans); font-size: 0.88rem !important; }
ul.featured-list { padding: 0; list-style: none; max-width: var(--measure); }
ul.featured-list li { margin: 0 0 1rem; padding-left: 0.9rem; border-left: 3px solid var(--rule-strong); }
ul.featured-list a { font-weight: 600; }
ul.featured-list p { margin: 0.15rem 0 0; }
ol.study-overview h2 { border: none; margin: 0; padding: 0; font-size: 1.2rem; }
.study-links { font-family: var(--sans); font-size: 0.9rem !important; }
.study-card { scroll-margin-top: 1rem; }

/* ----- non-verified states and drafts */

.nv { font-family: var(--sans); color: var(--muted); font-style: italic; }
.nv-mark { font-style: normal; display: inline-block; min-width: 1em; text-align: center; color: var(--muted); }
.awaiting { color: var(--muted); font-size: 0.9em; }
.nv-legend { font-size: 0.85rem; }
.draft-label { font-family: var(--sans); font-size: 0.78em; border: 1px dashed var(--rule-strong); border-radius: 3px;
  padding: 0 0.3em; margin-left: 0.4em; color: var(--muted); white-space: nowrap; }
.drafts-banner { background: var(--target); border-bottom: 2px dashed var(--rule-strong); padding: 0.6rem 1.25rem;
  font-family: var(--sans); text-align: center; }
.excluded-ref { color: var(--muted); }

/* ----- errata */

.erratum { border-top: 1px solid var(--rule); margin-top: 1rem; }
details.open-ex { margin: 0.3rem 0; font-family: var(--sans); font-size: 0.92rem; }
details.open-ex summary { cursor: pointer; padding: 0.2rem 0; }

/* ----- "See it in Lean", facts and references */

.see-lean { font-family: var(--sans); font-size: 0.85rem; white-space: nowrap; }
.see-lean::after { content: " →"; }
.see-lean-group { font-family: var(--sans); font-size: 0.85rem; }
.see-lean-group .see-lean::after { content: ""; }
.see-lean-line { margin: 0.2rem 0 1rem; }
ul.facts-list { font-family: var(--sans); font-size: 0.95rem; }
.references { margin-top: 2.5rem; }
ul.refs { font-size: 0.95rem; padding-left: 1.2rem; }
.ref-note { color: var(--muted); }
.proof-refs { font-size: 0.9rem; color: var(--muted); }
.proof-refs .refs-label { margin: 0.6rem 0 0; font-family: var(--sans); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.proof-refs ul.refs { margin-top: 0.2rem; }

/* ----- the Lean library pages */

pre.lean { font-family: var(--mono); font-size: 0.84rem; line-height: 1.45; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.8rem; margin: 0.5rem 0;
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: var(--wide); }
pre.lean code { font-size: 1em; }
pre.lean a { text-decoration: none; }
pre.lean a:hover { text-decoration: underline; }
pre.lean-statement { font-size: 0.9rem; border-left: 3px solid var(--accent); }
pre.lean-context { color: var(--muted); background: transparent; font-size: 0.8rem; }
.lk { font-weight: 600; }
.lc { color: var(--muted); font-style: italic; }
.ls { color: var(--accent-visited); }
.ln, .lo { color: var(--muted); }
.lean-decl { border-top: 1px solid var(--rule); margin-top: 1.4rem; padding-top: 0.2rem; scroll-margin-top: 1rem; }
.lean-decl:target { background: linear-gradient(to right, var(--target), transparent 60%); }
.decl-head { font-size: 1.05rem; margin: 0.8rem 0 0.2rem; }
.decl-head code { font-size: 0.92em; overflow-wrap: anywhere; }
.decl-kind { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.decl-fullname { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.decl-doc p { margin: 0.4rem 0; }
.decl-uses { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
details.lean-proof summary, details.lean-imports summary { cursor: pointer; font-family: var(--sans); font-size: 0.85rem; color: var(--accent); }
.lean-modname { font-family: var(--mono); font-size: 0.8rem; overflow-wrap: anywhere; }
.kind .lean-modname { text-transform: none; letter-spacing: 0; }
ul.lean-modules li { margin: 0.5rem 0; }
.lean-summary { font-size: 0.95rem; }

/* ----- small screens */

/* narrow screens: the sidebar folds away behind the Menu button (or, without a script, the link to
   it, the menu showing itself as the link's target), and opens over the page under the header */
@media (max-width: 56rem) {
  .layout { display: block; }
  .menu-button, .menu-link { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--sans); font-size: 0.95rem;
    padding: 0.3rem 0.75rem; border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--bg); color: var(--fg);
    text-decoration: none; cursor: pointer; }
  .menu-link:visited { color: var(--fg); }
  .menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 1rem; height: 2px; background: currentColor; border-radius: 1px; }
  .menu-icon { position: relative; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
  .menu-icon::before { top: -5px; }
  .menu-icon::after { top: 5px; }
  .menu-button[aria-expanded="true"] .menu-icon { background: transparent; }
  .menu-button[aria-expanded="true"] .menu-icon::before { top: 0; transform: rotate(45deg); }
  .menu-button[aria-expanded="true"] .menu-icon::after { top: 0; transform: rotate(-45deg); }
  .site-nav { display: none; position: absolute; left: 0; right: 0; z-index: 20; max-height: none; border-right: none;
    border-bottom: 1px solid var(--rule-strong); background: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 1rem 1.25rem 1.2rem; }
  html.js .site-nav.open, html:not(.js) .site-nav:target { display: block; }
  .layout { position: relative; }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  main { padding: 1rem 0.85rem 2.5rem; }
  .site-header { padding: 0.45rem 0.85rem; }
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.9rem; }
  h2 { font-size: 1.25rem; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd { margin-bottom: 0.5rem; }
  table.matrix th[scope="row"] { min-width: 7rem; max-width: 9rem; font-size: 0.82rem; }
  table.matrix td.cell a { padding: 0.3rem 0.3rem; }
  th, td { padding: 0.3rem 0.4rem; }
  .filters fieldset { width: 100%; }
  .toggle { padding: 0.2rem 0.55rem; }
}

/* families of spaces: the family page's members, and their rows in the grid */
section.member { border-top: 2px solid var(--rule-strong); margin-top: 2.5rem; padding-top: 0.5rem; }
.family-members tr.differs th, .family-members tr.differs td { background: var(--surface-2); }
.differs-mark, .witness-only { font-family: var(--sans); font-size: 0.8em; color: var(--muted); }
table.matrix tr.family-row th { text-align: left; font-family: var(--sans); font-size: 0.85rem;
  background: var(--surface-2); padding-top: 0.35rem; }
table.matrix tr.member-row th[scope="row"] { padding-left: 1.25rem; }
/* the end of a family's block of rows: a rule beneath its last member, so the next space is not read as one */
table.matrix tr.family-end > th, table.matrix tr.family-end > td { border-bottom: 2px solid var(--rule-strong); }
table.matrix tr.family-row th .family-label { position: sticky; left: 0.4rem; }
/* groups of the grid's rows (content/space-groups.yaml): a heading row each, foldable */
table.matrix tr.space-group-row th { text-align: left; font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  background: var(--surface); border-top: 2px solid var(--rule-strong); padding: 0.45rem 0.4rem 0.3rem; }
table.matrix tr.space-group-row th .space-group-label { position: sticky; left: 0.4rem; display: inline-flex;
  align-items: baseline; gap: 0.4rem; }
.row-group-toggle { border: 1px solid var(--rule-strong); background: var(--bg); color: var(--fg); border-radius: 3px;
  font: inherit; font-weight: normal; line-height: 1; padding: 0 0.25rem; cursor: pointer; }
table.grid tbody.folded > tr:not(.space-group-row) { display: none; }
ul.family-members { margin-top: 0.25rem; }
/* the spaces list: a family's members sit in a ruled block beneath it, closed by a gap before the next entry */
ul.item-list > li.family-entry { margin-bottom: 0.75rem; }
ul.item-list > li.family-entry > ul.family-members { border-left: 2px solid var(--rule-strong); padding-left: 0.9rem;
  margin-left: 0.2rem; list-style: none; }
/* a long page's contents (a family's page) */
nav.page-contents { border-left: 2px solid var(--rule-strong); padding: 0.1rem 0 0.1rem 0.9rem; margin: 1.5rem 0; }
nav.page-contents .page-contents-h { font-size: 1rem; margin: 0 0 0.3rem; }
nav.page-contents ul { margin: 0; padding-left: 1.1rem; }
/* a member's condition beneath its name (the members table's headers) or after it (the spaces list) */
table.family-members thead .member-condition { display: block; margin-top: 0.2rem; font-weight: normal;
  font-size: 0.85em; color: var(--muted); }
.member-condition { color: var(--muted); }

@media print {
  .site-header, .site-nav, .filters, .decide, .skip, .list-filter, .grid-tools, .group-toggle, .row-group-toggle, .prev-next { display: none !important; }
  .layout { display: block; }
  .table-scroll { overflow: visible; border: none; }
}
