/* Tokens. The default is the black sky the whole Sanctum is drawn on (site/public/sky.css);
   data-theme="light" on <html> opts the reader into its parchment reading mode. */
:root {
  --bg: #0B0D12;
  --bg-2: #141821;
  --card: #161B25;
  --fg: #E6DFCF;
  --muted: #8A857A;
  --line: #2A2F3B;
  --accent: #A82A20;
  --accent-2: #7A1A14;
  --link: #D9CFBE;
  --yug: #CF5547;
  --yug-bg: #1A1F2A;
  --focus: #C4473A;
  --glossed: #7fcbc4;
  --corroborated: #8fd1c6;
  --provisional: #e0bd62;
  --reconstructed: #9fb3e8;
  --coined: #d3a1dc;
  --enochian: #e2a27d;
  --productive: #94d3ad;
  --siglum: #aaa;
  --gap: #ff9b8a;
  --gap-bg: #3a2320;
  --ok-bg: #203126;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3eee4; --bg-2: #ebe4d6; --card: #fbf8f1; --fg: #1f1b16; --muted: #6c6457; --line: #d8cfbf;
  --accent: #7a2e1d; --accent-2: #a2522f; --link: #5a3a1e; --yug: #4a1f14; --yug-bg: #f1e6d8; --focus: #c47a3a;
  --glossed: #1f5f5b; --corroborated: #2f6b63; --provisional: #8a6a1c; --reconstructed: #3d4f7a; --coined: #6b3d73;
  --enochian: #8a4b2a; --productive: #3a6d4f; --siglum: #666; --gap: #9b2b1f; --gap-bg: #f6ddd7; --ok-bg: #e3eee4;
  --shadow: 0 1px 2px rgba(40, 30, 10, .08), 0 6px 20px rgba(40, 30, 10, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: .92em; }
code { background: var(--yug-bg); padding: .05em .3em; border-radius: 3px; }
pre { background: var(--bg-2); border: 1px solid var(--line); padding: .8em 1em; overflow-x: auto; border-radius: 6px; }
pre code { background: none; padding: 0; }
code.yug { color: var(--yug); }
code.yug.link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -.005em; }
h1 { font-size: 2rem; margin: .2em 0 .5em; }
h2 { font-size: 1.45rem; margin: 1.6em 0 .5em; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .4em; }
h4 { font-size: 1rem; margin: 1.2em 0 .3em; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--sans); font-size: .78rem; }
p { margin: .7em 0; }
blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--line); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95em; }
th, td { text-align: left; vertical-align: top; padding: .45em .6em; border-bottom: 1px solid var(--line); }
th { font-family: var(--sans); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr:hover td { background: color-mix(in srgb, var(--card) 60%, var(--bg-2)); }
ul, ol { padding-left: 1.4em; }
li { margin: .25em 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sans { font-family: var(--sans); }
.muted { color: var(--muted); }
.small { font-size: .9em; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: .6rem 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; color: var(--accent); text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; font-family: var(--sans); font-size: .9rem; }
.nav a { padding: .3rem .6rem; border-radius: 5px; text-decoration: none; color: var(--fg); }
.nav a:hover { background: var(--bg-2); }
.nav a.active { background: var(--accent); color: #fff; }

.page { max-width: 1100px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
.foot { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 2rem; color: var(--muted); font-size: .85em; font-family: var(--sans); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.card h3 { margin-top: .2em; }
.card a.block { text-decoration: none; color: inherit; display: block; }
.card a.block:hover h3 { color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; }
.tile .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.tile .l { font-family: var(--sans); font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }
.lede { font-size: 1.15rem; color: var(--fg); max-width: 60ch; }
.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: 2.6rem; margin-bottom: .2em; }
.hero .sub { color: var(--muted); font-size: 1.05rem; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.search { flex: 1 1 260px; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-family: var(--sans); font-size: .95rem; }
.search:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { font-family: var(--sans); font-size: .78rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.count { font-family: var(--sans); font-size: .85rem; color: var(--muted); }

.badge { display: inline-block; font-family: var(--sans); font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: .15em .5em; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.badge.Glossed { color: var(--glossed); }
.badge.Corroborated { color: var(--corroborated); }
.badge.Provisional { color: var(--provisional); }
.badge.Reconstructed { color: var(--reconstructed); }
.badge.Coined { color: var(--coined); }
.badge.Enochian { color: var(--enochian); }
.badge.Productive { color: var(--productive); }
.badge.Siglum, .badge.Once { color: var(--siglum); }
.badge.Gap { color: var(--gap); }
.badge.Evidence { color: var(--corroborated); background: color-mix(in srgb, var(--corroborated) 10%, transparent); }
.badge.Conlang { color: var(--reconstructed); background: color-mix(in srgb, var(--reconstructed) 10%, transparent); }

a.form, .form { font-family: var(--mono); color: var(--yug); font-weight: 600; text-decoration: none; }
a.form:hover { text-decoration: underline; }
.entry-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.entry-head h1 { font-family: var(--mono); color: var(--yug); font-size: 2.4rem; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 1rem 0; align-items: baseline; }
.kv dt { font-family: var(--sans); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: .25em; }
.kv dd { margin: 0; }
.once-list { columns: 3; column-gap: 2rem; font-size: .92em; }
.once-list div { break-inside: avoid; padding: .1em 0; }
@media (max-width: 760px) { .once-list { columns: 1; } }

.layout { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; }
.toc { position: sticky; top: 4rem; max-height: calc(100vh - 5rem); overflow: auto; font-family: var(--sans); font-size: .85rem; padding-right: .5rem; }
.toc a { display: block; padding: .18rem 0; text-decoration: none; color: var(--fg); }
.toc a.sub { padding-left: .9rem; color: var(--muted); font-size: .8rem; }
.toc a:hover, .toc a.active { color: var(--accent); }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .toc { position: static; max-height: none; border-bottom: 1px solid var(--line); padding-bottom: .8rem; } }
.prose { max-width: 76ch; }
.prose table { display: block; overflow-x: auto; }
.prose h2:first-child { margin-top: .4em; }

.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 1rem 0 1.2rem; font-family: var(--sans); font-size: .9rem; }
.tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

.block { border-left: 3px solid var(--line); padding: .3rem 1rem; margin: 1.2rem 0; scroll-margin-top: 5rem; }
.block.hit { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.block .id { font-family: var(--sans); font-size: .78rem; color: var(--muted); display: flex; gap: .8rem; flex-wrap: wrap; }
.block .id b { color: var(--accent); }
.block .y { font-family: var(--mono); color: var(--yug); font-size: 1.02em; margin: .4rem 0 .2rem; line-height: 1.5; }
.block .e { margin: 0 0 .3rem; }
.block .extra { font-size: .92em; color: var(--muted); }
.rubric { color: var(--muted); font-style: italic; margin: 1rem 0; font-size: .95em; }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; padding: 0 .1em; border-radius: 2px; }

textarea.input { width: 100%; min-height: 110px; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); resize: vertical; line-height: 1.5; }
textarea.input:focus, input.key:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn { font-family: var(--sans); font-size: .92rem; font-weight: 600; padding: .55rem 1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
select, input.key { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-family: var(--sans); font-size: .9rem; }
input.key { flex: 1 1 260px; font-family: var(--mono); }
.result { margin-top: 1.5rem; }
.result .line { font-family: var(--mono); font-size: 1.35rem; color: var(--yug); line-height: 1.5; padding: 1rem 1.2rem; background: var(--yug-bg); border-radius: 8px; border: 1px solid var(--line); overflow-wrap: anywhere; }
.tokens { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; align-items: flex-end; }
.tok { display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; padding: .3rem .55rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); min-width: 2.2rem; text-decoration: none; color: inherit; }
.tok .y { font-family: var(--mono); font-weight: 600; color: var(--yug); }
.tok .en { font-family: var(--sans); font-size: .7rem; color: var(--muted); }
.tok.attested { border-color: var(--corroborated); }
.tok.reconstructed { border-color: var(--reconstructed); }
.tok.coined { border-color: var(--coined); }
.tok.enochian { border-color: var(--enochian); }
.tok.gap { border-color: var(--gap); background: var(--gap-bg); }
.tok.gap .y { color: var(--gap); }
.tok.dropped { opacity: .55; border-style: dashed; }
.tok.dropped .y { text-decoration: line-through; font-weight: 400; }
.tok.punct { border: 0; background: none; min-width: 0; padding: .3rem .1rem; }
.tok[title] { cursor: help; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-family: var(--sans); font-size: .78rem; color: var(--muted); margin: .4rem 0 1rem; }
.legend i { display: inline-block; width: .8em; height: .8em; border-radius: 3px; border: 2px solid; vertical-align: -1px; margin-right: .3em; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg-2); margin: .5rem 0; }
.bar span { display: block; height: 100%; }
.bar .attested { background: var(--corroborated); }
.bar .reconstructed { background: var(--reconstructed); }
.bar .coined { background: var(--coined); }
.bar .enochian { background: var(--enochian); }
.bar .gaps { background: var(--gap); }
.gaplist li { margin: .5em 0; }
.gaplist b { color: var(--gap); }
.notice { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: .8rem 1rem; font-size: .95em; margin: 1rem 0; }
.notice.warn { border-color: var(--gap); background: var(--gap-bg); }
.notice.ok { background: var(--ok-bg); }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: .4em; }
@keyframes spin { to { transform: rotate(360deg); } }
details { margin: .8rem 0; }
summary { cursor: pointer; font-family: var(--sans); font-size: .9rem; color: var(--muted); }
.cite { font-family: var(--sans); font-size: .85em; }
.cite code { background: none; padding: 0; color: var(--link); }
.hands table td:first-child { white-space: nowrap; }
.rounds li { margin: .35em 0; }
.unverified { color: var(--gap); font-weight: 600; }
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 2rem; }
  .entry-head h1 { font-size: 1.8rem; }
  .result .line { font-size: 1.1rem; }
  table { font-size: .88em; }
  th, td { padding: .35em .4em; }
}

