/*
 * Cookie consent banner.
 *
 * Colours come from the theme's custom properties where they exist, with the
 * current CatDoors palette as fallback so the plugin still renders correctly
 * on its own.
 */

.cookie-consent {
    position: fixed;
    z-index: 99999;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    padding: 0 20px 18px;
    pointer-events: none;
}

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

.cookie-consent__dialog {
    width: 100%;
    max-width: 1180px;
    padding: 26px 30px;
    border: 1px solid var(--color-line, #e2ded8);
    border-radius: 12px;
    background: var(--color-paper, #f7f5f1);
    box-shadow: 0 12px 40px rgb(58 55 56 / 16%);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
}

.cookie-consent.is-open .cookie-consent__dialog {
    opacity: 1;
    transform: translateY(0);
}

/* ------------------------------------------------------------------ header */

.cookie-consent__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.cookie-consent__title {
    margin: 0;
    color: var(--color-ink, #202124);
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 700;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.cookie-consent__close {
    flex: 0 0 auto;
    padding: 4px;
    border: 0;
    background: none;
    color: var(--color-ink-soft, #51565c);
    cursor: pointer;
    line-height: 0;
}

.cookie-consent__close svg {
    width: 20px;
    height: 20px;
}

.cookie-consent__close:hover {
    color: var(--color-ink, #202124);
}

/* -------------------------------------------------------------------- body */

.cookie-consent__body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cookie-consent__content {
    min-width: 0;
}

.cookie-consent__message {
    max-width: 720px;
    margin: 0;
    color: var(--color-ink-soft, #51565c);
    font-size: 15px;
    line-height: 1.55;
}

/* -------------------------------------------------------------- categories */

.cookie-consent__categories {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.cookie-consent__categories[hidden] {
    display: none;
}

.cookie-consent__category {
    overflow: hidden;
    border: 1px solid var(--color-line, #e2ded8);
    border-radius: 9px;
    background: var(--color-white, #fff);
}

.cookie-consent__category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 11px 14px;
}

.cookie-consent__category-title {
    flex: 1 1 auto;
    color: var(--color-ink, #202124);
    font-size: 14px;
    font-weight: 650;
}

.cookie-consent__always-active {
    color: var(--color-teal-dark, #3f5f51);
    font-size: 13px;
    font-weight: 600;
}

.cookie-consent__description {
    padding: 0 14px 12px;
    color: var(--color-ink-soft, #51565c);
    font-size: 13px;
    line-height: 1.5;
}

.cookie-consent__description[hidden] {
    display: none;
}

.cookie-consent__toggle {
    flex: 0 0 auto;
    padding: 4px;
    border: 0;
    background: none;
    color: var(--color-ink-soft, #51565c);
    cursor: pointer;
    line-height: 0;
}

.cookie-consent__toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}

.cookie-consent__toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* ------------------------------------------------------------------ switch */

.cookie-consent__switch {
    flex: 0 0 auto;
}

.cookie-consent__checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.cookie-consent__label {
    position: relative;
    display: block;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--color-line, #e2ded8);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.cookie-consent__label::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-white, #fff);
    content: "";
    transition: transform 0.15s ease;
}

.cookie-consent__checkbox:checked + .cookie-consent__label {
    background: var(--color-teal, #507564);
}

.cookie-consent__checkbox:checked + .cookie-consent__label::after {
    transform: translateX(18px);
}

.cookie-consent__checkbox:focus-visible + .cookie-consent__label {
    outline: 2px solid var(--color-teal-dark, #3f5f51);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------- buttons */

.cookie-consent__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
}

.cookie-consent__btn {
    flex: 1 1 auto;
    min-height: 48px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cookie-consent__btn[hidden] {
    display: none;
}

.cookie-consent__btn--accept {
    border-color: var(--color-orange, #d9364f);
    background: var(--color-orange, #d9364f);
    color: var(--color-white, #fff);
}

.cookie-consent__btn--accept:hover,
.cookie-consent__btn--accept:focus-visible {
    border-color: var(--color-orange-dark, #b9283f);
    background: var(--color-orange-dark, #b9283f);
}

.cookie-consent__btn--deny {
    border-color: var(--color-line, #e2ded8);
    background: var(--color-white, #fff);
    color: var(--color-ink, #202124);
}

.cookie-consent__btn--deny:hover,
.cookie-consent__btn--deny:focus-visible {
    background: var(--color-teal-tint, #edf3f0);
}

.cookie-consent__btn--ghost {
    border-color: var(--color-line, #e2ded8);
    background: transparent;
    color: var(--color-ink-soft, #51565c);
}

.cookie-consent__btn--ghost:hover,
.cookie-consent__btn--ghost:focus-visible {
    border-color: var(--color-teal, #507564);
    color: var(--color-teal-dark, #3f5f51);
}

.cookie-consent__sr-only {
    position: absolute;
    overflow: hidden;
    clip: rect(0 0 0 0);
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    white-space: nowrap;
}

/* --------------------------------------------------------------- responsive */

@media (min-width: 1024px) {
    .cookie-consent__body {
        flex-direction: row;
        align-items: center;
        gap: 34px;
    }

    .cookie-consent__content {
        flex: 1 1 auto;
    }

    .cookie-consent__buttons {
        flex: 0 0 250px;
        flex-direction: column;
    }
}

@media (max-width: 767px) {
    .cookie-consent {
        padding: 0 12px 12px;
    }

    .cookie-consent__dialog {
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        padding: 22px 20px;
    }

    .cookie-consent__title {
        font-size: 23px;
    }

    .cookie-consent__message {
        font-size: 14px;
    }

    .cookie-consent__buttons {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent__dialog,
    .cookie-consent__label,
    .cookie-consent__label::after,
    .cookie-consent__toggle svg {
        transition: none;
    }
}
