/* jung-cw.css
 * Bollingen Series XX bookshelf — fallback flat-grid when the WebGL 3D
 * shelf is unavailable, plus shared per-volume styling that applies to
 * both modes (page reader chrome, header emblem, etc.).
 *
 * Loaded by index.html alongside the other per-template stylesheets.
 * Class names are namespaced `jung-cw-*` so this file never bleeds into
 * the other courses.
 *
 * Reader page dimensions come from `greb-course.jung-cw.theme/bollingen`
 * (`:page-size` → :root --page-width / --page-height), trim 6.25×9.25 in
 * @ 96dpi → 600×888 px unless overridden. `--doc-text-scale` applies only to
 * `.cw-text-scale-root` inside each `.page` so `[ ]` adjusts typography, not trim.
 */

/* Garage Gothic Black (Font Bureau) — author cream card on Princeton CW cover.
   Uses local install names; optional self-host at /fonts/GarageGothic-Black.woff2. */
@font-face {
  font-family: "Garage Gothic Black";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src:
    local("GarageGothic-Black"),
    local("Garage Gothic Black"),
    local("GarageGothic Black"),
    url("/fonts/GarageGothic-Black.woff2") format("woff2");
}

/* ── Shelf page (the /jung/collected-works/ route) ───────────────── */

.jung-cw-shelf {
  --jcw-spine-bg: #0a0a0a;
  --jcw-spine-ink: #ffffff;
  --jcw-spine-accent: #c9a449;
  --jcw-wood-1: #2b1f13;
  --jcw-wood-2: #1a120a;

  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--jcw-wood-1) 0%, var(--jcw-wood-2) 100%);
  color: #f4ecda;
  padding: 4rem 2rem 6rem;
}

.jung-cw-shelf-title {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 0.5rem;
  color: #f4ecda;
}

.jung-cw-shelf-subtitle {
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  text-align: center;
  margin: 0 0 3rem;
  color: rgba(244, 236, 218, 0.7);
}

/* Fallback flat grid — used when catalog.shelf/build! falls back through
 * render-flat! (no WebGL, BookshelfScene missing, or low-power device). */

.jung-cw-shelf-flat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: linear-gradient(180deg, #3a2a18 0%, #251a0e 100%);
  border-radius: 8px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.jung-cw-spine {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0.5rem 1rem;
  aspect-ratio: 1 / 4.2;
  background: var(--jcw-spine-bg);
  color: var(--jcw-spine-ink);
  border-radius: 2px;
  cursor: pointer;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.55),
    inset 1px 0 0 rgba(255, 255, 255, 0.06),
    inset -1px 0 0 rgba(0, 0, 0, 0.6);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.jung-cw-spine:hover,
.jung-cw-spine:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.6),
    inset 1px 0 0 rgba(255, 255, 255, 0.08),
    inset -1px 0 0 rgba(0, 0, 0, 0.7);
  outline: none;
}

.jung-cw-spine-author {
  font-family: "Optima", "Cinzel", Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.92;
}

.jung-cw-spine-rule {
  width: 60%;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
  margin: 0.35rem 0 0.45rem;
}

.jung-cw-spine-vol {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.jung-cw-spine-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  padding: 0.5rem 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}

.jung-cw-spine-emblem {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  margin-top: 0.35rem;
}

