:root {
  color-scheme: light;
  --ui-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --book-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --paper: #fffdfc;
  --canvas: #f7f3f0;
  --sidebar: #eee7e7;
  --sidebar-deep: #e5dada;
  --ink: #3a343d;
  --ink-strong: #24202a;
  --muted: #6f6672;
  --faint: #8c818c;
  --rule: #d8cbcb;
  --rule-strong: #bdaeb2;
  --accent: #75465b;
  --accent-strong: #5b3043;
  --accent-soft: #f0e1e7;
  --nebula-blue: #4f607e;
  --warm: #8e5b36;
  --focus: #9a5e31;
  --shadow: 0 18px 50px rgba(67, 49, 63, 0.12);
  --sidebar-width: 292px;
  --topbar-height: 66px;
  --reader-size: 18px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15131a;
  --canvas: #0a0b10;
  --sidebar: #0d0d12;
  --sidebar-deep: #211922;
  --ink: #e2dbe1;
  --ink-strong: #f4eef2;
  --muted: #b8adb5;
  --faint: #8d828b;
  --rule: #342833;
  --rule-strong: #574251;
  --accent: #d28a9a;
  --accent-strong: #f1b0bd;
  --accent-soft: #2a1f28;
  --nebula-blue: #8098c0;
  --warm: #d5a06e;
  --focus: #d5a06e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  scroll-padding-top: calc(var(--topbar-height) + 24px);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--ui-font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.sidebar-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--warm);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--ink-strong);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 120;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: transparent;
}

#reading-progress-bar,
.reading-progress__bar {
  display: block;
  width: 0;
  height: 100%;
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--nebula-blue), var(--focus));
  transition: width 80ms linear;
}

.topbar {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-height);
  padding: 0 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 76%, transparent);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(16px);
}

.topbar__brand,
.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: var(--ink-strong);
  text-decoration: none;
}

.brand__mark,
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 76%, transparent);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.brand-mark__jet {
  fill: var(--nebula-blue);
  opacity: 0.88;
}

.brand-mark__orbit {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
}

.brand-mark__core {
  fill: var(--warm);
  stroke: color-mix(in srgb, var(--paper) 70%, transparent);
  stroke-width: 1;
}

.brand-mark__electron {
  fill: var(--accent-strong);
}

.brand-mark text {
  fill: var(--paper);
  font-family: var(--ui-font);
  font-size: 5.7px;
  font-weight: 900;
  letter-spacing: -0.06em;
  pointer-events: none;
}

.brand__copy {
  min-width: 0;
}

.brand__title,
.brand-title,
.topbar__title {
  overflow: hidden;
  color: var(--ink-strong);
  font-family: var(--book-font);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__subtitle,
.topbar__subtitle {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__spacer {
  flex: 1;
}

.reader-controls,
.topbar__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button,
.control-button,
#toc-toggle,
#search-toggle,
#font-decrease,
#font-increase,
#theme-toggle,
#search-close {
  display: inline-grid;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.icon-button:hover,
.control-button:hover,
#toc-toggle:hover,
#search-toggle:hover,
#font-decrease:hover,
#font-increase:hover,
#theme-toggle:hover,
#search-close:hover {
  border-color: var(--rule);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#toc-toggle {
  display: none;
}

.control-divider {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--rule);
}

.book-sidebar {
  position: fixed;
  z-index: 110;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  overflow: hidden;
  border-right: 1px solid var(--rule);
  background:
    radial-gradient(circle at 18% 4%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 30%),
    var(--sidebar);
}

.sidebar-header,
.sidebar-heading {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--rule);
}

