/*
   Wellred catalogue reading experiment

   Derived from the canonical Wellred Books EPUB template:
   /Users/maarten-mac/Projects/wellred-indesign-automation/css/
   wellred-epub-template.css
   Source commit: wellred-indesign-automation-clean
   6ec8bb9cc1601487638028203e2e250b6bed4efa (tip of the production lane
   claude/wellred-batch-lane-05cde9 on 2026-08-23; that repo's main is still
   behind this baseline). Pinned as a commit rather than a branch so the
   source is re-readable after the lane moves.
   SHA-256 of css/wellred-epub-template.css at that commit:
   1813bb4f545bd2edfe26066f8c02123ec42c671d6ad73ebc7dcfb307bb2fd1e7
   (34226 bytes; verify with
   `git show 6ec8bb9:css/wellred-epub-template.css | sha256sum`)

   The source stylesheet targets paginated EPUB XHTML. These rules translate
   its typography and 14-point rhythm to the rendered catalogue while keeping
   every selector inside .wellred-reading, so the rest of the PWA is unchanged.
*/

.wellred-reading {
  --wellred-font: "Adobe Garamond Pro", Georgia, serif;
  --wellred-rhythm-1: 0.875rem;
  --wellred-rhythm-2: 1.75rem;
  --wellred-rhythm-3: 2.625rem;
  --wellred-rhythm-4: 3.5rem;
  --wellred-rhythm-half: 0.4375rem;
  --wellred-rhythm-quarter: 0.21875rem;
  --wellred-rhythm-6: 5.25rem;
  font-family: var(--wellred-font);
  color: var(--md-default-fg-color);
}

.wellred-reading h1,
.wellred-reading h2,
.wellred-reading h3,
.wellred-reading h4,
.wellred-reading h5,
.wellred-reading h6 {
  font-family: var(--wellred-font);
  font-weight: normal;
  font-style: italic;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--md-default-fg-color);
  text-indent: 0;
}

.wellred-reading h1 {
  margin-top: var(--wellred-rhythm-3);
  margin-bottom: var(--wellred-rhythm-3);
  font-size: 1.909em;
  text-align: center;
}

.wellred-reading h2 {
  margin-top: var(--wellred-rhythm-1);
  margin-bottom: var(--wellred-rhythm-half);
  padding-top: 0;
  border-top: 0;
  font-size: 1.5em;
  text-align: left;
}

.wellred-reading h3 {
  margin-top: var(--wellred-rhythm-1);
  margin-bottom: var(--wellred-rhythm-half);
  font-size: 1.25em;
  text-align: center;
}

.wellred-reading > p:not(.article-browser__empty) {
  margin: 0;
  padding: 0;
  font-family: var(--wellred-font);
  font-size: 1em;
  line-height: 1.27;
  text-align: justify;
  text-indent: 1.5em;
  hyphens: auto;
}

/* Series landing pages lead with intro/disclaimer prose before the volume
   browser. Those are page furniture, not book paragraphs: keep them
   unindented and give the stacked intro paragraphs breathing room. */
.wellred-reading > p:not(.article-browser__empty):not(.article-browser__item) {
  text-indent: 0;
}

.wellred-reading > p + p:not(.article-browser__empty):not(.article-browser__item) {
  margin-top: 0.6em;
}

/* Imported collected-works XHTML is kept inside a structural wrapper so its
   original classes, IDs, notes, tables, and page anchors survive conversion. */
.wellred-reading .epub-document p,
.wellred-reading .epub-document .body-text {
  margin: 0;
  padding: 0;
  font-family: var(--wellred-font);
  font-size: 1em;
  line-height: 1.27;
  text-align: justify;
  text-indent: 1.5em;
  hyphens: auto;
}

/* Work-level source/date lines use the same restrained treatment as
   Wellred's canonical .work-metadata class.  The LCW import calls this
   class .work-meta, so support both names without changing the source XHTML. */
.wellred-reading .epub-document .work-meta,
.wellred-reading .epub-document .work-metadata {
  margin-top: 0.35em;
  margin-bottom: 1.1em;
  font-size: 0.909em;
  line-height: 1.3;
  text-align: center;
  text-indent: 0;
}

/* Signed closing lines. They sit after the body text and should not inherit
   the book-paragraph indent or crowd the preceding paragraph. */
.wellred-reading .epub-document .signature,
.wellred-reading .epub-document p.signature,
.wellred-reading .epub-document .signature + .signature {
  margin: 0.7em 0 0;
  text-indent: 0;
  text-align: right;
}

.wellred-reading .epub-document .signature + .signature {
  margin-top: 0.25em;
}

.wellred-reading .epub-document .work-meta + .work-meta,
.wellred-reading .epub-document .work-metadata + .work-metadata {
  margin-top: 0;
}

.wellred-reading .epub-document .no-indent,
.wellred-reading .epub-document .chapter-opener + p,
.wellred-reading .epub-document h1 + p,
.wellred-reading .epub-document h2 + p,
.wellred-reading .epub-document h3 + p,
.wellred-reading .epub-document li > p,
.wellred-reading .epub-document td > p,
.wellred-reading .epub-document th > p {
  text-indent: 0;
}

.wellred-reading .epub-document .chapter-opener {
  margin-top: var(--wellred-rhythm-3);
  padding-bottom: var(--wellred-rhythm-2);
}

.wellred-reading .epub-document .chapter-opener h1,
.wellred-reading .epub-document .chapter-title {
  margin-top: 0;
  margin-bottom: var(--wellred-rhythm-2);
}

.wellred-reading .epub-document .pagebreak {
  /* A printed-page anchor sits inline inside a paragraph, between two halves of
     one sentence. display:block ended the line at the anchor, so the reader saw
     a hard return mid-sentence — 514 times in Volume 26 alone. Inline keeps the
     anchor addressable for the page navigation and lets the sentence flow. */
  display: inline;
  height: 0;
  overflow: hidden;
}

.wellred-reading .epub-document .footnotes-separator {
  display: block;
  width: 25%;
  margin: var(--wellred-rhythm-2) auto var(--wellred-rhythm-1);
  border: 0;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.wellred-reading .epub-document [role="doc-footnote"],
.wellred-reading .epub-document [role="doc-endnotes"],
.wellred-reading .epub-document .editorial-endnotes,
.wellred-reading .epub-document .unlinked-footnotes,
.wellred-reading .epub-document [data-epub-type="footnote"],
.wellred-reading .epub-document .footnote-container {
  font-size: 0.909em;
  line-height: 1.35;
}

/* The canonical Wellred template gives each note container a small block
   rhythm, then resets the inner paragraph so it does not inherit the book's
   first-line indent. LCW has no wrapper, so its .endnote paragraph carries
   the same treatment directly. */
.wellred-reading .epub-document [data-epub-type="footnote"],
.wellred-reading .epub-document .footnote-container {
  display: block;
  margin: 0 0 var(--wellred-rhythm-half);
}

.wellred-reading .epub-document p.footnote-para,
.wellred-reading .epub-document p.footnote {
  line-height: 1.35;
  margin: 0;
  padding: 0;
  text-indent: 0;
}

.wellred-reading .epub-document p.endnote {
  font-size: 0.909em;
  line-height: 1.35;
  margin: 0 0 var(--wellred-rhythm-half);
  padding: 0;
  text-indent: 0;
}

.wellred-reading .epub-document img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--wellred-rhythm-1) auto;
}