/* Empty / not-entitled state */
.jung-cw-shelf-empty {
  max-width: 480px;
  margin: 6rem auto;
  text-align: center;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  color: rgba(244, 236, 218, 0.85);
}
.jung-cw-shelf-empty h2 {
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── Cover page inside each volume (the :cover template invocation) ─ */

.jung-cw-cover {
  background: #0a0a0a;
  color: #f4ecda;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 3rem;
  min-height: 100%;
  position: relative;
}

.jung-cw-cover::before {
  content: "";
  position: absolute;
  inset: 1.5rem;
  border: 1px solid rgba(244, 236, 218, 0.22);
  pointer-events: none;
}

.jung-cw-cover-vol-label {
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 1rem;
  opacity: 0.85;
}

.jung-cw-cover-author-card {
  background: #f4ecda;
  color: #0a0a0a;
  font-family: "Garage Gothic Black", "Garage Gothic", "Libre Franklin", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-size: 2.4rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.jung-cw-cover-title {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-align: center;
  max-width: 18ch;
  margin: 0 0 1.5rem;
}

.jung-cw-cover-edition {
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 4rem;
}

.jung-cw-cover-series {
  font-family: "Optima", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b9d6e6;
  margin-bottom: 1.25rem;
}

.jung-cw-cover-publisher {
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #b9d6e6;
}

/* ── :cw-page — Princeton Bollingen Series XX page typography ──────
 *
 * Calibrated against scans of the actual hardcover:
 *   - Tight leading (line-height: 1.15)
 *   - Cream paper, dark serif ink
 *   - Centered small-caps running head, hairline rule under
 *   - Marginal § section numbers in the LEFT GUTTER (data-section attr)
 *   - Justified text with hyphens
 *   - First-line indent on continuing paragraphs
 *   - Footnotes inline at page bottom, hairline rule above, tiny font
 *   - Centered folio (page number) at the absolute bottom
 *
 * The .cw-page root sets a CSS grid so the running head, body, footnotes,
 * and footer stack in order. Long footnote blocks are scroll-capped so they
 * cannot steal all height from the body row (which would clip the main text).
 */

.cw-page {
  --cw-ink: #1a1610;
  --cw-paper: #fbf4e2;
  --cw-rule: rgba(26, 22, 16, 0.35);
  --cw-fn-ink: #2a2218;
  --cw-blue: #4a7aa3;
  --cw-margin-x: 0.55in;
  --cw-gutter: 1.4em;
  /* Always defined on `.cw-page` so `var(--cw-pad-x-multicol)` never goes invalid
     when `[data-cols]` rules apply — unresolved vars drop padding-longhands to unset
     and margins collapse to inherited 0 from the grid shell.
     Multi-col mode drops the marginal `§` gutter (no marginal numbers in
     column layout) so the body uses the SAME 1.0in inset as the running
     head and folio footer. This keeps the body, running head, and folio
     visually aligned — column text reads centered, not pushed off-axis
     by the leftover left-gutter inheritance. */
  --cw-pad-x-multicol: var(--cw-margin-x);
  --cw-fn-block-max: 42%;
  --cw-folio-outdent: 0.26in;

  background: var(--cw-paper);
  color: var(--cw-ink);
  font-family: "Sabon", "Source Serif 4", "Source Serif Pro", "Hoefler Text",
               Georgia, serif;
  font-size: 0.74rem;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Inner sheet: grid + zoom from `[ ]` — outer `.page` keeps fixed trim px. */
.cw-page > .cw-text-scale-root {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-rows: auto minmax(10.5rem, 1fr) auto auto;
  box-sizing: border-box;
}

/* Running head — small caps, centered, with hairline rule beneath. */
.cw-page .cw-running-head {
  text-align: center;
  font-family: "Optima", "Cinzel", Georgia, serif;
  font-size: 0.66rem;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.6in var(--cw-margin-x) 0.32in;
  color: var(--cw-ink);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.9em;
}

.cw-page .cw-running-head-paging {
  font-size: 0.57rem;
  opacity: 0.55;
  letter-spacing: 0.1em;
}

/* Body — text column with left gutter for marginal § numbers.
   Hidden scrollbar like book-body; footnotes are capped so this row keeps
   a sane height. overflow-y auto recovers edge cases without a visible bar. */
.cw-page .cw-body {
  /* ~11pt at 96dpi to match Princeton Bollingen Series XX body. The runtime
     paginator (cw-flow) measures blocks inside an off-screen `.cw-page` with
     the same CSS, so this also controls per-page density. Caveat: blocks are
     atomic — a paragraph taller than `--page-height` minus chrome gets its
     own oversized page. Keep this conservative until cw-flow learns to split
     paragraphs at line boundaries. */
  font-size: 0.95em;
  line-height: 1.18;
  padding: 0.16in var(--cw-margin-x) 0.24in calc(var(--cw-margin-x) + var(--cw-gutter));
  text-align: justify;
  text-justify: inter-word;
  min-height: 0;
  /* Pages must never scroll. Runtime pagination (cw-flow) splits overflow
     across additional pages; clipping here guarantees that a half-flowed
     page still looks like a page, not a scrollable column. */
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Multi-column (`data-cols` from `c`): symmetric horizontal inset so verso/recto
   outer margins match. `--cw-pad-x-multicol` lives on `.cw-page` (above), not on a
   `:has()` ancestor only — otherwise missing vars invalidate these longhands and
   horizontal padding collapses to 0. Running head / footnotes / footer still use
   `:has()` so single-column pages keep the narrower running-head rails. */
.cw-page .cw-body:is([data-cols="2"], [data-cols="3"]) {
  padding-left: var(--cw-pad-x-multicol);
  padding-right: var(--cw-pad-x-multicol);
  column-gap: 1.35rem;
}

.cw-page
  .cw-text-scale-root:has(.cw-body:is([data-cols="2"], [data-cols="3"]))
  .cw-running-head {
  padding-left: var(--cw-pad-x-multicol);
  padding-right: var(--cw-pad-x-multicol);
}

.cw-page
  .cw-text-scale-root:has(.cw-body:is([data-cols="2"], [data-cols="3"]))
  .cw-footnotes:not(.cw-footnotes--empty) {
  padding-left: var(--cw-pad-x-multicol);
  padding-right: var(--cw-pad-x-multicol);
}

.cw-page
  .cw-text-scale-root:has(.cw-body:is([data-cols="2"], [data-cols="3"]))
  footer.page-footer.cw-page-footer {
  padding-left: var(--cw-pad-x-multicol);
  padding-right: var(--cw-pad-x-multicol);
}

/* Paragraph — first-line indent on continuing paragraphs, no margin between
   so the page reads as a continuous block (Princeton convention). */
.cw-page .cw-para {
  margin: 0;
  text-indent: 1.5em;
  hyphens: auto;
  -webkit-hyphens: auto;
  position: relative;
}

/* First paragraph (or first after a heading/blockquote): no indent. */
.cw-page .cw-h2 + .cw-para,
.cw-page .cw-h3 + .cw-para,
.cw-page .cw-blockquote + .cw-para,
.cw-page .cw-sep + .cw-para,
.cw-page .cw-body > .cw-para:first-child {
  text-indent: 0;
}

/* Continuation of a paragraph whose start ran on the previous page — emitted
   by cw-flow's paragraph splitter (cw_flow.cljs split-oversized-paragraphs!)
   and tagged in render-block when text begins with [[cw-para--continued]].
   No first-line indent, per Princeton convention for runover paragraphs. */
.cw-page .cw-para.cw-para--continued {
  text-indent: 0;
}

/* Marginal § section numbers — sit in the left gutter, baseline-aligned. */
.cw-page .cw-para[data-section]::before {
  content: attr(data-section);
  position: absolute;
  left: calc(-1 * var(--cw-gutter));
  top: 0.05em;
  width: calc(var(--cw-gutter) - 0.8em);
  text-align: right;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-size: 1em;
  font-weight: 400;
  color: rgba(26, 22, 16, 0.65);
  letter-spacing: 0;
}

/* Paragraph carrying a § number drops the first-line indent — the number
   already provides the visual anchor. */
.cw-page .cw-para[data-section] { text-indent: 0; }

/* Headings — centered small caps for h2, italic small caps for h3. */
.cw-page .cw-h2 {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: 1.05em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  margin: 1.4em 0 0.9em;
  break-after: avoid;
}
.cw-page .cw-h3 {
  font-family: "Optima", Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-variant: small-caps;
  font-size: 0.92em;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 1em 0 0.6em;
  break-after: avoid;
}

.cw-page .cw-blockquote {
  margin: 0.6em 1.5em;
  font-style: italic;
  text-indent: 0;
}

.cw-page .cw-sep {
  text-align: center;
  margin: 1em 0;
  color: rgba(26, 22, 16, 0.45);
  letter-spacing: 0.5em;
  font-size: 0.85em;
}

/* Copyright / imprint page — centered blocks, roomier type, section ornaments
   (opt-in via :cw-body-class \"cw-body--copyright-colophon\" on :cw-page data). */
.cw-page .cw-body.cw-body--copyright-colophon {
  font-size: 0.58em;
  line-height: 1.45;
  text-align: center;
  text-justify: none;
  padding-top: 0.22in;
  padding-bottom: 0.42in;
}
.cw-page .cw-body.cw-body--copyright-colophon .cw-para {
  text-indent: 0;
  hyphens: none;
  -webkit-hyphens: none;
  margin: 0.48em auto 0;
  max-width: 38rem;
  text-wrap: balance;
}
.cw-page .cw-body.cw-body--copyright-colophon .cw-para:first-child {
  margin-top: 0;
}
.cw-page .cw-body.cw-body--copyright-colophon .cw-sep {
  margin: 1.35em auto 1.15em;
  opacity: 0.55;
  letter-spacing: 0.45em;
}

/* Footnote ref in body text — small superscript link, blue accent so the
   relationship to the footnote at the bottom of the page is visible. */
.cw-page .cw-fn-ref {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: super;
  margin: 0 0.1em;
  font-weight: 600;
}
.cw-page .cw-fn-ref a {
  text-decoration: none;
  color: var(--cw-blue, #4a7aa3);
  padding: 0 0.08em;
  border-radius: 1px;
}
.cw-page .cw-fn-ref a:hover { background: rgba(74, 122, 163, 0.18); }

/* Floating footnote (click superscript on a .cw-page with __footnotes). */
.cw-fn-popover-host {
  display: none;
  pointer-events: none;
  max-width: min(22rem, calc(100vw - 16px));
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.18));
}
.cw-fn-popover-host .cw-fn-popover-card {
  pointer-events: auto;
  background: var(--cw-paper);
  color: var(--cw-ink);
  border: 1px solid var(--cw-rule);
  border-radius: 4px;
  font-family: "Sabon", "Source Serif 4", "Source Serif Pro", "Hoefler Text",
               Georgia, serif;
  font-size: 0.74rem;
  line-height: 1.3;
  text-align: left;
  overflow: hidden;
}
.cw-fn-popover-host .cw-fn-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem 0.25rem;
  border-bottom: 1px solid var(--cw-rule);
  font-family: "Optima", "Cinzel", Georgia, serif;
  font-size: 0.65rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.cw-fn-popover-host .cw-fn-popover-n {
  color: var(--cw-blue, #4a7aa3);
  font-weight: 600;
}
.cw-fn-popover-host .cw-fn-popover-close {
  border: 0;
  background: transparent;
  color: rgba(26, 22, 16, 0.45);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
  border-radius: 2px;
}
.cw-fn-popover-host .cw-fn-popover-close:hover {
  color: var(--cw-ink);
  background: rgba(74, 122, 163, 0.12);
}
.cw-fn-popover-host .cw-fn-popover-body {
  padding: 0.45rem 0.55rem 0.55rem;
  max-height: min(40vh, 14rem);
  overflow-y: auto;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.cw-fn-popover-host .cw-fn-popover-body .cw-fn-ref { font-size: 0.75em; }

/* When the user clicks a fn-ref → URL hash becomes #cw-fn-N → :target
   highlights the corresponding footnote so the eye finds it instantly. */
.cw-page .cw-footnote:target {
  background: rgba(74, 122, 163, 0.16);
  border-radius: 2px;
}
.cw-page .cw-footnote:target .cw-footnote-marker { color: var(--cw-blue, #4a7aa3); }

/* Footnotes block at page bottom — hairline rule above.
   Font: half of .cw-body (body is 0.5em of .cw-page → notes 0.25em of page).
   Cap height so many notes cannot collapse the body to a few px (clip). */
.cw-page .cw-footnotes {
  padding: 0.85rem var(--cw-margin-x) 0.52in calc(var(--cw-margin-x) + var(--cw-gutter));
  font-size: 0.25em;
  line-height: 1.35;
  color: var(--cw-fn-ink);
}
.cw-page .cw-footnotes:not(.cw-footnotes--empty) {
  max-height: var(--cw-fn-block-max);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.cw-page .cw-footnotes::-webkit-scrollbar {
  display: none;
}
.cw-page .cw-footnotes--empty {
  /* Reserve a sliver so the page footer doesn't shift between pages with
     and without footnotes. */
  min-height: 0;
  padding: 0;
}
.cw-page .cw-footnotes-rule {
  border: 0;
  border-top: 1px solid var(--cw-rule);
  width: 30%;
  margin: 0.15em 0 0.65em -2.4em;
}
/* Footnote text block aligns with .cw-body paragraphs; marker hangs in the
   left gutter like marginal § numbers (same scheme as .cw-para[data-section]). */
.cw-page .cw-footnote {
  margin: 0.1em 0;
  text-indent: 0;
  position: relative;
  padding-left: 0;
}
.cw-page .cw-footnote-marker {
  position: absolute;
  left: calc(-1 * var(--cw-gutter));
  top: 0.12em;
  width: calc(var(--cw-gutter) - 0.45em);
  font-size: 0.9em;
  font-weight: 600;
  font-variant: super;
  vertical-align: super;
  text-align: right;
  padding-right: 0.15em;
  color: var(--cw-blue, #4a7aa3);
}

/* ── cw-page foot: centered document title + folio at outer margin ───
   Grid: outer column holds the page number (right on recto, left on verso);
   center column holds the running footer title (optically centered). */
.cw-page .cw-page-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  padding: 0.18in var(--cw-margin-x) 0.42in;
  font-family: "Optima", "Cinzel", Georgia, serif;
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: rgba(26, 22, 16, 0.55);
  border-top: none;
}
.cw-page .cw-page-footer .cw-page-footer-title {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  text-align: center;
  min-width: 0;
  max-width: 100%;
}
.cw-page .cw-page-footer .page-num {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  margin-inline: 0;
  margin-inline-end: calc(-1 * var(--cw-folio-outdent));
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: none;
  font-variant: normal;
  color: rgba(26, 22, 16, 0.78);
}

/* Verso (left page): folio at outer-LEFT; title stays centered. */
.cw-page.section-tab-side--left .cw-page-footer .page-num {
  grid-column: 1;
  justify-self: start;
  margin-inline-end: 0;
  margin-inline-start: calc(-1 * var(--cw-folio-outdent));
}

/* Chapter-divider uses the default d/page-footer — mirror it on verso
   pages too so the page-num stays at the outer corner. */
.cw-chapter-divider.section-tab-side--left .page-footer {
  flex-direction: row-reverse;
}
.cw-page .cw-footnote-body em { font-style: italic; }
.cw-page .cw-footnote-body strong { font-weight: 600; }

/* Folio — non–cw-page-footer shells (e.g. colophon). cw-page-footer wins below. */
.cw-page .page-footer {
  text-align: center;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-size: 0.66rem;
  padding: 0.32in var(--cw-margin-x) 0.5in;
  color: rgba(26, 22, 16, 0.65);
  background: transparent;
  border-top: 0;
  box-shadow: none;
  min-height: 0;
}
.cw-page .page-num { font-size: 0.66rem; }

/* Beat .cw-page .page-footer + .cw-page .page-num for Princeton reader foot. */
.cw-page footer.page-footer.cw-page-footer {
  font-size: 0.52rem;
  padding: 0.14in var(--cw-margin-x) 0.34in;
}
.cw-page footer.page-footer.cw-page-footer .page-num {
  font-size: 0.58rem;
  /* Magazine reader `.page-num` is `position:absolute`; that bypasses the
     cw-page-footer grid and pins the folio at `left:.65in`. Restore flow
     layout so verso folio sits at the outer margin via grid + outdent. */
  position: static;
  inset: auto;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
}

/* ── Princeton TOC overlay (body.cw-volume scope) ─────────────────
 * The i-key TOC sits over the reader with a light dim + blur; the open
 * book stays visible between the two columns. Columns use frosted cream
 * panels. Sabon serif, small-caps section header, leader-dotted rows.
 * DOM is from greb-course.nav-toc; these rules override global GREB styling. */

body.cw-volume .toc-overlay {
  background: rgba(8, 6, 4, 0.28);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Do not paint the full viewport cream — that hid the open book. Two frosted
   columns + dimmed overlay keep the spread visible between them. Clicks on the
   dim pass through (wrapper `pointer-events: none`; children re-enabled). */
body.cw-volume .toc-wrapper.open {
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

body.cw-volume .toc-wrapper.open > * {
  pointer-events: auto;
}

body.cw-volume .toc-wrapper.open .toc-col {
  background: rgba(251, 244, 226, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 22, 16, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
}

body.cw-volume .toc-wrapper {
  font-family: "Sabon", "Source Serif 4", "Hoefler Text", Georgia, serif;
}

body.cw-volume .toc-wrapper * {
  font-family: inherit !important;
}

/* Brand card left column — keep functional, restyle to match paper. */
body.cw-volume .toc-brand-card,
body.cw-volume .toc-shortcuts-card,
body.cw-volume .toc-api-card,
body.cw-volume .toc-entries-card {
  background: transparent;
  color: var(--cw-ink);
  border: none;
  border-top: 1px solid rgba(26, 22, 16, 0.18);
  box-shadow: none;
  padding-top: 1rem;
}
body.cw-volume .toc-brand-card { border-top: 0; }

body.cw-volume .toc-brand-name {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif !important;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cw-ink);
}
body.cw-volume .toc-brand-tagline,
body.cw-volume .toc-mode-label {
  font-family: "Sabon", Georgia, serif !important;
  font-style: italic;
  font-size: 0.78rem;
  color: rgba(26, 22, 16, 0.65);
}
body.cw-volume .toc-shortcut-key,
body.cw-volume .toc-section-num {
  background: rgba(26, 22, 16, 0.05);
  border: 1px solid rgba(26, 22, 16, 0.25);
  color: var(--cw-ink);
  font-family: "Optima", monospace !important;
}

/* Header: book contents only — search lives above; no shared "Index" label. */
body.cw-volume .toc-book-section-hdr {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif !important;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 1.1em 0 0.85em;
  border-top: 1px solid rgba(26, 22, 16, 0.2);
  margin-top: 0.5rem;
  border-bottom: 1px solid rgba(26, 22, 16, 0.3);
  margin-bottom: 1em;
  color: var(--cw-ink);
}
body.cw-volume .toc-book-section-title {
  display: block;
  width: 100%;
}

/* Legacy header (unused in current TOC markup; kept harmless). */
body.cw-volume .toc-entries-hdr {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif !important;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding-bottom: 0.9em;
  border-bottom: 1px solid rgba(26, 22, 16, 0.3);
  margin-bottom: 1em;
  color: var(--cw-ink);
}
body.cw-volume .toc-entries-icon { display: none; }

/* Group header (e.g. section title) — centered italic small-caps. */
body.cw-volume .toc-group-hdr {
  font-family: "Trajan Pro", "Optima", Georgia, serif !important;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  background: transparent;
  border: 0;
  border-top: 0;
  padding: 1.2em 0 0.6em;
  color: var(--cw-ink);
  cursor: pointer;
}
body.cw-volume .toc-group-hdr-label { letter-spacing: 0.1em; }
body.cw-volume .toc-group-chevron,
body.cw-volume .toc-section-num { display: none !important; }

/* Index entry rows — chapter label, leader dots, page number. */
body.cw-volume .toc-group-entries { padding: 0 0.2em; }
body.cw-volume .index-entry {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.3em 0.4em;
  font-family: "Sabon", "Source Serif 4", Georgia, serif !important;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--cw-ink);
  text-decoration: none;
  border-radius: 2px;
}
body.cw-volume .index-entry:hover {
  background: rgba(201, 164, 73, 0.15);
}
body.cw-volume .index-entry .entry-icon {
  display: none;
}
body.cw-volume .index-entry .entry-label {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.cw-volume .index-entry .index-entry-origin {
  font-style: italic;
  font-size: 0.78em;
  color: rgba(26, 22, 16, 0.55);
  margin-left: 0.4em;
}
body.cw-volume .index-entry .entry-dots {
  flex: 1 1 auto;
  align-self: end;
  margin: 0 0.35em 0.32em;
  border-bottom: 1.5px dotted rgba(26, 22, 16, 0.5);
  min-width: 1.5em;
}
body.cw-volume .index-entry .entry-page {
  font-variant: tabular-nums;
  font-size: 0.85em;
  color: var(--cw-ink);
  flex: 0 0 auto;
  letter-spacing: 0;
}

/* Search input — match paper feel. */
body.cw-volume .toc-search-wrap {
  border: 1px solid rgba(26, 22, 16, 0.25);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}
body.cw-volume .toc-search-input {
  font-family: "Sabon", Georgia, serif !important;
  font-style: italic;
  background: transparent;
  color: var(--cw-ink);
}
body.cw-volume .toc-search-input::placeholder {
  color: rgba(26, 22, 16, 0.45);
  font-style: italic;
}

/* Close button — discreet. */
body.cw-volume .toc-close-btn {
  color: rgba(26, 22, 16, 0.55);
  background: transparent;
  border: 1px solid rgba(26, 22, 16, 0.2);
  border-radius: 2px;
}
body.cw-volume .toc-close-btn:hover {
  background: rgba(26, 22, 16, 0.06);
  color: var(--cw-ink);
}

/* ── Footnotes visibility (`f` or omnibar `footnotes`) ─────────── */
/* visibility:hidden (not display:none) so the grid row keeps its
   reserved height — toggling `f` no longer reflows/clips the body. */

body.cw-fn-hidden .cw-page .cw-footnotes { visibility: hidden; }
body.cw-fn-hidden .cw-page .cw-fn-ref    { opacity: 0.4; }

/* Spread cross-axis: default `center` misaligns recto/verso when `zoom` yields
   slightly different used heights — tops drift apart and sheets look mismatched. */
body.cw-volume .spread.active,
body.cw-volume .spread.spread-preview-hover {
  align-items: flex-start;
}
/* …EXCEPT scan facsimiles. The `.page.scan-page` is sized to the PDF's own page
   (e.g. 901pt → 1201px), TALLER than the viewport-sized spread. With flex-start it
   pins to the top and, because the spread scales around its centre, the oversized
   sheet lands ~118px BELOW viewport centre (overflowing the bottom) — pressing 0
   can't fix it because the layout, not the pan, is off. Both facsimile pages are
   always equal height, so centring is safe (no recto/verso top-drift) and puts the
   book back on the viewport centre. */
body.cw-volume .spread.active:has(.page.scan-page),
body.cw-volume .spread.spread-preview-hover:has(.page.scan-page) {
  align-items: center;
}

/* Shift+C global column modes (.reader.book-cols-*) apply only to `.book-body`
   elsewhere — mirror for Jung CW `.cw-body` when no per-page `data-cols`. */
.reader.book-cols-2 .cw-body:not([data-cols]) {
  column-count: 2;
  column-gap: 1.25rem;
  column-fill: balance;
  column-rule: 1px solid rgba(26, 22, 16, 0.12);
}
.reader.book-cols-3 .cw-body:not([data-cols]) {
  column-count: 3;
  column-gap: 1rem;
  column-fill: balance;
  column-rule: 1px solid rgba(26, 22, 16, 0.1);
}

/* StPageFlip: odd spreads get a padded `page--blank` so the real folio sits in
   the right slot — forward curls from the gutter (mid-book), not the outer edge.
   Keep the pad sheet invisible in the transient overlay. */
body.cw-volume .page-flip-v2-overlay .page.page--blank {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

/* Text scale ([ ] / toolbar) — zoom typography inside trim, not the `.page` box. */
body.cw-volume .spread.active .page > .cw-text-scale-root,
body.cw-volume .page-flip-v2-overlay .page > .cw-text-scale-root,
body.cw-volume .spread.spread-preview-hover .page > .cw-text-scale-root {
  zoom: var(--doc-text-scale, 1);
  transition: zoom 0.2s cubic-bezier(0.25, 0.08, 0.25, 1);
}

/* Reader-mode line-spacing toggles (v key) override default leading. */
:is(.reader,.spread).book-leading-tight  .cw-page { line-height: 1.16; }
:is(.reader,.spread).book-leading-loose  .cw-page { line-height: 1.40; }
:is(.reader,.spread).book-leading-xloose .cw-page { line-height: 1.65; }

/* ── :cw-chapter-divider — half-title page ─────────────────────────
 * Cream paper. Centered section title in display small-caps with a
 * decorative rule beneath. Mirrors the Bollingen reference scan
 * (e.g. "THE PSYCHOLOGY OF THE UNCONSCIOUS" centered mid-page).      */

.cw-chapter-divider {
  background: var(--cw-paper, #fbf4e2);
  color: var(--cw-ink, #1a1610);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Sabon", "Source Serif 4", "Hoefler Text", Georgia, serif;
  padding: 0;
  min-height: 100%;
  height: 100%;
}

.page.cw-chapter-divider > .cw-text-scale-root {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cw-chapter-divider-frame {
  width: 100%;
  text-align: center;
  padding: 3.5in 0.8in;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cw-chapter-divider-eyebrow {
  font-family: "Optima", Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  margin-bottom: 1.2em;
  color: rgba(26, 22, 16, 0.55);
}
.cw-chapter-divider-title {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 3.2vw, 2.1rem);
  letter-spacing: 0.12em;
  line-height: 1.18;
  max-width: 18ch;
  margin: 0 0 1.1em;
}
.cw-chapter-divider-rule {
  width: 60px;
  height: 1px;
  background: rgba(26, 22, 16, 0.5);
  margin: 0 auto 1em;
}
.cw-chapter-divider-num {
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(26, 22, 16, 0.55);
  letter-spacing: 0.06em;
}

/* ── :cw-series-page — Bollingen XX series + editors ───────────── */

.page.cw-series-page {
  background: var(--cw-paper, #fbf4e2);
  color: var(--cw-ink, #1a1610);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  padding: 0;
  height: 100%;
}

.page.cw-series-page > .cw-text-scale-root {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cw-series-frame {
  width: 100%;
  max-width: 5in;
  padding: 1.6in 0.8in;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cw-series-series {
  font-family: "Optima", Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 0.8em;
  color: var(--cw-ink);
}
/* Princeton divider flourish — shared asset `/jung/cw/divider.svg` */
.cw-divider-svg {
  display: block;
  width: clamp(3.5rem, 22vw, 6.25rem);
  height: auto;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  filter: brightness(0.18) sepia(0.4) saturate(0.6);
}
.cw-series-rule.cw-divider-svg {
  margin-bottom: 1.6em;
}
.cw-series-collected {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.15em;
}
.cw-series-of {
  font-family: "Sabon", Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  margin-bottom: 0.3em;
  color: rgba(26, 22, 16, 0.7);
}
.cw-series-author {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 1.4em;
}
.cw-series-volume {
  font-family: "Sabon", Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  margin-bottom: 0.4em;
}
.cw-series-title {
  font-family: "Optima", Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 2.4em;
  color: rgba(26, 22, 16, 0.75);
  max-width: 38ch;
}
.cw-series-editors-label {
  font-family: "Optima", Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 0.9em;
  color: var(--cw-ink);
}
.cw-series-editors {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cw-series-editor {
  font-family: "Sabon", Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.55;
  font-variant: small-caps;
  color: var(--cw-ink);
}
/* Last editor (Greb) gets a hairline separator above to distinguish it. */
.cw-series-editor:last-child {
  margin-top: 0.55em;
  padding-top: 0.55em;
  border-top: 1px solid rgba(26, 22, 16, 0.22);
}

/* ── :cw-title-page — recreated inner title page ──────────────── */

.page.cw-title-page {
  background: var(--cw-paper, #fbf4e2);
  color: var(--cw-ink, #1a1610);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  padding: 0;
  height: 100%;
}

.page.cw-title-page > .cw-text-scale-root {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cw-title-frame {
  width: 100%;
  max-width: 4.6in;
  padding: 1in 0.8in 1.4in;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cw-title-display {
  font-family: "Baskerville URW Medium", "Baskerville URW", "URW Baskerville",
    "Libre Baskerville", Baskerville, "Baskerville Old Face", "Times New Roman",
    Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.12;
  margin: 0 0 1.2em;
  max-width: 14ch;
}
.cw-title-author {
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1.4em;
}
.cw-title-emblem {
  font-size: 1.8rem;
  margin-bottom: 1.4em;
  color: rgba(26, 22, 16, 0.7);
  font-family: serif;
}
.cw-title-emblem--svg {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cw-title-page .cw-title-emblem-img {
  display: block;
  width: 56px !important;
  height: 56px !important;
  max-width: 56px;
  opacity: 0.85;
  /* SVG uses currentColor where it can; outside that we tint with filter
     so the same asset renders as warm-black on cream paper. */
  filter: brightness(0.18) sepia(0.4) saturate(0.6);
}
.cw-title-translator {
  font-family: "Optima", Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1.6em;
  color: rgba(26, 22, 16, 0.7);
}
.cw-title-rule.cw-divider-svg {
  margin-bottom: 0.85em;
}
.cw-title-publisher {
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* ── :cw-colophon — Greb preservation note (reads like an Editorial
 * Note: full-width cw-body typography, first-line indents, tight
 * leading, centered running head at top). Inherits .cw-page styles
 * and only overrides the bits that need to feel like front-matter
 * rather than mid-volume prose. */

.cw-colophon .cw-colophon-body {
  /* Slightly looser than mid-volume leading because the manifesto is
     prose-heavy and not numbered. */
  line-height: 1.32;
}

.cw-colophon-vol {
  text-align: center;
  font-family: "Sabon", Georgia, serif;
  font-style: italic;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: rgba(26, 22, 16, 0.7);
  margin: 0 0 1.8em;
  text-indent: 0;
}

.cw-colophon-epigraph {
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 0.96rem;
  line-height: 1.45;
  text-align: center;
  margin: 1.8em auto 1.4em;
  max-width: 32ch;
  text-indent: 0;
  color: rgba(26, 22, 16, 0.85);
}
.cw-colophon-epigraph::before { content: "“"; margin-right: 0.06em; }
.cw-colophon-epigraph::after  { content: "”"; margin-left: 0.06em; }

.cw-colophon-license {
  font-family: "Sabon", Georgia, serif;
  font-size: 0.8rem;
  line-height: 1.42;
  text-align: justify;
  margin: 1.6em 0 1.4em;
  color: rgba(26, 22, 16, 0.72);
  font-style: italic;
  text-indent: 0;
}
.cw-colophon-signature {
  text-align: center;
  font-family: "Sabon", Georgia, serif;
  margin: 1em 0 0.4em;
}
.cw-colophon-name {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  font-variant: small-caps;
}
.cw-colophon-mark {
  display: inline-block;
  font-family: "Trajan Pro", "Optima", Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: lowercase;
  margin-top: 0.3em;
  color: rgba(26, 22, 16, 0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 22, 16, 0.25);
  padding-bottom: 0.1em;
  transition: color .15s ease, border-color .15s ease;
}
.cw-colophon-mark:hover {
  color: var(--cw-blue, #4a7aa3);
  border-bottom-color: var(--cw-blue, #4a7aa3);
}
.cw-colophon-mit {
  text-align: center;
  font-family: "Optima", Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(26, 22, 16, 0.5);
  margin-top: 0.6em;
}

/* ── :cw-cover — Bollingen XX dust jacket (Vol 7 reference) ───────
 * Black cloth-bound look with asymmetric layout calibrated against the
 * 1953 Pantheon Books photograph of Vol 7:
 *   • eyebrow ("VOLUME N OF THE / COLLECTED WORKS OF") top-right, blue
 *   • C. G. JUNG cream-card placard + display title left, mid-page
 *   • BOLLINGEN SERIES XX + publisher bottom-right, blue
 *   • subtle paper-grain shadow at the edges                          */

.page.cw-cover {
  --cw-blue: #98bdd6;        /* Bollingen dust-jacket accent */
  --cw-cream: #f0e6cc;
  --cw-cloth: #0a0a0a;

  background:
    radial-gradient(ellipse at 20% 110%, rgba(255,255,255,0.04), transparent 65%),
    radial-gradient(ellipse at 110% -10%, rgba(255,255,255,0.05), transparent 60%),
    var(--cw-cloth);
  color: var(--cw-cream);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  position: relative;
  height: 100%;
}

.page.cw-cover > .cw-text-scale-root {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Subtle inset border — matches the worn-cloth photograph. */
.cw-cover::before {
  content: "";
  position: absolute;
  inset: 0.55in;
  border: 1px solid rgba(244, 236, 218, 0.10);
  pointer-events: none;
}

.cw-cover-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  /* Asymmetric: right column gets ~60% so the cyan eyebrow + colophon fit
     their natural 2-line breaks ("VOLUME 7 OF THE / COLLECTED WORKS OF",
     "BOLLINGEN SERIES XX") without forced wraps inside each line. */
  grid-template-columns: 0.5fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    ".      eyebrow"
    "stack  stack"
    ".      colophon";
  padding: 1.1in 0.95in;
  column-gap: 0.4in;
  row-gap: 0.6in;
}

/* Three-font system (cover typography):
     • cyan eyebrow → Bodoni URW Medium (local / licensed), Bodoni fallbacks
     • cyan series + publisher → Jost (Futura proxy)
     • C. G. JUNG cream card → Garage Gothic Black (+ optional /fonts/GarageGothic-Black.woff2)
     • TWO ESSAYS… title → Oswald (Trade Gothic Bold Condensed proxy)
*/

/* Eyebrow: "VOLUME 7 OF THE / COLLECTED WORKS OF" — top-right, cyan. */
.cw-cover-eyebrow {
  grid-area: eyebrow;
  justify-self: end;
  text-align: right;
  /* URW: family + Medium weight; first name matches common desktop install. */
  font-family: "Bodoni URW Medium", "Bodoni URW", "URW Bodoni", "Libre Bodoni",
    "Bodoni MT", Bodoni, "Bodoni 72", serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.25;
  white-space: pre-line;
  color: var(--cw-blue);
}

/* Author card + title stack — anchored to the upper third like the
   Pantheon original, not vertically centered. */
.cw-cover-stack {
  grid-area: stack;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0.4in;
}

/* C. G. JUNG card — Garage Gothic Black on cream (falls back to geometric sans). */
.cw-cover-author-card {
  display: inline-block;
  background: var(--cw-cream);
  color: var(--cw-cloth);
  font-family: "Garage Gothic Black", "Garage Gothic", "Libre Franklin", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(1.45rem, 2.7vw, 1.95rem);
  letter-spacing: 0.1em;
  padding: 0.32em 0.7em 0.22em;
  margin: 0 0 1.05em;
  line-height: 1;
}

/* Title — condensed grotesk, sets the dust-jacket signature. Two
   natural lines: "TWO ESSAYS" / "IN ANALYTICAL PSYCHOLOGY". Slightly
   smaller font + 30ch keeps the long second line on one row. */
.cw-cover-title {
  font-family: "Oswald", "Trade Gothic", "Roboto Condensed", sans-serif;
  font-weight: 600;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  text-align: left;
  max-width: 30ch;
  margin: 0;
  color: var(--cw-cream);
}

/* Bottom-right colophon — series + publisher. */
.cw-cover-colophon {
  grid-area: colophon;
  justify-self: end;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Bottom-right cyan colophon — same geometric sans as eyebrow.
   nowrap keeps "BOLLINGEN SERIES XX" on a single line per the original. */
.cw-cover-series {
  font-family: "Jost", "Futura", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--cw-blue);
  margin-bottom: 1.4em;
  white-space: nowrap;
}

.cw-cover-publisher {
  font-family: "Jost", "Futura", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--cw-blue);
  white-space: nowrap;
}

/* ── :cw-toc — Bollingen XX printed table of contents ──────────────── */
.cw-page.cw-toc .cw-toc-body {
  padding: 0.3in 0.7in 0.25in;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cw-page.cw-toc .cw-toc-title {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-align: center;
  margin: 0 0 0.55rem;
  color: var(--cw-ink);
}

.cw-page.cw-toc .cw-toc-sections {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cw-page.cw-toc .cw-toc-section { display: contents; }

/* Centered multi-line section title (e.g. "THE PSYCHOLOGY OF / THE UNCONSCIOUS"). */
.cw-page.cw-toc .cw-toc-section-block {
  font-family: "Trajan Pro", "Optima", "Cinzel", Georgia, serif;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.18;
  margin: 0.35rem 0 0.25rem;
  color: var(--cw-ink);
}

/* Inline single-line section heading (small-caps centered). */
.cw-page.cw-toc .cw-toc-section-heading {
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  margin: 0.3rem 0 0.15rem;
  color: var(--cw-ink);
}

/* Grid: [Chapter prefix] [label · dot leader ·] [folio] */
.cw-page.cw-toc .cw-toc-row {
  display: grid;
  grid-template-columns: 4.3em 1fr 2em;
  align-items: baseline;
  column-gap: 0.3em;
  font-family: "Sabon", "Source Serif 4", Georgia, serif;
  font-size: 0.62rem;
  line-height: 1.18;
  color: var(--cw-ink);
}

/* Rows without 'Chapter N.' prefix still get the prefix column reserved
   for vertical alignment, but the cell is empty. */
.cw-page.cw-toc .cw-toc-row-prefix {
  text-align: right;
  font-variant: small-caps;
  white-space: nowrap;
  color: var(--cw-ink);
}

.cw-page.cw-toc .cw-toc-row-label {
  /* The label sits in column 2 next to the dot leader. Wrapped lines
     hang under the first line (no re-indent). */
  word-break: normal;
}

.cw-page.cw-toc .cw-toc-row--indent .cw-toc-row-label { padding-left: 1.6em; }

.cw-page.cw-toc .cw-toc-row--allcaps .cw-toc-row-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.86rem;
}

.cw-page.cw-toc .cw-toc-row--heading {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

.cw-page.cw-toc .cw-toc-row-leader {
  /* Dot leader: a hairline of low-ascender dots filling the slack. */
  border-bottom: 1px dotted rgba(26, 22, 16, 0.5);
  transform: translateY(-0.28em);
  height: 0;
  min-width: 1.2em;
  align-self: end;
}

.cw-page.cw-toc .cw-toc-row-folio {
  font-variant-numeric: oldstyle-nums;
  color: var(--cw-ink);
  text-align: right;
}

/* Linked rows: subtle hover affordance. Anchor stays in the same grid so
   layout doesn't shift between linked and plain rows. */
a.cw-page.cw-toc .cw-toc-row,
.cw-page.cw-toc a.cw-toc-row {
  text-decoration: none;
  color: inherit;
}

.cw-page.cw-toc .cw-toc-row--link {
  cursor: pointer;
  transition: color 120ms ease;
}

.cw-page.cw-toc .cw-toc-row--link:hover {
  color: var(--cw-blue, #4a7aa3);
}

.cw-page.cw-toc .cw-toc-row--link:hover .cw-toc-row-leader {
  border-bottom-color: currentColor;
}