.sidebar-header__edition,
.sidebar-heading .eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sidebar-header__title,
.sidebar-title {
  margin: 6px 0 0;
  color: var(--ink-strong);
  font-family: var(--book-font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.15;
}

.book-nav {
  height: calc(100% - 190px);
  overflow-y: auto;
  padding: 18px 14px 34px;
  overscroll-behavior: contain;
  scrollbar-color: var(--rule-strong) transparent;
  scrollbar-width: thin;
}

.sidebar-authors {
  margin: 7px 0 0;
  color: var(--muted);
  font-family: var(--book-font);
  font-size: 11px;
  line-height: 1.35;
}

.book-nav-list,
#page-outline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-nav-item {
  margin: 0;
  padding: 0;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-group-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-group__title,
.nav-group-title {
  margin: 0 10px 7px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-nav a {
  display: block;
  align-items: start;
  margin: 2px 0;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
}

.nav-label {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-title {
  display: block;
}

.book-nav a:hover {
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  color: var(--ink-strong);
}

.book-nav a[aria-current="page"],
.book-nav a.is-active {
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  color: var(--accent-strong);
  font-weight: 750;
}

.book-nav a[aria-current="page"] .nav-label {
  color: var(--accent);
}

.sidebar-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--sidebar) 92%, transparent);
  font-size: 10px;
}

.sidebar-footer a {
  display: block;
  color: var(--muted);
  text-decoration: none;
}

.sidebar-footer a + a {
  margin-top: 5px;
}

.nav-link__number,
.nav-number {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.book-nav a[aria-current="page"] .nav-link__number,
.book-nav a[aria-current="page"] .nav-number {
  color: var(--accent);
}

.sidebar-scrim,
#sidebar-scrim {
  display: none;
}

.reader-layout {
  display: grid;
  width: min(1180px, calc(100% - var(--sidebar-width)));
  grid-template-columns: minmax(0, 790px) 220px;
  gap: 66px;
  align-items: start;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 54px) 54px 130px;
}

.reader-content,
#reader-content {
  min-width: 0;
  container-name: reader;
  container-type: inline-size;
}

.book-section {
  width: 100%;
  min-height: 68vh;
  padding: clamp(32px, 5vw, 58px) clamp(26px, 6vw, 68px) clamp(58px, 7vw, 84px);
  border: 1px solid color-mix(in srgb, var(--rule) 72%, transparent);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--book-font);
  font-size: var(--reader-size);
  line-height: 1.7;
}

.book-section > :first-child {
  margin-top: 0;
}

.section-kicker,
.chapter-kicker,
.book-section__eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.book-section h1,
.book-section h2,
.book-section h3,
.book-section h4 {
  color: var(--ink-strong);
  font-family: var(--book-font);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.16;
  text-wrap: balance;
}

.book-section h1 {
  margin: 0 0 0.72em;
  font-size: clamp(2.25rem, 4.6vw, 3.65rem);
}

.book-section h2 {
  margin: 2.15em 0 0.72em;
  padding-top: 0.25em;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
}

.book-section h3 {
  margin: 1.8em 0 0.6em;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
}

.book-section h4 {
  margin: 1.5em 0 0.45em;
  font-size: 1.08em;
  font-style: italic;
}

.book-section p {
  margin: 0.9em 0;
  hanging-punctuation: first last;
  text-wrap: pretty;
}

.book-section ul,
.book-section ol {
  margin: 0.85em 0 1.15em;
  padding-left: 1.45em;
}

.book-section li {
  margin: 0.28em 0;
  padding-left: 0.22em;
}

.book-section hr {
  height: 1px;
  margin: 2.4em 0;
  border: 0;
  background: var(--rule);
}

.book-section b,
.book-section strong {
  color: var(--ink-strong);
}

.heading-permalink {
  margin-left: 0.35em;
  color: var(--rule-strong);
  font-family: var(--ui-font);
  font-size: 0.55em;
  font-weight: 600;
  opacity: 0;
  text-decoration: none;
  transition: opacity 120ms ease, color 120ms ease;
  vertical-align: 0.12em;
}

h1:hover > .heading-permalink,
h2:hover > .heading-permalink,
h3:hover > .heading-permalink,
.heading-permalink:focus-visible {
  color: var(--accent);
  opacity: 1;
}

.book-section img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2.1em auto 0.85em;
  object-fit: contain;
}

.book-section img.inline-diagram {
  margin-block: 1.35em;
}

.book-figure,
.book-section figure {
  margin: 2.4em 0 2.6em;
}

.book-figure img,
.book-section figure img {
  margin: 0 auto;
}

