/* Shared, centered book identity on landing and reading pages. */
footer.site-footer {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 64px 24px 96px;
  text-align: center;
  background: #130d08;
  border-top: 1px solid rgba(155, 142, 135, .15);
}

.site-footer .site-footer-title {
  font-family: 'EB Garamond', serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  color: #d2c4bc;
  text-decoration: none;
}

.site-footer-title em {
  color: #d97707;
  font-style: italic;
}

.site-footer .site-footer-author {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .05em;
  color: #d2c4bc;
}

html[data-theme="light"] footer.site-footer {
  background: var(--paper);
}

/* Optional paper-and-ink reading theme. The site's original dark presentation
   remains untouched unless the JS theme switch sets data-theme="light". */
html[data-theme="light"] {
  color-scheme: light;
  --paper: #e9ddc8;
  --paper-raised: #efe4d1;
  --paper-soft: #e7d9c2;
  --ink: #33291f;
  --ink-soft: #493b2e;
  --ink-muted: #78634d;
  --amber-ink: #824512;
  --rule: rgba(105, 79, 51, .28);
  --rule-light: rgba(105, 79, 51, .17);
}

html[data-theme="light"],
html[data-theme="light"] body {
  background-color: var(--paper);
  color: var(--ink);
}

/* Shared navigation, page chrome, and meaningful utility colors. */
html[data-theme="light"] header,
html[data-theme="light"] header nav,
html[data-theme="light"] footer {
  color: var(--ink);
}

html[data-theme="light"] #ean-logo,
html[data-theme="light"] header nav a,
html[data-theme="light"] footer a,
html[data-theme="light"] footer p,
html[data-theme="light"] footer span {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] #ean-logo em,
html[data-theme="light"] footer em {
  color: var(--amber-ink) !important;
}

