/*
 * SCENTIVOIRE · Porcelana — cookie consent (0.4.4)
 * Phones: bottom sheet (Reject all | Accept all, Configure below). Tablets (48–64em): full-width
 * bottom sheet with the three buttons in one row, clear of the hero titles. From 64em: a card at the
 * bottom right, narrow enough (clamp 360–440px) to stay clear of the hero search and calls to action,
 * with the three buttons stacked. Always position: fixed, so it never moves the page (no layout shift)
 * and never reaches the header. Three identical hairline buttons: rejecting is exactly as visible and
 * as easy as accepting; the × closes without consent.
 * Markup: inc/consent.php · behaviour: assets/js/consent.js.
 */

.pc-consent {
  --pc-cpad-y: 16px;
  --pc-cpad-b: calc(var(--pc-cpad-y) + env(safe-area-inset-bottom, 0px));
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30; /* above the page, below the header layers (40) and therefore below the mobile drawer */
  display: none;
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--pc-cpad-y) var(--pc-gutter) var(--pc-cpad-b);
  border-top: 1px solid var(--pc-grafito);
  background: var(--pc-porcelana);
  color: var(--pc-grafito);
  box-shadow: 0 -12px 32px rgba(29, 30, 32, 0.08);
  font-family: var(--pc-font);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
}
html.sv-consent-ask .pc-consent,
.pc-consent.is-open { display: block; }
.pc-consent:focus,
.pc-consent__title:focus { outline: none; }

@media (prefers-reduced-motion: no-preference) {
  html.sv-consent-ask .pc-consent,
  .pc-consent.is-open { animation: pc-consent-in 420ms var(--pc-ease) both; }
}
@keyframes pc-consent-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* The page can always scroll clear of the banner (space added after the footer only: nothing moves). */
html.sv-consent-visible body { padding-bottom: var(--pc-consent-space, 0px); }

.pc-consent__title {
  margin: 0 0 14px;
  padding-right: 44px; /* clear of the × */
  color: var(--pc-grafito);
  font-family: var(--pc-font);
  font-size: var(--pc-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: var(--pc-label-track);
  text-transform: uppercase;
}

/* × : closes without consent on a first visit (as Reject all), without changes when reopened. */
.pc-consent__close {
  position: absolute;
  top: calc(var(--pc-cpad-y) - 12px);
  right: calc(var(--pc-gutter) - 13px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--pc-grafito);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--pc-dur) var(--pc-ease);
}
.pc-consent__close:focus-visible { outline: 2px solid var(--pc-grafito); outline-offset: -2px; }
@media (hover: hover) {
  .pc-consent__close:hover { border-color: var(--pc-grafito); }
}

.pc-consent__text {
  margin: 0;
  max-width: 60ch;
  color: var(--pc-grafito);
}
.pc-consent__policy {
  color: var(--pc-grafito);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
  text-decoration-color: var(--pc-filete-activo);
  white-space: nowrap;
}
.pc-consent__policy:hover { text-decoration-color: currentColor; }

/* Actions (phones): Reject all | Accept all side by side, the third action on its own row. */
.pc-consent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.pc-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px 8px calc(10px + 0.2em);
  border: 1px solid var(--pc-grafito);
  border-radius: 0;
  background: transparent;
  color: var(--pc-grafito);
  font-family: var(--pc-font);
  font-size: var(--pc-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.2em; /* the site's tighter label tracking on phones (as DE/PL already use) */
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--pc-dur) var(--pc-ease), color var(--pc-dur) var(--pc-ease);
}
.pc-consent__btn:active {
  background: var(--pc-grafito);
  color: var(--pc-porcelana);
}
@media (hover: hover) {
  .pc-consent__btn:hover {
    background: var(--pc-grafito);
    color: var(--pc-porcelana);
  }
}
.pc-consent__btn--wide { grid-column: 1 / -1; }
/* Small phones: tighter still, so Reject all and Accept all are set alike (one line each where they fit). */
@media (max-width: 24.99em) {
  .pc-consent__btn {
    padding-inline: 6px calc(6px + 0.12em);
    letter-spacing: 0.12em;
  }
}
/* Polish labels are the longest («Akceptuj wszystkie»): tighter on every phone, so both stay on one line. */
@media (max-width: 47.99em) {
  html:lang(pl) .pc-consent__btn {
    padding-inline: 5px calc(5px + 0.08em);
    letter-spacing: 0.08em;
  }
}

