:root {
  --bg: #f4efe4;
  --ink: #1e241c;
  --line: #5e5144;
  --muted: #3c4038;
  --soft: rgba(94, 81, 68, 0.12);
  --body: 19px;
}

body {
  background: #101820;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.85;
}

.bookbar {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 16px;
  background: rgba(16, 24, 32, 0.94);
  color: #f4efe4;
  border-bottom: 1px solid rgba(244, 239, 228, 0.28);
}

.bookbar a {
  font-family: var(--serif);
  font-size: 20px;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.bookbar button {
  color: #f4efe4;
  border-color: rgba(244, 239, 228, 0.55);
  background: transparent;
}

.read-label {
  margin: 0 0 0 auto;
  color: #f4efe4;
  font-size: 15px;
  line-height: 1.4;
}

.desktop-hero {
  position: relative;
  height: 80vh;
  min-height: 520px;
  overflow: hidden;
  color: #f4efe4;
  background: #101820;
}

.desktop-hero img,
.mobile-open img {
  background: #101820;
}

.desktop-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 64% center;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 12, 10, 0.66) 0%, rgba(8, 12, 10, 0.2) 42%, rgba(8, 12, 10, 0) 70%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(640px, 52vw);
  padding: calc(10vh + 56px) 0 0 6vw;
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: 14px;
}

.desktop-hero h1 {
  font-size: 80px;
  line-height: 1.05;
  margin: 8px 0 12px;
  font-weight: 500;
}

.hero-copy .guide {
  font-size: 18px;
  line-height: 1.7;
  max-width: 24em;
}

.down {
  position: absolute;
  z-index: 1;
  left: 6vw;
  bottom: 28px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #f4efe4;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 239, 228, 0.7);
}

.mobile-open { display: none; }

.paper {
  background: var(--bg);
  color: var(--ink);
  padding: 28px 0 64px;
}

.paper-grid {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.toc-panel {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ink);
  padding-left: 10px;
}

.toc-panel a {
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 15px;
}

.toc-part {
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.toc-panel a.toc-chapter {
  align-items: flex-start;
  gap: 6px;
  padding-left: 10px;
  line-height: 1.35;
}

.toc-panel a.toc-chapter span {
  flex: 0 0 auto;
}

.toc-panel a[aria-current="true"] {
  box-shadow: inset 3px 0 0 #2d4b3b;
  text-decoration: none;
}

.chapter,
.part-break,
.front-block {
  scroll-margin-top: 76px;
}

.chapter { padding: 28px 0 12px; border-top: 1px solid rgba(30, 36, 28, 0.16); }

.ch-no,
.part-no {
  letter-spacing: 0.08em;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chapter > h2 { font-size: 40px; margin: 0 0 8px; }

.core-q {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 16px;
}

.section { padding: 8px 0 12px; scroll-margin-top: 76px; }

.section h3,
.catalog h3,
.interaction h3 { font-size: 28px; margin: 12px 0 8px; }

.specimen { width: min(380px, 100%); margin: 12px 0 20px; }

.specimen img,
.grounding-plate img { background: #e7e0d2; }

.specimen figcaption,
.grounding-plate figcaption,
.img-fallback {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
}

.img-fallback[hidden] { display: none; }

.stand {
  background: #e7e0d2;
  border: 1px solid rgba(30, 36, 28, 0.28);
  padding: 18px 18px 8px;
  margin: 16px 0;
}

.part-break { padding: 42px 0 8px; }

.part-break h2 { font-size: 34px; margin: 0 0 8px; }

.catalog details,
.source-fold {
  border-top: 1px solid rgba(30, 36, 28, 0.2);
  margin: 0;
}

.catalog summary,
.source-fold summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 18px;
  cursor: pointer;
  list-style: none;
}

.catalog summary::-webkit-details-marker,
.source-fold summary::-webkit-details-marker { display: none; }

.catalog summary::before,
.source-fold summary::before {
  content: "+";
  flex: 0 0 1em;
  color: var(--muted);
  font-family: var(--sans, sans-serif);
}

.catalog details[open] > summary::before,
.source-fold[open] > summary::before { content: "−"; }

.catalog details[open] > summary {
  font-family: var(--serif);
  font-size: 22px;
}

.catalog .quiet { font-size: 13px; color: var(--muted); }

.interaction article h4 {
  font-size: 22px;
  font-weight: 500;
  margin: 4px 0 8px;
}

.lookup { width: 100%; border-collapse: collapse; margin: 12px 0 18px; }

.lookup th,
.lookup td {
  border-bottom: 1px solid rgba(30, 36, 28, 0.2);
  text-align: left;
  vertical-align: top;
  padding: 8px 10px 8px 0;
}

.lookup th { width: 8em; font-weight: 500; }

html.is-enhanced [data-state-panel] { display: none; }
html.is-enhanced [data-state-panel].is-active { display: block; }
html.is-enhanced .reasons { display: none; }
html.is-enhanced .reasons.is-open { display: block; }

@media (max-width: 1100px) {
  .desktop-hero h1 { font-size: 72px; }
}

@media (max-width: 800px) {
  body { font-size: 18px; }
  .desktop-hero { display: none; }
  .mobile-open { display: block; background: #101820; color: #f4efe4; }
  .mobile-open img {
    width: 100%;
    height: clamp(220px, 42svh, 420px);
    object-fit: cover;
    object-position: 100% center;
  }
  .mobile-title { padding: 18px 16px 28px; }
  .mobile-title h1 { font-size: 40px; line-height: 1.15; margin: 6px 0 8px; }
  .mobile-title .down { position: static; color: #f4efe4; }
  .paper-grid { display: block; width: min(1080px, calc(100% - 24px)); }
  .bookbar { min-height: 52px; padding: 4px 12px; }
  .toc-toggle {
    border: 0;
    border-bottom: 1px solid rgba(244, 239, 228, 0.75);
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
  }
  .toc-panel {
    display: none;
    position: fixed;
    z-index: 5;
    top: 52px;
    left: 0;
    right: 0;
    max-height: min(70vh, 520px);
    overflow: auto;
    background: var(--bg);
    color: var(--ink);
    border-left: 0;
    border-bottom: 1px solid var(--ink);
    padding: 8px 16px 12px;
  }
  .toc-panel.is-open { display: flex; }
  .chapter > h2 { font-size: 32px; }
  .read-label { font-size: 14px; }
}

@media (min-width: 801px) {
  .toc-toggle { display: none; }
}

.bookbar :focus-visible,
.desktop-hero :focus-visible,
.mobile-open :focus-visible {
  outline: 2px solid #f7f1e4;
  outline-offset: 3px;
}

#earth-05-grounding .choice-row button[aria-pressed="true"] {
  background: #2d4b3b;
  color: #f4efe4;
  border-color: #2d4b3b;
}

#earth-05-grounding .grounding-art {
  border-color: rgba(75, 88, 60, 0.08);
}

#earth-05-grounding .grounding-label {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 13px;
}

#earth-05-grounding .grounding-plate.is-step-0 .grounding-label[data-part="feet"],
#earth-05-grounding .grounding-plate.is-step-1 .grounding-label[data-part="roots"],
#earth-05-grounding .grounding-plate.is-step-2 .grounding-label[data-part="branches"] {
  background: transparent;
  color: #1e241c;
  border: 0;
  font-weight: 600;
}