.book-figure figcaption,
.book-section figcaption {
  max-width: 96%;
  margin: 0.9em auto 0;
  color: var(--muted);
  font-family: var(--book-font);
  font-size: 0.82em;
  font-style: italic;
  line-height: 1.48;
}

.figure-label {
  color: var(--ink-strong);
  font-family: var(--ui-font);
  font-size: 0.86em;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.figure-caption-text {
  color: inherit;
}

.table-scroll {
  max-width: 100%;
  margin: 1.9em 0 2.2em;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: color-mix(in srgb, var(--canvas) 50%, var(--paper));
  -webkit-overflow-scrolling: touch;
}

.book-section table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 0.72em;
  font-variant-numeric: tabular-nums;
  line-height: 1.38;
}

.book-section th,
.book-section td {
  padding: 0.55em 0.72em;
  border-right: 1px solid color-mix(in srgb, var(--rule) 72%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 72%, transparent);
  text-align: left;
  vertical-align: top;
}

.book-section th {
  background: var(--sidebar-deep);
  color: var(--ink-strong);
  font-weight: 750;
}

.book-section tr:last-child > * {
  border-bottom: 0;
}

.book-section tr > *:last-child {
  border-right: 0;
}

.book-section .table-caption {
  padding: 0.9em 1em 0.95em;
  border-bottom: 1px solid var(--rule-strong);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
    color-mix(in srgb, var(--paper) 72%, var(--sidebar-deep));
  color: var(--ink-strong);
  text-align: left;
  white-space: normal;
}

.table-caption__number {
  display: block;
  margin-bottom: 0.25em;
  color: var(--accent);
  font-size: 0.76em;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-caption__title {
  display: inline;
  font-family: var(--book-font);
  font-size: 1.1em;
  font-weight: 650;
  line-height: 1.35;
}

.table-caption__continuation {
  display: inline-block;
  margin-left: 0.6em;
  color: var(--muted);
  font-size: 0.74em;
  font-style: italic;
  font-weight: 600;
}

.math-source {
  color: var(--ink-strong);
  font-family: "Times New Roman", var(--book-font);
}

.math-inline {
  display: inline-block;
  max-width: 100%;
  margin-inline: 0.035em;
  line-height: 1;
  vertical-align: -0.08em;
  white-space: nowrap;
}

.math-inline .katex {
  font-size: 1em !important;
}

.math-display {
  display: block;
  max-width: 100%;
  margin: 1.25em 0;
  padding: 0.85em 0.7em;
  overflow-x: auto;
  border-block: 1px solid color-mix(in srgb, var(--rule) 68%, transparent);
  background: color-mix(in srgb, var(--canvas) 42%, transparent);
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.katex-display {
  max-width: 100%;
  margin: 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3em 0;
}

.katex {
  color: var(--ink-strong);
  font-size: 1.02em !important;
}

.math-error {
  border-bottom: 1px dotted var(--warm);
  color: var(--warm);
}

.original-frontmatter,
.publication-details {
  margin-top: 2.2em;
  padding: 1.1em 1.25em;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--canvas) 46%, var(--paper));
}

.original-frontmatter summary,
.publication-details summary {
  color: var(--accent-strong);
  font-family: var(--ui-font);
  font-size: 0.82em;
  font-weight: 750;
  cursor: pointer;
}

.cover-hero {
  position: relative;
  display: grid;
  min-height: 640px;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: clamp(24px, 4cqi, 38px);
  align-items: center;
  margin: calc(clamp(32px, 5vw, 58px) * -1) calc(clamp(26px, 6vw, 68px) * -1) 2.6em;
  padding: clamp(48px, 7vw, 82px) clamp(30px, 6vw, 68px);
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(117, 70, 91, 0.42), transparent 33%),
    radial-gradient(circle at 88% 74%, rgba(79, 96, 126, 0.35), transparent 34%),
    linear-gradient(145deg, #090a0e, #17121a 58%, #10131b);
  color: #f4eef2;
}

