/*
 * legal.css — Legal-page-specific layout (v0.11.13).
 *
 * Loaded by agb.html, datenschutz.html, impressum.html, widerruf.html.
 * NO body-attribute scoping. Page-level scope is provided by a single
 * class on <body>: `legal-page` (info pages) or `legal-page legal-page--formal`
 * (AGB + Widerruf, tighter contract feel).
 *
 *   <body class="legal-page" data-page-id="datenschutz">          → Datenschutz, Impressum
 *   <body class="legal-page legal-page--formal" data-page-id="agb">  → AGB, Widerruf
 *
 * `data-page-id` is analytics-only — no CSS selector ever targets it. The
 * test_chrome_components invariants enforce this separation.
 *
 * Sitewide top-nav is position:fixed, so legal-page content needs top padding.
 * Long German compounds (Auftragsverarbeitungsvertrag) must not break narrow
 * viewports.
 */

/* Scoped reset for legal-page MAIN content only. The chrome (.nav-cart,
 * .nav-brand, .nav-links a) lives outside <main> and is untouched. */
.legal-page main *,
.legal-page main *::before,
.legal-page main *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* v0.11.13: line-height + word-break + hyphens scoped to main content only.
 * Previously on body[data-legal-mode] — but body cascades line-height into
 * every descendant, including the shared chrome nav. That made nav-brand
 * text render 1-3px taller on legal pages (line-height: 1.7 × ~16px font
 * ≈ 27px vs 1.4 default × 17px ≈ 24px on other pages). Scoping to <main>
 * keeps the chrome typography truly identical across pages. */
.legal-page main {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 4vw, 1.5rem) 4rem;
  line-height: 1.7;
  word-break: break-word;
  hyphens: auto;
}

/* === Back-to-home link above H1 ============================================ */
.back-link {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-text);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.back-link:hover { text-decoration: underline; }

.legal-page h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.meta-stamp {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 2rem;
}

/* === Summary block =========================================================
 * v0.11.15: card padding tuned. Selector prefixed with .legal-page to win
 * specificity over the `.legal-page main *` reset (which was silently zeroing
 * padding on cards since v0.11.11). Values: 24px vertical / 24-32px horizontal
 * — measured breathing room without going premium-card-loud. */
.legal-page .summary-block {
  background: var(--off-white);
  border-radius: 12px;
  padding: 1.5rem clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 2.5rem;
}
.summary-block .eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue-text);
  margin-bottom: 0.5rem;
}
.summary-block p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--navy);
}

/* === Table of contents — plain quiet list (v0.11.17 design-review D1) ======
 * Navigation should be quiet so the summary-block above stays loud.
 * Previously a bordered card; now no surface, just a numbered jump-list. */
.toc {
  margin: 0 0 2.5rem;
}
.toc summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
  list-style: none;
  user-select: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: ' ▾';
  color: var(--gray);
  font-size: 0.85rem;
}
.toc[open] summary::after { content: ' ▴'; }
.toc ol {
  list-style: none;
  margin-top: 1rem;
  padding-left: 0;
  display: grid;
  gap: 0.6rem;
}
.toc ol a {
  display: block;
  padding: 0.45rem 0;
  font-size: 0.95rem;
  color: var(--navy);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.15s;
}
.toc ol a:hover { color: var(--blue-text); text-decoration: underline; }
.toc ol .num,
.legal-page section h2 .num {
  display: inline-block;
  min-width: 2.25rem;
  margin-right: 0.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: var(--gray);
}
@media (min-width: 641px) {
  .toc summary { display: none; }
  .toc ol { margin-top: 0; }
}

/* === Consent settings widget — datenschutz #cookies (v0.11.17 D2) ==========
 * Live interactive controls. Container = card (controls deserve a container
 * so users know "this is the operative area"). Card uses design tokens, not
 * hardcoded hex. Hairlines between the 3 toggle rows kept for scanability;
 * border-top on the footer area dropped (redundant with the card border). */
.legal-page .consent-settings {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 2.5rem;
}
.consent-settings .consent-title {
  font-weight: 600;
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  color: var(--navy);
}
.consent-settings label {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.consent-settings label:first-of-type {
  cursor: default;
}
.consent-settings label:last-of-type {
  border-bottom: none;
}
.consent-settings label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}
.consent-settings label > div {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--navy);
}
.consent-settings label > div span {
  color: var(--gray);
  font-size: 0.9rem;
}
.consent-settings .consent-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.consent-settings .consent-saved {
  font-size: 0.85rem;
  color: var(--gray);
}
.consent-settings .consent-saved-flash {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 600;
}
.consent-settings .consent-withdraw {
  padding: 0.45rem 0.95rem;
  background: transparent;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}
.consent-settings .consent-withdraw:hover {
  background: rgba(220, 38, 38, 0.05);
}
.consent-settings .consent-note {
  margin: 1.4rem 0 0;
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.55;
}
.consent-settings .consent-note a {
  color: var(--blue-text);
  text-decoration: underline;
}

/* === Numbered sections ===================================================== */
.legal-page section {
  margin-top: 2.5rem;
  padding-top: 1rem;
}
.legal-page section h2 {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--navy);
  margin-bottom: 0.75rem;
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}
.legal-page section h2:target {
  background: var(--blue-light);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
}
.legal-page section p,
.legal-page section li {
  margin-bottom: 0.85rem;
  font-size: 1rem;
  color: var(--navy);
}
.legal-page section ul,
.legal-page section ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.legal-page section li {
  margin-bottom: 0.4rem;
}
.legal-page section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.legal-page section strong {
  font-weight: 600;
}

/* Inline links (body) — underlined per cognitive a11y. Class-scoped to legal,
 * so landingpage's own section anchor styling isn't affected. */
.legal-page section a,
.summary-block a {
  color: var(--link-on-light, var(--blue-text));
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.legal-page section a:hover {
  text-decoration-thickness: 2px;
  color: var(--blue-hover);
}

/* === Between-section back-to-top + bottom stamp ============================ */
.back-to-top {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--gray);
  text-decoration: none;
}
.back-to-top:hover { color: var(--blue-text); text-decoration: underline; }

.meta-stamp--bottom {
  margin-top: 4rem;
  margin-bottom: 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--gray);
}

/* === Formal-mode override (AGB, Widerruf) — tighter contract feel ========= */
.legal-page--formal section h2 .num {
  display: none;
}
.legal-page--formal section h2 {
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.legal-page--formal main {
  line-height: 1.55;
}
.legal-page--formal section p,
.legal-page--formal section li {
  font-size: 0.95rem;
  line-height: 1.55;
}
.legal-page--formal .summary-block .eyebrow {
  letter-spacing: 0.18em;
}