/* Simple forms: sign-in, access request */
.stack { display: grid; gap: .6rem; max-width: 28rem; }
.stack label { font-family: var(--sans); font-size: .9rem; color: var(--muted); }
.stack input, .stack textarea { font: inherit; padding: .5em .7em; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); }
.stack input:focus, .stack textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.stack button, a.button { font: inherit; font-family: var(--sans); padding: .5em 1em; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; justify-self: start; text-decoration: none; }
.stack button[disabled] { opacity: .6; cursor: wait; }
.stack textarea { resize: vertical; }
.stack .check { display: flex; gap: .5em; align-items: flex-start; font-family: var(--sans); font-size: .95rem; color: var(--fg); }
.stack .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.stack button.quiet, table.admin button.quiet { background: transparent; color: var(--accent); }
table.admin td.statement { white-space: pre-wrap; max-width: 36rem; font-size: .95em; }
table.admin td.actions { white-space: nowrap; }
table.admin button { font: inherit; font-family: var(--sans); font-size: .9rem; padding: .3em .8em; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
table.admin button[disabled] { opacity: .5; cursor: wait; }

/* ------------------------------------------------------------------ print preview */
/* Fonts are self-hosted and only fetched when a print page uses them. */
@font-face { font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/fell-regular.woff2) format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/fell-italic.woff2) format("woff2"); }
@font-face { font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/fell-sc.woff2) format("woff2"); }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/cinzel-600.woff2) format("woff2"); }

