/* Third Attempt – Studienseiten als kleine Paper (Regeln: DESIGN.md).
   Derselbe Kreidegrund wie die Startseite, Serifen nur für den Fließtext, Lesebreite statt Seitenbreite,
   Inhaltsverzeichnis links, rechts daneben eine einzige Spalte, in der alles gleich breit steht:
   Text, Notizen, Formeln, Abbildungen und Tabellen. Das Kampfrichter-Licht bleibt das einzige Motiv. Lädt nach styles.css. */

.paper {
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --toc: 13rem;
  --col: 41rem;
  --col-gap: 3rem;
  --gap-chapter: clamp(3.5rem, 5vw, 5rem);
}
/* Kopfzeile, Footer und Abschnitte bleiben in der Seitenbreite; nur der Lesetext steht schmaler. */
.paper-grid, .legal { --max: var(--max-read); }

/* ---------- Kopf einer Studie: ein Band auf Ink, so breit wie die Kopfzeile ----------
   Titel über die ganze Breite. Darunter teilen sich beide Spalten dieselben zwei Zeilen: Satz und Lichter
   beginnen auf einer Höhe, Angaben und Beschriftungen enden auf einer, Knöpfe und Bildzeile stehen auf einer. */
.title-block {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2.5rem, 4vw, 3.5rem) clamp(2rem, 5vw, 5rem);
  padding-block: clamp(7.5rem, 11vw, 10rem) var(--pad-section);
}
.title-block h1 { grid-column: 1 / -1; font-size: var(--step-head); letter-spacing: -0.04em; line-height: 0.95; }
.title-block__main, .title-block__key { display: grid; grid-row: 2 / span 2; grid-template-rows: subgrid; margin: 0; }
.title-block__text { display: grid; gap: 1.25rem; align-content: space-between; }
.title-block__deck { font-family: var(--serif); font-style: italic; font-size: var(--step-lead); line-height: 1.35; max-width: 42ch; }
.title-block__byline, .keylights__label { font-size: var(--step-small); line-height: 1.35; }
.title-block__byline { color: var(--muted); max-width: none; }
.title-block__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-self: center; }
.title-block__key figcaption { font-size: var(--step-small); line-height: 1.35; color: var(--muted); align-self: center; }
.keylights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 8.5rem)); justify-content: space-between; column-gap: 1rem; }
.keylights li { display: grid; gap: 0.75rem; align-content: space-between; justify-items: center; }
.keylights .rlight { width: 100%; container-type: inline-size; }
.keylights .rlight b { font-size: 27cqi; }
.keylights .rlight.is-long b { font-size: 22cqi; letter-spacing: -0.03em; }
/* Ist das Licht nur teilweise gefüllt, steht die Zahl im gefüllten Teil, nicht auf der Kante */
.keylights .rlight.is-fill b { translate: 0 0.8em; }
.keylights__label { color: var(--on-dark); text-align: center; }
/* "Read the study" landet am Anfang des Bandes; sein Innenabstand lässt Platz für die Kopfzeile */
.reading { scroll-margin-top: 0; }

/* ---------- Raster: Inhalt | Text | Rand ---------- */
.paper-grid {
  display: grid; grid-template-columns: var(--toc) minmax(0, 1fr);
  gap: var(--col-gap); align-items: start; padding-block: var(--pad-section);
}
.toc { position: sticky; top: 5rem; font-size: var(--step-small); }
.toc__title { font-weight: 600; margin-bottom: 0.75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.toc a { display: grid; grid-template-columns: 1.5rem 1fr; padding: 0.3rem 0; text-decoration: none; color: var(--muted); transition: color var(--t-hover) ease; }
.toc a:hover, .toc a.is-active { color: var(--ink); }
.toc a.is-active { font-weight: 600; }

.paper-body { font-family: var(--serif); font-size: 1.125rem; line-height: 1.65; }
.paper-body { counter-reset: sec; }
/* Abschnittsnummern als Zähler; die Quellen bleiben ohne Nummer. */
.paper-body > h2 { counter-increment: sec; }
.paper-body > h2::before { content: counter(sec); font-family: var(--font); color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }
.paper-body > h2#references::before { content: none; }
.paper-body > h2#references { counter-increment: none; }
.paper-body p { margin: 0 0 1.1rem; }
.paper-body > ol { padding-left: 1.4rem; display: grid; gap: 0.5rem; font-size: 0.98rem; }
.paper-body > ul { margin: 0 0 1.25rem; padding-left: 1.2rem; display: grid; gap: 0.6rem; }
.paper-body h2 {
  font-family: var(--font); font-size: var(--step-title); letter-spacing: -0.025em; line-height: 1.1;
  margin: var(--gap-chapter) 0 1.25rem; display: flex; gap: 0.9rem; align-items: baseline; scroll-margin-top: 4.5rem;
}
.sec { font-family: var(--font); font-variant-numeric: tabular-nums; color: var(--red); font-weight: 600; }
.toc .sec { color: inherit; font-weight: 500; }
.paper-body code { font-size: 0.85em; background: var(--surface); padding: 0.1em 0.35em; }
.paper-body .link, .paper-body a { text-underline-offset: 0.15em; }

/* Abstract und Kurzfassung */
.abstract { background: var(--surface); padding: 1.5rem 1.75rem; }
.abstract h2 { font-size: var(--step-body); letter-spacing: 0; margin: 0 0 0.6rem; }
.abstract p { font-size: 1.0625rem; margin: 0; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.plain li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.25rem; align-items: baseline; }
.plain b { font-family: var(--font); font-size: var(--step-title); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.plain p { margin: 0; }

/* Notizen stehen als Kästen in der Spalte, wie die Formel-Kästen. */
.tnote { font-family: var(--font); font-size: var(--step-small); color: var(--muted); margin-top: -1.25rem !important; }
.side {
  margin: 0.25rem 0 1.5rem; padding: 0.8rem 1rem; background: var(--surface);
  font-family: var(--font); font-size: var(--step-small); line-height: 1.5; color: var(--muted);
}

/* Mathematik zum Aufklappen: der Text liest sich ohne, wer mag, klappt auf. */
.math { margin: 0.25rem 0 1.5rem; background: var(--surface); }
.math summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem; font-family: var(--font); font-size: var(--step-small); font-weight: 600;
}
.math summary::-webkit-details-marker { display: none; }
.math summary::before {
  content: "∑"; display: grid; place-content: center; width: 1.6rem; aspect-ratio: 1; border-radius: 50%;
  background: var(--ink); color: var(--light); font-weight: 500; flex: none;
  transition: transform var(--t-ui) var(--ease-out);
}
.math[open] summary::before { content: "−"; }
.math summary:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.math > :not(summary) { padding-inline: 1rem; }
.math > p { font-size: 1rem; }
.math > :last-child { padding-bottom: 0.5rem; }

/* Formeln (beim Bauen mit KaTeX gesetzt) */
.eq, .paper .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }
.paper .katex { font-size: 1.08em; }
.paper .katex-display { margin: 0.5rem 0; }