.cover-hero::before {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 0.65px, transparent 0.9px);
  background-position: 11px 17px;
  background-size: 61px 61px;
  content: "";
  opacity: 0.17;
  pointer-events: none;
}

.cover-hero__copy,
.cover-hero__visual {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.cover-hero__edition {
  margin: 0 0 18px;
  color: #d5a06e;
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cover-hero h1,
.book-section .cover-hero h1 {
  max-width: none;
  margin: 0;
  color: #fffafb;
  font-size: clamp(2.35rem, 7cqi, 3.75rem);
  line-height: 0.98;
}

.cover-hero__authors {
  margin: 1.6em 0 0;
  color: #d8cdd6;
  font-family: var(--ui-font);
  font-size: 0.83em;
  line-height: 1.7;
}

.cover-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: #eff8f7;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.primary-action {
  border-color: #e0ad7b;
  background: #f3dfca;
  color: #2a1d21;
}

.secondary-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.cover-hero__visual figure {
  margin: 0;
}

.cover-hero__visual img {
  width: 100%;
  height: clamp(360px, 48cqi, 480px);
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.4);
  object-fit: cover;
  object-position: 54% 50%;
}

@container reader (max-width: 720px) {
  .cover-hero {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .cover-hero__visual {
    width: min(78%, 330px);
    justify-self: center;
  }

  .cover-hero h1,
  .book-section .cover-hero h1 {
    max-width: 12ch;
    font-size: clamp(2.45rem, 11cqi, 3.6rem);
  }
}

.cover-hero__visual figcaption {
  max-width: none;
  margin: 11px 0 0;
  color: #b8adb5;
  font-family: var(--ui-font);
  font-size: 10px;
  font-style: normal;
  line-height: 1.45;
}

.cover-hero__caption a {
  color: #d5a06e;
}

.publication-details__body {
  display: grid;
  gap: 1em;
  padding-top: 1em;
}

.study-notice,
.publication-card,
.source-publication-record {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
}

.study-notice {
  padding: clamp(1.15em, 3vw, 1.6em);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--rule));
  background:
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--nebula-blue) 18%, transparent), transparent 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, var(--paper)), var(--paper));
  font-family: var(--ui-font);
}

.study-notice__eyebrow {
  margin: 0 0 0.65em !important;
  color: var(--accent);
  font-size: 0.62em;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-section .study-notice h2,
.book-section .publication-card h2 {
  margin: 0 0 0.55em;
  padding: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.study-notice p {
  max-width: none;
  margin-block: 0.65em;
  font-size: 0.78em;
  line-height: 1.55;
}

.study-notice__support {
  color: var(--ink-strong);
  font-weight: 750;
}

.study-notice__clarification {
  color: var(--muted);
  font-size: 0.66em !important;
}

.publication-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin-top: 1em;
}

.publication-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0.65em 0.85em;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--paper);
  font-size: 0.7em;
  font-weight: 750;
  text-decoration: none;
}

.publication-action--buy {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffafb;
}

.publication-action--buy:hover {
  background: var(--accent-strong);
  color: #fff;
}

.publication-card {
  padding: 1.25em;
  font-family: var(--ui-font);
}

.publication-card dl {
  display: grid;
  grid-template-columns: minmax(6em, 0.25fr) minmax(0, 1fr);
  gap: 0.4em 1em;
  margin: 0;
  font-size: 0.7em;
  line-height: 1.5;
}

.publication-card dt {
  color: var(--muted);
  font-weight: 750;
}

.publication-card dd {
  margin: 0;
  color: var(--ink-strong);
}

.publication-citation {
  margin: 1em 0 0 !important;
  padding-top: 0.9em;
  border-top: 1px solid var(--rule);
  font-size: 0.67em;
  line-height: 1.5;
}

.source-publication-record {
  padding: 0.9em 1em;
  font-family: var(--ui-font);
}

.source-publication-record > summary {
  font-size: 0.72em;
}

.source-publication-record__body {
  padding-top: 1em;
  color: var(--muted);
  font-size: 0.7em;
}

.book-section .original-edition-figure {
  max-width: 390px;
  margin: 0 auto 2em;
}

