/* Banner y panel de cookies del kit (assets/kit/consentimiento.css). Solo si la web carga algo no técnico.
   Se adapta a cada web cambiando estas variables desde su propia CSS (en :root o en .webo-consent, .webo-consent-panel):
   --wc-bg, --wc-fg, --wc-btn-bg, --wc-btn-fg, --wc-radio, --wc-font.
   Los tres botones de cada capa son idénticos a propósito: rechazar tiene que ser tan fácil y visible como aceptar. */
.webo-consent,
.webo-consent-panel {
  --wc-bg: #1d1d1b;
  --wc-fg: #f6f4ee;
  --wc-btn-bg: #f6f4ee;
  --wc-btn-fg: #1d1d1b;
  --wc-radio: 10px;
  --wc-font: inherit;
  --wc-ease: cubic-bezier(.23, 1, .32, 1);
  box-sizing: border-box;
  font-family: var(--wc-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--wc-fg);
  background: var(--wc-bg);
}
.webo-consent *, .webo-consent-panel * { box-sizing: border-box; }

/* ---------- Primera capa: aviso fijo abajo ---------- */
.webo-consent {
  position: fixed;
  z-index: 2147483000;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--wc-bajo, 0px) + env(safe-area-inset-bottom, 0px));
  max-width: 40rem;
  max-height: calc(100dvh - 32px - var(--wc-bajo, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 auto;
  padding: 16px;
  border-radius: var(--wc-radio);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}
/* El aviso recibe el foco al abrirse (para el lector de pantalla), pero no es un control: sin contorno */
.webo-consent:focus, .webo-consent:focus-visible { outline: none; }
.webo-consent__texto { margin: 0 0 12px; text-wrap: pretty; }
.webo-consent a, .webo-consent-panel a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.webo-consent a:focus-visible, .webo-consent-panel a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }
/* El enlace a la política va solo en su línea: necesita 24 px de alto para el dedo (WCAG 2.2, 2.5.8; 02/11/2026) */
.webo-consent__texto a, .webo-consent-panel__intro a { display: inline-block; padding-block: 4px; line-height: 16px; }

/* Botones: uno debajo de otro en pantallas estrechas, tres iguales en fila cuando caben */
.webo-consent, .webo-consent-panel__caja { container-type: inline-size; }
.webo-consent__botones { display: grid; grid-template-columns: 1fr; gap: 8px; }
@container (min-width: 17rem) { .webo-consent > .webo-consent__botones { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 26rem) { .webo-consent-panel__botones { grid-template-columns: repeat(3, 1fr); } }
@supports not (container-type: inline-size) {
  @media (min-width: 30rem) { .webo-consent__botones { grid-template-columns: repeat(3, 1fr); } }
}
.webo-consent__btn {
  min-height: 44px;
  margin: 0;
  padding: 10px 8px;
  border: 1px solid var(--wc-btn-bg);
  border-radius: calc(var(--wc-radio) * .6);
  background: var(--wc-btn-bg);
  color: var(--wc-btn-fg);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.webo-consent__btn:focus-visible { outline: 2px solid var(--wc-fg); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .webo-consent__btn { transition: opacity .15s ease-out; }
  .webo-consent__btn:hover { opacity: .88; }
}

/* ---------- Segunda capa: panel modal por finalidades ---------- */
.webo-consent-panel {
  width: min(34rem, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--wc-radio);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.webo-consent-panel:not([open]) { display: none; }
/* Sin <dialog> nativo: se coloca a mano */
.webo-consent-panel[role="dialog"] { position: fixed; inset: 16px; z-index: 2147483001; height: fit-content; }
.webo-consent-panel::backdrop { background: rgba(0, 0, 0, .5); }
.webo-consent-panel__caja { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.webo-consent-panel__cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.webo-consent-panel__titulo { margin: 0; padding-top: 8px; font: inherit; font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.webo-consent-panel__cerrar {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -4px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.webo-consent-panel__cerrar:focus-visible { outline: 2px solid var(--wc-fg); outline-offset: -2px; }
.webo-consent-panel__intro { margin: 0 0 16px; text-wrap: pretty; }
.webo-consent-panel__lista { margin: 0 0 20px; padding: 0; list-style: none; border-top: 1px solid color-mix(in srgb, var(--wc-fg) 22%, transparent); }
.webo-consent-panel__item { padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--wc-fg) 22%, transparent); }
.webo-consent-panel__fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; }
label.webo-consent-panel__fila { cursor: pointer; }
.webo-consent-panel__nombre { font-weight: 600; }
.webo-consent-panel__siempre { font-size: .9em; opacity: .85; }
.webo-consent-panel__desc { margin: 2px 0 0; font-size: .92em; opacity: .9; }
.webo-consent-panel__check { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--wc-btn-bg); cursor: pointer; }
.webo-consent-panel__check:focus-visible { outline: 2px solid var(--wc-fg); outline-offset: 3px; }

/* Aviso para lectores de pantalla (invisible) */
.webo-consent-vivo { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Entrada suave solo si el sistema no pide reducir el movimiento */
@media (prefers-reduced-motion: no-preference) {
  .webo-consent { animation: webo-consent-entra .32s var(--wc-ease) both; }
  .webo-consent-panel[open] { animation: webo-consent-panel .22s var(--wc-ease) both; }
  .webo-consent-panel[open]::backdrop { animation: webo-consent-fondo .22s ease-out both; }
}
@keyframes webo-consent-entra { from { opacity: 0; transform: translateY(12px); } }
@keyframes webo-consent-panel { from { opacity: 0; transform: scale(.97); } }
@keyframes webo-consent-fondo { from { opacity: 0; } }

@media (forced-colors: active) {
  .webo-consent, .webo-consent-panel { border: 1px solid CanvasText; }
  .webo-consent__btn { border-color: ButtonText; }
}