/* Art-led mastheads carry the paper palette beneath a warm, restrained veil. */
html[data-theme="light"] header:has(.hero-gradient):not(:has(#hero)) {
  background-color: var(--paper);
}

html[data-theme="light"] header:has(.hero-gradient):not(:has(#hero)) .hero-gradient {
  background: linear-gradient(
    to bottom,
    rgba(238, 227, 207, .748) 0%,
    rgba(235, 222, 199, .7735) 64%,
    rgba(233, 221, 200, .85) 100%
  ) !important;
}

html[data-theme="light"] header:has(.hero-gradient) nav a,
html[data-theme="light"] body:has(> div[style*="position:fixed"][style*="z-index:0"]) header nav a {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] header:has(.hero-gradient) nav a.text-on-surface-variant,
html[data-theme="light"] body:has(> div[style*="position:fixed"][style*="z-index:0"]) header nav a.text-on-surface-variant {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #ean-logo,
html[data-theme="light"] body:has(> div[style*="position:fixed"][style*="z-index:0"]) #ean-logo {
  color: var(--ink) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #ean-logo em,
html[data-theme="light"] body:has(> div[style*="position:fixed"][style*="z-index:0"]) #ean-logo em {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child .text-primary-fixed,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child .text-primary-fixed,
html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child .text-on-surface,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child .text-on-surface {
  color: var(--ink) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child .text-on-surface-variant,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child .text-on-surface-variant,
html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child > p,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child > p {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child .text-secondary-container,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child .text-secondary-container {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #introduction-content > .flex > div:first-child .bg-surface-container\/60,
html[data-theme="light"] header:has(.hero-gradient) #part-intro-content > .flex > div:first-child .bg-surface-container\/60 {
  color: var(--ink) !important;
  background-color: var(--paper-raised) !important;
}

html[data-theme="light"] #ean-ham-icon {
  color: var(--ink) !important;
}

html[data-theme="light"] header:has(.hero-gradient) #ean-ham-icon,
html[data-theme="light"] body:has(header .hero-gradient) #ean-ham-icon,
html[data-theme="light"] body:has(> div[style*="position:fixed"][style*="z-index:0"]) #ean-ham-icon {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] #ean-mobile-menu {
  background: rgba(235, 223, 202, .98) !important;
  border-color: var(--rule);
}

html[data-theme="light"] #ean-mobile-menu a {
  color: var(--ink) !important;
}

html[data-theme="light"] #ean-mobile-menu a[href="/trust"],
html[data-theme="light"] #ean-mobile-menu a[href="/networks"],
html[data-theme="light"] #ean-mobile-menu a[href="/transparency"] {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .text-on-surface,
html[data-theme="light"] .text-primary,
html[data-theme="light"] .text-primary-fixed,
html[data-theme="light"] .text-on-background,
html[data-theme="light"] .text-inverse-surface {
  color: var(--ink) !important;
}

html[data-theme="light"] .text-on-surface-variant,
html[data-theme="light"] .text-outline,
html[data-theme="light"] .text-tertiary,
html[data-theme="light"] .text-on-primary-container {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .text-secondary,
html[data-theme="light"] .text-secondary-container,
html[data-theme="light"] .text-secondary-fixed,
html[data-theme="light"] .text-secondary-fixed-dim,
html[data-theme="light"] .text-on-secondary-container {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .text-on-surface\/60,
html[data-theme="light"] .text-on-surface-variant\/60,
html[data-theme="light"] .text-on-surface-variant\/40,
html[data-theme="light"] .text-on-surface-variant\/30,
html[data-theme="light"] .text-outline\/60 {
  color: var(--ink-muted) !important;
}

html[data-theme="light"] .bg-surface,
html[data-theme="light"] .bg-background,
html[data-theme="light"] .bg-surface-dim {
  background-color: var(--paper) !important;
}

html[data-theme="light"] .bg-surface-container-lowest,
html[data-theme="light"] .bg-surface-container-low,
html[data-theme="light"] .bg-surface-container,
html[data-theme="light"] .bg-surface-container\/60,
html[data-theme="light"] .bg-surface-container\/50 {
  background-color: var(--paper-raised) !important;
}

html[data-theme="light"] .bg-surface-container-high,
html[data-theme="light"] .bg-surface-container-highest,
html[data-theme="light"] .bg-surface-variant,
html[data-theme="light"] .bg-surface-bright,
html[data-theme="light"] .bg-primary-container {
  background-color: var(--paper-soft) !important;
}

html[data-theme="light"] .border-outline,
html[data-theme="light"] .border-outline\/50,
html[data-theme="light"] .border-outline-variant,
html[data-theme="light"] .border-primary\/30,
html[data-theme="light"] .border-primary\/50 {
  border-color: var(--rule) !important;
}

html[data-theme="light"] .border-outline\/5,
html[data-theme="light"] .border-outline-variant\/10,
html[data-theme="light"] .border-outline-variant\/20,
html[data-theme="light"] .border-outline-variant\/40 {
  border-color: var(--rule-light) !important;
}

html[data-theme="light"] .hover\:text-primary:hover,
html[data-theme="light"] .hover\:text-on-surface:hover,
html[data-theme="light"] .hover\:text-secondary-fixed:hover,
html[data-theme="light"] .hover\:text-primary:focus-visible {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .hover\:border-primary\/70:hover {
  border-color: rgba(130, 69, 18, .72) !important;
}

html[data-theme="light"] :is(a, button, summary, [tabindex]):focus-visible {
  outline-color: var(--amber-ink);
}

/* Warm surfaces retain the existing translucent/card geometry. */
html[data-theme="light"] .glass-card {
  background: rgba(241, 231, 213, .94) !important;
  border-color: rgba(105, 79, 51, .25) !important;
  box-shadow: 0 12px 36px rgba(50, 37, 25, .08);
}

html[data-theme="light"] .organic-squiggle {
  background: linear-gradient(90deg, transparent, #95724d, transparent);
}

html[data-theme="light"] .root-line {
  background: linear-gradient(to bottom, rgba(130, 69, 18, .42), transparent);
}

/* On paper, let the living illustration sit directly on the page rather than
   enclosing it in a dark panel or laying a veil over the artwork. */
html[data-theme="light"] #hero {
  background: var(--paper);
}

html[data-theme="light"] #hero::before {
  background: radial-gradient(ellipse 78% 74% at 50% 48%,
    rgba(105, 79, 51, 0) 38%,
    rgba(105, 79, 51, .025) 100%);
}

html[data-theme="light"] #hero::after {
  background: linear-gradient(to bottom, transparent, var(--paper) 95%);
}

html[data-theme="light"] #hero-content .hero-label {
  color: var(--amber-ink);
}

html[data-theme="light"] #hero-content .hero-title {
  color: var(--ink);
  text-shadow: 0 1px 18px rgba(105, 79, 51, .10);
}

html[data-theme="light"] #hero-content .hero-title em {
  color: var(--amber-ink);
}

