/* ============================================================
   book.css — Leseoberflaeche des Living Book
   Ergaenzt style.css, nutzt dieselben Design-Tokens.
   ============================================================ */

/* ---------- Grundraster ---------- */
.chapter { padding: calc(var(--header-h, 72px) + 3rem) 0 5rem; }
.crumb {
  font-size: .875rem; color: var(--color-text-faint);
  margin-bottom: 2rem; display: flex; gap: .5rem;
}
.crumb a { color: var(--color-text-muted); text-decoration: none; }
.crumb a:hover { color: var(--color-primary); }

.chapter__eyebrow {
  font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-primary); font-weight: 500; margin-bottom: .75rem;
}
.chapter__title {
  font-family: 'Zodiak', Georgia, serif; font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.12;
  letter-spacing: -.02em; margin: 0 0 1.5rem;
}
.chapter__meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  padding: .875rem 0; margin-bottom: 3rem;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  font-size: .875rem; color: var(--color-text-muted);
}
.chapter__meta span { display: inline-flex; align-items: center; gap: .375rem; }
.chapter__meta span::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--color-primary); opacity: .6;
}

/* ---------- Lesetypografie ---------- */
.prose { font-size: 1.125rem; line-height: 1.75; color: var(--color-text); }
.prose > * + * { margin-top: 1.35em; }
.prose h2 {
  font-family: 'Zodiak', Georgia, serif; font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25; margin-top: 3rem; margin-bottom: 0; letter-spacing: -.015em;
}
.prose h3 {
  font-size: 1.25rem; font-weight: 600; margin-top: 2.25rem; margin-bottom: 0;
  color: var(--color-secondary);
}
.prose p { max-width: 68ch; }
.prose ul, .prose ol { padding-left: 1.5rem; max-width: 68ch; }
.prose li + li { margin-top: .5rem; }
.prose strong { font-weight: 600; }
.prose a { color: var(--color-primary); text-underline-offset: 3px; }
.prose code {
  font-size: .9em; background: var(--color-surface-offset);
  padding: .15em .4em; border-radius: 3px;
}
.prose blockquote {
  border-left: 3px solid var(--color-primary);
  padding: .25rem 0 .25rem 1.25rem; margin-left: 0;
  color: var(--color-text-muted); font-style: normal;
}

/* Evidenz-Marker: dezent, nicht im Lesefluss stoerend */
.ev-tag {
  display: inline-block; font-size: .6875rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--color-text-faint);
  border: 1px solid var(--color-divider); border-radius: 2px;
  padding: .05rem .35rem; margin-left: .35rem; white-space: nowrap;
  vertical-align: .1em;
}

/* Tabellen (Selbstcheck, Vergleiche) */
.prose table {
  width: 100%; font-size: .9375rem; margin-top: 1.5rem;
  display: block; overflow-x: auto;
  /* separate statt collapse: sonst verlieren sticky-Zellen ihre Rahmen */
  border-collapse: separate; border-spacing: 0;
}
.prose--tables table { display: table; }
.prose th, .prose td {
  padding: .625rem .75rem; text-align: left; vertical-align: top;
  border-right: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}
.prose tr > *:first-child { border-left: 1px solid var(--color-divider); }
.prose thead th { border-top: 1px solid var(--color-divider); }

/* Tabellenkopf bleibt beim Scrollen stehen, aber unterhalb der Navigation.
   z-index bewusst weit unter .header (100), top entspricht der Kopfzeilenhoehe. */
.prose--tables thead th {
  position: sticky;
  top: var(--header-h, 64px);
  z-index: 5;
  background: var(--color-surface-offset);
  font-weight: 600;
}
.prose th { background: var(--color-surface-offset); font-weight: 600; }

/* Auf schmalen Geraeten scrollt die Tabelle seitlich; dann stoert ein
   klebender Kopf mehr als er hilft. */
@media (max-width: 700px) {
  .prose--tables table { display: block; overflow-x: auto; }
  .prose--tables thead th { position: static; }
}

/* Fussnoten */
.prose .footnotes { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--color-divider); }
.prose .footnotes h2 { font-size: 1.125rem; margin-top: 0; text-transform: uppercase; letter-spacing: .06em; }
.prose .footnotes ol { font-size: .875rem; color: var(--color-text-muted); line-height: 1.6; }
.prose .footnotes a { word-break: break-word; }
.prose a.footnote-ref sup { color: var(--color-primary); font-weight: 600; padding: 0 .1em; }

/* ---------- Zitierhinweis ---------- */
.cite {
  margin-top: 3.5rem; padding: 1.25rem 1.5rem;
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 6px;
}
.cite h2 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-faint); margin: 0 0 .625rem; }
.cite code { font-size: .8125rem; line-height: 1.6; background: none; padding: 0;
  color: var(--color-text-muted); }

/* ---------- Kapitelnavigation ---------- */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--color-divider);
}
.chapter-nav a {
  flex: 1 1 45%; text-decoration: none; color: var(--color-text);
  font-weight: 500; font-size: .9375rem; padding: .875rem 1rem;
  border: 1px solid var(--color-divider); border-radius: 6px;
  transition: border-color .2s, color .2s;
}
.chapter-nav a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chapter-nav__next { text-align: right; }