.book-section .original-edition-figure img {
  max-height: 420px;
  margin: 0 auto;
}

.book-section .original-edition-figure figcaption {
  font-size: 0.78em;
}

.restoration-note {
  display: block;
  margin: -1.2em 0 2.2em;
  padding: 0.75em 0.9em;
  border-left: 3px solid var(--focus);
  background: color-mix(in srgb, var(--focus) 9%, transparent);
  color: var(--muted);
  font-family: var(--ui-font);
  font-size: 0.68em;
  line-height: 1.5;
}

.contents-directory {
  display: grid;
  gap: 1.35em;
  margin-top: 2em;
}

.contents-group {
  padding-bottom: 1.35em;
  border-bottom: 1px solid var(--rule);
}

.contents-group:last-child {
  border-bottom: 0;
}

.book-section .contents-group > h2 {
  margin: 0 0 0.7em;
  padding: 0;
  color: var(--accent-strong);
  font-family: var(--ui-font);
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-section .contents-list,
.book-section .contents-subsections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-section .contents-item {
  margin: 0;
  padding: 0;
}

.contents-item + .contents-item {
  margin-top: 0.6em;
}

.contents-link,
.contents-subsections a {
  display: grid;
  grid-template-columns: minmax(5.8em, auto) minmax(0, 1fr) auto;
  gap: 0.7em;
  align-items: baseline;
  padding: 0.5em 0.65em;
  border-radius: 5px;
  color: var(--ink);
  text-decoration: none;
}

.contents-link:hover,
.contents-subsections a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.contents-link__label {
  color: var(--accent);
  font-family: var(--ui-font);
  font-size: 0.62em;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contents-link__title {
  color: var(--ink-strong);
  font-size: 1.04em;
  font-weight: 600;
  line-height: 1.28;
}

.contents-link__page,
.contents-subsection__page {
  color: var(--faint);
  font-family: var(--ui-font);
  font-size: 0.64em;
  font-variant-numeric: tabular-nums;
}

.book-section .contents-subsections {
  margin: 0.12em 0 0.8em 1.25em;
  padding-left: 0.75em;
  border-left: 1px solid var(--rule);
}

.book-section .contents-subsection {
  margin: 0;
  padding: 0;
}

.contents-subsections a {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-block: 0.31em;
  color: var(--muted);
  font-size: 0.76em;
  line-height: 1.38;
}

.contents-subsection--h3 a {
  padding-left: 1.35em;
  font-size: 0.7em;
}

.glossary-table {
  min-width: 100% !important;
  table-layout: auto;
}

.glossary-table caption {
  padding: 0.8em 1em;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-strong);
  font-family: var(--book-font);
  font-size: 1.15em;
  font-weight: 650;
  text-align: left;
}

.glossary-table th:first-child {
  width: 18%;
  white-space: nowrap;
}

.glossary-table .glossary-reference {
  width: 22%;
  color: var(--muted);
  white-space: nowrap;
}

.glossary-table .glossary-group-row > th {
  padding-block: 0.8em;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.94em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cross-reference,
.index-page-link,
.index-see-link {
  border-radius: 0.15em;
  text-decoration-color: color-mix(in srgb, var(--accent) 58%, transparent);
}

.cross-reference:hover,
.index-page-link:hover,
.index-see-link:hover {
  background: var(--accent-soft);
}

.book-section :target {
  animation: target-flash 1.8s ease-out;
}

@keyframes target-flash {
  from { background-color: color-mix(in srgb, var(--focus) 22%, transparent); }
  to { background-color: transparent; }
}

.index-quick-nav {
  position: sticky;
  z-index: 2;
  top: calc(var(--topbar-height) + 8px);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  margin: 1.8em 0 2.2em;
  padding: 0.55em;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 93%, transparent);
  backdrop-filter: blur(10px);
  font-family: var(--ui-font);
  font-size: 0.7em;
}

.index-quick-nav a {
  display: grid;
  min-width: 2em;
  min-height: 2em;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}

.index-quick-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.book-section .index-letter-group > h2 {
  margin: 1.6em 0 0.7em;
  padding: 0 0 0.28em;
  border-bottom: 2px solid var(--accent);
  color: var(--accent-strong);
  font-family: var(--ui-font);
  font-size: 1.2em;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.book-section .index-list {
  column-count: 2;
  column-gap: 2.2em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--ui-font);
  font-size: 0.68em;
  line-height: 1.46;
}

.book-section .index-list > li {
  break-inside: avoid-column;
  margin: 0 0 0.62em;
  padding: 0;
}

.book-section .index-list ul {
  margin: 0.22em 0 0.32em;
  padding-left: 1.15em;
  color: var(--muted);
  list-style: none;
}

.book-section .index-list ul > li {
  position: relative;
  margin: 0.12em 0;
  padding-left: 0.7em;
}

.book-section .index-list ul > li::before {
  position: absolute;
  left: 0;
  color: var(--rule-strong);
  content: "–";
}

.index-page-link {
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.index-see-link {
  font-weight: 650;
}

.page-outline {
  position: sticky;
  top: calc(var(--topbar-height) + 40px);
  max-height: calc(100vh - var(--topbar-height) - 74px);
  overflow-y: auto;
  color: var(--muted);
  scrollbar-width: thin;
}

.page-outline__title,
.outline-title {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-outline nav,
.page-outline__nav {
  display: grid;
  gap: 2px;
  padding-left: 13px;
  border-left: 1px solid var(--rule);
}

.page-outline ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-outline a {
  display: block;
  padding: 4px 3px 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-decoration: none;
}

.page-outline a[data-level="3"] {
  padding-left: 13px;
  font-size: 10px;
}

.page-outline a:hover,
.page-outline a.is-active,
.page-outline a[aria-current="location"] {
  color: var(--accent-strong);
}

.page-outline a.is-active {
  font-weight: 750;
}

.chapter-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}

.chapter-pager a,
.chapter-pager button {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.chapter-pager a:hover,
.chapter-pager button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.chapter-pager a:last-child,
.chapter-pager button:last-child {
  align-items: flex-end;
  text-align: right;
}

.chapter-pager button:disabled {
  visibility: hidden;
  cursor: default;
}

.pager-direction {
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.pager-title {
  margin-top: 4px;
  font-family: var(--book-font);
  font-size: 14px;
  font-weight: 650;
}

.search-dialog,
#search-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
  color: var(--ink);
}

.search-dialog::backdrop,
#search-dialog::backdrop {
  background: rgba(9, 18, 23, 0.54);
  backdrop-filter: blur(4px);
}

.search-panel {
  display: grid;
  gap: 0;
}

.search-dialog__header,
.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--rule);
}