@media (max-width: 800px) {
  #earth-05-grounding .choice-row { flex-wrap: nowrap; gap: 6px; }
  #earth-05-grounding .choice-row button {
    flex: 1 1 0;
    min-height: 44px;
    padding: 6px 4px;
    text-align: center;
  }
}

@media (max-width: 359px) {
  .bookbar { gap: 8px; padding: 0 10px; }
  .hero-copy, .down { left: 16px; }
}

/* series-vignettes */
.series-jump { margin: 12px 0 0; }
.series-jump a { min-height: 44px; display: inline-flex; align-items: center; }
.end-jump { padding: 8px 0 28px; }
.vignette-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 8px;
}
.vignette-pair.is-single { grid-template-columns: 1fr; }
.vignette-pane { margin: 0; }
.vignette-pane .vignette-frame {
  overflow: hidden;
  max-width: 460px;
  margin-inline: auto;
  background: #f4efe4;
}
.vignette-frame img { width: 200%; max-width: none; height: auto; display: block; }
.vignette-frame.is-right img { margin-left: -100%; }
.vignette-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 44px;
  cursor: pointer;
}
.vignette-pane figcaption { margin-top: 6px; }
.vignette-open:focus-visible { outline: none; }
.vignette-pane:focus-within {
  outline: 2px solid #1e241c;
  outline-offset: 3px;
}
.vignette-dialog {
  box-sizing: border-box;
  border: 0;
  padding: 12px;
  background: #101820;
  color: #f4efe4;
  width: min(960px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
}
.vignette-dialog::backdrop { background: rgba(16, 24, 32, 0.78); }
.vignette-dialog .vignette-frame {
  width: 100%;
  max-width: 920px;
  margin-inline: 0;
  overflow: hidden;
  background: #f4efe4;
}
.vignette-close {
  min-height: 44px;
  min-width: 44px;
  margin-top: 8px;
  color: #f4efe4;
  border: 1px solid rgba(244, 239, 228, 0.7);
  background: transparent;
}
.vignette-close:focus-visible { outline: 2px solid #f7f1e4; outline-offset: 3px; }
@media (max-width: 800px) {
  .vignette-pair { grid-template-columns: 1fr; }
}
