/* ============================================================================
   CANTOVI · Consentimiento de cookies (Figma CANTOVI UI › «Cookie consent»)
   Banner (fondo inverso, abajo) · <dialog> de preferencias · aviso que sustituye a mapas/vídeos de terceros · enlaces legales del pie.
   z-index: banner 950 (sobre el flotante 900, bajo mega-menú 999/1000 y
   menú móvil 1200; la intro de la Home, 10000, lo tapa mientras dura).
   ========================================================================== */

.consent-banner[hidden] { display: none !important; }

/* ---- Banner ---------------------------------------------------------------- */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 950;
  background: var(--bg-inverse, #1b2124);
  color: var(--fg-inverse, #f7f8f8);
  padding: 24px clamp(20px, 4vw, 32px) calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 12, 26, .16);
  font-family: var(--font-family-base);
}
.consent-banner__inner {
  width: min(100%, 1080px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 48px;
}
.consent-banner__text { flex: 1 1 auto; min-width: 0; }
.consent-banner__title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 28px;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: 0;
  color: inherit;
  text-transform: none;
}
.consent-banner__body {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: var(--font-weight-medium, 500);
  color: inherit;
}
.consent-banner a,
.consent-dialog__intro a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.consent-banner a:focus-visible,
.consent-banner__config:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}
.consent-banner__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.consent-banner__choice { display: flex; gap: 12px; }
.consent-banner__config {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: var(--font-weight-medium, 500);
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.consent-banner .btn { min-width: 0; }

@media (max-width: 900px) {
  .consent-banner { padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .consent-banner__inner { flex-direction: column; align-items: stretch; gap: 16px; }
  .consent-banner__title { font-size: 18px; line-height: 26px; }
  .consent-banner__actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .consent-banner__choice > .btn { flex: 1 1 0; }
  .consent-banner__config { align-self: center; min-height: 44px; }
}

/* ---- Panel de preferencias -------------------------------------------------- */
.consent-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--grey-300, #bfc2c6);
  border-radius: 0;
  background: var(--bg-default, #f7f8f8);
  color: var(--fg-default, #1b2124);
  box-shadow: 0 8px 32px rgba(0, 12, 26, .16);
  font-family: var(--font-family-base);
  overflow: auto;
}
.consent-dialog::backdrop { background: rgba(27, 33, 36, .48); }
.consent-dialog__inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
}
.consent-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.consent-dialog__title {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: 0;
  color: inherit;
  text-transform: none;
}
.consent-dialog__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -4px -8px 0 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.consent-dialog__close:hover { background: var(--opacity-dark-05, rgba(0,0,0,.05)); }
.consent-dialog__close:focus-visible { outline: 1px solid currentColor; outline-offset: 0; }
.consent-dialog__intro,
.consent-cat__desc {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: var(--font-weight-medium, 500);
  color: var(--grey-700, #404953);
}
.consent-cats { list-style: none; margin: 0; padding: 0; }
.consent-cat {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--grey-300, #bfc2c6);
}
.consent-cat__text { flex: 1 1 auto; }
.consent-cat__title {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 24px;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: 0;
  color: inherit;
  text-transform: none;
}
.consent-dialog__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.consent-dialog__choice { display: flex; gap: 12px; }
.consent-dialog .btn { min-width: 0; }

@media (max-width: 640px) {
  .consent-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
  }
  .consent-dialog__inner { padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); gap: 16px; }
  .consent-dialog__title { font-size: 20px; line-height: 28px; }
  .consent-dialog__actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .consent-dialog__choice > .btn { flex: 1 1 0; }
  .consent-dialog__save { align-self: center; min-height: 44px; }
}

/* ---- Interruptor (checkbox con role="switch") ------------------------------- */
.consent-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 44px;
  height: 24px;
  margin: 0;
  border: 1px solid var(--grey-700, #404953);
  border-radius: 9999px;
  background: var(--grey-300, #bfc2c6);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.consent-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--base-white, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .2s cubic-bezier(.23, 1, .32, 1);
}
.consent-switch:checked { background: var(--grey-950, #1b2124); border-color: var(--grey-950, #1b2124); }
.consent-switch:checked::before { transform: translateX(20px); }
.consent-switch:disabled { cursor: not-allowed; background: var(--grey-600, #666d76); border-color: var(--grey-600, #666d76); }
.consent-switch:focus-visible { outline: 2px solid var(--grey-950, #1b2124); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .consent-switch, .consent-switch::before { transition: none; }
}

/* ---- Mapa / vídeo bloqueado hasta aceptar «Contenido de terceros» ----------- */
.consent-embed {
  width: 100%;
  height: 100%;
  min-height: 240px;
}
.consent-embed__placeholder {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 24px;
  background: var(--grey-100, #e6e7e8);
  color: var(--fg-default, #1b2124);
  font-family: var(--font-family-base);
}
.consent-embed__text {
  margin: 0;
  max-width: 44ch;
  font-size: 14px;
  line-height: 20px;
  font-weight: var(--font-weight-medium, 500);
}
.consent-embed__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.consent-embed .btn { min-width: 0; }

/* ---- Enlaces legales del pie (template-parts/cantovi-footer.php) ------------ */
html body #footer.site-footer .footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
html body #footer.site-footer .footer-legal-link {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: var(--grey-300, #bfc2c6);
  text-decoration: none;
  text-underline-offset: 3px;
  cursor: pointer;
}
html body #footer.site-footer .footer-legal-link:hover { color: var(--grey-50, #f7f8f8); text-decoration: underline; }
html body #footer.site-footer .footer-legal-link:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