/* Abbildungen: immer in der Textspalte, nie in den Rand */
.fig { margin: 1.75rem 0 2rem; background: var(--surface); padding: 1.25rem 1.25rem 1rem; display: grid; gap: 0.75rem; }
/* Titel und Quellzeile jeder Abbildung, damit sie auch geteilt für sich steht */
.fig__title { font-family: var(--font); font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin: 0; max-width: none; }
.fig__tabs { font-family: var(--font); }
.fig__source { font-family: var(--font); font-size: 0.75rem; color: var(--muted); margin: 0; max-width: none; }
/* In der Spalte steht alles gleich breit, auch der Fließtext */
.paper-body > p, .paper-body > ul, .paper-body > ol { max-width: none; }
.fig figcaption, .tool__fig figcaption { font-family: var(--font); font-size: var(--step-small); line-height: 1.45; color: var(--muted); max-width: 70ch; }
.fig figcaption b, .ptable caption b, .tool__fig figcaption b { color: var(--ink); }
.fig .chart text { font-size: 12px; }
.chart .axis-title { fill: var(--muted); }
.fig .legend, .fig .chart-table, .tool__fig .legend, .tool__fig .chart-table { font-family: var(--font); }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; }
.ptable { border-collapse: collapse; width: 100%; font-family: var(--font); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.ptable caption { caption-side: top; text-align: left; font-size: var(--step-small); color: var(--muted); padding-bottom: 0.6rem; }
.ptable th { text-align: right; font-weight: 600; padding: 0.55rem 0 0.55rem 1rem; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.ptable td { text-align: right; padding: 0.55rem 0 0.55rem 1rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.ptable th:first-child, .ptable td:first-child { text-align: left; padding-left: 0; }
.ptable td small { color: var(--muted); font-size: 0.8em; display: block; }
.ptable tr.is-best td { font-weight: 600; }

.plist { margin: 0 0 1.25rem; padding-left: 1.2rem; display: grid; gap: 0.6rem; }
.refs { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.5rem; font-size: 0.98rem; }

.fig__tabs { margin-bottom: 0.25rem; }

/* Die Leiste zum Teilen steht klein unter jeder Abbildung (common.js, figureShares) */
.fig { position: relative; scroll-margin-top: 5rem; }

/* Sehr breite Bildschirme: etwas breiter und größer gesetzt, damit die Seite nicht als schmaler Streifen wirkt. */
@media (min-width: 100em) {
  :root { --max-read: 69rem; }
  .paper { --toc: 14rem; }
  .paper-body { font-size: 1.25rem; }
  .abstract p { font-size: 1.1875rem; }
}

/* ---------- Schmalere Bildschirme: das Inhaltsverzeichnis rückt über den Text ---------- */
@media (max-width: 56em) {
  .title-block { grid-template-columns: minmax(0, 1fr); }
  .title-block__main, .title-block__key { grid-row: auto; grid-template-rows: none; gap: 2rem; }
  .keylights { justify-content: start; }
  .paper-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; background: var(--surface); padding: 1rem 1.25rem; }
  .toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; }
  .plain li { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
  .paper-body { font-size: 1.0625rem; }
}
@media (max-width: 40em) {
  .title-block .button { padding-inline: 1.1rem; }
  .toc ol { grid-template-columns: minmax(0, 1fr); }
  .paper .katex-display > .katex { font-size: 0.86em; }
  .ptable { font-size: 0.85rem; }
  /* Breite Tabellen verlieren die letzte Spalte; Tabellen mit Männern und Frauen behalten beide */
  .ptable:has(th:nth-child(4)) th:last-child, .ptable:has(th:nth-child(4)) td:last-child { display: none; }
}

/* ---------- Impressum und Datenschutz ---------- */
.legal { padding-block: clamp(7rem, 11vw, 9rem) var(--pad-section); font-family: var(--serif); font-size: 1.0625rem; line-height: 1.65; }
.legal h1 { font-family: var(--font); font-size: var(--step-head); letter-spacing: -0.04em; line-height: 0.95; margin-bottom: 2rem; }
.legal h2 { font-family: var(--font); font-size: var(--step-lead); letter-spacing: -0.02em; line-height: 1.2; margin: 2.25rem 0 0.75rem; }
.legal p { margin: 0 0 1rem; max-width: 65ch; }
.legal__date { color: var(--muted); font-size: var(--step-small); font-family: var(--font); }
