/* DHM24 Cookie-Einstellungen auf VM 108.
   Markup rendert PHP (#dhm24-cookie-preferences). Keine externen Schriften, Bilder oder Skripte.
   Gestaltung: warme weiße Karte, Anthrazit, Markenakzent Rostorange #ea6b20 (nur Fläche/Linie;
   für Text und Schalter wird die dunklere Variante mit AA-Kontrast genutzt).
   Erste Ebene: „Nur notwendige“ und „Alle erlauben“ sind identisch gestaltet (gleiche Gewichtung).
   Kein Overlay, keine Scroll- oder Fokussperre: Seite bleibt vollständig bedienbar. */

/* ---------------------------------------------------------------------------------------------
   Defensive [hidden]-Regeln für alle vom Skript gesteuerten Elemente
   --------------------------------------------------------------------------------------------- */
.dhm24-consent[hidden],
.dhm24-consent [hidden],
.dhm24-consent__reopen[hidden],
.dhm24-consent__checkout-button[hidden],
[data-dhm24-cookie-open][hidden],
[data-dhm24-cookie-error][hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------------------------------------
   Panel
   --------------------------------------------------------------------------------------------- */
.dhm24-consent {
  --dhm24-consent-brand: #ea6b20;
  --dhm24-consent-brand-ink: #a4460c;   /* ca. 6:1 auf der Karte, für Text, Links, Schalter */
  --dhm24-consent-brand-deep: #7f3608;
  --dhm24-consent-ink: #24201c;         /* Anthrazit, ca. 15:1 */
  --dhm24-consent-ink-soft: #57504a;    /* ca. 7.8:1 */
  --dhm24-consent-card: #fffdf9;        /* warmes Weiß */
  --dhm24-consent-paper: #f7f2ea;
  --dhm24-consent-rule: #e4dacc;
  --dhm24-consent-focus: #24201c;
  --dhm24-consent-gap: max(1.5rem, env(safe-area-inset-bottom, 0px));

  box-sizing: border-box;
  position: fixed;
  z-index: 99990;
  left: max(1.5rem, env(safe-area-inset-left, 0px));
  right: auto;
  bottom: var(--dhm24-consent-gap);
  width: min(30rem, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  max-height: calc(100dvh - 3rem);
  margin: 0;
  padding: 1.375rem 1.5rem 1.25rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--dhm24-consent-rule);
  border-top: 4px solid var(--dhm24-consent-brand);
  border-radius: 6px;
  background: var(--dhm24-consent-card);
  box-shadow:
    0 1px 2px rgba(36, 32, 28, 0.06),
    0 24px 48px -20px rgba(36, 32, 28, 0.42);
  color: var(--dhm24-consent-ink);
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.55;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  animation: dhm24-consent-in 0.22s ease-out both;
}

.dhm24-consent *,
.dhm24-consent *::before,
.dhm24-consent *::after {
  box-sizing: border-box;
}

.dhm24-consent[aria-busy="true"] {
  cursor: progress;
}

.dhm24-consent[aria-busy="true"] button {
  pointer-events: none;
  opacity: 0.7;
}

@keyframes dhm24-consent-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------------------------------------
   Text
   --------------------------------------------------------------------------------------------- */
.dhm24-consent__copy {
  margin: 0 0 1.125rem;
}

.dhm24-consent__copy h2,
#dhm24-consent-title {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dhm24-consent-ink);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.3;
  text-transform: none;
}

/* Programmatischer Fokus beim Öffnen: sichtbar bei Tastaturbedienung, ohne Störrahmen bei Mausklick */
#dhm24-consent-title:focus {
  outline: none;
}

#dhm24-consent-title:focus-visible {
  outline: 3px solid var(--dhm24-consent-focus);
  outline-offset: 4px;
  border-radius: 2px;
}

