/* Aviso y preferencias de cookies (rediseño v3, 25-09-2026): el mismo idioma que la web (carbón, Newsreader con cursiva ciruela,
   kickers con su línea de luz) y botones de Rechazar y Aceptar exactamente iguales, como piden Datatilsynet y el CEPD:
   rechazar tiene que ser tan fácil y tan visible como aceptar. El botón flotante no cambia.
   Es autónomo: no depende de v3-system (lo cargan también las páginas originales, con Merriweather) */

.cookie-consent,
.cookie-modal {
    --ck-carbon: #111111;
    --ck-panel: #16151a;
    --ck-hueso: #f5f4f1;
    --ck-ciruela: #83136c;
    --ck-ciruela-luz: #b04a97;
    --ck-luz: 232, 172, 104;
    --ck-core: 255, 246, 206;
    --ck-serif: "Newsreader", "Merriweather", Georgia, serif;
    --ck-sans: "Inter", Arial, sans-serif;
    --ck-ease: cubic-bezier(.19, 1, .22, 1);
    color: var(--ck-hueso);
    font-family: var(--ck-sans);
    -webkit-font-smoothing: antialiased;
}

.cookie-consent[hidden],
.cookie-modal[hidden],
.cookie-floating[hidden] {
    display: none;
}

/* ---------- Aviso ---------- */

.cookie-consent {
    position: fixed;
    left: 50%;
    bottom: clamp(1rem, 3.5vh, 2.4rem);
    z-index: 100000;
    width: min(calc(100vw - 2rem), 60rem);
    transform: translateX(-50%);
    animation: ckRise .9s var(--ck-ease) both;
}

@keyframes ckRise { from { opacity: 0; transform: translate(-50%, 18px); } }

.cookie-consent__panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.4rem 3rem;
    align-items: end;
    padding: 1.7rem 1.9rem 1.6rem;
    overflow: hidden;
    border: 1px solid rgba(245, 244, 241, .12);
    border-radius: 1.1rem;
    background: rgba(22, 21, 26, .96);
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .75);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

/* Una luz cálida y fina en el canto de arriba, desde la izquierda */
.cookie-consent__panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 1.9rem;
    width: min(18rem, 40%);
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--ck-luz), .9), rgba(var(--ck-luz), 0));
}

.cookie-consent__eyebrow,
.cookie-modal__eyebrow {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: 0 0 .9rem;
    color: rgba(245, 244, 241, .6);
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.cookie-consent__eyebrow::before,
.cookie-modal__eyebrow::before {
    content: "";
    width: 1.8rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--ck-luz), .9), rgba(var(--ck-luz), 0));
}

.cookie-consent h2,
.cookie-modal h2 {
    margin: 0;
    color: var(--ck-hueso);
    font-family: var(--ck-serif);
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    font-weight: 300;
    letter-spacing: -.02em;
    line-height: 1.05;
}

.cookie-consent h2 em,
.cookie-modal h2 em { color: var(--ck-ciruela-luz); font-style: italic; font-weight: 300; }

.cookie-consent p,
.cookie-modal p {
    max-width: 38rem;
    margin: .8rem 0 0;
    color: rgba(245, 244, 241, .7);
    font-size: .88rem;
    font-weight: 300;
    line-height: 1.6;
}

.cookie-consent .cookie-consent__google,
.cookie-modal .cookie-consent__google { color: rgba(245, 244, 241, .48); font-size: .74rem; line-height: 1.55; }

.cookie-consent__policy,
.cookie-consent__google a {
    color: rgba(245, 244, 241, .78);
    text-decoration: underline;
    text-decoration-color: rgba(245, 244, 241, .3);
    text-underline-offset: .2em;
    transition: color .3s ease, text-decoration-color .3s ease;
}

:where(html:not(.is-touch)) .cookie-consent__policy:hover,
.cookie-consent__policy:focus-visible,
:where(html:not(.is-touch)) .cookie-consent__google a:hover,
.cookie-consent__google a:focus-visible { color: var(--ck-hueso); text-decoration-color: rgba(var(--ck-luz), .8); }

.cookie-consent__actions { display: grid; justify-items: center; gap: .75rem; }
.cookie-consent__choices { display: flex; gap: .6rem; }

/* ---------- Botones: Rechazar y Aceptar, idénticos ---------- */

