:root {
  --paper: #f6f1e6;
  --ink: #1c1814;
  --muted: #5e564c;
  --line: #d9d0c0;
  --accent: #7a3e2a;
  --chrome: rgba(246, 241, 230, 0.94);
  --font: clamp(1.15rem, 0.55rem + 1.6vw, 1.35rem);
  --measure: 38rem;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --serif: "Source Serif 4", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}
html { color-scheme: light; }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 40;
  background: #fff;
  padding: 0.4rem 0.6rem;
}

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

button {
  touch-action: manipulation;
}

/* Full-width app bar. Never sit this in a row flex with the article. */
.chrome {
  position: sticky;
  top: 0;
  z-index: 20;
  display: block;
  width: 100%;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-family: var(--sans);
  font-size: 0.92rem;
}
.chrome-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 1rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
}
.chrome-bar > button,
.tools button {
  appearance: none;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  min-height: 2.35rem;
  cursor: pointer;
  font: inherit;
}
.chrome-bar > button:hover,
.tools button:hover,
.chrome-bar > button[aria-pressed="true"],
.tools button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.now-reading {
  flex: 1;
  margin: 0;
  text-align: center;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tools { display: flex; gap: 0.35rem; flex-shrink: 0; }

.reading-progress {
  height: 2px;
  background: transparent;
  pointer-events: none;
}
#progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(28, 24, 20, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
body.toc-open .toc-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.toc {
  position: fixed;
  z-index: 25;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(22rem, 92vw);
  overflow: auto;
  overscroll-behavior: contain;
  background: #faf6ee;
  border-right: 1px solid var(--line);
  padding: 1rem 1.1rem 3rem;
  font-family: var(--sans);
  box-shadow: 8px 0 30px rgba(28, 24, 20, 0.12);
  transform: translateX(calc(-100% - 24px));
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
  pointer-events: none;
}
body.toc-open .toc {
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.22s ease, visibility 0s;
}
.toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.toc h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
}
.toc-head button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  font: inherit;
}
.toc a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  padding: 0.42rem 0.15rem;
  line-height: 1.3;
}
.toc a:hover { color: var(--accent); }
.toc a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}
.toc .book-title {
  margin-top: 1.15rem;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.reader {
  display: block;
  width: 100%;
  min-height: calc(100dvh - 3.2rem);
}
#article {
  display: block;
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 2rem;
  font-size: var(--font);
  font-optical-sizing: auto;
  line-height: 1.62;
  hyphens: auto;
}
#article h1 {
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  line-height: 1.1;
}
#article .subtitle {
  text-align: center;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 1.2rem;
}
#article .kicker {
  text-align: center;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.65rem;
}
#article h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  text-align: center;
  font-weight: 600;
  margin: 0.15rem 0 0.25rem;
}
#article h3 {
  text-align: center;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  margin: 0 0 1.6rem;
}
#article p { margin: 0 0 0.95em; }
#article .body-copy p { text-indent: 1.3em; }
#article p.lead,
#article .qa p,
#article .cover-note,
#article .body-copy p:first-of-type { text-indent: 0; }
#article .drop:first-letter {
  float: left;
  font-size: 3.15em;
  line-height: 0.78;
  padding: 0.06em 0.08em 0 0;
  font-weight: 600;
}
.speaking { background: #efe3c8; }

.cover {
  min-height: calc(100dvh - 8rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 0 2rem;
}
.cover-kicker {
  text-align: center;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.cover-actions { text-align: center; margin: 1.6rem 0 2.2rem; }
.btn-primary {
  appearance: none;
  font-family: var(--sans);
  font-size: 1rem;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent); }
.cover-vols {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 22rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}
.cover-vols li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}
.cover-vols li:last-child { border-bottom: 1px solid var(--line); }
.cover-vols a { color: var(--ink); text-decoration: none; }
.cover-vols a:hover { color: var(--accent); }

.qa {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.96em;
}
.qa .who { font-weight: 600; color: var(--ink); font-style: normal; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.5rem 0 4.5rem;
  font-family: var(--sans);
}
.pager button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  min-height: 2.6rem;
  max-width: 48%;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

.cover-note {
  text-align: center;
  font-style: italic;
  color: var(--muted);
  max-width: 28rem;
  margin: 0 auto;
  line-height: 1.5;
}
hr.ornament {
  border: 0;
  border-top: 1px solid var(--line);
  width: 4.5rem;
  margin: 1.2rem auto 1.4rem;
}

.leaf {
  margin: 1.6rem 0 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.leaf-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}
.original-btn {
  appearance: none;
  text-transform: none;
  letter-spacing: 0;
  font: inherit;
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
}
.original-btn:hover { background: #efe6d6; }
.muted { color: var(--muted); font-style: italic; }

.listen-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.88rem;
}
.listen-bar button {
  appearance: none;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  min-height: 2.4rem;
  cursor: pointer;
  font: inherit;
}
#listen-status { flex: 1; min-width: 7rem; }

.original-dialog {
  width: min(40rem, 94vw);
  max-height: 92vh;
  border: 0;
  padding: 0;
  background: #1c1814;
  color: var(--paper);
}
.original-dialog::backdrop { background: rgba(20, 16, 12, 0.72); }
.original-dialog form header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  font-family: var(--sans);
}
.original-dialog h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.original-dialog button {
  appearance: none;
  background: transparent;
  color: inherit;
  border: 1px solid #6b6258;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
.original-body {
  padding: 0 0.9rem 0.9rem;
  overflow: auto;
  max-height: calc(92vh - 3.2rem);
}
.original-body img {
  display: block;
  width: 100%;
  background: #fff;
}

body[data-edition="mobile"] .desktop-only { display: none !important; }
body[data-edition="desktop"] .mobile-only { display: none !important; }
body[data-edition="mobile"] .original-btn { display: none !important; }

@media (max-width: 800px) {
  .chrome-bar { gap: 0.4rem; padding-inline: 0.7rem; }
  .chrome-bar > button,
  .tools button { padding-inline: 0.65rem; }
  #article {
    width: calc(100% - 1.6rem);
    padding-top: 1.4rem;
    padding-bottom: 1.4rem;
  }
  .pager { width: calc(100% - 1.6rem); padding-bottom: 6.2rem; }
  .cover { min-height: auto; padding-top: 1.5rem; }
}

@media (min-width: 801px) {
  .reader { padding-bottom: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .toc, .toc-backdrop { transition: none; }
}

@media print {
  .chrome, .pager, .listen-bar, .toc, .toc-backdrop, .original-btn, .skip {
    display: none !important;
  }
  body { background: #fff; }
  #article { width: 100%; }
}