html[data-theme="light"] #hero-content .hero-sub {
  color: var(--ink-soft);
  text-shadow: 0 1px 10px rgba(233, 221, 200, .45);
}

html[data-theme="light"] #book-gallery .parts-row a {
  color: var(--ink-muted);
}

html[data-theme="light"] #book-gallery .parts-row a:hover {
  color: var(--amber-ink);
}

html[data-theme="light"] #book-gallery .parts-row .pip {
  background: var(--rule);
}

html[data-theme="light"] #explore-cue .lbl,
html[data-theme="light"] #explore-cue .ico {
  color: rgba(105, 79, 51, .62);
}

html[data-theme="light"] #hero-content .btn-begin {
  color: var(--paper-raised);
  background: #493b2e;
}

html[data-theme="light"] #hero-content .btn-begin:hover {
  background: #62492f;
}

html[data-theme="light"] #hero-content .btn-explore {
  color: var(--ink-soft);
  background: rgba(241, 231, 213, .36);
  border-color: rgba(105, 79, 51, .42);
}

html[data-theme="light"] #hero-content .btn-explore:hover {
  color: var(--amber-ink);
  background: rgba(241, 231, 213, .78);
  border-color: var(--amber-ink);
}

/* A direct, high-contrast contact action in the author panel. */
.author-contact-button {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: .75rem 2rem;
  color: #291b14;
  background: #dec1af;
  border: 1px solid #dec1af;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .18em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.author-contact-button:hover {
  color: #291b14;
  background: #f0d5be;
  border-color: #f0d5be;
}

.author-contact-button:focus-visible {
  outline: 2px solid #ffb77d;
  outline-offset: 3px;
}

html[data-theme="light"] .author-contact-button {
  color: var(--paper-raised);
  background: #493b2e;
  border-color: #493b2e;
}

html[data-theme="light"] .author-contact-button:hover {
  color: var(--paper-raised);
  background: #62492f;
  border-color: #62492f;
}

html[data-theme="light"] .author-contact-button:focus-visible {
  outline-color: var(--amber-ink);
}

/* Gallery and home editorial bands. */
html[data-theme="light"] #about,
html[data-theme="light"] #about-author,
html[data-theme="light"] #book-gallery {
  background-color: var(--paper);
  color: var(--ink);
}

html[data-theme="light"] #book-gallery {
  background-image: radial-gradient(circle at 80% 5%, rgba(130, 69, 18, .055), transparent 28rem);
  border-color: var(--rule-light);
}

html[data-theme="light"] .gallery-heading,
html[data-theme="light"] .gallery-about,
html[data-theme="light"] .chapter-tease,
html[data-theme="light"] .book-introduction,
html[data-theme="light"] .part-group,
html[data-theme="light"] .about-intro,
html[data-theme="light"] .about-body,
html[data-theme="light"] .acc-label,
html[data-theme="light"] .chapter-tease-link,
html[data-theme="light"] .part-chapter-grid .chapter-card {
  border-color: var(--rule-light) !important;
}

html[data-theme="light"] .gallery-overview-line,
html[data-theme="light"] .gallery-title,
html[data-theme="light"] .a-head,
html[data-theme="light"] .part-title,
html[data-theme="light"] .part-summary-title,
html[data-theme="light"] .chapter-card-copy strong,
html[data-theme="light"] .chapter-teaser-title,
html[data-theme="light"] .chapter-teaser-section-title {
  color: var(--ink) !important;
}