.wellred-reading .epub-document .table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Material wraps Markdown tables in two helper elements.  Reset those
   helpers here as well; otherwise the inner table keeps its intrinsic EPUB
   cell width and the reading card clips the prose before this rule can help. */
.wellred-reading .epub-document .table-scroll > .md-typeset__scrollwrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wellred-reading .epub-document .table-scroll > .md-typeset__scrollwrap > .md-typeset__table {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) {
  overflow-x: visible;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) > table {
  display: table;
  width: 100%;
  max-width: 100%;
  table-layout: auto;
  overflow: visible;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) .md-typeset__table > table {
  display: table;
  width: 100%;
  max-width: 100%;
  table-layout: auto;
  overflow: visible;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) td,
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) th {
  white-space: normal;
}

/* Some Progress Publishers preliminaries use a three-cell EPUB layout table
   with empty side cells. Give the prose cell the available width instead of
   letting the browser divide the card into three equal columns. */
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > td:first-child,
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > th:first-child,
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > td:last-child,
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > th:last-child {
  width: 4%;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > td:nth-child(2),
.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) tr > th:nth-child(2) {
  width: 92%;
}

.wellred-reading .epub-document .table-scroll:not(.table-scroll--wide) table:has(tr > td:nth-child(3)):not(:has(tr > td:nth-child(4))) {
  table-layout: fixed;
}

.wellred-reading .epub-document .table-scroll--wide > table {
  width: max-content;
  min-width: 100%;
}

.wellred-reading .epub-document .table-scroll--wide > .md-typeset__scrollwrap > .md-typeset__table {
  width: max-content;
  min-width: 100%;
}

.wellred-reading .epub-document .table-scroll--wide .md-typeset__table > table {
  display: table;
  width: max-content;
  min-width: 100%;
}

.wellred-reading .epub-document table {
  border-collapse: collapse;
}

