/* HLA4: baner cookies i okno ustawień zgód. Czerń, biel i czerwień; tokeny semantyczne motywu z ciemnymi wartościami zastępczymi.
   Trzy przyciski są równorzędne: ta sama klasa, rozmiar, waga i kolor (obrys biały 2 px na czarnym). Progi: 480, 720, 960, 1200. */
.h4-consent,
.h4-consent-wrap,
.h4-consent-toast {
  --hc-bg: var(--h4-bg, #000);
  --hc-text: var(--h4-text, #fff);
  --hc-mute: var(--h4-mute, #b8b8b8);
  --hc-surface: var(--h4-surface, rgba(255, 255, 255, 0.07));
  --hc-line: var(--h4-line, rgba(255, 255, 255, 0.2));
  --hc-red: var(--h4-red, #d62f3a);
  --hc-radius: var(--h4-radius, 6px);
  --hc-font: var(--h4-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --hc-display: var(--h4-font-display, "Arial Narrow", sans-serif);
  box-sizing: border-box;
  color: var(--hc-text);
  font-family: var(--hc-font);
  font-size: 1rem;
  line-height: 1.55;
  color-scheme: dark;
}

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

.h4-consent-wrap[hidden],
.h4-consent [hidden] {
  display: none;
}

html.h4-consent-on body {
  padding-bottom: var(--h4-consent-h, 0px);
}

html.h4-consent-lock {
  overflow: hidden;
}

/* ---------- Pierwsza warstwa: baner na dole ---------- */
.h4-consent {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9000;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  border-top: 3px solid var(--hc-red);
  background: var(--hc-bg);
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.55);
}

.h4-consent .h4-consent__in {
  display: grid;
  gap: 14px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.h4-consent .h4-consent__title {
  margin: 0 0 6px;
  font-family: var(--hc-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hc-text);
}

.h4-consent .h4-consent__text {
  margin: 0;
  max-width: 70ch;
  font-size: 1rem;
  color: var(--hc-text);
}

.h4-consent .h4-consent__links {
  margin: 4px 0 0;
  font-size: 1rem;
  color: var(--hc-mute);
}

.h4-consent-wrap .h4-consent-dlinks {
  display: block;
}

.h4-consent .h4-consent__links a,
.h4-consent-wrap .h4-consent-dlinks a {
  display: inline-block;
  padding: 8px 2px;
  color: var(--hc-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.h4-consent .h4-consent__links a:hover {
  text-decoration-thickness: 2px;
}

.h4-consent .h4-consent__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Jeden wygląd dla wszystkich trzech przycisków (w banerze i w oknie): żaden nie jest wyróżniony */
.h4-consent .h4-consent-btn,
.h4-consent-wrap .h4-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid var(--hc-text);
  border-radius: var(--hc-radius);
  background: transparent;
  color: var(--hc-text);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.h4-consent .h4-consent-btn:hover,
.h4-consent-wrap .h4-consent-btn:hover {
  background: var(--hc-text);
  color: var(--hc-bg);
}

.h4-consent .h4-consent-btn:focus-visible,
.h4-consent-wrap .h4-consent-btn:focus-visible,
.h4-consent-wrap .h4-consent-close:focus-visible,
.h4-consent-wrap .h4-consent-cat__more summary:focus-visible {
  outline: 3px solid var(--hc-text);
  outline-offset: 3px;
}

.h4-consent .h4-consent__links a:focus-visible {
  outline: 3px solid var(--hc-text);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  .h4-consent .h4-consent__in {
    padding: 20px 28px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .h4-consent .h4-consent__actions {
    flex-direction: row;
  }

  .h4-consent .h4-consent__actions .h4-consent-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (min-width: 960px) {
  .h4-consent .h4-consent__in {
    grid-template-columns: minmax(0, 1fr) minmax(500px, 600px);
    align-items: center;
    gap: 40px;
    padding: 22px var(--h4-pad, 56px);
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
}

/* ---------- Druga warstwa: okno ustawień ---------- */
.h4-consent-wrap {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
}

.h4-consent-wrap .h4-consent-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--hc-bg);
  border-top: 3px solid var(--hc-red);
}

.h4-consent-wrap .h4-consent-dialog:focus {
  outline: none;
}

.h4-consent-wrap .h4-consent-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hc-line);
}

.h4-consent-wrap .h4-consent-dialog__title {
  margin: 0;
  font-family: var(--hc-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hc-text);
}

.h4-consent-wrap .h4-consent-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--hc-line);
  border-radius: var(--hc-radius);
  background: transparent;
  color: var(--hc-text);
  cursor: pointer;
}

.h4-consent-wrap .h4-consent-close:hover {
  border-color: var(--hc-text);
}

.h4-consent-wrap .h4-consent-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.h4-consent-wrap .h4-consent-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.h4-consent-wrap .h4-consent-dialog__intro {
  margin: 0 0 18px;
  color: var(--hc-mute);
}

.h4-consent-wrap .h4-consent-dialog__foot {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hc-line);
  background: var(--hc-bg);
}

/* Kategorie */
.h4-consent-wrap .h4-consent-cat {
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  background: var(--hc-surface);
}

.h4-consent-wrap .h4-consent-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.h4-consent-wrap .h4-consent-cat__title {
  margin: 0;
  font-family: var(--hc-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hc-text);
}

.h4-consent-wrap .h4-consent-cat__always {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--hc-line);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--hc-text);
}

.h4-consent-wrap .h4-consent-cat__desc {
  margin: 10px 0 0;
  color: var(--hc-mute);
}

/* Przełącznik: pole wyboru ukryte wizualnie, obsługiwane klawiaturą i dotykiem na całym obszarze */
.h4-consent-wrap .h4-consent-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  cursor: pointer;
}

