/* Shared presentation: shell, document/collection forms, prose, components.
 * Cover artwork and fitted typography live in covers.css.
 * Values preserve the frozen pre-refactor appearance, including its responsive
 * and language-specific differences. This is hand-maintained CSS, not generated.
 */

@font-face {
  font-family: "Vollkorn";
  src: url("/fonts/vollkorn/vollkorn-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans/noto-sans-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
}

@font-face {
  font-family: "Literata";
  src: url("/fonts/literata/literata-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Literata";
  src: url("/fonts/literata/literata-latin-variable-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  /* Locked logo colors are independent of the reading palette. */
  --mw-logo-red: #C73E1D;
  --mw-logo-green: #006B3C;
  --mw-logo-foreground: #000000;
  --mw-border-red: var(--mw-logo-red);
  --mw-border-neutral: #666666;
  --mw-border-green: var(--mw-logo-green);
  --mw-cover-border-gradient: linear-gradient(
    90deg,
    var(--mw-border-red) 0 42%,
    var(--mw-border-neutral) 50%,
    var(--mw-border-green) 58% 100%
  );
  --mw-section-divider: rgb(0 0 0 / 50%);
  --reader-canvas: #F1EFE9;
  --reader-surface: #FBFAF7;
  --reader-raised: #F5F2EA;
  --reader-callout: #E9E4D9;
  --reader-text: #363430;
  --reader-heading: #1D1C1A;
  --reader-muted: #504E48;
  --reader-link: #174E82;
  --reader-visited: #604078;
  --reader-monk: #922B14;
  --reader-witch: #005B33;
  --reader-rule: #D6D2C8;
  --reader-control-border: #77736A;
  --reader-focus: #174E82;
  --progress-track: var(--reader-rule);
  --progress-saga: #805500;
  --progress-book: var(--reader-link);
  --release-amber-background: #F7E4B0;
  --release-amber-border: #9A6700;
  --release-amber-text: #4A3200;
  --action-background: #2B2926;
  --action-color: #FBFAF7;
  --action-border: var(--reader-control-border);
  --action-hover-background: var(--reader-heading);
  --action-hover-color: var(--reader-surface);
  --action-focus: var(--reader-focus);
  --reader-font: "Literata", Georgia, "Times New Roman", serif;
  --reader-ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reader-measure: 64ch;
  --reader-shell: 48rem;
  --reader-landing-shell: min(740px, 66ch);
  --reader-gutter: clamp(1rem, 4.5vw, 1.5rem);
  --page-gap: clamp(1rem, 3vw, 1.5rem);
  --panel-padding: clamp(1rem, 3vw, 1.5rem);
  --reader-progress-height: 0.25rem;
  --reader-progress-gap: 1px;
}

html {
  background: var(--reader-canvas);
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  --shell-width: var(--reader-shell);
  display: block;
  margin: 0;
  padding: 0;
  background: var(--reader-canvas);
  color: var(--reader-text);
  font-family: var(--reader-ui-font);
  font-size: 1.18em;
  line-height: 1.55;
}

.shell--collection {
  --shell-width: var(--reader-landing-shell);
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 0.18em;
}

p {
  margin: 0 0 1em;
}

/* The cover compositor supplies its own heading typography. */
h1 {
  font-family: "Vollkorn", serif;
  font-style: normal;
  font-weight: 700;
  font-synthesis: none;
}

.page-frame {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--shell-width);
  margin-inline: auto;
}

.page-frame > :is(main, nav.pagination, .reading-progress-group) {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

::selection {
  background: var(--reader-link);
  color: var(--reader-surface);
}

.page-content {
  --page-content-padding-start: clamp(1.25rem, 3vw, 2.5rem);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--reader-shell);
  min-width: 0;
  margin-inline: auto;
  padding:
    var(--page-content-padding-start)
    max(var(--reader-gutter), env(safe-area-inset-right))
    clamp(1.5rem, 4vw, 3rem)
    max(var(--reader-gutter), env(safe-area-inset-left));
  border: 0;
  background: var(--reader-surface);
  color: var(--reader-text);
  font-size: 1rem;
}

.shell--collection .page-content {
  padding: var(--page-gap) 0 0;
  background: transparent;
  font-size: inherit;
}

.document,
.collection--reading,
.prose {
  max-width: var(--reader-measure);
  margin-inline: auto;
  color: var(--reader-text);
  font-family: var(--reader-font);
  font-size: clamp(1.125rem, 1.04rem + 0.35vw, 1.25rem);
  font-style: normal;
  font-weight: 400;
  font-synthesis: none;
  font-optical-sizing: auto;
  line-height: 1.68;
  text-align: left;
  word-spacing: normal;
  letter-spacing: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.prose p,
.prose li {
  font-size: 1em;
  line-height: inherit;
}

.prose p {
  margin: 0 0 1.05em;
}

.prose :is(ul, ol) {
  margin-block: 0 1.2em;
  padding-inline-start: 1.4em;
}

.prose li + li {
  margin-block-start: 0.35em;
}

:where(.document, .collection--reading, .prose) :is(strong, b) {
  font-weight: 650;
  letter-spacing: normal;
}

.prose p strong {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.prose em,
.prose i {
  font-style: italic;
}

.prose > :last-child,
.document > :last-child,
.collection > :last-child,
.panel > :last-child {
  margin-block-end: 0;
}

:where(.document, .collection--reading, .prose, .panel) :is(h1, h2, h3) {
  display: block;
  color: var(--reader-heading);
  border: 0;
  font-family: var(--reader-font);
  font-style: normal;
  font-weight: 650;
  font-synthesis: none;
  font-optical-sizing: auto;
  text-wrap: balance;
}

:where(.document, .collection--reading, .prose) h1 {
  margin: 0.2em 0 0.9em;
  padding: 0;
  font-size: clamp(2rem, 1.55rem + 2.2vw, 3rem);
  line-height: 1.15;
  text-align: center;
}

:where(.document, .collection--reading, .prose, .panel) h2 {
  margin: 1.7em 0 0.65em;
  font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem);
  line-height: 1.22;
  text-align: left;
}

.home-page__contents > h2 {
  margin-block-start: 0;
}

:where(.document, .collection--reading, .prose, .panel) h3 {
  margin: 1.55em 0 0.55em;
  font-size: clamp(1.25rem, 1.16rem + 0.4vw, 1.4rem);
  line-height: 1.28;
  text-align: left;
}

.page-header {
  margin-block-end: clamp(1.4rem, 4vw, 2.25rem);
}

.page-header + .release-notices {
  margin-block-start: -0.6em;
}

/* Hero profiles render their lead portrait directly after the header. Keep it
 * visually connected to the title without changing spacing for other media. */
.page-header + .shortcode-picture {
  display: block;
  margin-block-start: clamp(-1.25rem, -2vw, -0.75rem);
}

/* The picture shortcode remains manuscript-owned. A leading portrait keeps its
 * existing relationship to the heading/status, across the new prose boundary. */
:is(.page-header, .release-notices) + .prose > .shortcode-picture:first-child,
.prose .release-notices + .shortcode-picture {
  display: block;
  margin-block-start: -0.3em;
}

@media (max-width: 600px) {
  body {
    font-size: 1em;
  }

  :is(.page-header, .release-notices) + .prose > .shortcode-picture:first-child,
  .prose .release-notices + .shortcode-picture {
    margin-block-start: -0.5em;
  }
}

@media (min-width: 601px) {
  .page-header + .release-notices {
    margin-block-start: -1em;
  }
}

.kicker {
  margin: 0 0 0.55rem;
  color: var(--reader-muted);
  opacity: 1;
  font-family: var(--reader-ui-font);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  word-spacing: 0.08em;
  hyphens: none;
  overflow-wrap: normal;
}

.role-title {
  color: var(--reader-heading);
  font-family: "Vollkorn", serif;
  font-weight: 700;
}

.role-title--monk .role-title__role {
  color: var(--reader-monk);
}

.role-title--witch .role-title__role {
  color: var(--reader-witch);
}

.term {
  font-size: 1em;
  font-variant-caps: normal;
  white-space: normal;
  font-weight: 550;
}

:where(.document, .collection--reading, .prose, .panel, .site-footer, .error-page__choices) a {
  color: var(--reader-link);
  text-decoration-line: underline;
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.16em;
}

:where(.document, .collection--reading, .prose, .panel, .site-footer, .error-page__choices) a:visited {
  color: var(--reader-visited);
}

:where(.document, .collection--reading, .prose, .panel, .site-footer, .error-page__choices) a:focus-visible,
nav.pagination a:focus-visible,
.action:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid var(--reader-focus);
  outline-offset: 0.2rem;
}

@media (hover: hover) {
  :where(.document, .collection--reading, .prose, .panel, .site-footer, .error-page__choices) a:hover {
    text-decoration-thickness: 0.12em;
  }
}

/**********
  Reader Navigation
**********/

nav.pagination a,
nav.pagination span {
  margin: 0 0.2em;
  text-decoration: none;
}

.nav-icon {
  font-size: 0.9em;
  letter-spacing: -0.08em;
}

nav.pagination .prev > i {
  margin-inline-end: 0.25em;
}

nav.pagination .next > i {
  margin-inline-start: 0.25em;
}

nav.pagination {
  display: grid;
  grid-template-areas: "prev context next";
  grid-template-columns: minmax(4.5rem, 1fr) auto minmax(4.5rem, 1fr);
  align-items: stretch;
  box-sizing: border-box;
  width: min(100%, var(--reader-shell));
  min-height: 52px;
  margin-inline: auto;
  padding: 0.25rem var(--reader-gutter);
  border: 0;
  border-inline: 0;
  border-block: 1px solid var(--reader-rule);
  background: var(--reader-surface);
  color: var(--reader-heading);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
}

.shell--collection .page-frame > nav.pagination {
  border-inline: 1px solid var(--reader-rule);
}

.page-frame > nav.pagination:first-of-type {
  border-block-start: 0;
}

nav.pagination > .prev {
  grid-area: prev;
  justify-self: start;
}

nav.pagination > .next {
  grid-area: next;
  justify-self: end;
}

.pagination__context {
  grid-area: context;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
}

nav.pagination > :is(a, .prev, .next),
.pagination__context > :is(a, span) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  margin: 0;
  padding: 0.45rem 0.55rem;
  color: var(--reader-link);
  text-decoration: none;
}

nav.pagination .disabled {
  color: var(--reader-muted);
  opacity: 1;
}

nav.pagination .sep {
  min-height: 44px;
  padding-inline: 0.2rem;
  color: var(--reader-muted);
  opacity: 1;
}

nav.pagination .sep.bar {
  display: none;
}

.reading-progress-group {
  width: min(100%, var(--reader-shell));
  display: grid;
  row-gap: var(--reader-progress-gap);
  margin-inline: auto;
  background: var(--reader-surface);
}

.reading-progress {
  --progress-fill: var(--progress-book);
  width: 100%;
  height: var(--reader-progress-height);
  background: var(--progress-track);
}

.reading-progress--saga {
  --progress-fill: var(--progress-saga);
}

.reading-progress--book {
  --progress-fill: var(--progress-book);
}

.reading-progress__fill {
  display: block;
  width: var(--progress-value);
  height: 100%;
  background: var(--progress-fill);
}

.reading-progress--placeholder {
  background: var(--progress-track);
}

/**********
  Collection Composition, Panels, and Actions
**********/

.book-page {
  padding-block-end: var(--page-gap);
}

.home-page__cover,
.book-page__cover--with-action {
  margin-block-end: var(--page-gap);
}

.book-page__cover {
  padding-block: 0 var(--page-gap);
}

.book-page__cover--with-action {
  padding-block-end: 0;
}

.book-page__cover > .book-page__cover-action {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.book-page__contents {
  margin-block-start: var(--page-gap);
}

.book-page__contents .book-toc h2 {
  margin-block-start: 0;
}

.book-page__status .release-notices {
  margin: 0;
}

.panel,
.more.more--ruled {
  box-sizing: border-box;
  padding: var(--panel-padding);
  border: 1px solid var(--reader-rule);
  background: var(--reader-surface);
}

.panel :is(p, li):last-child {
  margin-block-end: 0;
  padding-block-end: 0;
}

.action-row {
  margin-block: 0 var(--page-gap);
}

.home-page .language-switcher {
  margin-inline: 0;
  margin-block: var(--page-gap);
  padding: 0;
  border: 1px solid var(--reader-rule);
  background: var(--reader-surface);
  font-size: 1em;
}

.home-page .language-switcher :is(ul, li) {
  width: 100%;
}

.home-page .language-switcher ul {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-page .language-switcher a {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  color: var(--reader-link);
  font-family: var(--reader-ui-font);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  text-underline-offset: 0.15em;
  opacity: 1;
  transition: none;
}

.language-switcher__spacer {
  visibility: hidden;
}

@media (hover: hover) {
  .home-page .language-switcher a:hover {
    background: var(--reader-raised);
    color: var(--reader-link);
  }
}

/**********
  Notes, Quotations, and Status
**********/

.prose blockquote {
  position: relative;
  margin: 1.65em 0;
  padding: 1.1em 1.15em;
  border: 0;
  border-inline-start: 3px solid var(--reader-control-border);
  background: var(--reader-raised);
  color: var(--reader-text);
  font-family: inherit;
  font-size: 1em;
  font-style: normal;
  line-height: inherit;
}

.prose blockquote::before {
  content: none;
}

/* Keep the decorative opening mark inside its French quotation. */
.prose:lang(fr) blockquote {
  padding-inline-start: 3.25em;
}

.prose:lang(fr) blockquote::before {
  content: "«";
  position: absolute;
  top: 0.6rem;
  left: 0.25rem;
  color: color-mix(in srgb, currentColor 42%, transparent);
  font-size: 3.4em;
  line-height: 0.8;
}

.prose blockquote p {
  margin-block: 0 0.8em;
}

.prose blockquote p:last-child {
  margin-block-end: 0;
}

/* Canonical more block: a short bookmark using the native link color in each theme. */
.more {
  position: relative;
  margin: 1.65em 0;
  padding-block: 1.625rem 1.6875rem;
  padding-inline: 3.375rem 1.625rem;
  border: 0;
  border-radius: 0.4375rem;
  background: var(--reader-raised);
  color: var(--reader-text);
  font-family: var(--reader-font);
  font-size: 1.1875rem;
  line-height: 1.72;
}

.more::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 1.3125rem;
  inline-size: 0.875rem;
  block-size: 1.875rem;
  background: var(--reader-link);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  pointer-events: none;
}

.more__inner.prose {
  max-width: none;
  margin-inline: 0;
  font-size: inherit;
  line-height: inherit;
}

.more p {
  font-size: inherit;
}

.more p:last-child {
  margin-bottom: 0;
}

.more .more__title {
  margin: 0 0 0.625rem;
  color: var(--reader-heading);
  font-family: var(--reader-ui-font);
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: 0.015em;
  text-transform: none;
}

@media (max-width: 30rem) {
  .more {
    padding-block: 1.4375rem 1.5rem;
    padding-inline: 2.9375rem 1.1875rem;
    font-size: 1.125rem;
  }

  .more::before {
    inset-inline-start: 1.125rem;
  }
}

/* Compact chapter-opening invitation; retain the standard bookmark treatment. */
.more.more--compact {
  padding-block: 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

.more--compact .more__title {
  margin-bottom: 0.375rem;
}

/* Ruled character/author links are the second established notice treatment. */
.more.more--ruled {
  border-radius: 0;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.more--ruled::before {
  content: none;
}

.more--ruled .more__title {
  padding-block: 0 0.5rem;
  margin: 0 0 0.625rem;
  border-block-end: 1px solid var(--reader-rule);
  font-family: var(--reader-font);
  font-size: clamp(1.25rem, 1.16rem + 0.4vw, 1.4rem);
  font-weight: 450;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.more--ruled .more__inner > p:not(.more__title) {
  margin: 0;
}

.more__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 2.1875rem;
  margin-block-start: 0.625rem;
}

.more__links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
  min-inline-size: 0;
  min-block-size: 2.75rem;
  padding-block-end: 0.25rem;
  border-block-end: 1px solid currentColor;
  font-size: 1.1875rem;
  /* Keep names consistent; the native dark red also needs large, bold text. */
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
}

.more__links a[data-role="monk"],
.more__links a[data-role="monk"]:visited {
  color: var(--reader-monk);
}

.more__links a[data-role="witch"],
.more__links a[data-role="witch"]:visited {
  color: var(--reader-witch);
}

.more--ruled .more__links a:hover {
  text-decoration: none;
}

.more__arrow {
  flex-shrink: 0;
  font-family: var(--reader-ui-font);
  font-size: 1.1875rem;
  line-height: 1;
}

.release-status,
.release-status--grey,
.release-status--silver {
  border: 1px solid var(--reader-rule);
  background: var(--reader-raised);
  box-shadow: none;
  color: var(--reader-text);
}

.release-status {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  max-width: none;
  min-height: 48px;
  margin: 0;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  text-align: center;
  word-spacing: normal;
  letter-spacing: normal;
}

.release-status__label {
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.release-status > .release-status__label {
  margin: 0;
  color: var(--reader-heading);
  font-family: var(--reader-ui-font);
  line-height: 1.4;
}

.release-notices {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

/* The same action may be an anchor or the non-interactive release label. Cover
 * profiles only supply --action-* values; they do not own these mechanics. */
.action {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  width: 100%;
  min-height: 48px;
  padding: 0.75em 1.25em;
  border: 2px solid var(--action-border);
  border-block-start-width: 0;
  background: var(--action-background);
  box-shadow: none;
  color: var(--action-color);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.015em;
  line-height: 1.2;
  text-decoration: none;
}

.action:visited {
  color: var(--action-color);
}

.release-status--amber {
  border-color: var(--release-amber-border);
  background: var(--release-amber-background);
  color: var(--release-amber-text);
}

.release-status--amber > .release-status__label {
  color: inherit;
}

.action__label {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
}

a.action:hover {
  background: var(--action-hover-background);
  color: var(--action-hover-color);
}

.action--compact {
  gap: 0.45em;
  padding: 0.7rem 0.9em;
  line-height: 1.25;
}

.prose hr {
  width: 3rem;
  margin: clamp(2rem, 7vw, 3.5rem) auto;
  border: 0;
  border-block-start: 1px solid var(--reader-rule);
}

.chapter-page .prose hr {
  width: 100%;
  margin-inline: 0;
}

/**********
  Contents and Saga Links
**********/

.toc-list {
  margin: 1.25rem 0 0;
  border: 0;
}

.toc-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.toc-list li {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-block-start: 1px solid var(--reader-rule);
}

.toc-list a:hover,
.toc-list a:focus {
  text-decoration: underline;
}

.toc-list li:first-child {
  border-block-start: 0;
}

.toc-list li + li {
  margin-block-start: 0.35em;
}

.toc-list li::before {
  content: none;
}

.toc-list a {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0.65rem 0.35rem;
  color: var(--reader-link);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
}

.toc-list a:visited {
  color: var(--reader-visited);
}

.toc-list__number,
.saga-book-number {
  color: var(--reader-muted);
  opacity: 1;
  font-family: var(--reader-ui-font);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.chapter-list {
  margin: 0;
  padding-inline-start: 1.45rem;
  color: var(--reader-heading);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  line-height: 1.45;
}

.chapter-entry {
  margin: 0;
  padding-block: 0.25rem;
  border-block-start: 1px solid var(--reader-rule);
}

.chapter-entry:first-child {
  border-block-start: 0;
}

.chapter-entry-unnumbered {
  list-style-type: disc;
}

.chapter-title,
.scene-list a {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.55rem 0.25rem;
  color: var(--reader-link);
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
}

.chapter-title:visited,
.scene-list a:visited {
  color: var(--reader-visited);
}

.scene-list {
  margin: 0 0 0.5rem;
  padding-inline-start: 1.2rem;
}

.scene-list li {
  margin: 0;
}

.saga-heading ~ h3 {
  margin-block-end: 0.45rem;
}

.saga-book-row {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  align-items: center;
  box-sizing: border-box;
  min-height: 48px;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.35rem;
  border-block-start: 1px solid var(--reader-rule);
  color: var(--reader-link);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
}

.saga-book-row:visited {
  color: var(--reader-visited);
}

.saga-book-row--title-only {
  grid-template-columns: minmax(0, 1fr);
}

.saga-book-title {
  font-size: 1rem;
  line-height: 1.4;
}

.saga-book-number {
  align-self: start;
  text-transform: uppercase;
  word-spacing: normal;
  text-decoration: none;
}

.saga-book-awesome {
  margin-right: 0.4em;
  text-decoration: none;
}

.saga-book-title-text {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (max-width: 300px) {
  .saga-book-row {
    gap: 0.09em;
  }

  .saga-book-number {
    align-self: auto;
  }
}

/**********
  Tables and Book Facts
**********/

.table-scroll {
  box-sizing: border-box;
  max-width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--reader-rule);
  background: var(--reader-surface);
}

.table-scroll table {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
  color: var(--reader-text);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
  line-height: 1.45;
}

.table-scroll th,
.table-scroll td {
  min-width: 4.25rem;
  padding: 0.65rem 0.6rem;
  border: 0;
  border-block-end: 1px solid var(--reader-rule);
  text-align: left;
  vertical-align: top;
}

.table-scroll th {
  background: var(--reader-raised);
  color: var(--reader-heading);
  font-weight: 700;
}

.table-scroll th:empty {
  display: table-cell;
}

.table-scroll :is(th, td):last-child {
  text-align: right;
}

.table-scroll tbody tr:last-child td {
  border-block-end: 0;
}

@media (hover: hover) {
  .table-scroll tbody tr:hover {
    background: var(--reader-raised);
  }
}

.book-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  box-sizing: border-box;
  margin: var(--page-gap) 0 0;
  padding: 0;
  border: 1px solid var(--reader-rule);
  background: var(--reader-surface);
  color: var(--reader-text);
  font-family: var(--reader-ui-font);
}

.book-facts--with-listen-time {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.book-facts__item {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  padding: 0.8rem 0.5rem;
  text-align: center;
}

.book-facts__item + .book-facts__item {
  border-inline-start: 1px solid var(--reader-rule);
}

.book-facts dt {
  margin: 0 0 0.35rem;
  color: var(--reader-muted);
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.book-facts dd {
  margin: 0;
  color: var(--reader-heading);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/**********
  Non-cover Media
**********/

.prose img,
.panel img {
  max-width: 100%;
  height: auto;
}

/* These are the existing picture-shortcode classes, not layered book covers. */
.cover {
  display: block;
  box-sizing: border-box;
  width: auto;
  height: auto;
  max-width: min(100%, var(--cover-max-width));
  max-height: var(--cover-max-height);
  margin: 0 auto 0.85em;
  border: 2px solid #ccc;
}

.cover.portrait {
  --cover-max-width: 600px;
  --cover-max-height: 800px;
  border-color: #aaa;
  filter: brightness(1.2);
}

.cover.avatar {
  --cover-max-width: 240px;
  --cover-max-height: 240px;
}

.prose .cover.portrait {
  border: 1px solid var(--reader-rule);
  box-shadow: none;
  filter: none;
}

@media (max-width: 600px) {
  .cover {
    --cover-max-width: 100%;
    --cover-max-height: 70vh;
    margin-bottom: 0.75em;
  }
}

.not-the-end {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  margin: 0 auto 1.5em;
}

.not-the-end img {
  display: block;
  width: min(calc(50% - 0.5rem), 16rem);
  height: auto;
}

.not-the-end img:first-child {
  margin-top: 0.25rem;
  width: min(calc(45% - 0.45rem), 12rem);
}

.prose pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--reader-rule);
  background: var(--reader-raised);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  line-height: 1.5;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  overflow-wrap: normal;
}

/**********
  Footer and Error Page
**********/

.site-footer {
  --site-footer-inline-space: max(
    var(--reader-gutter),
    env(safe-area-inset-left),
    env(safe-area-inset-right)
  );
  background: var(--reader-canvas);
  color: var(--reader-muted);
  font-family: var(--reader-ui-font);
}

.site-footer-inner {
  box-sizing: border-box;
  width: min(100%, var(--shell-width));
  max-width: var(--shell-width);
  margin-inline: auto;
  padding-inline: 0;
}

.site-community-links {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  position: static;
  width: 100%;
  max-width: none;
  gap: 0.35rem 0.75rem;
  margin: 0;
  padding: 0.5rem var(--site-footer-inline-space);
  border-block-end: 1px solid var(--reader-rule);
}

.site-community-links::after {
  content: none;
}

.community-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  white-space: nowrap;
  min-height: 44px;
  padding-inline: 0.25rem;
  color: var(--reader-link);
  font-size: 1.125rem;
  line-height: 1.4;
  opacity: 1;
  text-decoration: none;
}

.community-link > span {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.community-link > i {
  font-size: 1.15em;
}

.attribs {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--reader-measure);
  margin: 0 auto;
  padding: 0.8rem var(--site-footer-inline-space) 1.2rem;
}

.attribs p {
  margin: 0 0 0.75rem;
  color: var(--reader-muted);
  opacity: 1;
  font-size: 0.875rem;
  line-height: 1.55;
  text-align: left;
  word-spacing: normal;
  letter-spacing: normal;
}

.attribs p:last-child {
  margin-bottom: 0;
}

.shell--collection .site-footer :is(.site-community-links, .attribs) {
  padding-block: 0.5em;
}

.shell--collection .attribs p:last-child {
  margin-bottom: 0.75rem;
}

body.error-page .page-content {
  display: grid;
  align-items: center;
  min-height: 68vh;
  padding-block: clamp(1.25rem, 4vw, 2.5rem);
}

.error-page__content {
  container-type: inline-size;
  width: 100%;
  max-width: 42rem;
  border: 1px solid var(--reader-rule);
  background: var(--reader-surface);
  box-shadow: 0 0.35rem 1rem rgb(0 0 0 / 0.08);
}

.error-page__brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: clamp(7rem, 23vw, 10rem);
  padding: clamp(1.5rem, 6vw, 2.75rem) clamp(1rem, 5vw, 2rem);
  overflow: hidden;
  border-block-end: 2px solid transparent;
  background:
    linear-gradient(#171712, #171712) padding-box,
    var(--mw-cover-border-gradient) border-box;
  color: #FFF3DC;
  text-decoration: none;
  isolation: isolate;
}

.error-page__brand::before,
.error-page__brand::after {
  position: absolute;
  z-index: -1;
  width: 55%;
  height: 180%;
  border-radius: 50%;
  content: "";
  filter: blur(2.25rem);
  opacity: 0.24;
}

.error-page__brand::before {
  top: -80%;
  left: -20%;
  background: var(--mw-logo-red);
}

.error-page__brand::after {
  right: -20%;
  bottom: -80%;
  background: var(--mw-logo-green);
}

.error-page__brand:visited {
  color: #FFF3DC;
}

.error-page__brand:focus-visible {
  outline-color: #FFF3DC;
  outline-offset: -5px;
}

@media (hover: hover) {
  .error-page__brand:hover .error-page__brand-title {
    transform: scale(1.015);
  }
}

.error-page__brand-title {
  color: inherit;
  font-family: "Noto Sans", system-ui, sans-serif;
  font-size: clamp(0.95rem, 6.2cqi, 2.45rem);
  font-weight: 700;
  font-synthesis: none;
  letter-spacing: 0.035em;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 0.05em 0.12em rgb(0 0 0 / 0.3);
  text-transform: uppercase;
  text-wrap: balance;
  transition: transform 160ms ease-out;
  white-space: nowrap;
}

.error-page__body {
  padding: clamp(1.5rem, 5vw, 2.5rem);
}

.error-page__code {
  color: var(--reader-monk);
}

.error-page__content h1 {
  margin-block-start: 0;
  margin-block-end: clamp(1.25rem, 4vw, 1.75rem);
  font-size: clamp(1.8rem, 1.35rem + 2vw, 2.6rem);
}

.error-page__message {
  text-align: center;
}

.error-page__message p {
  margin-block-end: 0.55em;
}

.error-page__content h1 span {
  white-space: nowrap;
}

.error-page__content h1 span::before {
  content: " · ";
}

.error-page__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-block-start: clamp(1.5rem, 5vw, 2rem);
  font-family: var(--reader-ui-font);
  font-size: 1rem;
}

.error-page__choices a {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--action-border);
  background: var(--action-background);
  color: var(--action-color);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.error-page__choices a:visited {
  color: var(--action-color);
}

.error-page__choices a span {
  margin-inline-start: 0.45em;
}

@media (hover: hover) {
  .error-page__choices a:hover {
    background: var(--action-hover-background);
    color: var(--action-hover-color);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --mw-logo-foreground: #FFFFFF;
    --mw-border-red: rgb(199 62 29 / 75%);
    --mw-border-neutral: rgb(102 102 102 / 75%);
    --mw-border-green: rgb(0 107 60 / 75%);
    --mw-section-divider: rgb(255 255 255 / 50%);
    --reader-canvas: #10110F;
    --reader-surface: #181A17;
    --reader-raised: #20221F;
    --reader-callout: #20221F;
    --reader-text: #D8D5CC;
    --reader-heading: #F1EEE6;
    --reader-muted: #B7B3AA;
    --reader-link: #8EC5FF;
    --reader-visited: #BFA1D8;
    /* Role accents are bold headings; this true red clears AAA for large text. */
    --reader-monk: #FF453A;
    --reader-witch: #77D3A6;
    --reader-rule: #3A3D37;
    --reader-control-border: #6A6E66;
    --reader-focus: #8EC5FF;
    --progress-saga: #E4B46A;
    --release-amber-background: #332A16;
    --release-amber-border: #D9A441;
    --release-amber-text: #FFE19A;
    --action-background: #D8D5CC;
    --action-color: #181A17;
  }

  .site-footer {
    color: var(--reader-text);
  }

  .cover {
    border-color: #777;
    box-shadow: 0 0 0.35em rgba(0, 0, 0, 0.55);
    filter: brightness(1.25);
  }

  .cover.portrait {
    border-color: #777;
    filter: brightness(1);
  }

  .not-the-end img {
    filter: invert(1) brightness(0.9);
  }

}

@media (max-width: 48rem) {
  .page-content {
    max-width: none;
  }
}

@media (max-width: 712px) {
  .shell--collection .page-frame > nav.pagination,
  .shell--collection .action,
  .shell--collection .panel,
  .home-page .language-switcher,
  .book-facts {
    border-inline: 0;
  }
}

@media (max-width: 720px) {
  .attribs {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .not-the-end {
    gap: 0.5rem;
  }

  .not-the-end img {
    width: min(calc(50% - 0.25rem), 10rem);
  }

  .not-the-end img:first-child {
    width: min(calc(45% - 0.225rem), 7.25rem);
  }

  .site-community-links {
    padding-block: 0.65rem;
  }

  .community-link {
    padding-inline: 0.45rem;
    font-size: 0.9rem;
  }
}

@media (min-width: 22rem) and (max-width: 30rem) {
  .site-community-links {
    justify-content: space-between;
    gap: 0;
  }

  .community-link {
    gap: 0.3em;
    padding-inline: 0.125rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 35rem) {
  .error-page__choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .error-page__content h1 span {
    display: block;
    margin-block-start: 0.25em;
    white-space: normal;
  }

  .error-page__content h1 span::before {
    content: none;
  }
}

@media (max-width: 22rem) {
  nav.pagination {
    grid-template-areas:
      "context context"
      "prev next";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  nav.pagination > .prev,
  nav.pagination > .next {
    width: 100%;
  }

  .pagination__context {
    border-block-end: 1px solid var(--reader-rule);
  }

}

@media (forced-colors: active) {
  .reading-progress {
    background: CanvasText;
  }

  .reading-progress__fill {
    background: Highlight;
  }

  .document,
  .collection--reading,
  .prose,
  .panel,
  .page-content,
  nav.pagination,
  .site-footer,
  .book-facts,
  .table-scroll {
    forced-color-adjust: auto;
    background: Canvas;
    color: CanvasText;
  }

  .role-title--monk .role-title__role,
  .role-title--witch .role-title__role,
  .more__links a[data-role],
  .more__links a[data-role]:visited,
  :where(.document, .collection--reading, .prose, .panel, .site-footer) a,
  nav.pagination a {
    color: LinkText;
  }

  :where(a, [tabindex]):focus-visible {
    outline-color: Highlight;
  }
}

@media print {
  :root {
    --reader-canvas: #fff;
    --reader-surface: #fff;
    --reader-raised: #fff;
    --reader-callout: #fff;
    --reader-text: #000;
    --reader-heading: #000;
    --reader-muted: #222;
    --reader-link: #000;
    --reader-visited: #000;
    --reader-monk: #000;
    --reader-witch: #000;
    --reader-rule: #777;
    --reader-control-border: #777;
    --reader-focus: #000;
    --action-background: #fff;
    --action-color: #000;
  }

  html {
    overflow-y: auto;
    background: #fff;
  }

  nav,
  nav.pagination,
  .reading-progress-group,
  .site-footer {
    display: none;
  }

  body,
  .document,
  .collection--reading,
  .page-content,
  .prose,
  .panel,
  .book-facts,
  .table-scroll {
    border-color: #777;
    background: white;
    color: black;
  }

  .page-content,
  .document,
  .collection--reading,
  .prose {
    max-width: none;
  }

  body,
  .document,
  .collection--reading,
  .prose {
    font-size: 11pt;
    line-height: 1.55;
  }

  .cover {
    border-color: #ddd;
  }

  .release-status--grey,
  .release-status--silver,
  .release-status--amber {
    break-inside: avoid;
  }

  .table-scroll {
    overflow: visible;
  }

  .table-scroll table {
    width: 100%;
  }
}

/* Chapter listening is a standalone YouTube link with no player assets. */
.chapter-listen {
  container: chapter-listen / inline-size;
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
  z-index: 2;
  margin-block: clamp(1.4rem, 4vw, 2.25rem);
}
.page-header:has(+ .chapter-listen),
.page-header:has(+ .chapter-listen) h1 {
  margin-block-end: 0;
}
.youtube-bar,
.youtube-bar:visited {
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid #454742;
  border-radius: 10px;
  background: #454742;
  color: #fff;
  text-decoration: none;
}
.youtube-bar { font: 600 0.9375rem/1.35 var(--reader-ui-font); }
.youtube-bar__label { min-width: 0; }
.youtube-bar__logo { flex: none; display: block; width: 130px; height: auto; }
.youtube-bar__external { flex: none; width: 18px; height: 18px; margin-inline-start: auto; }
@media (hover: hover) {
  .youtube-bar:hover {
    background: #454742;
    color: #fff;
    box-shadow: inset 0 0 0 2px #fff;
    text-decoration: none;
  }
}
.youtube-bar:focus-visible { outline: 3px solid var(--reader-focus); outline-offset: 0.2rem; }
@container chapter-listen (max-width: 600px) {
  .youtube-bar { gap: 10px; font-size: 0.875rem; }
  .youtube-bar__logo { width: 110px; }
}
@media (max-width: 440px) {
  .youtube-bar__comment { display: none; }
}
@container chapter-listen (max-width: 360px) {
  .youtube-bar { gap: 12px; padding-inline: 12px; }
  .youtube-bar__logo { width: 100px; }
  .youtube-bar__external { width: 16px; height: 16px; }
}
@media (width < 300px) {
  .youtube-bar { gap: 8px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .youtube-bar { transition: box-shadow 0.15s; }
}
@media (forced-colors: active) {
  .youtube-bar { border-color: LinkText; }
  .youtube-bar__logo { fill: LinkText; }
}
@media print {
  .chapter-listen { display: none; }
}