html[data-theme="light"] .gallery-overview-line em,
html[data-theme="light"] .gallery-title em,
html[data-theme="light"] .part-summary-title em,
html[data-theme="light"] .part-title em,
html[data-theme="light"] .a-kicker,
html[data-theme="light"] .chapter-teaser-kicker,
html[data-theme="light"] .chapter-teaser-section-number,
html[data-theme="light"] .chapter-card-copy span,
html[data-theme="light"] .part-summary-kicker,
html[data-theme="light"] .chapter-tease-number {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .gallery-about p,
html[data-theme="light"] .gallery-intro,
html[data-theme="light"] .gallery-footer p,
html[data-theme="light"] .about-body-text .a-body,
html[data-theme="light"] .a-body,
html[data-theme="light"] .part-description,
html[data-theme="light"] .chapter-teaser-tagline,
html[data-theme="light"] .chapter-teaser-note {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .chapter-tease-label,
html[data-theme="light"] .gallery-note,
html[data-theme="light"] .part-summary-action {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .chapter-tease-link {
  color: var(--ink-soft);
}

html[data-theme="light"] .chapter-tease-link:not(:last-child)::after {
  color: var(--ink-muted);
}

html[data-theme="light"] .chapter-tease-link:hover,
html[data-theme="light"] .chapter-tease-link:focus-visible,
html[data-theme="light"] .part-summary-card:hover .part-summary-title {
  color: var(--ink);
}

html[data-theme="light"] .book-map {
  background: rgba(241, 231, 213, .76);
  border-color: var(--rule);
}

html[data-theme="light"] .chapter-card {
  color: var(--ink);
}

html[data-theme="light"] .chapter-card:hover {
  background: rgba(130, 69, 18, .06);
}

html[data-theme="light"] .gallery-controls button {
  color: var(--ink);
  border-color: var(--rule);
}

html[data-theme="light"] .gallery-controls button:hover {
  background: rgba(130, 69, 18, .07);
}

html[data-theme="light"] .gallery-controls button:focus-visible,
html[data-theme="light"] .chapter-card:focus-visible,
html[data-theme="light"] .gallery-begin:focus-visible,
html[data-theme="light"] .part-summary-card:focus-visible,
html[data-theme="light"] .part-cover:focus-visible {
  outline-color: var(--amber-ink);
}

html[data-theme="light"] .gallery-begin {
  color: var(--ink);
  background: rgba(130, 69, 18, .055);
  border-color: rgba(130, 69, 18, .42);
}

html[data-theme="light"] .gallery-begin:hover {
  color: var(--paper-raised);
  background: #493b2e;
}

html[data-theme="light"] .part-summary-card,
html[data-theme="light"] .part-open {
  color: var(--ink-soft);
}

html[data-theme="light"] .part-open:hover {
  color: var(--amber-ink);
}

html[data-theme="light"] .part-cover {
  background: var(--paper-soft);
  border-color: var(--rule);
}

html[data-theme="light"] .book-cover-img {
  box-shadow: 5px 8px 24px rgba(50, 37, 25, .2), 1px 0 5px rgba(50, 37, 25, .12);
}

/* Introduction contents and chapter-format chooser. */
html[data-theme="light"] #introduction-content .chapter-format-heading,
html[data-theme="light"] #part-intro-content .chapter-format-heading {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .intro-toc-part {
  border-color: var(--rule);
}

html[data-theme="light"] .intro-toc-part-name,
html[data-theme="light"] .intro-toc-part-link,
html[data-theme="light"] .intro-toc-current-label,
html[data-theme="light"] .intro-toc-title,
html[data-theme="light"] .intro-toc-snippet,
html[data-theme="light"] .chapter-choice-description {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .intro-toc-part-kicker,
html[data-theme="light"] .intro-toc-cta,
html[data-theme="light"] .chapter-format-heading,
html[data-theme="light"] .chapter-choice-action,
html[data-theme="light"] .chapter-choice-card .material-symbols-outlined {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .intro-toc-number,
html[data-theme="light"] .intro-toc-chevron,
html[data-theme="light"] .chapter-choice-arrow {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .intro-toc-chapter {
  color: var(--ink-soft);
  border-color: var(--rule-light);
}

html[data-theme="light"] .intro-toc-chapter:hover,
html[data-theme="light"] .intro-toc-chapter:focus-visible {
  color: var(--ink);
  background: rgba(130, 69, 18, .07);
  box-shadow: inset 3px 0 var(--amber-ink);
}

html[data-theme="light"] .intro-toc-chapter:hover .intro-toc-number,
html[data-theme="light"] .intro-toc-chapter:focus-visible .intro-toc-number,
html[data-theme="light"] .intro-toc-part summary:hover .intro-toc-part-name,
html[data-theme="light"] .intro-toc-part summary:focus-visible .intro-toc-part-name,
html[data-theme="light"] .intro-toc-part-link:hover {
  color: var(--ink);
}

html[data-theme="light"] .intro-toc-part summary:focus-visible,
html[data-theme="light"] .intro-toc-part-link:focus-visible,
html[data-theme="light"] .intro-toc-chapter:focus-visible {
  outline-color: var(--amber-ink);
}

html[data-theme="light"] .chapter-choice-card {
  color: var(--ink);
  background: rgba(242, 233, 217, .96);
  border-color: rgba(105, 79, 51, .3);
}

html[data-theme="light"] button.chapter-choice-card:hover,
html[data-theme="light"] button.chapter-choice-card:focus-visible,
html[data-theme="light"] button.chapter-choice-card.is-active {
  background: var(--paper-soft);
  border-color: var(--amber-ink);
}

html[data-theme="light"] .chapter-audio-player {
  background: rgba(241, 231, 213, .98) !important;
  border-color: rgba(130, 69, 18, .35) !important;
}

html[data-theme="light"] .chapter-audio-close {
  color: var(--ink-soft);
}

html[data-theme="light"] .chapter-audio-close:hover,
html[data-theme="light"] .chapter-audio-close:focus-visible {
  color: var(--amber-ink);
}

/* Fixed book artwork reads as a quiet image-texture beneath the paper palette. */
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] {
  background-color: var(--paper) !important;
  isolation: isolate;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(233, 221, 200, .646);
}

html[data-theme="light"] main h1,
html[data-theme="light"] main h2,
html[data-theme="light"] main h3,
html[data-theme="light"] main .text-primary-fixed,
html[data-theme="light"] main .text-primary,
html[data-theme="light"] main .text-on-surface {
  color: var(--ink) !important;
}

html[data-theme="light"] main p,
html[data-theme="light"] main .text-on-surface-variant,
html[data-theme="light"] main .text-outline {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] main .text-secondary,
html[data-theme="light"] main .text-secondary-container {
  color: var(--amber-ink) !important;
}

/* Chapter copy sits directly over the page artwork, as in dark mode. */
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section h1,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section h2,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-primary-fixed,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-primary,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-on-surface {
  color: var(--ink) !important;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section p,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-on-surface-variant,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-outline {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-secondary,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section .text-secondary-container {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section #pdf-btn,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section #listen-btn {
  color: var(--ink) !important;
  background-color: var(--paper-raised) !important;
  border-color: var(--rule) !important;
}

html[data-theme="light"] #pdf-btn,
html[data-theme="light"] #listen-btn,
html[data-theme="light"] main button.bg-surface-container\/60 {
  color: var(--ink) !important;
  background-color: rgba(241, 231, 213, .94) !important;
  border-color: rgba(105, 79, 51, .4) !important;
}

html[data-theme="light"] #pdf-btn:hover,
html[data-theme="light"] #listen-btn:hover,
html[data-theme="light"] main button.bg-surface-container\/60:hover {
  color: var(--amber-ink) !important;
  border-color: var(--amber-ink) !important;
}

html[data-theme="light"] #ch8-audio,
html[data-theme="light"] main .bg-surface-container-low {
  background-color: rgba(241, 231, 213, .96) !important;
}

html[data-theme="light"] main aside .glass-card,
html[data-theme="light"] #pdf-panel .glass-card {
  background: rgba(241, 231, 213, .96) !important;
}

html[data-theme="light"] main aside [style*="font-family:'EB Garamond'"] {
  color: var(--ink) !important;
}

html[data-theme="light"] main aside [class*="text-primary/60"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] main a[style*="color:#635851"],
html[data-theme="light"] main a[style*="color: #635851"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section a[style*="color:#635851"],
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section a[style*="color: #635851"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section a[style*="color:#635851"]:hover,
html[data-theme="light"] body > div[style*="position:fixed"][style*="z-index:0"] ~ main > section a[style*="color: #635851"]:hover {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] .book-pager,
html[data-theme="light"] .book-pager a,
html[data-theme="light"] .book-pager span,
html[data-theme="light"] .book-pager .text-on-surface-variant {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] .book-pager a:hover,
html[data-theme="light"] .book-pager a:focus-visible,
html[data-theme="light"] .book-pager a:hover span,
html[data-theme="light"] .book-pager a:focus-visible span {
  color: var(--amber-ink) !important;
}

/* Reader dialogs, chapter previews, and sign-in/purchase overlays on home. */
html[data-theme="light"] #book-modal,
html[data-theme="light"] #chapter-teaser-modal,
html[data-theme="light"] #part-teaser-modal,
html[data-theme="light"] .chapter-pdf-modal {
  background: rgba(58, 45, 32, .54);
}

html[data-theme="light"] .chapter-teaser-dialog,
html[data-theme="light"] .chapter-pdf-dialog,
html[data-theme="light"] .chapter-pdf-frame,
html[data-theme="light"] #book-modal .glass-card,
html[data-theme="light"] #chapter-teaser-modal .glass-card,
html[data-theme="light"] #part-teaser-modal .glass-card {
  color: var(--ink);
  background: var(--paper-raised);
  border-color: rgba(130, 69, 18, .32);
  box-shadow: 0 24px 80px rgba(50, 37, 25, .2);
}

html[data-theme="light"] .chapter-teaser-header,
html[data-theme="light"] .chapter-teaser-contents-heading,
html[data-theme="light"] .chapter-teaser-section,
html[data-theme="light"] .chapter-teaser-footer,
html[data-theme="light"] .chapter-pdf-dialog-header {
  border-color: var(--rule-light);
}

html[data-theme="light"] .chapter-teaser-contents-heading {
  color: var(--ink-soft);
}

html[data-theme="light"] .chapter-teaser-section-title {
  color: var(--ink-soft);
}

html[data-theme="light"] .chapter-teaser-footer {
  background: rgba(231, 217, 194, .82);
}

html[data-theme="light"] .chapter-teaser-close {
  color: var(--ink-soft);
  background: rgba(241, 231, 213, .94);
  border-color: var(--rule);
}

html[data-theme="light"] .chapter-teaser-close:hover,
html[data-theme="light"] .chapter-teaser-close:focus-visible {
  color: var(--amber-ink);
  border-color: var(--amber-ink);
}

html[data-theme="light"] .chapter-teaser-access {
  color: var(--paper-raised);
  background: #493b2e;
}

html[data-theme="light"] .chapter-teaser-access:hover,
html[data-theme="light"] .chapter-teaser-access:focus-visible {
  background: var(--ink);
}

html[data-theme="light"] .chapter-pdf-dialog-title {
  color: var(--ink);
}

html[data-theme="light"] .chapter-pdf-dialog-kicker,
html[data-theme="light"] .chapter-pdf-open-link:hover,
html[data-theme="light"] .chapter-pdf-open-link:focus-visible,
html[data-theme="light"] .chapter-pdf-close:hover,
html[data-theme="light"] .chapter-pdf-close:focus-visible {
  color: var(--amber-ink);
}

html[data-theme="light"] .chapter-pdf-open-link,
html[data-theme="light"] .chapter-pdf-close {
  color: var(--ink-soft);
}

html[data-theme="light"] .chapter-pdf-close {
  border-color: var(--rule);
}

html[data-theme="light"] .reading-audio-panel {
  background: var(--paper);
}

html[data-theme="light"] .reading-audio-note {
  color: var(--ink);
}

/* Home auth/access forms: align form surfaces and labels without changing
   structure, controls, or interaction affordances. */
html[data-theme="light"] #book-modal :is(h1, h2, h3, label, p, span, a),
html[data-theme="light"] #book-modal :is(.text-on-surface, .text-on-surface-variant) {
  color: var(--ink-soft);
}

html[data-theme="light"] #book-modal [style*="color:#ede0d7"],
html[data-theme="light"] #book-modal [style*="color: #ede0d7"],
html[data-theme="light"] #book-modal [style*="color:#f0e4d8"],
html[data-theme="light"] #book-modal [style*="color: #f0e4d8"] {
  color: var(--ink) !important;
}

html[data-theme="light"] #book-modal [style*="color:#9b8e87"],
html[data-theme="light"] #book-modal [style*="color: #9b8e87"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] #book-modal [style*="color:#d97707"],
html[data-theme="light"] #book-modal [style*="color: #d97707"] {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] #book-modal > .glass-card > div > div[style*="border-top"] {
  border-color: var(--rule) !important;
}

html[data-theme="light"] #book-modal input#code-input {
  color: var(--ink) !important;
  border-bottom-color: var(--rule) !important;
}

html[data-theme="light"] #book-modal #modal-step-parts a {
  color: var(--ink) !important;
}

html[data-theme="light"] #book-modal #modal-step-parts a span:first-child {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] #book-modal #modal-step-parts a em {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] #book-modal #modal-step-code > div button[onclick*="checkCode"] {
  color: var(--paper-raised) !important;
  background: #493b2e !important;
}