.search-header > div {
  min-width: 0;
  flex: 1;
}

.search-header .eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-header h2 {
  margin: 0;
  color: var(--ink-strong);
  font-family: var(--book-font);
  font-size: 22px;
  font-weight: 600;
}

.search-dialog__header input,
#book-search {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  background: var(--canvas);
  color: var(--ink-strong);
  outline: 0;
}

.search-label {
  padding: 16px 18px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

#book-search {
  width: calc(100% - 36px);
  margin: 0 18px;
}

.search-help {
  margin: 8px 18px 10px;
  color: var(--faint);
  font-size: 10px;
}

#book-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-results,
#search-results {
  max-height: min(620px, calc(100vh - 150px));
  overflow-y: auto;
  padding: 8px 14px 18px;
}

.search-empty,
.search-status {
  padding: 30px 14px;
  color: var(--muted);
  font-family: var(--book-font);
  text-align: center;
}

.search-result {
  display: block;
  padding: 13px 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  color: var(--ink-strong);
}

.search-result__section {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.search-result__text {
  margin-top: 4px;
  font-family: var(--book-font);
  font-size: 14px;
  line-height: 1.45;
}

.search-result mark {
  border-radius: 2px;
  background: color-mix(in srgb, var(--focus) 35%, transparent);
  color: inherit;
}

.book-footer-note {
  margin-top: 36px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 1280px) {
  .reader-layout {
    width: min(900px, calc(100% - var(--sidebar-width)));
    grid-template-columns: minmax(0, 790px);
    margin-right: auto;
    padding-right: 48px;
    padding-left: 48px;
  }

  .page-outline {
    display: none;
  }
}

@media (max-width: 960px) {
  .topbar {
    left: 0;
    padding: 0 16px;
  }

  #toc-toggle {
    display: inline-grid;
  }

  .book-sidebar {
    width: min(330px, calc(100vw - 52px));
    transform: translateX(-102%);
    box-shadow: 18px 0 60px rgba(0, 0, 0, 0.25);
    transition: transform 190ms ease;
  }

  body.sidebar-open .book-sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim,
  #sidebar-scrim {
    position: fixed;
    z-index: 105;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(7, 16, 20, 0.48);
    opacity: 0;
    transition: opacity 190ms ease, visibility 190ms ease;
  }

  body.sidebar-open .sidebar-scrim,
  body.sidebar-open #sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .reader-layout {
    width: min(900px, 100%);
    grid-template-columns: minmax(0, 1fr);
    margin-left: 0;
    padding: calc(var(--topbar-height) + 34px) clamp(18px, 5vw, 48px) 110px;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: 60px;
    --reader-size: 17px;
  }

  .topbar {
    gap: 5px;
    padding: 0 10px;
  }

  .topbar .brand {
    flex: 1 1 auto;
    overflow: hidden;
    min-width: 34px;
  }

  .topbar .brand-title {
    display: none;
  }

  .control-label {
    display: none;
  }

  .brand__subtitle,
  .topbar__subtitle {
    display: none;
  }

  .brand__mark {
    width: 30px;
    height: 30px;
  }

  .control-divider,
  #font-decrease,
  #font-increase {
    display: none;
  }

  .reader-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: calc(var(--topbar-height) + 16px) 0 92px;
  }

  #reader-content {
    width: 100%;
    overflow: hidden;
  }

  .book-section {
    min-height: calc(100vh - var(--topbar-height));
    padding: 34px 21px 58px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .book-section h1 {
    font-size: clamp(2.05rem, 10vw, 3rem);
  }

  .book-section h2 {
    font-size: clamp(1.55rem, 7.5vw, 1.95rem);
  }

  .book-section table {
    font-size: 0.68em;
  }

  .contents-link {
    grid-template-columns: minmax(4.7em, auto) minmax(0, 1fr) auto;
    gap: 0.45em;
    padding-inline: 0.4em;
  }

  .book-section .contents-subsections {
    margin-left: 0.55em;
    padding-left: 0.45em;
  }

  .contents-subsections a {
    padding-inline: 0.4em;
  }

  .book-section .index-list {
    column-count: 1;
    font-size: 0.72em;
  }

  .index-quick-nav {
    top: calc(var(--topbar-height) + 4px);
    margin-inline: -0.25em;
    font-size: 0.66em;
  }

  .glossary-table th:first-child,
  .glossary-table .glossary-reference {
    width: auto;
  }

  .cover-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    margin: -34px -21px 2em;
    padding: 58px 24px 40px;
  }

  .cover-hero h1,
  .book-section .cover-hero h1 {
    max-width: 12ch;
    font-size: clamp(2.45rem, 13vw, 3.6rem);
  }

  .cover-hero__visual {
    width: min(78%, 310px);
    justify-self: center;
  }

  .chapter-pager {
    grid-template-columns: 1fr;
    padding: 0 14px;
  }

  .chapter-pager a:last-child {
    align-items: flex-start;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    --paper: #fff;
    --ink: #111;
    --ink-strong: #000;
  }

  body {
    background: #fff;
  }

  .topbar,
  .book-sidebar,
  .sidebar-scrim,
  .reading-progress,
  .page-outline,
  .chapter-pager,
  .heading-permalink,
  .search-dialog,
  #search-dialog {
    display: none !important;
  }

  .reader-layout {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
  }

  .book-section,
  .book-section[hidden] {
    display: block !important;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    break-before: page;
  }

  .book-section:first-child {
    break-before: auto;
  }

  .cover-hero {
    margin: 0 0 2em;
    color: #111;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