body[data-route="print"] .page { max-width: none; padding: 0; }
body[data-route="print"] .foot { display: none; }

.pp {
  --ui-bg: #0B0D12; --ui-bg-2: #141821; --ui-card: #161B25; --ui-line: #2A2F3B;
  --ui-fg: #E6DFCF; --ui-muted: #7F7B72; --ui-accent: #C4473A; --ui-accent-2: #7A1A14; --ui-warn: #E0A24A;
  --pp-paper: #ece2cc; --pp-ink: #1d1712; --pp-rubric: #8e1f14;
  --pp-ink-2: color-mix(in srgb, var(--pp-ink) 62%, var(--pp-paper));
  --pp-w: 6in; --pp-h: 9in; --pp-m: .7in; --pp-yug: 12.5pt; --pp-eng: 11.5pt; --pp-lead: 1.4;
  --pp-book: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --pp-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --pp-display: "Cinzel", "Trajan Pro", Georgia, serif;
  display: grid; grid-template-columns: 290px 1fr; grid-template-rows: auto 1fr;
  min-height: calc(100vh - 56px); background: var(--ui-bg); color: var(--ui-fg); font-family: var(--sans);
}
.pp-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--ui-line); background: linear-gradient(180deg, #0B0D12, var(--ui-bg)); }
.pp-back { color: var(--ui-accent); text-decoration: none; font-weight: 600; }
.pp-back:hover { color: var(--ui-accent); text-shadow: 0 0 8px rgba(196,71,58,.5); }
.pp-crumb { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ui-muted); }
.pp-sp { flex: 1; }
.pp-btn { font: 600 13px var(--sans); letter-spacing: .04em; color: #F3ECDD; background: var(--ui-accent); border: 0; padding: 9px 16px; cursor: pointer; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.pp-btn:hover { box-shadow: 0 0 18px rgba(196,71,58,.5); }
.pp-btn.pp-ghost { background: transparent; color: var(--ui-accent); outline: 1px solid var(--ui-accent); outline-offset: -1px; }
.pp-btn:focus-visible, .pp-seg button:focus-visible, .pp-side input:focus-visible, .pp-reset:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }

