/* assets/cookie.css v2 — banner de consentimiento (WP-01-TRACKING).
   Insertado al principio del <body>: es lo primero en el orden de tabulación.
   - < 1280 px: banner compacto en el flujo del documento (no superpuesto); en móvil el CTA del hero ya
     queda bajo la línea de flotación y la barra CTA fija inferior sigue visible.
   - ≥ 1280 px: tarjeta flotante abajo a la derecha, sobre la imagen
     del hero: no desplaza el contenido, no tapa la navegación, el H1 ni el CTA del hero (visible a 1280×800).
     Si en la primera visualización taparía un control (formulario de contacto, respuestas del test),
     cookie.js añade .cookie-banner-inline y el banner vuelve al flujo.
     WCAG 2.2 SC 2.4.11: html.eco-cookie-open aplica scroll-padding-bottom con la altura de la tarjeta
     (técnica C43), para que un elemento enfocado no quede oculto tras ella.
   Contrastes AA sobre #1A1A24: texto #E2E8F0 (≈14:1), enlaces #6EE7B7 (≈12:1), bordes #CBD5E1 (≈11:1). */
.cookie-banner {
    position: relative; z-index: 10000;
    background: #1A1A24; color: #E2E8F0;
    border-bottom: 2px solid #10B981; padding: 0.9rem 5%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    opacity: 0; transition: opacity 0.2s ease;
    max-height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}
.cookie-banner *, .cookie-banner *::before, .cookie-banner *::after { box-sizing: border-box; }
.cookie-banner.visible { opacity: 1; }
.cookie-banner[hidden], .cookie-banner [hidden] { display: none !important; }