/* Preferences */
.pc-consent__cats {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.pc-consent__cat {
  padding: 12px 0;
  border-top: 1px solid var(--pc-filete);
}
.pc-consent__cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}
.pc-consent__cat-name {
  color: var(--pc-grafito);
  font-size: var(--pc-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: var(--pc-label-track);
  text-transform: uppercase;
  cursor: default;
}
label.pc-consent__cat-name { cursor: pointer; }
.pc-consent__always {
  color: var(--pc-pizarra);
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
}
.pc-consent__cat-desc {
  margin: 4px 0 0;
  max-width: 60ch;
  color: var(--pc-pizarra);
  font-size: 0.8125rem;
  line-height: 1.5;
}
/* The Save / Reject / Accept row stays in view while the categories scroll (short screens). */
.pc-consent__view--prefs .pc-consent__actions {
  position: sticky;
  bottom: calc(-1 * var(--pc-cpad-b));
  z-index: 1;
  margin: 0 0 calc(-1 * var(--pc-cpad-b));
  padding: 12px 0 var(--pc-cpad-b);
  border-top: 1px solid var(--pc-filete);
  background: var(--pc-porcelana);
}

/* Switch: a square hairline track; the knob position (not colour alone) shows the state. */
.pc-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 44px;
  height: 24px;
}
.pc-switch__input {
  position: absolute;
  top: -10px;
  right: 0;
  bottom: -10px;
  left: 0;
  z-index: 1;
  width: 100%;
  height: calc(100% + 20px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.pc-switch__track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--pc-grafito);
  background: var(--pc-porcelana);
  transition: background-color var(--pc-dur) var(--pc-ease);
}
.pc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--pc-grafito);
  transition: transform var(--pc-dur) var(--pc-ease), background-color var(--pc-dur) var(--pc-ease);
}
.pc-switch__input:checked + .pc-switch__track { background: var(--pc-grafito); }
.pc-switch__input:checked + .pc-switch__track::after { background: var(--pc-porcelana); transform: translateX(20px); }
.pc-switch__input:focus-visible + .pc-switch__track { outline: 2px solid var(--pc-grafito); outline-offset: 3px; }

/* Tablets: full-width sheet, text across the width and the three buttons in one row (~210px high). */
@media (min-width: 48em) {
  .pc-consent {
    --pc-cpad-y: 20px;
    font-size: 0.875rem;
    line-height: 1.55;
  }
  .pc-consent__text { max-width: none; }
  .pc-consent__actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pc-consent__btn--wide { grid-column: auto; }
  .pc-consent__btn {
    padding-inline: 12px calc(12px + var(--pc-label-track));
    letter-spacing: var(--pc-label-track);
  }
}

/* From 64em: bottom-right card, clear of the hero titles, search and calls to action on the left. */
@media (min-width: 64em) {
  /* Compact (13px text, 40px buttons) so it also stays below the ficha title on short laptops (1280×720). */
  .pc-consent {
    --pc-cpad-y: 20px;
    right: 24px;
    bottom: 24px;
    left: auto;
    width: clamp(360px, 29vw, 440px);
    max-height: calc(100vh - 128px);
    max-height: calc(100dvh - 128px);
    padding: var(--pc-cpad-y) 24px;
    border: 1px solid var(--pc-grafito);
    box-shadow: 0 18px 48px rgba(29, 30, 32, 0.14);
    font-size: 0.8125rem;
    line-height: 1.5;
  }
  .pc-consent__close { right: 11px; }
  .pc-consent__text { max-width: 60ch; }
  /* Stacked: every label fits on one line in all seven languages. */
  .pc-consent__actions { grid-template-columns: minmax(0, 1fr); }
  .pc-consent__actions { margin-top: 14px; }
  .pc-consent__view--prefs .pc-consent__actions { margin-top: 0; }
  .pc-consent__btn { min-height: 40px; }
}

/* Footer «Cookie preferences»: a button that looks like the footer links. */
.pc-consent-open {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

@media print {
  .pc-consent { display: none !important; }
  html.sv-consent-visible body { padding-bottom: 0; }
}
