/* ==========================================================================
   Consent Manager (10/2026, nach dem Vorbild Lieblingsfliese) – Banner und Einstellungen.
   Sichtbarkeit: Inline-CSS in consent-head.twig (.consent display none/flex) +
   Klassen am <html> (cs-consent-pending | -modal | -open). Mobil kompaktes Bottom-Sheet
   (ca. 30 % der Höhe, Seite bleibt sichtbar), ab 768 px Karte am unteren Rand (Hero und
   Einstiegsformular bleiben sichtbar), Einstellungen als mittiges Modal. Farben über die lokalen Variablen in .consent.
   ========================================================================== */
.consent {
  --consent-radius: 14px;
  --color-primary: #b85a00;
  --color-secondary: #b85a00;
  --color-secondary-hover: #8f4600;
  --color-text: #363f4a;
  --color-text-muted: #5f6b7a;
  --color-border: #e5e7eb;
  --color-surface: #f4f5f7;
  --color-success: #14ab23;
  --page-gutter: 20px;
  --btn-radius: 6px;
  --consent-shadow: 0 -8px 32px rgba(0, 0, 0, .18);
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: flex-end;
  justify-content: center;
  font-family: inherit;
  color: var(--color-text);
  pointer-events: none;
}

.cs-consent-open body { overflow: hidden; }

.consent__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, .2);
  pointer-events: auto;
}
.consent--inline .consent__backdrop { display: none; }

.consent__dialog {
  position: relative;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  background: #fff;
  border-radius: var(--consent-radius) var(--consent-radius) 0 0;
  box-shadow: var(--consent-shadow);
  pointer-events: auto;
  outline: none;
}
.consent__dialog[hidden] { display: none; }

/* ── Ebene 1 ─────────────────────────────────────────────────── */

.consent__banner {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px var(--page-gutter) calc(10px + env(safe-area-inset-bottom));
}

.consent__title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  line-height: 1.3;
  font-weight: 700;
  color: #243141;
}

.consent__text {
  margin: 0 0 4px;
  font-size: .875rem;
  line-height: 1.45;
}
.consent__note {
  margin: 0 0 12px;
  font-size: .75rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.consent__link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.consent__link:hover { color: var(--color-primary); }

/* Gleichwertige Buttons: gleiche Größe, Ebene und Schrift – nur Füllung vs. Kontur.
   Auch mobil nebeneinander, damit das Bottom-Sheet flach bleibt. */
.consent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--color-secondary);
  border-radius: var(--btn-radius);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.consent__btn--primary {
  background: var(--color-secondary);
  color: #fff;
}
.consent__btn--primary:hover { background: var(--color-secondary-hover); border-color: var(--color-secondary-hover); }
.consent__btn--secondary {
  background: #fff;
  color: var(--color-secondary);
}
.consent__btn--secondary:hover { background: var(--color-surface); }
.consent__btn:focus-visible,
.consent__link:focus-visible,
.consent-cat__toggle:focus-visible,
.consent__close:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.consent__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin: 8px 0 0;
  font-size: .75rem;
  color: var(--color-text-muted);
}
.consent__meta a { color: inherit; }

/* ── Ebene 2 ─────────────────────────────────────────────────── */

.consent__settings {
  display: flex;
  flex-direction: column;
  height: 92vh;
  height: 92dvh;
}

.consent__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px var(--page-gutter) 12px;
  border-bottom: 1px solid var(--color-border);
}
.consent__head .consent__title { margin: 0; }

.consent__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--color-secondary);
  cursor: pointer;
}
.consent__close:hover { background: var(--color-surface); }

.consent__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px var(--page-gutter);
}

.consent__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 12px var(--page-gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  background: #fff;
  border-radius: 0 0 var(--consent-radius) var(--consent-radius);
}