.h4-consent-wrap .h4-consent-switch__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.h4-consent-wrap .h4-consent-switch__track {
  position: relative;
  display: block;
  flex: none;
  width: 54px;
  height: 32px;
  border: 2px solid var(--hc-text);
  border-radius: 999px;
  background: transparent;
}

.h4-consent-wrap .h4-consent-switch__track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--hc-text);
  content: "";
}

.h4-consent-wrap .h4-consent-switch__input:checked ~ .h4-consent-switch__track {
  border-color: var(--hc-red);
  background: var(--hc-red);
}

.h4-consent-wrap .h4-consent-switch__input:checked ~ .h4-consent-switch__track::after {
  left: 25px;
}

.h4-consent-wrap .h4-consent-switch__input:focus-visible ~ .h4-consent-switch__track {
  outline: 3px solid var(--hc-text);
  outline-offset: 3px;
}

.h4-consent-wrap .h4-consent-switch__text {
  min-width: 5.6em;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--hc-text);
}

.h4-consent-wrap .h4-consent-switch__text::after {
  content: attr(data-off);
}

.h4-consent-wrap .h4-consent-switch__input:checked ~ .h4-consent-switch__text::after {
  content: attr(data-on);
}

/* Szczegóły: karty zamiast szerokiej tabeli */
.h4-consent-wrap .h4-consent-cat__more {
  margin-top: 12px;
}

.h4-consent-wrap .h4-consent-cat__more summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  color: var(--hc-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.h4-consent-wrap .h4-consent-items {
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.h4-consent-wrap .h4-consent-item {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  background: var(--hc-bg);
  font-size: 0.9375rem;
}

.h4-consent-wrap .h4-consent-item dt {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hc-mute);
}

.h4-consent-wrap .h4-consent-item dd {
  margin: 2px 0 0;
  color: var(--hc-text);
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .h4-consent-wrap {
    align-items: center;
    padding: 24px;
  }

  .h4-consent-wrap .h4-consent-dialog {
    width: min(720px, 100%);
    height: auto;
    max-height: min(780px, 100%);
    border: 1px solid var(--hc-line);
    border-top: 3px solid var(--hc-red);
    border-radius: var(--hc-radius);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  }

  .h4-consent-wrap .h4-consent-dialog__head,
.h4-consent-wrap .h4-consent-dialog__body,
.h4-consent-wrap .h4-consent-dialog__foot {
    padding-right: 24px;
    padding-left: 24px;
  }

  .h4-consent-wrap .h4-consent-dialog__foot {
    flex-direction: row;
  }

  .h4-consent-wrap .h4-consent-dialog__foot .h4-consent-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* ---------- Potwierdzenie i zastępniki ---------- */
.h4-consent-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 9200;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border: 2px solid var(--hc-text);
  border-radius: var(--hc-radius);
  background: var(--hc-bg);
  font-weight: 600;
  transform: translateX(-50%);
}

.h4-consent-toast:empty {
  display: none;
}

.h4-consent-embed-off {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--h4-line, rgba(255, 255, 255, 0.2));
  border-radius: var(--h4-radius, 6px);
  background: var(--h4-surface, rgba(255, 255, 255, 0.07));
}

.h4-consent-embed-off a {
  color: var(--h4-link, #fff);
  text-decoration: underline;
}

/* Przycisk "Ustawienia cookies" w treści strony (polityka cookies) */
.h4-cookie-settings {
  margin: 1.2em 0;
}

.h4-cookie-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 2px solid var(--h4-text, #fff);
  border-radius: var(--h4-radius, 6px);
  background: transparent;
  color: var(--h4-text, #fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.h4-cookie-button:hover {
  background: var(--h4-text, #fff);
  color: var(--h4-bg, #000);
}

.h4-cookie-button:focus-visible {
  outline: 3px solid var(--h4-text, #fff);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .h4-consent {
    animation: h4-consent-in 0.28s ease-out;
  }

  .h4-consent-wrap .h4-consent-switch__track,
.h4-consent-wrap .h4-consent-switch__track::after {
    transition: background-color 0.18s, border-color 0.18s, left 0.18s;
  }

 @keyframes h4-consent-in {
    from {
      transform: translateY(24px);
      opacity: 0;
    }

    to {
      transform: none;
      opacity: 1;
    }
  }
}

@media print {
  .h4-consent,
  .h4-consent-wrap,
  .h4-consent-toast {
    display: none;
  }
}