.dhm24-consent__copy p,
.dhm24-consent__options p {
  margin: 0 0 0.625rem;
  color: var(--dhm24-consent-ink-soft);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.dhm24-consent__copy p:last-child,
.dhm24-consent__options p:last-child {
  margin-bottom: 0;
}

.dhm24-consent a {
  color: var(--dhm24-consent-brand-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.dhm24-consent a:hover {
  color: var(--dhm24-consent-brand-deep);
  text-decoration-thickness: 2px;
}

/* ---------------------------------------------------------------------------------------------
   Schaltflächen – gemeinsame Basis
   --------------------------------------------------------------------------------------------- */
.dhm24-consent button,
.dhm24-consent__reopen,
.dhm24-consent__checkout-button {
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Fokus: 3 px Anthrazit mit hellem Abstand, auf Karte und gefüllten Schaltflächen deutlich sichtbar */
.dhm24-consent :is(a, button, summary, input):focus-visible,
.dhm24-consent__reopen:focus-visible,
.dhm24-consent__checkout-button:focus-visible {
  outline: 3px solid var(--dhm24-consent-focus, #24201c);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fffdf9;
}

/* Erste Ebene: exakt gleiche Gestaltung beider Entscheidungen */
.dhm24-consent__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.625rem;
  margin: 0 0 0.875rem;
}

.dhm24-consent__actions button,
.dhm24-consent [data-cookie-save] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.875rem;
  margin: 0;
  padding: 0.6875rem 1rem;
  border: 2px solid var(--dhm24-consent-ink);
  border-radius: 4px;
  background: var(--dhm24-consent-card);
  box-shadow: none;
  color: var(--dhm24-consent-ink);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dhm24-consent__actions button:hover,
.dhm24-consent__actions button:active {
  background: var(--dhm24-consent-ink);
  color: var(--dhm24-consent-card);
}

/* Auswahl speichern: in den Details, warmer Markenton mit AA-Kontrast */
.dhm24-consent [data-cookie-save] {
  width: auto;
  min-width: 12rem;
  margin-top: 0.25rem;
  justify-self: start;
  border-color: var(--dhm24-consent-brand-ink);
  background: var(--dhm24-consent-brand-ink);
  color: #ffffff;
}

.dhm24-consent [data-cookie-save]:hover,
.dhm24-consent [data-cookie-save]:active {
  border-color: var(--dhm24-consent-brand-deep);
  background: var(--dhm24-consent-brand-deep);
  color: #ffffff;
}

/* ---------------------------------------------------------------------------------------------
   Details / Auswahl
   --------------------------------------------------------------------------------------------- */
.dhm24-consent__details {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--dhm24-consent-rule);
}

.dhm24-consent__details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.625rem 0.25rem 0.5rem 0;
  border-radius: 2px;
  color: var(--dhm24-consent-ink);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.dhm24-consent__details > summary::-webkit-details-marker {
  display: none;
}

.dhm24-consent__details > summary::marker {
  content: '';
}

/* Chevron aus Rahmenlinien, ohne Grafikdatei */
.dhm24-consent__details > summary::after {
  content: '';
  flex: 0 0 auto;
  width: 0.5625rem;
  height: 0.5625rem;
  margin: 0 0.375rem 0.25rem 0;
  border-right: 2px solid var(--dhm24-consent-brand-ink);
  border-bottom: 2px solid var(--dhm24-consent-brand-ink);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.dhm24-consent__details[open] > summary::after {
  margin-bottom: -0.125rem;
  transform: rotate(-135deg);
}

.dhm24-consent__details > summary:hover {
  color: var(--dhm24-consent-brand-ink);
}

.dhm24-consent__options {
  display: grid;
  gap: 0.75rem;
  padding: 0.375rem 0 0.125rem;
}

/* Zeile mit Kontrollkästchen: Label umschließt das Feld oder Feld und Label stehen in einem Container.
   Raster statt Flex: Schalter links, Beschriftung und Erläuterung untereinander rechts. */
.dhm24-consent__options label:has(> input[type="checkbox"]),
.dhm24-consent__options :is(div, li, p):has(> input[type="checkbox"]) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.875rem;
  row-gap: 0;
  align-items: start;
  margin: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--dhm24-consent-rule);
  border-radius: 4px;
  background: var(--dhm24-consent-paper);
  color: var(--dhm24-consent-ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.dhm24-consent__options label:has(> input[type="checkbox"]) > input[type="checkbox"],
.dhm24-consent__options :is(div, li, p):has(> input[type="checkbox"]) > input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1 / span 3;
}

.dhm24-consent__options :is(div, li, p):has(> input[type="checkbox"]) > :not(input) {
  grid-column: 2;
}

.dhm24-consent__options :is(div, li, p):has(> input[type="checkbox"]) label {
  display: block;
  margin: 0;
}

.dhm24-consent__options label {
  color: var(--dhm24-consent-ink);
  font-weight: 700;
  cursor: pointer;
}

.dhm24-consent__options :is(small, .description) {
  display: block;
  margin-top: 0.125rem;
  color: var(--dhm24-consent-ink-soft);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
}

/* Kontrollkästchen als Schalter: bleibt semantisch ein natives Kontrollkästchen */
.dhm24-consent input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0.0625rem 0 0;
  padding: 0;
  border: 2px solid var(--dhm24-consent-ink-soft);
  border-radius: 999px;
  background: #ffffff;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dhm24-consent input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0.1875rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--dhm24-consent-ink-soft);
  transform: translateY(-50%);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.dhm24-consent input[type="checkbox"]:checked {
  border-color: var(--dhm24-consent-brand-ink);
  background: var(--dhm24-consent-brand-ink);
}

.dhm24-consent input[type="checkbox"]:checked::before {
  background: #ffffff;
  transform: translate(1.25rem, -50%);
}

.dhm24-consent input[type="checkbox"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dhm24-consent input[type="checkbox"]:focus-visible {
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------------------------------
   Rückmeldung bei nicht speicherbarer Auswahl
   --------------------------------------------------------------------------------------------- */
.dhm24-consent [data-dhm24-cookie-error] {
  margin: 0 0 0.875rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid #b42318;
  border-left-width: 4px;
  border-radius: 4px;
  background: #fff4f2;
  color: #7a1a12;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------------------------
   Wieder-Öffnen-Schaltflächen
   --------------------------------------------------------------------------------------------- */

/* Ersatzposition neben dem Panel (kein Footer gefunden): kompakte Schaltfläche im Dokumentfluss */
.dhm24-consent__reopen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: calc(100% - 2rem);
  min-height: 2.75rem;
  margin: 1rem auto max(1rem, env(safe-area-inset-bottom, 0px));
  padding: 0.5rem 1rem;
  border: 2px solid #24201c;
  border-radius: 4px;
  background: #fffdf9;
  box-shadow: none;
  color: #24201c;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dhm24-consent__reopen:hover {
  background: #24201c;
  color: #fffdf9;
}

/* Im Footer: fügt sich wie ein Footer-Link ein, erbt Schrift und Farbe des Footers */
.dhm24-consent__reopen-item {
  list-style: none;
}

.dhm24-consent__reopen.dhm24-consent__reopen--footer {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  max-width: none;
  min-height: 2.5rem;
  margin: 0;
  padding: 0.1875rem 0.75rem;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: start;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-transform: inherit;
}

.dhm24-consent__reopen.dhm24-consent__reopen--footer:hover {
  background: transparent;
  color: inherit;
  text-decoration-thickness: 2px;
}

/* Auf dunklem wie hellem Footer sichtbar: Rahmen in aktueller Textfarbe */
.dhm24-consent__reopen.dhm24-consent__reopen--footer:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  box-shadow: none;
}

/* Vorhandener Öffner im Checkout */
.dhm24-consent__checkout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin: 0.5rem 0;
  padding: 0.5rem 1rem;
  border: 2px solid #a4460c;
  border-radius: 4px;
  background: #fffdf9;
  box-shadow: none;
  color: #a4460c;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dhm24-consent__checkout-button:hover {
  background: #a4460c;
  color: #ffffff;
}

/* ---------------------------------------------------------------------------------------------
   Responsiv
   --------------------------------------------------------------------------------------------- */
@media (min-width: 75em) {
  .dhm24-consent {
    --dhm24-consent-gap: max(2rem, env(safe-area-inset-bottom, 0px));
    left: max(2rem, env(safe-area-inset-left, 0px));
    width: min(32rem, calc(100vw - 4rem));
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    padding: 1.625rem 1.75rem 1.375rem;
  }

  #dhm24-consent-title {
    font-size: 1.25rem;
  }
}

/* Mobil: zentriert mit Rand, volle verfügbare Breite */
@media (max-width: 39.9375em) {
  .dhm24-consent {
    --dhm24-consent-gap: max(0.75rem, env(safe-area-inset-bottom, 0px));
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    width: auto;
    max-width: 32rem;
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    margin-inline: auto;
    padding: 1.125rem 1.125rem 1rem;
  }

  #dhm24-consent-title {
    font-size: 1.0625rem;
  }

  .dhm24-consent__copy {
    margin-bottom: 0.875rem;
  }

  .dhm24-consent__copy p {
    font-size: 0.875rem;
  }

  .dhm24-consent [data-cookie-save] {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }
}

/* Sehr schmal: Entscheidungen untereinander, weiterhin gleich groß */
@media (max-width: 22.5em) {
  .dhm24-consent__actions {
    grid-template-columns: 1fr;
  }
}

/* Niedrige Viewports (Querformat Smartphone): kompakter, Panel bleibt scrollbar */
@media (max-height: 32em) {
  .dhm24-consent {
    --dhm24-consent-gap: max(0.5rem, env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    padding-top: 0.875rem;
    padding-bottom: 0.75rem;
  }

  .dhm24-consent__copy {
    margin-bottom: 0.625rem;
  }

  .dhm24-consent__actions {
    margin-bottom: 0.5rem;
  }
}

/* ---------------------------------------------------------------------------------------------
   Barrierefreiheit: Bewegung, erzwungene Farben, Druck
   --------------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .dhm24-consent,
  .dhm24-consent *,
  .dhm24-consent *::before,
  .dhm24-consent *::after,
  .dhm24-consent__reopen,
  .dhm24-consent__checkout-button {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .dhm24-consent {
    border: 2px solid CanvasText;
  }

  .dhm24-consent input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 0;
  }

  .dhm24-consent input[type="checkbox"]::before {
    content: none;
  }

  .dhm24-consent__details > summary::after {
    border-color: CanvasText;
  }

  .dhm24-consent :is(a, button, summary, input):focus-visible,
  .dhm24-consent__reopen:focus-visible,
  .dhm24-consent__checkout-button:focus-visible,
  #dhm24-consent-title:focus-visible {
    outline: 3px solid Highlight;
  }
}

@media print {
  .dhm24-consent,
  .dhm24-consent__reopen {
    display: none !important;
  }
}
