/* ==========================================================================
   Consent-Tool (js/consent.js) -- Modal, Kategorie-Switches, Footer-Link.
   Reused Tokens: --ink, --muted, --lila, --blau, --font, --surface, --line, --radius aus style.css.
   ========================================================================== */

/* AP1.3: nicht-blockierende Bottom-Sheet-Leiste statt Vollbild-Modal -- kein Backdrop, kein
   Scroll-Lock (siehe consent.js openModal/closeModal). Das Overlay selbst ist pointer-events:none
   und deckt daher visuell wie interaktiv nur seinen eigenen unteren Streifen ab; der Rest der
   Seite bleibt darunter voll klick- und scrollbar. Nur .consent-box bekommt pointer-events zurueck. */
.consent-overlay {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 120; /* ueber Loader (100) und body.nav-open .site-header (50) -- ein haengender Loader waere sonst ein toter Bildschirm */
  display: flex;
  justify-content: center;
  padding: clamp(12px, 3vw, 24px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .25s ease, transform .25s ease;
}
.consent-overlay[hidden] { display: none; }
.consent-overlay.is-visible { opacity: 1; transform: translateY(0); }

.consent-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 32px);
  font-family: var(--font);
  pointer-events: auto;
}
/* Programmatischer .focus() beim Oeffnen triggert :focus, nicht :focus-visible (das ist an
   Tastatur-/Mausinteraktion gekoppelt) -- ohne diese Regel bliebe der Fokus auf dem Dialog
   selbst unsichtbar. */
.consent-box:focus { outline: 2px solid var(--blau); outline-offset: 4px; }

.consent-level[hidden] { display: none; }

.consent-title { font-size: 1.3rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.consent-text { color: var(--muted); font-size: .92rem; line-height: 1.6; margin-bottom: 20px; }
.consent-text a { color: var(--blau); }

.consent-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .consent-actions { flex-direction: column; }
}
/* Ebene 1 ist der rechtlich kritische Punkt: beide Buttons gleiche Klasse, gleiche Groesse,
   gleiche Flaeche, gleicher Kontrast. Kein Gradient auf der einen Seite gegen Outline auf der
   anderen -- genau das ist der Standard-Dark-Pattern-Vorwurf der DSK-Orientierungshilfe. Der
   einzige Unterschied ist der Farbton (Hue) bei identischem Kontrast zu weisser Schrift. */
.consent-btn {
  flex: 1;
  min-height: 46px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600;
  font-size: .92rem;
  color: #fff;
  cursor: pointer;
}
.consent-btn--a { background: var(--blau); }
.consent-btn--b { background: #4b4f5c; }
/* Ebene 2 ("Ablehnen" neben "Speichern"): gleiche Groesse/Gewicht wie --a/--b, nur der Hue
   unterscheidet sich -- DSK-Orientierungshilfe verlangt eine gleich einfache Ablehnung auch auf
   der zweiten Ebene, nicht nur auf der Bottom-Sheet-Ebene 1 (siehe consent.js Level-2-Actions). */
.consent-btn--c { background: #6b7280; }
@media (hover: hover) {
  .consent-btn:hover { opacity: .92; }
}
.consent-btn:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }

.consent-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}
.consent-link {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: var(--blau); cursor: pointer; text-decoration: none;
}
.consent-link:hover { text-decoration: underline; }
.consent-links span { color: var(--muted); }

.consent-back {
  background: none; border: none; padding: 0; margin: 0 0 12px;
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--blau); cursor: pointer;
}

.consent-cats { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.consent-cat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.consent-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.consent-cat-name { font-weight: 600; color: var(--ink); font-size: .95rem; }
.consent-cat-desc { color: var(--muted); font-size: .85rem; line-height: 1.55; }
.consent-cat-desc a { color: var(--blau); }

.consent-switch { position: relative; display: inline-flex; flex: none; width: 44px; height: 26px; }
.consent-switch input {
  position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer;
}
.consent-switch input:disabled { cursor: default; }
.consent-switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line);
  transition: background .2s ease;
  pointer-events: none; /* liegt im DOM nach dem input und wuerde dessen Klicks sonst abfangen */
}
.consent-switch-track::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 22, 28, .35);
  transition: transform .2s ease;
}
.consent-switch input:checked + .consent-switch-track { background: var(--blau); }
.consent-switch input:checked + .consent-switch-track::after { transform: translateX(18px); }
.consent-switch input:disabled + .consent-switch-track { opacity: .55; }
.consent-switch input:focus-visible + .consent-switch-track { outline: 2px solid var(--blau); outline-offset: 2px; }

/* Nur fuer Screenreader -- transportiert die Escape-Meldung ("Nur notwendige Cookies
   akzeptiert."), lebt bewusst AUSSERHALB des Modals, damit sie auch nach dessen Schliessen
   noch vorgelesen wird (ein aria-live-Element innerhalb eines geschlossenen/verborgenen
   Containers wird von vielen Screenreadern ignoriert). */
.consent-sr-live {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.footer-cookie-btn {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: rgba(255, 255, 255, .7); cursor: pointer; text-decoration: underline;
}
@media (hover: hover) {
  .footer-cookie-btn:hover { color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .consent-overlay { transition-duration: 0s; }
  .consent-switch-track, .consent-switch-track::after { transition-duration: 0s; }
}
