/* ============================================================================
   Consentimiento de cookies
   ----------------------------------------------------------------------------
   Los tres botones pesan LO MISMO. No es estética: la política de cookies §4 se
   comprometió por escrito a que «Rechazar todas las no esenciales» fuera «tan
   accesible y destacado como el botón de aceptar», y es lo que exigen el RGPD y
   la CNIL. Un «rechazar» en gris pequeño al lado de un «aceptar» azul grande es
   un patrón oscuro y anula el consentimiento.
   ============================================================================ */

.ck-cortina {
  position: fixed; inset: 0; z-index: 2147483646;
  background: color-mix(in srgb, #0D1E3C 34%, transparent);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
}
.ck-cortina[data-visible] { opacity: 1; pointer-events: auto }

.ck {
  position: fixed; z-index: 2147483647; left: 50%; bottom: 0;
  width: min(680px, calc(100vw - 24px));
  transform: translate(-50%, 12px);
  margin-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  background: #fff; color: var(--ink, #18181B);
  border: 1px solid var(--line, #E4E4E7); border-radius: 20px;
  box-shadow: 0 2px 10px rgba(19, 43, 86, .10), 0 22px 48px rgba(19, 43, 86, .18);
  padding: clamp(18px, 3vw, 26px);
  /* Con el panel de categorías abierto el cuadro mide ~767 px: cabe en un
     iPhone 13 (812) y NO en un SE (667). Se acota a la pantalla y desplaza por
     dentro, para que los botones nunca queden fuera de alcance. */
  max-height: calc(100dvh - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  opacity: 0; visibility: hidden;
  transition: opacity .3s var(--ease-out, cubic-bezier(.16,1,.3,1)),
              transform .3s var(--ease-out, cubic-bezier(.16,1,.3,1)),
              visibility .3s;
}
.ck[data-visible] { opacity: 1; visibility: visible; transform: translate(-50%, 0) }

.ck h2 {
  font-family: var(--display, inherit); font-weight: 600;
  font-size: clamp(17px, 2vw, 20px); line-height: 1.25; letter-spacing: -.02em;
  margin: 0 0 8px;
}
.ck p { font-size: 14.5px; line-height: 1.58; color: var(--ink-soft, #3F3F46); margin: 0 0 18px }
.ck a { color: var(--royal, #214E9C); text-decoration: underline; text-underline-offset: 2px }

/* ── Los tres botones, del mismo tamaño y la misma jerarquía ─────────────── */
.ck-acciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: stretch }
.ck-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 12px 14px; border-radius: 999px;
  font: inherit; font-size: 14.5px; font-weight: 600; text-align: center;
  border: 1.5px solid var(--navy, #132B56); background: #fff; color: var(--navy, #132B56);
  cursor: pointer; transition: background .16s ease, color .16s ease, transform .16s ease;
}
.ck-btn:hover { background: var(--sky, #D8E4F2) }
.ck-btn:active { transform: translateY(1px) }

/* RECHAZAR y ACEPTAR son gemelos: mismo relleno, mismo borde, mismo tamaño.
   Que midan igual no basta — pintar «aceptar» y dejar «rechazar» en contorno
   inclina la decisión, y es justo lo que la CNIL ha sancionado. El único que
   se distingue es «Configurar», que no es una respuesta sino un camino. */
.ck-btn--elegir { background: var(--navy, #132B56); color: #fff; border-color: var(--navy, #132B56) }
.ck-btn--elegir:hover { background: var(--royal, #214E9C); border-color: var(--royal, #214E9C) }
.ck-btn:focus-visible,
.ck [type="checkbox"]:focus-visible + .ck-sw {
  outline: 3px solid var(--royal, #214E9C); outline-offset: 2px;
}

/* ── Panel de categorías ─────────────────────────────────────────────────── */
.ck-detalle { margin: 0 0 18px; display: grid; gap: 10px }
/* `display:grid` de autor gana al `[hidden]{display:none}` del navegador, así
   que sin esta línea el panel salía desplegado siempre y «Configurar» lo
   ocultaba en vez de abrirlo. */
.ck-detalle[hidden] { display: none }
.ck-cat {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  padding: 14px 16px; border: 1px solid var(--line, #E4E4E7); border-radius: 14px;
  background: var(--canvas-2, #F7F9FC);
}
.ck-cat b { display: block; font-size: 14.5px; margin-bottom: 3px }
.ck-cat span { display: block; font-size: 13px; line-height: 1.5; color: var(--muted, #71717A) }
.ck-cat code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px }

/* Interruptor. El de «necesarias» va fijo en sí y deshabilitado: decirle al
   usuario que puede apagar lo que no se puede apagar sería mentirle. */
.ck-cat [type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0 }
.ck-sw {
  display: block; width: 46px; height: 27px; border-radius: 999px; cursor: pointer;
  background: var(--line, #E4E4E7); position: relative; transition: background .18s ease;
  flex: 0 0 auto;
}
.ck-sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s var(--ease-out, cubic-bezier(.16,1,.3,1));
}
[type="checkbox"]:checked + .ck-sw { background: var(--navy, #132B56) }
[type="checkbox"]:checked + .ck-sw::after { transform: translateX(19px) }
[type="checkbox"]:disabled + .ck-sw { background: var(--sky-line, #B3CDE9); cursor: not-allowed; opacity: .8 }

.ck-fijo { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--royal, #214E9C); white-space: nowrap; align-self: center }

@media (max-width: 560px) {
  .ck-acciones { grid-template-columns: 1fr }
  .ck { border-radius: 18px }
  /* La ficha se apila: en dos columnas, «SIEMPRE ACTIVAS» se comía la mitad
     del ancho y el texto quedaba en tiras de tres palabras. */
  .ck-cat { grid-template-columns: 1fr; gap: 10px }
  .ck-fijo { justify-self: start }
  .ck-cat label { justify-self: start }
}

/* Quien pide menos movimiento no debería recibir un panel que se desliza. */
@media (prefers-reduced-motion: reduce) {
  .ck, .ck-cortina, .ck-sw::after { transition: none !important }
  .ck { transform: translate(-50%, 0) }
}

/* En impresión el banner no pinta nada. */
@media print { .ck, .ck-cortina { display: none !important } }