.cookie-content { display: flex; align-items: center; gap: 0.6rem 1.5rem; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.cookie-text { flex: 1 1 420px; min-width: 0; }
.cookie-title {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.cookie-text p { color: #E2E8F0; font-size: 0.85rem; line-height: 1.45; margin: 0; }
.cookie-banner a { color: #6EE7B7; text-decoration: underline; text-underline-offset: 2px; }
.cookie-banner a:hover { color: #A7F3D0; }

/* Tres botones con el mismo peso visual (mismo estilo, tamaño y posición en la fila). */
.cookie-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; flex: 0 0 auto; }
.cookie-btn {
    min-height: 44px; min-width: 9.5rem; padding: 0.55rem 1rem; margin: 0;
    background: transparent; color: #FFFFFF; border: 2px solid #CBD5E1; border-radius: 999px;
    font: 600 0.85rem/1.2 'Outfit', 'Inter', system-ui, sans-serif; text-align: center;
    cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
}
.cookie-btn:hover { background: #FFFFFF; color: #1A1A24; border-color: #FFFFFF; }
.cookie-banner a:focus-visible, .cookie-btn:focus-visible, .cookie-option input:focus-visible {
    outline: 3px solid #6EE7B7; outline-offset: 2px;
}

/* Panel « Configurar » */
.cookie-panel { flex: 1 1 100%; order: 2; }
.cookie-actions { order: 3; }
.cookie-banner-expanded .cookie-actions { flex: 1 1 100%; justify-content: end; }
.cookie-fieldset { border: 1px solid rgba(203, 213, 225, 0.45); border-radius: 10px; padding: 0.6rem 0.9rem 0.4rem; margin: 0.2rem 0 0; }
.cookie-legend { padding: 0 0.4rem; font: 700 0.95rem/1.3 'Outfit', 'Inter', system-ui, sans-serif; color: #FFFFFF; }
.cookie-option { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.5rem 0; border-top: 1px solid rgba(203, 213, 225, 0.2); }
.cookie-option:first-of-type { border-top: 0; }
.cookie-option input[type="checkbox"] { width: 24px; height: 24px; margin: 0.1rem 0 0; flex: 0 0 auto; accent-color: #10B981; cursor: pointer; }
.cookie-option label { cursor: pointer; min-height: 24px; }
.cookie-option-fixed { display: block; padding-left: calc(24px + 0.7rem); }
.cookie-option-name { display: block; color: #FFFFFF; font-weight: 600; font-size: 0.88rem; line-height: 1.35; }
.cookie-option-desc { display: block; color: #CBD5E1; font-size: 0.8rem; line-height: 1.4; }

/* Enlace « Configurar cookies » del pie de página */
.cookie-settings-link {
    background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
    font: inherit; color: #CBD5E1; text-decoration: underline; text-underline-offset: 2px;
}
.cookie-settings-link:hover { color: #10B981; }
.cookie-settings-link:focus-visible { outline: 3px solid #10B981; outline-offset: 2px; border-radius: 3px; }
.cookie-settings-wrap { margin-top: 1rem; }

/* Botón discreto en el flujo, al final del <body> (páginas sin <footer>, p. ej. evaluacion.html).
   cookie.js solo lo muestra con una elección ya registrada. */
.cookie-settings-flow { margin-top: auto; padding: 12px 16px; text-align: center; }
.cookie-settings-flow[hidden] { display: none !important; }
.cookie-settings-fab {
    min-height: 44px; min-width: 44px; padding: 0 0.9rem; border-radius: 999px;
    background: rgba(26, 26, 36, 0.92); color: #E2E8F0; border: 1px solid rgba(203, 213, 225, 0.6);
    font: 600 0.8rem/1 'Inter', system-ui, sans-serif; text-decoration: none;
}
.cookie-settings-fab:hover { color: #FFFFFF; border-color: #FFFFFF; }

/* Móvil: banner compacto (≤ 30 % de la altura a 375×812) */
@media (max-width: 768px) {
    .cookie-banner { padding: 0.6rem 16px 0.7rem; }
    .cookie-content { gap: 0.55rem; }
    .cookie-text { flex-basis: 100%; }
    .cookie-text p { font-size: 0.8rem; line-height: 1.38; }
    .cookie-actions { flex: 1 1 100%; gap: 0.5rem; }
    .cookie-btn { min-width: 0; padding: 0.4rem 0.3rem; font-size: 0.8rem; }
}
/* Escritorio: tarjeta flotante (superpuesta) que deja visibles nav, H1 y CTA del hero. */
@media (min-width: 1280px) {
    .cookie-banner {
        position: fixed; top: auto; left: auto; right: 2rem; bottom: 6.5rem;
        width: 23.5rem; max-width: calc(100vw - 4rem); max-height: calc(100vh - 8.5rem);
        padding: 1rem 1.1rem; border: 2px solid #10B981; border-radius: 14px;
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    }
    .cookie-content { gap: 0.75rem; }
    .cookie-text { flex: 1 1 100%; }
    .cookie-actions { flex: 1 1 100%; gap: 0.5rem; }
    .cookie-banner-expanded .cookie-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cookie-btn { min-width: 0; padding: 0.45rem 0.4rem; font-size: 0.8rem; }
    html.eco-cookie-open { scroll-padding-bottom: calc(var(--eco-cookie-h, 0px) + 7.5rem); }
    /* Espacio reservado al final del documento: los últimos elementos enfocables pueden desplazarse
       por encima de la tarjeta (scroll-padding no permite pasar del final del documento). */
    html.eco-cookie-open body { padding-bottom: calc(var(--eco-cookie-h, 0px) + 7.5rem); }
    /* Páginas donde la tarjeta taparía un control (formulario, test): banner en el flujo, como < 1280 px. */
    .cookie-banner.cookie-banner-inline {
        position: relative; right: auto; bottom: auto; width: auto; max-width: none; max-height: 100vh;
        padding: 0.9rem 5%; border: 0; border-bottom: 2px solid #10B981; border-radius: 0;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    }
    .cookie-banner-inline .cookie-content { gap: 0.6rem 1.5rem; }
    .cookie-banner-inline .cookie-text { flex: 1 1 420px; }
    .cookie-banner-inline .cookie-actions { flex: 0 0 auto; gap: 0.6rem; }
    .cookie-banner-inline.cookie-banner-expanded .cookie-actions { flex: 1 1 100%; }
    .cookie-banner-inline .cookie-btn { min-width: 9.5rem; padding: 0.55rem 1rem; font-size: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cookie-banner { transition: none; }
}
@media print {
    .cookie-banner, .cookie-settings-flow { display: none !important; }
}