.cookie-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.6rem;
    min-height: 3rem;
    padding: 0 1.5rem;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(245, 244, 241, .55);
    border-radius: 999px;
    color: var(--ck-hueso);
    background: transparent;
    font: 500 .84rem/1 var(--ck-sans);
    letter-spacing: .01em;
    cursor: pointer;
    appearance: none;
    transition: color .5s var(--ck-ease), border-color .5s ease;
}

/* La misma cortina de los botones de la web: sube el hueso y el texto pasa a carbón */
.cookie-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--ck-hueso);
    transform: translateY(102%);
    transition: transform .6s var(--ck-ease);
}

:where(html:not(.is-touch)) .cookie-btn:hover,
.cookie-btn:focus-visible { border-color: var(--ck-hueso); color: var(--ck-carbon); }
:where(html:not(.is-touch)) .cookie-btn:hover::before,
.cookie-btn:focus-visible::before { transform: translateY(0); }
.cookie-btn:focus-visible { outline: 2px solid rgba(var(--ck-luz), .8); outline-offset: 3px; }

/* Configurar: un enlace de texto, secundario para las dos opciones */
.cookie-link {
    position: relative;
    padding: .3rem 0;
    border: 0;
    color: rgba(245, 244, 241, .72);
    background: none;
    font: 500 .78rem/1 var(--ck-sans);
    cursor: pointer;
    transition: color .35s ease;
}

.cookie-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(.35);
    transform-origin: left;
    transition: transform .6s var(--ck-ease);
}

:where(html:not(.is-touch)) .cookie-link:hover,
.cookie-link:focus-visible { color: var(--ck-hueso); }
:where(html:not(.is-touch)) .cookie-link:hover::after,
.cookie-link:focus-visible::after { transform: scaleX(1); }
.cookie-link:focus-visible { outline: 1px solid rgba(var(--ck-luz), .8); outline-offset: 4px; }

/* ---------- Preferencias ---------- */

.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(10, 10, 12, .72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: ckFade .5s ease both;
}

@keyframes ckFade { from { opacity: 0; } }

.cookie-modal__panel {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(100%, 44rem);
    max-height: min(88svh, 50rem);
    overflow: hidden;
    border: 1px solid rgba(245, 244, 241, .12);
    border-radius: 1.2rem;
    background: var(--ck-panel);
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8);
    animation: ckUp .8s var(--ck-ease) both;
}

@keyframes ckUp { from { opacity: 0; transform: translateY(20px); } }

.cookie-modal__panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 2rem;
    width: 16rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--ck-luz), .9), rgba(var(--ck-luz), 0));
}

.cookie-modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; padding: 2rem 2rem 1.2rem; }

.cookie-modal__close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    border: 1px solid rgba(245, 244, 241, .2);
    border-radius: 50%;
    color: rgba(245, 244, 241, .8);
    background: transparent;
    font: 300 1.3rem/1 var(--ck-sans);
    cursor: pointer;
    transition: border-color .4s ease, color .4s ease, transform .6s var(--ck-ease);
}

:where(html:not(.is-touch)) .cookie-modal__close:hover,
.cookie-modal__close:focus-visible { border-color: var(--ck-hueso); color: var(--ck-hueso); transform: rotate(90deg); }
.cookie-modal__close:focus-visible { outline: 2px solid rgba(var(--ck-luz), .8); outline-offset: 3px; }

.cookie-modal__body { overflow-y: auto; padding: 0 2rem 1.4rem; overscroll-behavior: contain; }
.cookie-modal__body > p:first-child { margin-top: 0; }

.cookie-categories { margin: 1.6rem 0 0; border-top: 1px solid rgba(245, 244, 241, .1); }

.cookie-category {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .4rem 2rem;
    align-items: center;
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(245, 244, 241, .1);
}

.cookie-category h3 { margin: 0; font-family: var(--ck-serif); font-size: 1.2rem; font-weight: 300; letter-spacing: -.01em; line-height: 1.2; }
.cookie-category p { margin: .35rem 0 0; font-size: .82rem; }
.cookie-category__status { margin-top: .5rem; color: rgba(var(--ck-luz), .85); font-size: .58rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; }