.pp-side { border-right: 1px solid var(--ui-line); padding: 16px 18px 40px; background: var(--ui-bg-2); overflow: auto; font-size: 13px; }
.pp-side h3 { font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ui-muted); margin: 22px 0 10px; border: 0; padding: 0; }
.pp-side h3:first-child { margin-top: 4px; }
.pp-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-seg button { flex: 1 1 0; min-width: 0; font: 500 12px var(--sans); color: var(--ui-fg); background: var(--ui-card); border: 1px solid var(--ui-line); padding: 8px 4px; cursor: pointer; clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px); }
.pp-seg[data-key="trim"] button { flex: 1 1 30%; }
.pp-seg button[aria-pressed="true"] { border-color: var(--ui-accent); color: var(--ui-accent); box-shadow: inset 0 0 12px rgba(196,71,58,.12); }
.pp-dims { display: flex; gap: 10px; margin: 10px 0 4px; }
.pp-dims label { display: flex; align-items: center; gap: 6px; color: var(--ui-muted); font-family: var(--mono); font-size: 12px; }
.pp-dims input { width: 64px; background: var(--ui-card); color: var(--ui-fg); border: 1px solid var(--ui-line); padding: 5px 6px; font: 12px var(--mono); }
.pp-range { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; margin: 12px 0 0; align-items: center; }
.pp-range output { font: 12px var(--mono); color: var(--ui-accent); }
.pp-range input { grid-column: 1 / -1; width: 100%; accent-color: var(--ui-accent); }
.pp-colors { display: flex; gap: 10px; margin-top: 10px; }
.pp-color { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ui-muted); cursor: pointer; }
.pp-color input { appearance: none; -webkit-appearance: none; width: 44px; height: 28px; padding: 0; border: 1px solid var(--ui-line); background: none; cursor: pointer; }
.pp-color input::-webkit-color-swatch-wrapper { padding: 2px; }
.pp-color input::-webkit-color-swatch { border: 0; }
.pp-tog { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--ui-line); cursor: pointer; }
.pp-tog input { appearance: none; -webkit-appearance: none; width: 34px; height: 18px; margin: 0; background: var(--ui-card); border: 1px solid var(--ui-line); position: relative; cursor: pointer; }
.pp-tog input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--ui-muted); transition: left .15s; }
.pp-tog input:checked { border-color: var(--ui-accent); }
.pp-tog input:checked::after { left: 18px; background: var(--ui-accent); box-shadow: 0 0 8px var(--ui-accent); }
.pp-stat { font: 12px var(--mono); color: var(--ui-muted); display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.pp-stat b { color: var(--ui-fg); font-weight: 600; }
.pp-stat .pp-warn { color: var(--ui-warn); }
.pp-reset { margin-top: 18px; background: none; border: 1px solid var(--ui-line); color: var(--ui-muted); font: 12px var(--sans); padding: 7px 10px; cursor: pointer; }
.pp-reset:hover { color: var(--ui-fg); border-color: var(--ui-muted); }

.pp-stage {
  overflow: auto; padding: 40px 16px 80px; min-width: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(122,26,20,.18), transparent 60%),
    linear-gradient(rgba(196,71,58,.035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(196,71,58,.035) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--ui-bg);
}
.pp-spreads { display: flex; flex-direction: column; align-items: center; gap: 48px; width: max-content; margin: 0 auto; }
.pp-spread-wrap { position: relative; }
.pp-tag { position: absolute; top: -24px; left: 0; font: 12px var(--mono); letter-spacing: .1em; color: var(--ui-muted); }
.pp-spread { display: flex; box-shadow: 0 30px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(196,71,58,.08); }

/* the book page, in print units */
.pp-page {
  width: var(--pp-w); height: var(--pp-h); position: relative; overflow: hidden; flex: none;
  background: var(--pp-paper); color: var(--pp-ink); font-family: var(--pp-book);
  padding: calc(var(--pp-m) * 1.05) var(--pp-m) calc(var(--pp-m) * 1.15);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pp-page::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(40,25,10,.32) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.pp-nograin .pp-page::before { display: none; }
.pp-verso { box-shadow: inset -26px 0 30px -22px rgba(0,0,0,.45); padding-left: calc(var(--pp-m) * 1.15); padding-right: calc(var(--pp-m) * .9); }
.pp-recto { box-shadow: inset 26px 0 30px -22px rgba(0,0,0,.45); padding-left: calc(var(--pp-m) * .9); padding-right: calc(var(--pp-m) * 1.15); }
.pp-page.pp-over { outline: 3px solid var(--ui-warn); outline-offset: -3px; }
.pp-frame { position: absolute; inset: calc(var(--pp-m) * .38); border: 1px solid color-mix(in srgb, var(--pp-ink) 45%, transparent); pointer-events: none; }
.pp-frame::after { content: ""; position: absolute; inset: 4px; border: .5px solid color-mix(in srgb, var(--pp-ink) 30%, transparent); }
.pp-noframe .pp-frame { display: none; }
.pp-rh { position: absolute; top: calc(var(--pp-m) * .55); left: 0; right: 0; text-align: center; font: 600 7.5pt var(--pp-display); letter-spacing: .3em; color: var(--pp-ink-2); text-transform: uppercase; }
.pp-folio { position: absolute; bottom: calc(var(--pp-m) * .5); left: 0; right: 0; text-align: center; font: 9.5pt var(--pp-sc); color: var(--pp-ink-2); letter-spacing: .1em; }
.pp-folio::before, .pp-folio::after { content: "◆"; font-size: 5pt; vertical-align: 2px; margin: 0 10px; color: var(--pp-rubric); }
.pp-body { position: relative; height: 100%; overflow: hidden; }

.pp-u { margin: 0 0 .95em; position: relative; }
.pp-who { display: block; font: calc(var(--pp-eng) * .78) var(--pp-sc); letter-spacing: .14em; color: var(--pp-rubric); margin-bottom: 1px; }
.pp-y { font-style: italic; font-size: var(--pp-yug); line-height: var(--pp-lead); }
.pp-e { font-size: var(--pp-eng); line-height: var(--pp-lead); }
.pp-inter .pp-e { color: var(--pp-ink-2); margin-top: .2em; }
.pp-cite { position: absolute; top: 2px; font: 6.5pt var(--mono); letter-spacing: .05em; color: var(--pp-ink-2); writing-mode: vertical-rl; transform: rotate(180deg); }
.pp-verso .pp-cite { left: calc(var(--pp-m) * -.5); }
.pp-recto .pp-cite { right: calc(var(--pp-m) * -.5); }
.pp-nocites .pp-cite { display: none; }
.pp-r { font-style: italic; font-size: calc(var(--pp-eng) * .86); line-height: 1.38; color: var(--pp-rubric); margin: .2em 0 .95em; }
.pp-r::before { content: "☞ "; font-style: normal; }
.pp-drop::first-letter { font-family: var(--pp-display); font-style: normal; font-weight: 600; float: left; font-size: 3.3em; line-height: .86; padding: .06em .12em 0 0; color: var(--pp-rubric); }

.pp-front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em; height: 100%; }
.pp-sigil { width: 82%; height: auto; color: var(--pp-ink); }
.pp-sigil .pp-red { color: var(--pp-rubric); }
.pp-cap { font: 600 7.5pt var(--pp-display); letter-spacing: .3em; text-transform: uppercase; color: var(--pp-ink-2); }
.pp-title { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; }
.pp-pre { font: 600 8pt var(--pp-display); letter-spacing: .4em; text-transform: uppercase; color: var(--pp-ink-2); }
.pp-title h1 { font: 600 calc(var(--pp-w) * .068)/1.15 var(--pp-display); letter-spacing: .06em; text-transform: uppercase; margin: .7em 0 .3em; border: 0; color: var(--pp-ink); }
.pp-rule { width: 60%; height: 1px; background: color-mix(in srgb, var(--pp-ink) 50%, transparent); margin: 1em auto; position: relative; }
.pp-rule::after { content: "✠"; position: absolute; left: 50%; top: -.7em; transform: translateX(-50%); background: var(--pp-paper); padding: 0 .5em; color: var(--pp-rubric); font-size: 10pt; }
.pp-sub { font-style: italic; font-size: 12pt; }
.pp-imprint { position: absolute; bottom: calc(var(--pp-m) * .9); left: 0; right: 0; font: 9pt var(--pp-sc); letter-spacing: .18em; color: var(--pp-ink-2); }

@media (max-width: 860px) {
  .pp { grid-template-columns: 1fr; }
  .pp-side { border-right: 0; border-bottom: 1px solid var(--ui-line); }
  .pp-bar { flex-wrap: wrap; }
}
@media print {
  body[data-route="print"] { background: none; }
  body[data-route="print"] .top, body[data-route="print"] .foot,
  .pp-bar, .pp-side, .pp-tag { display: none !important; }
  .pp { display: block; min-height: 0; background: none; }
  .pp-stage { padding: 0; background: none; overflow: visible; }
  .pp-spreads { display: block; zoom: 1 !important; width: auto; }
  .pp-spread { display: block; box-shadow: none; }
  .pp-page { box-shadow: none !important; outline: 0 !important; break-after: page; page-break-after: always; }
}
@media (prefers-reduced-motion: reduce) { .pp-tog input::after { transition: none; } }