.wellred-reading .epub-document th,
.wellred-reading .epub-document td {
  padding: 0.25rem 0.5rem;
  vertical-align: top;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.wellred-reading > h1 + p,
.wellred-reading > h2 + p,
.wellred-reading > h3 + p,
.wellred-reading > .reader-context + h1 + p,
.wellred-reading > .reader-context + h1 + .article-meta + p {
  text-indent: 0;
}

.wellred-reading em,
.wellred-reading .Italic {
  font-style: italic;
}

.wellred-reading blockquote,
.wellred-reading .epub-document blockquote,
.md-typeset .wellred-reading blockquote,
.md-typeset .wellred-reading .epub-document blockquote {
  margin: var(--wellred-rhythm-1) 1.5rem;
  padding: 0;
  border-left: 0;
  border: 0;
  border-radius: 0;
  font-family: var(--wellred-font);
  font-size: 0.909em;
  font-style: normal;
  color: var(--md-default-fg-color);
  box-shadow: none;
  background: transparent;
}

.wellred-reading blockquote p,
.wellred-reading .epub-document blockquote p {
  margin: var(--wellred-rhythm-1) 0;
  text-indent: 0;
}

.wellred-reading blockquote p:first-child,
.wellred-reading .epub-document blockquote p:first-child {
  margin-top: 0;
}

.wellred-reading blockquote p:last-child,
.wellred-reading .epub-document blockquote p:last-child {
  margin-bottom: 0;
}

.wellred-reading .epub-document ul,
.wellred-reading .epub-document ol {
  margin-top: var(--wellred-rhythm-1);
  margin-bottom: var(--wellred-rhythm-1);
  margin-left: 0;
  margin-right: 0;
  padding-left: 2em;
  font-family: var(--wellred-font);
}

.wellred-reading .epub-document blockquote ul,
.wellred-reading .epub-document blockquote ol {
  margin-top: 0;
  margin-bottom: 0;
}

.wellred-reading .epub-document ul li,
.wellred-reading .epub-document ol li {
  margin-bottom: var(--wellred-rhythm-half);
  text-align: justify;
}

.wellred-reading .epub-document li > p {
  margin: 0;
}

.wellred-reading .epub-document .quote,
.wellred-reading .epub-document blockquote {
  text-indent: 0;
}

.wellred-reading .article-browser,
.wellred-reading .reader-context,
.wellred-reading .article-pager {
  font-family: var(--hc-font-serif);
}

/* Material's compact furniture values fall below 12px at several points.
   These labels and summaries are part of the collected-works reading path,
   not ornamental metadata, so keep one legible floor across all three lanes. */
.wellred-reading .reader-context,
.wellred-reading .article-browser__count,
.wellred-reading .article-card__byline,
.wellred-reading .article-card__summary,
.wellred-reading .article-card__meta,
.wellred-reading .article-pager__label {
  font-size: 0.75rem;
}

.wellred-reading .article-browser__list,
.wellred-reading .article-browser__list p,
.wellred-reading .article-pager p {
  text-indent: 0;
  text-align: left;
}

.wellred-reading .article-browser {
  margin-top: var(--wellred-rhythm-2);
}

/* Build/review history is useful orientation but not the primary task on a
   series landing page. It starts collapsed and reads as quiet library
   metadata; opening it does not compete with the volume filter below. */
.wellred-reading > details.series-activity {
  max-width: 34em;
  margin: var(--wellred-rhythm-1) auto;
  color: var(--md-default-fg-color--light);
  font-family: var(--hc-font-serif);
  font-size: 0.875rem;
}

.wellred-reading > details.series-activity > summary {
  min-height: 2.75rem;
  padding: 0.6rem 0;
  color: var(--md-default-fg-color--light);
  cursor: pointer;
}

.wellred-reading > details.series-activity[open] > summary {
  color: var(--hc-accent-text);
}

.wellred-reading > details.series-activity p,
.wellred-reading > details.series-activity li {
  max-width: none;
  text-align: left;
  text-indent: 0;
}

/* EPUB navigation depth is structural metadata, not user-facing prose.
   Keep the generated group label, but indent its entries as a real nested
   level instead of presenting “Level 3” as a flat section heading. */
.wellred-reading .article-browser__item--nested .article-card__link {
  padding-left: 2.25rem;
}

@media screen and (max-width: 40rem) {
  .wellred-reading h1 {
    margin-top: var(--wellred-rhythm-2);
    margin-bottom: var(--wellred-rhythm-2);
  }

  .wellred-reading > p:not(.article-browser__empty) {
    text-align: left;
  }

  .wellred-reading blockquote {
    margin-right: 0.75rem;
    margin-left: 0.75rem;
  }
}

/* ---------------------------------------------------------------------------
   Reading-surface corrections, 2026-08-15.

   Audited against the rendered site across all three collected-works lanes.
   Every rule here fixes a case where the shared foundation either fails to
   reach imported EPUB markup or carries a print value onto the screen.
   Source defects (orphaned note digits, flattened metadata tables, baked
   print hyphens) are deliberately NOT addressed here; they belong upstream.
   --------------------------------------------------------------------------- */

/* Reading measure. Imported text inherits the full Material content column:
   760px at 16px is ~97 characters per line against a comfortable 60-75.

   Clamp the container, not the individual elements. Per-element rules lose the
   cascade to existing class selectors (.body-text is (0,3,0) and carries
   `margin: 0`, so classed and unclassed paragraphs end up on different left
   edges), and an `em` max-width resolves against each element's own font-size,
   so headings would get a wider column than the prose beneath them. One
   container rule keeps every descendant on the same measure. */
.wellred-reading .epub-document {
  max-width: 34em;
  margin-inline: auto;
}

/* The same measure for the pages that lead to the chapters. .epub-document
   wraps imported chapter XHTML only; hooks.py gives lane and volume index
   pages the .wellred-reading wrapper alone, so the clamp above never reached
   them and they kept the full Material column — measured at ~94 and ~95
   characters per line against the ~68 of a chapter, which is essentially the
   ~97 this rule exists to remove.

   Clamped to the same 34em rather than a wider catalogue measure: the index
   blurb is running prose and reads as the first page of the book, so it
   should sit on the column the book sits on. Scoped to the wrapper's direct
   prose so the volume browser, cover, and nav are untouched. The two
   article-browser exclusions follow the reset above, which carries the same
   pair: those paragraphs are browser furniture, not running prose, and the
   cover is sized by its image rather than by the measure. */
.wellred-reading > p:not(.article-browser__empty):not(.article-browser__item):not(.collected-works-volume-cover),
.wellred-reading > ul,
.wellred-reading > ol,
.wellred-reading > blockquote {
  max-width: 34em;
  margin-inline: auto;
}

/* Tables are display matter, not running prose, so they keep the full content
   column rather than the text measure — the same argument as facsimile plates.
   Without this, LCW's dense reference tables render at 512px where they used
   to have 728px and wrap badly. Applies to wide and ordinary tables alike;
   the wide variant additionally scrolls internally via the rules further down. */
.wellred-reading .epub-document .table-scroll {
  position: relative;
  left: 50%;
  /* The viewport term matters: a break-out wider than the screen is centred
     half off the left edge, where nothing can scroll to it. */
  width: min(46em, 100% + 13rem, 100vw - 2rem);
  max-width: none;
  transform: translateX(-50%);
}

/* Screen rhythm. The canonical template's 1.27 is a paginated-EPUB value and
   reads as a solid block on screen at this measure. */
.wellred-reading .epub-document p,
.wellred-reading .epub-document .body-text,
.wellred-reading .epub-document li {
  line-height: 1.5;
}

/* Note containers nest in MECW (.editorial-endnotes > .footnote-container),
   and both carry 0.909em, so notes compounded down to 13.2px. Reset the
   inner container; the outer keeps the intended single step down. */
.wellred-reading .epub-document .editorial-endnotes .footnote-container,
.wellred-reading .epub-document .editorial-endnotes [data-epub-type="footnote"] {
  font-size: 1em;
}

/* Unresolved note markers. These are wrapped but unstyled, so they render as
   baseline body-size digits mid-sentence and read as corruption. Presenting
   them as markers is a viewer-side mitigation only - the upstream fix is
   marker reconciliation in the MECW build. */
.wellred-reading .epub-document .unresolved-marker-glyph {
  vertical-align: super;
  font-size: 0.7em;
  line-height: 0;
  color: var(--md-default-fg-color--light);
}

/* Notes block whitespace: the generated "Endnotes" heading sat tight against
   the separator rule, and consecutive notes ran together at 8.75px. */
.wellred-reading .epub-document h3.notes {
  margin-top: 0;
  margin-bottom: var(--wellred-rhythm-1);
  text-align: left;
}

.wellred-reading .epub-document .footnotes-separator {
  margin-bottom: var(--wellred-rhythm-2);
}

.wellred-reading .epub-document .editorial-endnotes .footnote-container {
  margin-bottom: var(--wellred-rhythm-1);
}

/* Volume cover. .collected-works-volume-cover is a <p>, so the
   `.wellred-reading > p:not(...)` reset above (0,2,1) beat it (0,1,0) and
   applied margin:0 - the cover lost both its centring and its rhythm. */
/* Volume intro: the jacket beside the blurb, not above or below it.

   Two columns rather than a float. Text wrapped around a floated jacket
   changes line length the moment it clears the image — on this column that is
   roughly 64 characters beside the cover and 95 below it, and the long lines
   are the ones carrying most of the blurb. Side by side, every line is the
   same 64, and the cover has no dead space beside it. */
.wellred-reading > .volume-intro {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  margin: 0.5rem 0 2rem;
}

.wellred-reading > .volume-intro > p.collected-works-volume-cover {
  /* Source order puts the cover first so it leads on a narrow screen; on a
     wide one it is ordered to the right of the text it introduces. */
  order: 2;
  flex: 0 0 auto;
  width: 11rem;
  max-width: 38%;
  margin: 0;
}

.wellred-reading > .volume-intro > p.collected-works-volume-cover img {
  width: 100%;
  height: auto;
  margin: 0;
}

.wellred-reading > .volume-intro > p:not(.collected-works-volume-cover) {
  order: 1;
  flex: 1 1 auto;
  /* Ragged right, deliberately. The blurb no longer matches the
     `.wellred-reading > p` reset now that it sits inside this wrapper, and
     left-aligned is the better default here anyway: a justified blurb at this
     width opens visible rivers, which is the designer's X-02 complaint in the
     one place on the page it is cheapest to avoid. */
  text-align: left;
  hyphens: manual;
  /* Without this a long unbroken blurb sets the flex base width from its
     content and pushes the cover off the row. */
  min-width: 0;
  max-width: none;
  margin: 0 0 var(--wellred-rhythm-1);
}

.wellred-reading > .volume-intro > p:last-child {
  margin-bottom: 0;
}

@media screen and (max-width: 50rem) {
  /* Below roughly 800px the text column would fall under 45 characters beside
     the jacket, so stack instead and let the cover lead the page. */
  .wellred-reading > .volume-intro {
    display: block;
  }

  .wellred-reading > .volume-intro > p.collected-works-volume-cover {
    width: min(10rem, 45%);
    max-width: none;
    margin: 0 auto 1.5rem;
  }
}


@media screen and (max-width: 40rem) {
  /* The override above only reaches `.wellred-reading > p`. Every imported
     paragraph is a descendant of .epub-document, so it stayed justified and
     hyphenated at ~41 characters per line, which produces heavy rivers. */
  .wellred-reading .epub-document p,
  .wellred-reading .epub-document .body-text,
  .wellred-reading .epub-document li {
    text-align: left;
    hyphens: manual;
  }
}

/* ---------------------------------------------------------------------------
   Canonical Wellred semantic vocabulary, synced 2026-08-23.

   The first viewer port carried the canonical font, headings, paragraphs,
   notes and tables, but left most template classes to Material defaults. That
   made the Wellred catalogue only superficially canonical and made equivalent
   MECW/LCW structures diverge whenever they used a shared class name. These
   are the scrolling-browser equivalents from the current Wellred production
   lane. Paginated-only properties are intentionally omitted.
   --------------------------------------------------------------------------- */

.wellred-reading .epub-document h4 {
  margin: var(--wellred-rhythm-1) 0;
  font-size: 1.1em;
  text-align: center;
}

.wellred-reading .epub-document h3.part-date,
.wellred-reading .epub-document h2.sigil_not_in_toc,
.wellred-reading .epub-document h3.sigil_not_in_toc {
  margin-top: var(--wellred-rhythm-1);
  margin-bottom: var(--wellred-rhythm-half);
}

.wellred-reading .epub-document h3.part-date {
  font-size: 1em;
  text-align: center;
}

.wellred-reading .epub-document h1.sigil_not_in_toc {
  text-align: center;
}

.wellred-reading .epub-document .chapter-opener.opener-bare h1 {
  margin-bottom: 1.4em;
}

.wellred-reading .epub-document .chapter-opener.opener-subtitle h1 {
  margin-bottom: 0.25em;
}

.wellred-reading .epub-document .sub,
.wellred-reading .epub-document .subtitle {
  margin: 0.6em 0 1.2em;
  font-size: 1.454em;
  font-style: italic;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .chapter-opener .subtitle {
  margin-top: 0;
  margin-bottom: 0.6em;
}

.wellred-reading .epub-document .chapter-opener.opener-subtitle .subtitle {
  margin-bottom: 1.8em;
}

.wellred-reading .epub-document .author,
.wellred-reading .epub-document .chapter-author,
.wellred-reading .epub-document .date,
.wellred-reading .epub-document .dateline,
.wellred-reading .epub-document .middle,
.wellred-reading .epub-document .mini-dateline {
  font-style: normal;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .author {
  margin: 0;
  font-size: 1.18em;
}

.wellred-reading .epub-document .chapter-author {
  margin: 0 0 var(--wellred-rhythm-3);
}

.wellred-reading .epub-document .date,
.wellred-reading .epub-document .dateline {
  margin: 0 0 1.6em;
  font-size: 0.909em;
}

.wellred-reading .epub-document .middle {
  margin: var(--wellred-rhythm-1) 0 0;
  font-size: 0.875em;
}

.wellred-reading .epub-document .mini-dateline {
  margin: 0 0 var(--wellred-rhythm-1);
  font-size: 0.875em;
}

.wellred-reading .epub-document .chapter-opener .opening-block > p,
.wellred-reading .epub-document .chapter-opener .opening-block > blockquote {
  margin-top: 0;
  margin-bottom: 0;
}

.wellred-reading .epub-document .opening-quote,
.wellred-reading .epub-document .chapter-opener .opening-block > blockquote.opening-quote {
  display: block;
  width: 18em;
  max-width: 100%;
  margin: var(--wellred-rhythm-half) 0 calc(var(--wellred-rhythm-1) + var(--wellred-rhythm-half)) auto;
  font-size: 0.833em;
  font-style: normal;
  line-height: 1.4;
  text-align: right;
  text-indent: 0;
}

.wellred-reading .epub-document .opening-quote p {
  margin: 0;
  text-align: right;
  text-indent: 0;
}

.wellred-reading .epub-document .opening-quote p + p,
.wellred-reading .epub-document .opening-block .attribution {
  margin-top: 0.45em;
}

.wellred-reading .epub-document .dedication,
.wellred-reading .epub-document .source {
  margin: var(--wellred-rhythm-2) 0;
  font-size: 0.909em;
  font-style: italic;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .source {
  margin: var(--wellred-rhythm-1) 0;
  color: var(--md-default-fg-color--light);
  font-size: 0.875em;
}

.wellred-reading .epub-document .intro {
  margin: 0 1.5em var(--wellred-rhythm-1);
  font-size: 0.909em;
  text-indent: 0;
}

.wellred-reading .epub-document .editor-note,
.wellred-reading .epub-document .editor-note-quote,
.wellred-reading .epub-document .footnote-quote {
  font-size: 0.875em;
  text-align: left;
  text-indent: 0;
}

.wellred-reading .epub-document .editor-note {
  margin: 0;
  padding-left: 2.188rem;
}

.wellred-reading .epub-document .editor-note-quote,
.wellred-reading .epub-document .footnote-quote {
  margin: var(--wellred-rhythm-half) 0 0 2.188rem;
  font-size: 0.792em;
  line-height: 1.4;
}

.wellred-reading .epub-document .no-space {
  margin-top: 0;
  margin-bottom: 0;
}

.wellred-reading .epub-document .small { font-size: 0.875em; }
.wellred-reading .epub-document .small-caps {
  font-size: 0.9em;
  font-variant: small-caps;
}
.wellred-reading .epub-document strong,
.wellred-reading .epub-document b,
.wellred-reading .epub-document .strong { font-weight: 700; }
.wellred-reading .epub-document .em { font-style: italic; }

.wellred-reading .epub-document .superscript {
  vertical-align: super;
  font-size: max(0.75em, 12px);
  line-height: 0;
}

.wellred-reading .epub-document p.page-header { display: none; }
.wellred-reading .epub-document p.glossary {
  margin-bottom: 0.3em;
  text-indent: 0;
}
.wellred-reading .epub-document p.poetry {
  margin: var(--wellred-rhythm-half) 1.5em;
  text-align: left;
  text-indent: 0;
}

.wellred-reading .epub-document .break {
  margin: var(--wellred-rhythm-2) 0;
  font-size: 1.2em;
  letter-spacing: 0.3em;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .numbered-list,
.wellred-reading .epub-document .bullet-list,
.wellred-reading .epub-document .abc-list {
  margin: var(--wellred-rhythm-1) 0;
  padding-left: 2.4em;
}

.wellred-reading .epub-document .bullet-list {
  padding-left: 1.5em;
  list-style: none;
}

.wellred-reading .epub-document .bullet-list > li::before {
  display: inline-block;
  width: 1.5em;
  margin-left: -1.5em;
  content: "–\00a0";
}

.wellred-reading .epub-document .abc-list,
.wellred-reading .epub-document li.a,
.wellred-reading .epub-document li.lower-alpha { list-style-type: lower-alpha; }
.wellred-reading .epub-document li.i { list-style-type: lower-roman; }
.wellred-reading .epub-document li.upper-alpha { list-style-type: upper-alpha; }
.wellred-reading .epub-document li.upper-roman { list-style-type: upper-roman; }

.wellred-reading .epub-document .quoted-numbered-list,
.wellred-reading .epub-document .quoted-bullet-list {
  margin: var(--wellred-rhythm-1) 0 var(--wellred-rhythm-1) 2.5rem;
  padding-left: 1em;
}

.wellred-reading .epub-document .list-paragraph,
.wellred-reading .epub-document .sub-list-paragraph {
  margin: 0 0 0 2.5rem;
  line-height: 1.5;
  text-indent: 0;
}

.wellred-reading .epub-document .sub-list-item,
.wellred-reading .epub-document .sub-list-paragraph { margin-left: 3.5rem; }

.wellred-reading .epub-document .letter-title,
.wellred-reading .epub-document .letter-start,
.wellred-reading .epub-document .letter-salutation,
.wellred-reading .epub-document .letter-end,
.wellred-reading .epub-document .letter-end-cont,
.wellred-reading .epub-document .letter-source,
.wellred-reading .epub-document .main-footer {
  font-style: normal;
  text-indent: 0;
}

.wellred-reading .epub-document .letter-title {
  margin: var(--wellred-rhythm-1) 0 0;
  font-style: italic;
  text-align: center;
}

.wellred-reading .epub-document .letter-start,
.wellred-reading .epub-document .letter-source {
  margin: 0 0 calc(var(--wellred-rhythm-half) + var(--wellred-rhythm-quarter));
  line-height: 1.2;
  text-align: right;
}

.wellred-reading .epub-document .letter-salutation {
  margin: var(--wellred-rhythm-1) 0;
  text-align: left;
}

.wellred-reading .epub-document .letter-end,
.wellred-reading .epub-document .main-footer {
  margin: var(--wellred-rhythm-2) 0 0;
  line-height: 1.2;
  text-align: right;
}

.wellred-reading .epub-document figure,
.wellred-reading .epub-document .figure {
  display: block;
  margin: var(--wellred-rhythm-1) 0;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document figcaption,
.wellred-reading .epub-document .figcaption {
  display: block;
  margin: var(--wellred-rhythm-1) 0;
  color: var(--md-default-fg-color--light);
  font-size: 0.875em;
  line-height: 1.3;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .inset-box {
  margin: var(--wellred-rhythm-2) 1.5em;
  padding: var(--wellred-rhythm-1);
  border: 1px solid var(--md-default-fg-color--lighter);
}

.wellred-reading .epub-document .bibliography,
.wellred-reading .epub-document .bibliography-sub {
  margin: var(--wellred-rhythm-half) 0 0;
  padding-left: 1.5em;
  font-size: 0.875em;
  line-height: 1.3;
  text-align: left;
  text-indent: -1.5em;
}

.wellred-reading .epub-document .bibliography-sub { margin-top: 0; }
.wellred-reading .epub-document .timeline { margin: 1.25em 0; }

.wellred-reading .epub-document .timeline-year {
  margin: 1.4em 0 0.7em;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document p.tl-runin {
  margin: 0 0 0.5em 2em;
  text-align: left;
  text-indent: -2em;
}

.wellred-reading .epub-document p.tl-runin .tl-sep { padding: 0 0.4em; }

.wellred-reading .epub-document .sgc-toc-level-1,
.wellred-reading .epub-document .sgc-toc-level-2,
.wellred-reading .epub-document .sgc-toc-level-3 {
  margin: 0.4em 0;
  text-align: left;
  text-indent: 0;
}
.wellred-reading .epub-document .sgc-toc-level-2 {
  margin-left: 1.5em;
  font-size: 0.9em;
}
.wellred-reading .epub-document .sgc-toc-level-3 {
  margin-left: 3em;
  font-size: 0.85em;
}

.wellred-reading .epub-document .part-number {
  margin: var(--wellred-rhythm-6) 0 var(--wellred-rhythm-2);
  font-size: 1.3em;
  font-style: italic;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .part-title,
.wellred-reading .epub-document .section-start {
  margin: var(--wellred-rhythm-2) 0;
  font-size: 1.909em;
  font-style: normal;
  line-height: 1.2;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .sub-heading {
  margin: var(--wellred-rhythm-2) 0 var(--wellred-rhythm-1);
  font-size: 1.5em;
  font-style: italic;
  text-align: left;
  text-indent: 0;
}

.wellred-reading .epub-document .right,
.wellred-reading .epub-document .numeric,
.wellred-reading .epub-document td.numeric,
.wellred-reading .epub-document th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wellred-reading .epub-document .no-break { break-inside: avoid; }

.wellred-reading .epub-document .title-page-inner {
  margin-top: 18vh;
  text-align: center;
}

.wellred-reading .epub-document .publisher-mark {
  margin-top: var(--wellred-rhythm-6);
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .publisher-mark img {
  width: 84px;
  max-width: 84px;
  margin: 0 auto var(--wellred-rhythm-half);
}

.wellred-reading .epub-document .placeholder { font-style: italic; }
.wellred-reading .epub-document .pagebreak_before { margin-top: var(--wellred-rhythm-4); }
.wellred-reading .epub-document .hero {
  margin: var(--wellred-rhythm-6) 0 var(--wellred-rhythm-4);
  font-size: 2.4em;
}

.wellred-reading .epub-document .toc-part {
  margin-top: 1em;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .toc-part-sub {
  display: block;
  margin: 0.15em 0 0.5em;
  font-size: 0.9em;
  font-style: italic;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document .table-text,
.wellred-reading .epub-document .table-header {
  margin: 0;
  padding: 0.35em 0.5em;
  font-size: 0.875em;
  font-style: normal;
  line-height: 1.3;
  text-align: left;
  text-indent: 0;
}

.wellred-reading .epub-document .table-header { font-weight: 700; }

/* Chronology year headings. The canonical template rules each year group off
   with a 1.5pt line above; on screen that is a body-row rule, which the
   browser table treatment does not use. The extra space above carries the
   grouping instead. */
.wellred-reading .epub-document td.chron-year {
  padding-top: 0.6em;
  padding-bottom: 0.3em;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  text-indent: 0;
}

.wellred-reading .epub-document table.dist-table {
  width: 100%;
  margin-top: var(--wellred-rhythm-1);
  border-collapse: collapse;
}

.wellred-reading .epub-document table.dist-table td {
  padding: 0.35em 0.5em;
  border: 0;
  font-size: 0.875em;
  text-align: center;
}

/* Anchor jumps land below the sticky header; a note target gets context
   without turning scholarly apparatus into card UI. */
.wellred-reading .epub-document [id] { scroll-margin-top: 5rem; }

.wellred-reading .epub-document [role="doc-footnote"]:target,
.wellred-reading .epub-document .footnote-container:target,
.wellred-reading .epub-document .endnote:target {
  background: color-mix(in srgb, var(--hc-accent-text) 8%, transparent);
}

@media screen and (max-width: 40rem) {
  /* The explicit return link already provides the useful destination on a
     phone; the full breadcrumb trail was a redundant second navigation row. */
  .wellred-reading .reader-context__trail { display: none; }
  .wellred-reading .epub-document .opening-quote { width: min(18em, 92%); }
  .wellred-reading .epub-document .editor-note { padding-left: 1.25rem; }
  .wellred-reading .epub-document .editor-note-quote,
  .wellred-reading .epub-document .footnote-quote { margin-left: 1.25rem; }
}

/* ---------------------------------------------------------------------------
   MECW block vocabulary, 2026-08-15.

   The MECW producer emits a deliberate semantic vocabulary that this
   stylesheet had never mapped, so every one of these classes inherited plain
   body-paragraph treatment: first-line indent, justification, no separation.
   Everything below is presentation for markup that is already correct at
   source. Classes left deliberately unmapped are the ones that need nothing:
   `.editorial-footnote` and `.author-footnote` are modifiers on an already
   styled `.footnote-container`; `.editorial-marker` and `.author-marker` are
   `<sup>` elements the browser already sets; `.outline-heading` and
   `.notes-heading` are headings covered by the element rules; `.opener-bare`
   modifies `.chapter-opener`; `.note-anchor` and `.outline-anchor` are empty
   link targets that must stay invisible.
   --------------------------------------------------------------------------- */

/* Adjudication glyphs are the same defect as .unresolved-marker-glyph above:
   a bare letter left inline at body size reads as a typo rather than a marker.
   Presentation only; the durable fix is marker reconciliation upstream. */
.wellred-reading .epub-document .image-adjudicated-marker {
  vertical-align: super;
  font-size: 0.7em;
  line-height: 0;
  color: var(--md-default-fg-color--light);
}

/* Editorial apparatus. These are the editors speaking, not the authors, and
   they must not read as body prose. */
.wellred-reading .epub-document .note-gap,
.wellred-reading .epub-document .residual-note-intro {
  display: block;
  margin: var(--wellred-rhythm-half) 0;
  font-size: 0.909em;
  font-style: italic;
  color: var(--md-default-fg-color--light);
  text-indent: 0;
  text-align: left;
}

.wellred-reading .epub-document .editorial-notes-residual {
  margin-top: var(--wellred-rhythm-2);
}

/* Verse. Marked correctly at source with <br> line breaks, so it only needs
   to stop behaving like a justified, first-line-indented paragraph. */
.wellred-reading .epub-document .verse-stanza {
  margin: var(--wellred-rhythm-1) 0 var(--wellred-rhythm-1) 2.5em;
  text-indent: 0;
  text-align: left;
  hyphens: manual;
}

/* Scene breaks: `* * *` was rendering as an indented, justified paragraph. */
.wellred-reading .epub-document .break {
  margin: var(--wellred-rhythm-2) 0;
  text-indent: 0;
  text-align: center;
}

/* Facsimile plates and their captions. */
.wellred-reading .epub-document .facsimile-plate {
  margin: var(--wellred-rhythm-2) 0;
  text-align: center;
}

.wellred-reading .epub-document .plate-inline-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--wellred-rhythm-1) auto;
}

.wellred-reading .epub-document .plate-caption {
  display: block;
  margin-top: var(--wellred-rhythm-half);
  font-size: 0.909em;
  font-style: italic;
  color: var(--md-default-fg-color--light);
  text-indent: 0;
  text-align: center;
}

/* Volume title pages are centred display matter, not running prose. */
.wellred-reading .epub-document .cover-art {
  margin: var(--wellred-rhythm-2) 0;
  text-align: center;
}

.wellred-reading .epub-document .volume-title-page {
  margin: var(--wellred-rhythm-half) 0;
  text-indent: 0;
  text-align: center;
}

.wellred-reading .epub-document .volume-title-series,
.wellred-reading .epub-document .volume-title-author {
  letter-spacing: 0.08em;
}

/* Front-matter and colophon furniture: present, but quieter than the text. */
.wellred-reading .epub-document .publisher,
.wellred-reading .epub-document .front-matter-editor-intro,
.wellred-reading .epub-document .production {
  font-size: 0.909em;
  color: var(--md-default-fg-color--light);
  text-indent: 0;
  text-align: left;
}

.wellred-reading .epub-document .production-page {
  margin-top: var(--wellred-rhythm-3);
}

.wellred-reading .epub-document .production-heading {
  margin-bottom: var(--wellred-rhythm-1);
  font-style: italic;
  color: var(--md-default-fg-color);
}

.wellred-reading .epub-document .production-title {
  margin-bottom: var(--wellred-rhythm-1);
  text-align: left;
}

/* ---------------------------------------------------------------------------
   LCW legacy vocabulary, 2026-08-16.

   Unlike MECW, these are not classes anyone designed for this viewer: they are
   marxists.org / Sigil residue carried through the import. They are mapped
   here because the LCW producer's own runtime stylesheet
   (`OEBPS/css/reading.css` in the candidate EPUBs) already defines them, on
   the same 14pt rhythm grid this file uses. These rules are a port of that
   intent, not a fresh design — check that file before changing them.

   One deliberate divergence is noted at .sig below.
   --------------------------------------------------------------------------- */

/* .fst is LCW's no-indent. 4,374 paragraphs were taking the book indent at the
   start of a block, which is precisely what the class exists to prevent. */
.wellred-reading .epub-document p.fst,
.wellred-reading .epub-document p.fst-r,
.wellred-reading .epub-document p.information,
.wellred-reading .epub-document p.footer {
  text-indent: 0;
}

.wellred-reading .epub-document p.fst-r {
  font-style: normal;
  text-align: right;
}

/* Correspondence structure. LCW is heavily epistolary and none of these were
   distinguishable from running prose. */
.wellred-reading .epub-document p.salutation,
.wellred-reading .epub-document p.saluation {
  margin: var(--wellred-rhythm-1) 0;
  font-style: normal;
  text-align: left;
  text-indent: 0;
}

.wellred-reading .epub-document p.closing {
  margin: var(--wellred-rhythm-2) 0 var(--wellred-rhythm-1);
  line-height: 1.2;
  font-style: normal;
  text-align: right;
  text-indent: 0;
}

.wellred-reading .epub-document p.closing + p.closing {
  margin-top: 0.15em;
}

.wellred-reading .epub-document p.placedate,
.wellred-reading .epub-document p.placesdate {
  margin: 0 0 var(--wellred-rhythm-1);
  font-size: 1em;
  font-style: normal;
  text-align: right;
  text-indent: 0;
}

/* .sig / .sigrest are LCW's spelling of .signature. Deliberate divergence from
   the producer stylesheet, which centres these: the viewer already sets
   signatures right-aligned for MECW and Wellred, and one house treatment
   across the three lanes is the point of this stylesheet. */
.wellred-reading .epub-document .sig,
.wellred-reading .epub-document .sigrest {
  margin: 0.7em 0 0;
  font-size: 1em;
  font-style: normal;
  text-align: right;
  text-indent: 0;
}

.wellred-reading .epub-document .sig + .sig,
.wellred-reading .epub-document .sig + .sigrest,
.wellred-reading .epub-document .signature + .sig,
.wellred-reading .epub-document .sigrest + .sigrest {
  margin-top: 0.25em;
}

/* Note apparatus. .endnote is already handled above; these are its siblings. */
.wellred-reading .epub-document p.ednote,
.wellred-reading .epub-document p.inote,
.wellred-reading .epub-document p.t2h-foot {
  margin: 0 0 var(--wellred-rhythm-1);
  font-size: 0.909em;
  line-height: 1.35;
  text-indent: 0;
}

/* Inline editorial interpolations — "(…—Ed)" — set apart from the author. */
.wellred-reading .epub-document span.inote,
.wellred-reading .epub-document span.anote,
.wellred-reading .epub-document span.sic {
  font-size: 0.909em;
  color: var(--md-default-fg-color--light);
}

/* Quoted matter. The viewer already resets .quote's indent; these are the
   variants, and they carry the producer's inset and size step. */
.wellred-reading .epub-document .quote,
.wellred-reading .epub-document p.quoteb,
.wellred-reading .epub-document p.quotec,
.wellred-reading .epub-document p.blockquote_inside_p,
.wellred-reading .epub-document p.indent,
.wellred-reading .epub-document p.indentb {
  margin-left: 1.5rem;
  margin-right: 1.5rem;
  font-size: 0.909em;
  text-indent: 0;
}

.wellred-reading .epub-document p.indent-list {
  margin-left: 2.5rem;
  text-indent: 0;
}

.wellred-reading .epub-document p.hanging_indent {
  margin: 0.2em 0;
  padding-left: 1.5em;
  text-indent: -1.5em;
}

.wellred-reading .epub-document p.toc,
.wellred-reading .epub-document span.toc {
  display: block;
  margin: 0.3em 0;
  padding-left: 1.5em;
  text-align: left;
  text-indent: -1.5em;
}

/* Display lines: work titles and subtitles are centred matter, not prose. */
.wellred-reading .epub-document p.title,
.wellred-reading .epub-document p.sub,
.wellred-reading .epub-document .subtitle {
  margin: var(--wellred-rhythm-1) 0;
  font-style: italic;
  text-align: center;
  text-indent: 0;
}

.wellred-reading .epub-document h1 span.h3small {
  font-size: 0.7em;
}

.wellred-reading .epub-document span.smc {
  font-variant: small-caps;
}

/* Lenin's manuscript underlinings survive only as these classes; unstyled,
   the emphasis they record was invisible. */
.wellred-reading .epub-document .lenin-underline-double,
.wellred-reading .epub-document .lenin-underline-quad,
.wellred-reading .epub-document .lenin-underline-wavy,
.wellred-reading .epub-document .lenin-underline-wavy-double {
  letter-spacing: 0.25em;
}

.wellred-reading .epub-document .center,
.wellred-reading .epub-document td.center,
.wellred-reading .epub-document th.center {
  text-align: center;
}

/* The producer hides these spacer paragraphs outright. */
.wellred-reading .epub-document .skip {
  display: none;
}

.wellred-reading .epub-document table.border {
  width: auto;
  margin: var(--wellred-rhythm-1) auto;
  border-collapse: collapse;
}

.wellred-reading .epub-document table.border td,
.wellred-reading .epub-document table.border th {
  border: 0.5px solid var(--md-default-fg-color--lighter);
  padding: 0.3em 0.5em;
  vertical-align: top;
}

.wellred-reading .epub-document table.info,
.wellred-reading .epub-document table.infobloc {
  font-size: 0.909em;
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Collected-works tables — one shared header treatment

   The three lanes used to arrive with three different table conventions,
   because they come from three producers: the Wellred upgrader emitted no
   <thead> and no <th> and marked its heading row by italicising the cells,
   the Wellred cleaner emitted <thead> with <td> cells, and LCW arrives
   pre-wrapped from its own pipeline. Styling each convention separately
   would have meant one stylesheet holding a shim per lane.

   That is now settled in the importer instead: _normalise_table_headers()
   in import_collected_works.py promotes a header row to <thead> with
   <th scope="col"> cells for every lane, so the rules below are plain
   structural CSS with nothing lane-specific in them.

   The treatment is the designer's recipe from the snag list: delete the
   rules, add back only what is needed — one fine rule under the column
   headings, 0.125pt (1px as it lands on screen) — and let space do the rest
   of the separating. The viewer already had no table rules at all, so what
   is added here is the one line they asked to keep, plus the gap.
   -------------------------------------------------------------------------- */

.wellred-reading .epub-document .table-scroll--wide {
  /* The importer wraps producer-marked content tables so this element owns
     the viewport while the table keeps its intrinsic column geometry. */
  background-repeat: no-repeat;
  background-size: 2.5rem 100%, 2.5rem 100%, 0.9rem 100%, 0.9rem 100%;
  background-position: left center, right center, left center, right center;
  background-attachment: local, local, scroll, scroll;
  background-image:
    linear-gradient(to right, var(--md-default-bg-color) 40%, transparent),
    linear-gradient(to left, var(--md-default-bg-color) 40%, transparent),
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 16%), transparent),
    radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 16%), transparent);
}

.wellred-reading .epub-document table.content-table {
  margin: 0;
  border-collapse: collapse;
}

/* The canonical template's table perimeter (2pt over, 1.5pt under) and its
   per-row ruling are paginated-print values, and the browser lane has already
   settled the other way: no perimeter, no body-row rules, one fine rule under
   genuine column headings. `.content-table--compact` and `--quiet` therefore
   need no browser rules of their own — all three modes render identically
   here, because the mode system exists to vary ruling the screen does not
   have. See "Screen values are not template values" in
   UNIFIED-CSS-FOUNDATION.md.

   Space, not rules, does the separating. Slightly wider column gutters than
   the generic table padding, so adjacent figures read as separate columns
   without a vertical rule between them. */
.wellred-reading .epub-document table.content-table td,
.wellred-reading .epub-document table.content-table th {
  padding: 0.3em 0.9em;
  vertical-align: baseline;
}

/* Header cells were <td> in every lane before the importer promoted them, so
   the browser defaults for <th> — bold, centred — would change how existing
   books look. Neutralise both; .center still wins where the producer set it,
   carrying one more class than this selector. */
.wellred-reading .epub-document thead th {
  font-weight: normal;
  text-align: left;
}

/* Canonical heading treatment, without the canonical heading rules: the
   single fine rule below is set once on the row, immediately after. */
.wellred-reading .epub-document table.content-table thead th,
.wellred-reading .epub-document table.content-table thead td {
  font-variant: small-caps;
  letter-spacing: 0.03em;
}

/* The single fine rule under the column headings, and the gap beneath it. */
.wellred-reading .epub-document thead > tr {
  border-bottom: 1px solid var(--md-default-fg-color--light);
}

.wellred-reading .epub-document thead > tr > th,
.wellred-reading .epub-document thead > tr > td {
  padding-bottom: 0.45em;
}

.wellred-reading .epub-document thead + tbody > tr:first-child > td,
.wellred-reading .epub-document thead + tbody > tr:first-child > th {
  padding-top: 0.55em;
}

/* Table captions. The designer wants table titles lifted out of the table
   body and set as a caption, and sources moved out to a note. The lifting is
   producer work; this is the presentation waiting for it, so a caption is
   styled the day one is emitted rather than inheriting heading italics. */
.wellred-reading .epub-document table caption {
  caption-side: top;
  margin-bottom: var(--wellred-rhythm-half);
  font-size: 0.909em;
  font-style: normal;
  line-height: 1.3;
  text-align: left;
  color: var(--md-default-fg-color--light);
}

/* Still not expressible, and deliberately not guessed at: the designer also
   asks for centred data columns and distinct treatment for total rows and
   columns. CSS cannot tell a row label from a datum, nor a total from
   ordinary data, and :last-child would style any table whose final row
   happens to be data. Both need a marker from the producer — .center already
   exists for the first. */

/* LCW marks section divisions with a bare <hr class="section"> — 1,765 of
   them. A full-width rule across the reading column is heavier than the
   division warrants; match the restrained separator already used for notes. */
.wellred-reading .epub-document hr.section {
  display: block;
  width: 25%;
  margin: var(--wellred-rhythm-2) auto;
  border: 0;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

/* ---------------------------------------------------------------------------
   Reading-surface polish, 2026-08-23. Each item below was found by sweeping
   every built page at three widths in both themes, not by reading the CSS.
   -------------------------------------------------------------------------- */

/* Footnote references rendered at 10–11px — the smallest text anywhere in the
   corpus, and one of the few things a reader has to hit deliberately. <sup>
   applies its own reduction on top of the note-sizing already in place, so the
   two compounded. Floor the size, and enlarge the hit area with padding that
   is cancelled by an equal negative margin, so the line box does not move. */
.wellred-reading .epub-document sup {
  /* Size the reference here, once. The browser's own `smaller` on <sup> was
     reducing 16px to 13.3px and anything set on the anchor then reduced it
     again, which is how a note number ended up at 10.4px. line-height: 0 keeps
     the raised number from stretching the line it sits in. */
  /* A floor, not just a ratio: inside the notes block the surrounding text is
     already reduced to ~14.5px, so a purely relative size lands back at 11px.
     max() keeps the proportion in body text and the floor everywhere else. */
  font-size: max(0.78em, 12px);
  line-height: 0;
  vertical-align: super;
}

.wellred-reading .epub-document sup a.footnote-ref,
.wellred-reading .epub-document sup a[data-epub-type="noteref"],
.wellred-reading .epub-document a.footnote-ref {
  /* inherit, not a second reduction. The padding enlarges the hit area and the
     equal negative margin cancels it, so the line box does not move. */
  font-size: inherit;
  padding: 0.5em 0.3em;
  margin: -0.5em -0.3em;
  text-decoration: none;
}

/* Breadcrumb and pager links measured 23px tall, one pixel under the 24px
   minimum for a pointer target. They are the primary way back out of a
   chapter, so they should not be the hardest thing on the page to hit. */
.wellred-reading .reader-context a,
.wellred-reading .article-pager a {
  min-height: 24px;
  line-height: 24px;
}

/* Two syntax-highlighting tokens in Material's own palette land just under
   4.5:1 on the slate background (4.45 and 4.48). They appear in the operations
   docs' shell blocks. Nudged rather than restyled. */
[data-md-color-scheme="slate"] .highlight .m,
[data-md-color-scheme="slate"] .highlight .mi,
[data-md-color-scheme="slate"] .highlight .mf {
  color: #f2897b;
}

[data-md-color-scheme="slate"] .highlight .nb {
  color: #a99cf0;
}

/* Back-references inside the notes block ("[1]" returning to the text) are the
   same kind of target as the reference itself and were 16-19px tall. Same
   treatment: a floor on the size, and a hit area that does not move the line. */
.wellred-reading .epub-document [data-epub-type="footnote"] a,
.wellred-reading .epub-document .footnote-container a,
.wellred-reading .epub-document .footnote-para a,
.wellred-reading .epub-document .footnote a,
.wellred-reading .epub-document .endnote a,
.wellred-reading .epub-document .editorial-endnotes a {
  font-size: max(1em, 12px);
  padding: 0.45em 0.3em;
  margin: -0.45em -0.3em;
}

/* Collected-works contents pages.

   MECW contents labels carry the printed numbering inside the link text —
   "1. On the Early History of the Germans" — while the EPUB marks the list up
   as <ol>. The browser then numbers it again and the reader sees
   "3. 1. On the Early History of the Germans". The printed number is the
   authority, so suppress the generated one. Sub-entries carry no printed
   number and get no marker, which matches the printed contents.

   Scoped to the TOC section: ordered lists in body prose keep their numbering.
   LCW and Wellred contents pages do not use <ol> and are unaffected. */
.epub-document section[data-epub-type="toc"] ol {
  list-style: none;
  padding-left: 1.6em;
}
.epub-document section[data-epub-type="toc"] > ol {
  padding-left: 0;
}

/* Work-level metadata — "Written in late May 1883", "First published in…",
   "Printed according to…" — reads as ordinary prose and gets lost at the end
   of a work. In print it is apparatus, set apart from the text.

   These carry `body-text no-indent work-metadata`, so the mobile rule that
   left-aligns `.body-text` was cancelling the centring: it looked correct on
   desktop and like body prose on a phone. `p.work-metadata` outranks it, so
   the treatment now holds at every width. */
.wellred-reading .epub-document p.work-meta,
.wellred-reading .epub-document p.work-metadata {
  text-align: center;
  text-indent: 0;
  font-size: 0.82em;
  line-height: 1.35;
  color: var(--md-default-fg-color--light);
  margin-top: 0;
  margin-bottom: 0.2em;
}

/* Open the block away from the prose, and close it before the notes. */
.wellred-reading .epub-document p:not(.work-metadata):not(.work-meta) + p.work-metadata,
.wellred-reading .epub-document p:not(.work-metadata):not(.work-meta) + p.work-meta {
  margin-top: 2em;
  padding-top: 1.1em;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}
.wellred-reading .epub-document p.work-metadata:last-of-type,
.wellred-reading .epub-document p.work-meta:last-of-type {
  margin-bottom: 1.6em;
}

/* Extended quotations. The print sets them a full step down from the body —
   7.96pt against 9.95pt on MECW vol 26 physical page 140 — and the builder
   flattened them to ordinary paragraphs, so a quoted letter read as Engels'
   own prose. Paragraphs carrying `quotation` are the adjudicated ones. */
.wellred-reading .epub-document p.quotation {
  font-size: 0.88em;
  line-height: 1.45;
  margin-left: 1.6em;
  margin-right: 0.4em;
  text-indent: 0;
}
.wellred-reading .epub-document p.quotation + p.quotation {
  margin-top: 0.55em;
  text-indent: 1.2em;
}
.wellred-reading .epub-document p:not(.quotation) + p.quotation {
  margin-top: 1em;
}
.wellred-reading .epub-document p.quotation + p:not(.quotation) {
  margin-top: 1em;
  /* Body text resuming after a quotation is a fresh start, not a continuation,
     so it takes no indent — the same convention as after a section break. 103
     paragraphs in Volume 26 alone. */
  text-indent: 0;
}

/* The paragraph after a section break takes the book indent, which reads as a
   continuation rather than a fresh start. Wellred's convention is no indent
   after a break, as after a heading or a chapter opener. */
.wellred-reading .epub-document p.break + p,
.wellred-reading .epub-document p.break + p.body-text {
  text-indent: 0;
}