/* Interruptor: apagado, un carril con el tirador en hueso; encendido, carril ciruela y tirador de luz */
.cookie-switch { position: relative; display: inline-flex; cursor: pointer; }
.cookie-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.cookie-switch span {
    position: relative;
    width: 3rem;
    height: 1.7rem;
    border: 1px solid rgba(245, 244, 241, .3);
    border-radius: 999px;
    background: rgba(245, 244, 241, .04);
    transition: background-color .6s ease, border-color .6s ease;
}

.cookie-switch span::after {
    content: "";
    position: absolute;
    top: 50%;
    left: .2rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: rgba(245, 244, 241, .7);
    transform: translateY(-50%);
    transition: transform .6s var(--ck-ease), background-color .6s ease, box-shadow .6s ease;
}

.cookie-switch input:checked + span { border-color: var(--ck-ciruela-luz); background: rgba(131, 19, 108, .55); }
.cookie-switch input:checked + span::after { background: rgb(var(--ck-core)); box-shadow: 0 0 10px 1px rgba(var(--ck-luz), .55); transform: translate(1.3rem, -50%); }
.cookie-switch input:focus-visible + span { outline: 2px solid rgba(var(--ck-luz), .8); outline-offset: 3px; }
.cookie-switch input:disabled + span { cursor: default; opacity: .55; }

.cookie-modal__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
    padding: 1.2rem 2rem 1.6rem;
    border-top: 1px solid rgba(245, 244, 241, .1);
}

.cookie-modal__actions .cookie-btn { min-width: 0; }

/* ---------- Botón flotante (sin cambios) ---------- */

.cookie-floating {
    position: fixed;
    left: max(var(--site-edge, 1rem), env(safe-area-inset-left));
    right: auto;
    top: auto;
    bottom: max(var(--site-edge, 1rem), env(safe-area-inset-bottom));
    transform: none;
    z-index: 100050;
    height: 2.65rem;
    width: 2.65rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #000;
    cursor: pointer;
    box-shadow: none;
    mix-blend-mode: difference;
    transition: transform 0.3s ease, opacity 0.25s ease;
}

:where(html:not(.is-touch)) .cookie-floating:hover {
    transform: translateY(-2px);
}

.cookie-floating img {
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: auto;
    height: 2.08rem;
    object-fit: contain;
    flex: 0 0 auto;
    margin: 0;
    transform: translate(-50%, -50%);
    filter: brightness(0);
}

.cookie-floating span {
    display: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .cookie-consent { bottom: .75rem; width: min(calc(100vw - 1.5rem), 30rem); }
    .cookie-consent__panel { grid-template-columns: 1fr; gap: 1.2rem; padding: 1.4rem 1.3rem 1.3rem; }
    .cookie-consent__panel::before { left: 1.3rem; }
    .cookie-consent h2 { font-size: 1.55rem; }
    .cookie-consent p { font-size: .84rem; }
    .cookie-consent__actions { justify-items: stretch; }
    .cookie-consent__choices { display: grid; grid-template-columns: 1fr 1fr; }
    .cookie-btn { min-width: 0; min-height: 2.9rem; padding: 0 1rem; }
    .cookie-link { justify-self: center; }

    .cookie-modal { align-items: end; padding: .6rem; }
    .cookie-modal__panel { max-height: calc(100svh - 1.2rem); border-radius: 1.1rem; }
    .cookie-modal__header { padding: 1.5rem 1.3rem 1rem; }
    .cookie-modal__body { padding: 0 1.3rem 1.2rem; }
    .cookie-modal h2 { font-size: 1.7rem; }
    .cookie-modal__actions { grid-template-columns: 1fr 1fr; padding: 1rem 1.3rem 1.2rem; }
    /* Guardar selección ocupa la fila entera, debajo de las dos opciones iguales */
    .cookie-modal__actions [data-cookie-save] { grid-column: 1 / -1; }

    .cookie-floating {
        left: var(--site-edge, 0.75rem);
        right: auto;
        top: auto;
        bottom: var(--site-edge, 0.75rem);
        width: 2.35rem;
        height: 2.35rem;
        transform: none;
    }

    .cookie-floating img {
        height: 1.84rem;
    }

    :where(html:not(.is-touch)) .cookie-floating:hover {
        transform: translateY(-2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent, .cookie-modal, .cookie-modal__panel { animation: none; }
    .cookie-btn, .cookie-btn::before, .cookie-link::after, .cookie-switch span, .cookie-switch span::after, .cookie-modal__close { transition: none; }
}
