/* Datenschutz und Impressum. Farben, Schrift und Kopfleiste: siehe topbar.css */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.014em;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1128px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 32px) 24px 96px;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- Inhaltsverzeichnis ---------- */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 40px);
  max-height: calc(100vh - var(--topbar-h) - 64px);
  overflow: auto;
  font-size: 0.8125rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
  scrollbar-width: none;
}

.toc::-webkit-scrollbar { display: none; }

.toc summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text);
  padding-bottom: 10px;
}

.toc summary::-webkit-details-marker { display: none; }

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 6px 0;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); font-weight: 600; }

.toc a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}

/* ---------- Dokument ---------- */
.doc {
  padding: 56px clamp(24px, 6vw, 72px) 64px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.doc h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 8.4vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: 400;
}

.doc h1 + p {
  font-size: 1.1875rem;
  line-height: 1.42;
  color: var(--text-muted);
}

.doc h2 {
  margin: 2.2em 0 0.6em;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.doc h1,
.doc h2,
.doc h3 { overflow-wrap: break-word; }

.doc h3 {
  margin: 1.8em 0 0.35em;
  font-size: 1.0625rem;
  font-weight: 600;
}

.doc p,
.doc ul {
  margin: 0 0 1em;
}

.doc ul {
  padding-left: 1.2em;
}

.doc li {
  margin-bottom: 0.4em;
}

.doc li::marker { color: var(--text-muted); }

.doc strong { font-weight: 600; }

.doc a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.doc a:hover { text-decoration-thickness: 2px; }

.doc footer {
  margin-top: 4em;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---------- Nach-oben-Button ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--bar);
  box-shadow: 0 0 0 1px var(--line);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.to-top.visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .layout {
    max-width: 748px;
    padding-top: calc(var(--topbar-h) + 16px);
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-size: 0.9375rem;
  }

  .toc summary { padding-bottom: 0; font-size: 0.9375rem; }
  .toc[open] summary { padding-bottom: 8px; }
  .toc summary::after { content: " ▾"; color: var(--text-muted); }
  .toc[open] summary::after { content: " ▴"; }
}

@media (max-width: 600px) {
  .layout { padding-left: 12px; padding-right: 12px; padding-bottom: 72px; }
  .doc { padding: 32px 20px 40px; border-radius: 22px; }
  .doc h2 { font-size: 1.3125rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .toc, .to-top { display: none; }
  .layout { display: block; margin: 0; padding: 0; }
  .doc { padding: 0; box-shadow: none; }
}
