/* rerum ∉ □♁ — "Rubric" theme */

@font-face { font-family: "STIX Two Text"; src: url("/assets/fonts/stix-two-text-normal-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("/assets/fonts/stix-two-text-italic-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/fonts/dm-mono-normal-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/fonts/dm-mono-normal-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
/* The site name, preloaded and tiny */
@font-face { font-family: "Wordmark"; src: url("/assets/fonts/wordmark.woff2") format("woff2"); font-display: block; }
/* Notation symbols — only fetched when a symbol appears */
@font-face {
  font-family: "Notation"; src: url("/assets/fonts/stix-two-math-notation.woff2") format("woff2"); font-display: swap;
  unicode-range: U+00A7, U+00B6, U+00D7, U+2190-21FF, U+2200-22FF, U+2300-23FF, U+25A0-25FF, U+2600-266F, U+27C0-27EF, U+2980-29FF;
}

:root {
  --bg: #121010; --rail: #0c0a0a; --surface: #1b1817; --plate: #1f1b19; --tile: #1a1615; --line: #2e2826; --rule: #4a413a;
  --ink: #efe8dc; --soft: #cbc2b4; --muted: #968c7f; --rubric: #ec6446;
  --serif: "STIX Two Text", Georgia, serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;
  --glyph: "Notation", "STIX Two Math", "STIX Two Text", serif;
  --measure: 680px; --margin: 250px; --gutter: 56px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #efe9dd; --rail: #e5ddcd; --surface: #f7f3ea; --plate: #e6dfd1; --tile: #e8e0d0; --line: #d2c8b5; --rule: #bdb2a0;
  --ink: #191512; --soft: #3d342c; --muted: #6b6052; --rubric: #b5301a;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.55; transition: background .3s, color .3s; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 3px; }
img, svg { max-width: 100%; height: auto; }

.g { font-family: var(--glyph); font-style: normal; }
.rub { color: var(--rubric); }
.ink { color: var(--ink); }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--ink); color: var(--bg); padding: 8px 12px; }
html:not(.js) .js-only { display: none !important; }

/* ---------- shell & rail ---------- */
.shell { display: grid; grid-template-columns: 92px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); border-right: 1px solid var(--line); padding: 32px 0 24px; }
.railin { position: sticky; top: 32px; display: flex; flex-direction: column; align-items: center; gap: 48px; }
.mark { text-decoration: none !important; }
.wordmark { display: block; font-family: "Wordmark", var(--glyph); font-size: 30px; line-height: 1; white-space: nowrap; color: var(--ink);
  writing-mode: vertical-rl; text-orientation: sideways; -webkit-text-orientation: sideways; transform: rotate(180deg); }
.wordmark-inline { font-family: "Wordmark", var(--glyph); }
.glyphs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-glyph, .tool { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 2px; font-size: 23px; color: var(--muted); text-decoration: none !important; background: transparent; border: 0; }
.rail-glyph:hover, .rail-glyph.on { color: var(--rubric); background: var(--surface); }
.tool { font-size: 21px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); }
.tool.sub { border: 0; color: var(--rubric); }
.nt-toggle[aria-pressed="true"] { background: var(--rubric); border-color: var(--rubric); color: var(--bg); }

.main { padding: 40px 72px 96px; max-width: 1280px; display: flex; flex-direction: column; gap: 64px; min-width: 0; }

/* ---------- top bar ---------- */
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 32px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.topbar a { color: var(--soft); }
.topbar .g { font-size: 15px; }
.topnav { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.topnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rubric); text-underline-offset: 5px; }

/* ---------- N.B. ---------- */
.nb { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px 24px; align-items: baseline; margin-top: -32px; }
.nb-mark { font-size: 30px; font-style: italic; color: var(--rubric); }
.nb p { margin: 0; max-width: 760px; font-size: 18px; line-height: 1.6; color: var(--soft); }
.nb a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rubric); text-underline-offset: 5px; }
.nb-x { width: 40px; height: 40px; background: none; border: 0; color: var(--muted); font-size: 20px; }
html.nb-off .nb { display: none; }