/* ---------- Inhaltsverzeichnis ---------- */
.toc { margin-top: 3rem; }
.toc__part + .toc__part { margin-top: 3rem; }
.toc__part h2 {
  font-size: .8125rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--color-primary); margin-bottom: 1rem;
}
.toc__list { list-style: none; padding: 0; margin: 0; }
.toc__list li + li { margin-top: .5rem; }
.toc__list a {
  display: grid; grid-template-columns: 2.5rem 1fr auto; align-items: baseline; gap: 1rem;
  padding: .875rem 1rem; text-decoration: none; color: var(--color-text);
  border: 1px solid var(--color-divider); border-radius: 6px;
  transition: border-color .2s, background .2s;
}
.toc__list a:hover { border-color: var(--color-primary); background: var(--color-surface); }
.toc__num { font-family: 'Zodiak', Georgia, serif; font-size: 1.25rem; color: var(--color-primary); }
.toc__title { font-weight: 500; }
.toc__meta { font-size: .8125rem; color: var(--color-text-faint); white-space: nowrap; }

.download-row { display: flex; gap: .75rem; flex-wrap: wrap; margin: 2rem 0 0; }
.lead { font-size: 1.125rem; color: var(--color-text-muted); max-width: 62ch; }
.lead + .lead { margin-top: 1rem; }

/* ---------- Kopf der Buchuebersicht ---------- */
.book-head { margin-bottom: 2.25rem; }
.book-head__title {
  font-family: 'Zodiak', Georgia, serif; font-weight: 700;
  font-size: clamp(1.75rem, 4.5vw, 2.75rem); line-height: 1.08;
  letter-spacing: -.02em; margin: 0;
}
.book-head__sub {
  font-family: 'Zodiak', Georgia, serif; font-weight: 400;
  font-size: clamp(1.0625rem, 2.2vw, 1.375rem); line-height: 1.35;
  color: var(--color-text-muted); margin: .4rem 0 0;
}

/* ---------- Selbst-Check-Kasten unter dem Inhaltsverzeichnis ---------- */
.sc-teaser {
  margin-top: 4rem; padding: 1.75rem;
  border: 1px solid var(--color-divider); border-radius: 8px;
  background: var(--color-surface);
}
.sc-teaser h2 {
  font-family: 'Zodiak', Georgia, serif; font-weight: 700;
  font-size: 1.5rem; line-height: 1.2; margin: 0 0 .875rem;
}
.sc-teaser p {
  color: var(--color-text-muted); max-width: 62ch;
  line-height: 1.65; margin: 0 0 1rem;
}
.sc-teaser p + p { margin-top: 0; }
.sc-teaser .btn { margin-top: .5rem; }

/* ---------- Changelog ---------- */
.cl { list-style: none; padding: 0; margin: 2.5rem 0 0; }
.cl__item { padding: 1.25rem 0; border-bottom: 1px solid var(--color-divider); }
.cl__head { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.cl__version { font-family: 'Zodiak', Georgia, serif; font-size: 1.125rem; color: var(--color-primary); }
.cl__head time { font-size: .875rem; color: var(--color-text-faint); }
.cl__class {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .15rem .5rem; border-radius: 2px; font-weight: 600;
}
.cl__class--substanz { background: var(--color-primary-light); color: var(--color-primary-active); }
.cl__class--evidenz  { background: var(--color-secondary-light); color: var(--color-secondary); }
.cl__class--korrektur{ background: var(--color-surface-offset); color: var(--color-text-muted); }
.cl__item p { margin: 0; color: var(--color-text-muted); max-width: 68ch; }

/* ---------- Druck ---------- */
@media print {
  .header, .chapter-nav, .footer, .consent-banner, .crumb { display: none !important; }
  .chapter { padding-top: 0; }
  .prose { font-size: 11pt; }
  .prose a { color: inherit; text-decoration: none; }
  .ev-tag { border: none; color: #666; }
}

/* ---------- Lesefortschritt ---------- */
.read-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 200;
  background: var(--color-primary); transform: scaleX(0); transform-origin: 0 50%;
  will-change: transform;
}
@media print { .read-progress { display: none; } }

/* ---------- Eroeffnung des Kapitels ----------
   Ersetzt die frühere Zwischenüberschrift "Hook": Der Einstieg wird
   typografisch als Auftakt gesetzt, statt als Abschnitt benannt zu werden. */
.chapter__lead {
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-divider);
}
.chapter__lead p {
  font-size: 1.25rem;
  line-height: 1.62;
  color: var(--color-text);
  max-width: 62ch;
}
.chapter__lead p:first-of-type::first-letter {
  float: left;
  font-family: 'Zodiak', Georgia, serif;
  font-size: 3.6em;
  line-height: .82;
  font-weight: 700;
  color: var(--color-primary);
  padding: .06em .12em 0 0;
}
.chapter__lead .ev-tag { vertical-align: .15em; }

@media (max-width: 600px) {
  .chapter__lead p { font-size: 1.125rem; }
  .chapter__lead p:first-of-type::first-letter { font-size: 3em; }
}