.consent-cat {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.consent-cat__head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.consent-cat__toggle {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.consent-cat__label { font-weight: 700; font-size: 1rem; }
.consent-cat__count { font-size: .8125rem; color: var(--color-text-muted); }
.consent-cat__chevron { align-self: center; margin-left: auto; transition: transform .2s; }
.consent-cat__toggle[aria-expanded="true"] .consent-cat__chevron { transform: rotate(180deg); }
.consent-cat__always { font-size: .8125rem; font-weight: 600; color: #0e7a19; white-space: nowrap; }
.consent-cat__desc { margin: 4px 0 0; font-size: .875rem; line-height: 1.5; color: var(--color-text-muted); }

.consent-cat__services {
  margin-top: 12px;
  padding: 4px 12px;
  background: var(--color-surface);
  border-radius: 10px;
}
.consent-service { padding: 10px 0; }
.consent-service + .consent-service { border-top: 1px solid var(--color-border); }
.consent-service__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.consent-service__name { font-weight: 600; font-size: .9375rem; }
.consent-service__purpose { margin: 4px 0 6px; font-size: .8125rem; line-height: 1.5; }
.consent-service__details summary {
  font-size: .8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.consent-service__facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin: 8px 0 0;
  font-size: .8125rem;
  line-height: 1.45;
}
.consent-service__facts dt { font-weight: 600; margin-top: 6px; }
.consent-service__facts dd { margin: 0; overflow-wrap: anywhere; }
.consent-service__cookies { margin: 0; padding-left: 1.1em; }
.consent-service__facts code { font-size: .78rem; }

.consent__id { margin: 16px 0 0; font-size: .75rem; color: var(--color-text-muted); overflow-wrap: anywhere; }

/* Schalter */
.consent-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  cursor: pointer;
}
.consent-switch--small { width: 42px; height: 24px; }
.consent-switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.consent-switch__track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #b5b5b5;
  transition: background-color .15s;
}
.consent-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.consent-switch--small .consent-switch__track::after { width: 18px; height: 18px; }
.consent-switch__input:checked + .consent-switch__track { background: var(--color-success); }
.consent-switch__input:checked + .consent-switch__track::after { transform: translateX(20px); }
.consent-switch--small .consent-switch__input:checked + .consent-switch__track::after { transform: translateX(18px); }
.consent-switch__input:indeterminate + .consent-switch__track { background: #7fae74; }
.consent-switch__input:indeterminate + .consent-switch__track::after { transform: translateX(10px); }
.consent-switch__input:focus-visible + .consent-switch__track { outline: 3px solid var(--color-primary); outline-offset: 2px; }

/* ── schmale Handys (iPhone SE u. ä.): Buttons einzeilig halten ─ */

@media (max-width: 380px) {
  .consent { --page-gutter: 16px; }
  .consent__btn { padding: 8px 6px; font-size: .875rem; white-space: nowrap; }
}

/* ── ab 640 px: Fußleiste der Einstellungen dreispaltig ──────── */

@media (min-width: 640px) {
  .consent__foot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── ab 768 px: Banner unten, Einstellungen mittig ───────────── */

@media (min-width: 768px) {
  .consent { align-items: flex-end; padding: 24px; }

  .consent__dialog { border-radius: var(--consent-radius); box-shadow: 0 24px 64px rgba(0, 0, 0, .25); }

  .consent__banner {
    max-width: 600px;
    padding: 32px 36px 28px;
  }
  .consent__title { margin-bottom: 8px; font-size: 1.5rem; }
  .consent__text { margin-bottom: 8px; font-size: .9375rem; line-height: 1.5; }
  .consent__note { margin-bottom: 16px; font-size: .8125rem; }
  .consent__btn { min-height: 48px; padding: 10px 20px; font-size: 1rem; }
  .consent__meta { justify-content: flex-start; margin-top: 14px; font-size: .8125rem; }

  .consent__settings { align-self: center; max-width: 720px; height: auto; max-height: min(86vh, 820px); }
  .consent__head { padding: 20px 28px 14px; }
  .consent__scroll { padding: 18px 28px; }
  .consent__foot { padding: 14px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .consent *, .consent *::after { transition: none !important; }
}

@media print {
  .consent { display: none !important; }
}