/* ---------- lead ---------- */
.lead { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; align-items: start; }
.lead-no { font-size: 132px; line-height: .82; color: var(--rubric); letter-spacing: -.04em; }
.lead-body { display: flex; flex-direction: column; gap: 20px; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lead-t { margin: 0; font-size: 68px; font-weight: 400; line-height: 1.02; letter-spacing: -.02em; max-width: 900px; }
.thesis { margin: 0; display: flex; gap: 14px; max-width: 760px; font-size: 22px; line-height: 1.5; color: var(--soft); }
.lead-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lead-meta .g { font-size: 17px; }
.read { min-height: 40px; display: inline-flex; align-items: center; color: var(--rubric); font-family: var(--serif); font-size: 18px; font-style: italic; text-decoration: underline; text-underline-offset: 5px; }

/* ---------- shelves ---------- */
.shelves { display: flex; flex-direction: column; gap: 18px; }
.shelves .label { margin: 0; }
.shelfgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.tile { display: flex; flex-direction: column; align-items: flex-start; height: 100%; min-height: 190px; padding: 22px 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none !important; }
.tile:hover { background: var(--tile); }
.tile-g { height: 72px; display: flex; align-items: center; font-size: 58px; line-height: 1; transition: transform .2s ease, color .2s; }
.tile:hover .tile-g { transform: translateY(-3px); color: var(--rubric); }
.tile-n { margin-top: 30px; font-size: 20px; line-height: 1.15; }
.tile-c { margin-top: auto; padding-top: 14px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- ledger ---------- */
.ledger { display: flex; flex-direction: column; }
.ledger-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; padding-bottom: 20px; }
.ledger-head h1, .ledger-head h2 { margin: 0; font-size: 40px; font-weight: 400; letter-spacing: -.01em; }
.row { display: grid; grid-template-columns: 52px 76px minmax(0, 1fr) 150px 96px; gap: 20px; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--line); text-decoration: none !important; }
.row:last-child { border-bottom: 1px solid var(--line); }
.row-g { font-size: 28px; line-height: 1; color: var(--soft); }
.row-no { font-family: var(--mono); font-size: 13px; color: var(--rubric); }
.row-main { display: flex; flex-direction: column; gap: 6px; }
.row-t { font-size: 25px; line-height: 1.2; }
.row:hover .row-t { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.row-s { font-size: 17px; line-height: 1.5; color: var(--muted); }
.row-x { font-family: var(--mono); font-size: 11.5px; color: var(--rubric); }
.row-f { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.row-f .g { font-size: 17px; color: var(--ink); }
.row-d { text-align: right; font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--muted); }
.empty { margin: 0; padding: 26px 0; border-top: 1px solid var(--line); font-size: 19px; font-style: italic; color: var(--muted); }

/* ---------- guide placeholder ---------- */
.guide { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px 48px; padding-top: 32px; }
.guide-t { margin: 0; font-size: 30px; font-weight: 400; font-style: italic; color: var(--rubric); }
.guide-box { display: flex; flex-direction: column; gap: 18px; padding: 28px 32px; border: 1px dashed var(--line); }
.guide-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 40px; }
.guide-slots li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; }
.slot { height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.slot-t { font-size: 17px; font-style: italic; color: var(--muted); }

/* ---------- essay ---------- */
.essay { display: flex; flex-direction: column; gap: 34px; max-width: calc(var(--measure) + var(--gutter) + var(--margin)); }
.essay-meta { max-width: var(--measure); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.essay-meta a { color: var(--soft); }
.essay-meta .g { font-size: 16px; }
.nt-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; background: transparent; border: 1px solid var(--rubric); border-radius: 999px; font-family: var(--mono); font-size: 11.5px; color: var(--rubric); }
.nt-pill .g { font-size: 15px; }
.nt-pill[aria-pressed="true"] { background: var(--rubric); color: var(--bg); }
.essay-head { max-width: var(--measure); display: flex; flex-direction: column; gap: 22px; padding-top: 24px; }
.essay-head h1 { margin: 0; font-size: 64px; font-weight: 400; line-height: 1.02; letter-spacing: -.02em; }
.footing { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.footing .g { font-size: 19px; margin-right: 4px; }

.prose { max-width: var(--measure); font-size: 21px; line-height: 1.68; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { margin: 1.6em 0 .6em; display: flex; align-items: baseline; gap: 18px; font-size: 30px; font-weight: 400; line-height: 1.2; }
.prose h3 { margin: 1.4em 0 .5em; font-size: 23px; font-weight: 400; font-style: italic; }
.secno { font-family: var(--mono); font-size: 14px; color: var(--rubric); }
.prose a { text-decoration: underline; text-decoration-color: var(--rubric); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.prose blockquote { margin: 0 0 1.4em; padding-left: 48px; color: var(--soft); font-style: italic; font-size: 20px; }
.prose blockquote p:last-child { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose hr { border: 0; text-align: center; margin: 2em 0; }
.prose hr::after { content: "⁂"; color: var(--rubric); font-size: 20px; }
.prose code { font-family: var(--mono); font-size: .8em; background: var(--surface); padding: 1px 5px; }

/* margin notes (from footnotes) */
.sn-ref { font-family: var(--mono); font-size: 11px; line-height: 0; color: var(--rubric); padding-left: 2px; vertical-align: super; }
.sidenote { float: right; clear: right; width: var(--margin); margin-right: calc(-1 * (var(--margin) + var(--gutter))); margin-top: .35em; margin-bottom: 1em; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.55; color: var(--soft); font-style: normal; font-family: var(--serif); }
.sn-n { font-family: var(--mono); font-size: 11px; color: var(--rubric); margin-right: 4px; }
.prose blockquote .sidenote { font-style: normal; }

/* hidden notation */
.nt { display: none; font-family: var(--mono); font-size: .66em; font-style: normal; letter-spacing: 0; color: var(--rubric); opacity: .78; padding: 0 .3em; }
.nt .g { font-size: 1.3em; }
html.show-nt .nt { display: inline; }

/* figures */
.prose figure { margin: 1.6em 0; }
.prose figure img { display: block; width: 100%; }
.prose figcaption { margin-top: 12px; font-size: 15.5px; line-height: 1.5; color: var(--muted); }
.figno { font-family: var(--mono); font-size: 11.5px; color: var(--rubric); margin-right: 6px; }
figure.fig:not(.plain):not(.map) img { background: var(--plate); padding: 18px; border: 1px solid var(--line); }
figure.wide { width: calc(100% + var(--gutter) + var(--margin)); max-width: none; }
figure.wide figcaption { max-width: var(--measure); }
figure.margin { float: right; clear: right; width: var(--margin); margin: .3em calc(-1 * (var(--margin) + var(--gutter))) 1em 0; }
figure.margin figcaption { font-size: 14px; }
figure.margin img { padding: 10px !important; }
:root:not([data-theme="light"]) figure.invert img { filter: invert(1) hue-rotate(180deg); background: transparent !important; }

/* maps */
.map-svg { display: block; width: 100%; height: auto; font-family: var(--serif); }
.m-box { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.m-root { stroke: var(--ink); }
.m-name { fill: var(--ink); font-size: 17px; }
.m-desc { fill: var(--muted); font-size: 13.5px; font-style: italic; }
.m-hold, .m-tent, .m-fail { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-hold, .m-tent { stroke: var(--soft); }
.m-tent { stroke-dasharray: 6 6; }
.m-fail { stroke: var(--rubric); }
.m-head { fill: var(--soft); }
.m-rule { stroke: var(--rule); stroke-width: 1.5; fill: none; }
.m-dot { fill: var(--ink); }
.m-dot-tent { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.m-dot-none { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }
.m-mask { fill: var(--bg); }
.m-glyph { fill: var(--rubric); font-family: var(--glyph); font-size: 24px; }
.m-label { fill: var(--soft); font-size: 14px; font-style: italic; }
.m-label-fail { fill: var(--rubric); }
.map-text { margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.map-text summary { cursor: pointer; }
.map-text ul { margin: 8px 0 0; padding-left: 1.2em; font-family: var(--serif); font-size: 15px; }

/* video (click to load) */
.video { margin: 1.6em 0; }
.yt-play { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; background: var(--plate); border: 1px solid var(--line); overflow: hidden; }
.yt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.yt-btn { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--bg); }
.yt-btn path { fill: var(--rubric); }
.yt-note { position: absolute; left: 14px; bottom: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--soft); background: var(--bg); padding: 2px 6px; }
.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }

.qed { max-width: var(--measure); margin: -1.2em 0 0; text-align: right; font-size: 21px; }

/* excerpt hand-off */
.continue { max-width: var(--measure); display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); }
.continue h2 { margin: 0; font-size: 26px; font-weight: 400; }
.continue p { margin: 0; font-size: 17.5px; color: var(--soft); }
.continue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.continue-actions a:not(.btn) { color: var(--muted); text-decoration: underline; text-underline-offset: 4px; font-size: 16px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 20px; background: var(--ink); color: var(--bg) !important; border-radius: 2px; text-decoration: none !important; }

.essay-foot { max-width: var(--measure); display: flex; flex-direction: column; gap: 28px; padding-top: 24px; }
.cite { margin: 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 16px; color: var(--soft); }
.cite .label { margin-right: 12px; font-size: 11px; }
.nearby { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.nearby a { display: flex; flex-direction: column; gap: 8px; font-size: 21px; line-height: 1.25; }
.nearby a.r { text-align: right; grid-column: 2; }
.nearby .label { text-transform: none; letter-spacing: 0; }

/* ---------- reading list ---------- */
.page-t { margin: 0; font-size: 64px; font-weight: 400; line-height: 1.02; letter-spacing: -.02em; }
.rl-head { display: flex; flex-direction: column; gap: 18px; margin-bottom: -16px; }
.rl-filters { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rl-kind { min-height: 40px; padding: 0; background: none; border: 0; font-size: 18px; color: var(--muted); }
.rl-kind .n { font-family: var(--mono); font-size: 11px; }
.rl-kind[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rubric); text-underline-offset: 6px; }
.rl-list { display: flex; flex-direction: column; margin-top: -32px; }
.rl-item { display: grid; grid-template-columns: 52px 110px minmax(0, 1fr) 150px 110px; gap: 20px; align-items: baseline; padding: 24px 0; border-bottom: 1px solid var(--line); }
.rl-item[hidden] { display: none; }
.rl-kindlabel { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rl-main { display: flex; flex-direction: column; gap: 6px; }
.rl-t { font-size: 23px; line-height: 1.25; }
.rl-t.book { font-style: italic; }
.rl-by { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.rl-note { margin: 4px 0 0; max-width: 640px; font-size: 17px; color: var(--soft); }
.rl-cited { display: flex; flex-direction: column; font-family: var(--mono); font-size: 12px; }
.rl-cited a { color: var(--rubric); }
.rl-go { justify-self: end; font-family: var(--mono); font-size: 12px; }

.page { display: flex; flex-direction: column; gap: 32px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .sidenote, figure.margin { float: none; display: block; width: auto; margin: .6em 0 1em 1.2em; }
  figure.wide { width: 100%; }
  .shelfgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .guide { grid-template-columns: 1fr; }
  .guide-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rl-item { grid-template-columns: 40px minmax(0, 1fr); }
  .rl-kindlabel, .rl-cited, .rl-go { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .shell { grid-template-columns: 1fr; }
  .rail { padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .railin { position: static; flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
  .wordmark { writing-mode: horizontal-tb; transform: none; font-size: 24px; }
  .glyphs { flex-direction: row; }
  .glyphs:not(.tools) { order: 3; width: 100%; justify-content: space-between; }
  .main { padding: 24px 20px 64px; gap: 48px; }
  .lead { grid-template-columns: 1fr; gap: 12px; }
  .lead-no { font-size: 72px; }
  .lead-t, .essay-head h1, .page-t { font-size: 40px; }
  .shelfgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 36px minmax(0, 1fr); }
  .row-no, .row-f, .row-d { display: none; }
  .prose { font-size: 19px; }
  .guide-slots { grid-template-columns: 1fr; }
  .nb { grid-template-columns: 1fr auto; }
  .nb-mark { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