html[data-theme="light"] #book-modal input,
html[data-theme="light"] #book-modal select,
html[data-theme="light"] #book-modal textarea {
  color: var(--ink);
  background: #f2e9d9;
  border-color: rgba(91, 69, 48, .42);
}

html[data-theme="light"] #book-modal input::placeholder,
html[data-theme="light"] #book-modal textarea::placeholder {
  color: #78634d;
  opacity: 1;
}

html[data-theme="light"] #book-modal button,
html[data-theme="light"] #book-modal a {
  accent-color: var(--amber-ink);
}

html[data-theme="light"] #book-modal button[onclick*="closeBookModal"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] main [style*="color:#d97707"],
html[data-theme="light"] main [style*="color: #d97707"] {
  color: var(--amber-ink) !important;
}

html[data-theme="light"] main [style*="color:#635851"],
html[data-theme="light"] main [style*="color: #635851"] {
  color: var(--ink-soft) !important;
}

html[data-theme="light"] #book-modal :is(button, a):focus-visible,
html[data-theme="light"] #book-modal :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--amber-ink);
  outline-offset: 2px;
}

html[data-theme="light"] .chapter-audio-player audio {
  color-scheme: light;
}

/* The one always-available control is deliberately outside theme scoping.
   JS may insert it into any page; no layout or typography elsewhere changes. */
.ean-theme-toggle {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 9000;
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  color: #ede0d7;
  background: rgba(24, 18, 13, .92);
  border: 1px solid rgba(222, 193, 175, .34);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
  font: 500 10px/1 'JetBrains Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.ean-theme-toggle svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.ean-theme-toggle:hover {
  border-color: #dec1af;
  transform: translateY(-2px);
}

.ean-theme-toggle:focus-visible {
  outline: 2px solid #ffb77d;
  outline-offset: 3px;
}

.ean-theme-label {
  white-space: nowrap;
}

.ean-theme-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-theme="light"] .ean-theme-toggle {
  color: var(--ink);
  background: rgba(241, 231, 213, .96);
  border-color: rgba(105, 79, 51, .32);
  box-shadow: 0 4px 16px rgba(50, 37, 25, .1);
}

html[data-theme="light"] .ean-theme-toggle:hover {
  color: var(--amber-ink);
  border-color: var(--amber-ink);
}

html[data-theme="light"] .ean-theme-toggle:focus-visible {
  outline-color: var(--amber-ink);
}

@media (prefers-reduced-motion: reduce) {
  .ean-theme-toggle {
    transition: none;
  }
  .ean-theme-toggle:hover {
    transform: none;
  }
}
