/* Astra has no matching token set, so the banner carries its own. */
.cc-banner,
.cc-modal,
.cc-footer-strip {
    --color-primary: #0F172A;
    --color-accent: #0067FF;
    --color-accent-hover: #005EE9;
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-text: #0F172A;
    --color-text-light: #364151;
    --color-success: #15803D;
    --color-border: #E2E8F0;
    --color-border-dark: #D1DAE5;
    --font-body: inherit;
    --font-display: inherit;
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-lg: 1.5rem;
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.2);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1200px;
}
.cc-footer-strip {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
}
.cc-footer-strip a { color: #0F172A; text-decoration: underline; }
/* ===========================================
   COOKIE CONSENT
   =========================================== */
.cc-banner,
.cc-modal {
    --cc-link: #FFFFFF;
    --cc-on-accent: #FFFFFF;
}

.cc-banner[hidden],
.cc-modal[hidden] {
    display: none !important;
}

/* Level 1: banner */
.cc-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.92);
    padding: var(--sp-3) var(--sp-6);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cc-banner.is-visible {
    transform: translateY(0);
}

/* Focus moves to the banner for screen readers; the container itself is
   not interactive, so it draws no focus ring. */
.cc-banner:focus {
    outline: none;
}

.cc-banner-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
}

.cc-banner-title {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px;
}

.cc-banner-text p {
    font-size: var(--fs-sm);
    line-height: 1.45;
    margin: 0;
    max-width: 90ch;
}

.cc-banner a {
    color: var(--cc-link);
    text-decoration: underline;
}

.cc-banner a:hover {
    color: #fff;
}

.cc-banner-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--sp-2);
}

/* Buttons.
   "Reject all" and "Accept all" are deliberately identical in size, contrast
   and type. Do not emphasise one over the other: that would undermine the
   validity of the consent. */
.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-2) var(--sp-4);
    min-height: 40px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.cc-btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.cc-banner .cc-btn:focus-visible {
    outline-color: var(--cc-link);
}

.cc-btn-choice {
    background: #fff;
    color: var(--color-primary);
    border-color: #fff;
}

.cc-btn-choice:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--cc-on-accent);
}

/* Banner buttons stay on one line */
.cc-banner-actions .cc-btn {
    white-space: nowrap;
}

.cc-btn-tertiary {
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
}

.cc-btn-tertiary:hover {
    border-color: #fff;
    color: #fff;
}

.cc-btn-save {
    background: var(--color-accent);
    color: var(--cc-on-accent);
    border-color: var(--color-accent);
}

.cc-btn-save:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}

/* Level 2: settings panel */
.cc-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
}

.cc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cc-modal.is-visible .cc-modal-backdrop {
    opacity: 1;
}

.cc-modal-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: min(88vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cc-modal.is-visible .cc-modal-panel {
    opacity: 1;
    transform: none;
}

.cc-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--color-border);
}

.cc-modal-title {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    color: var(--color-primary);
    margin: 0;
}

.cc-modal-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    color: var(--color-text-light);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.cc-modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.cc-modal-close:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.cc-modal-body {
    padding: var(--sp-5) var(--sp-6);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cc-modal-intro {
    font-size: var(--fs-sm);
    line-height: 1.6;
    color: var(--color-text-light);
    margin: 0 0 var(--sp-5);
}

.cc-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.cc-cat {
    padding: var(--sp-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.cc-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-2);
}

.cc-cat-name {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-primary);
}

label.cc-cat-name {
    cursor: pointer;
}

.cc-cat-desc {
    font-size: var(--fs-sm);
    line-height: 1.6;
    color: var(--color-text);
    margin: 0;
}

.cc-cat-meta {
    font-size: var(--fs-xs);
    line-height: 1.6;
    color: var(--color-text-light);
    margin: var(--sp-2) 0 0;
}

.cc-cat-meta code {
    font-size: 0.95em;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 3px;
    padding: 1px 4px;
}

/* Toggle */
.cc-switch {
    position: relative;
    flex-shrink: 0;
    display: inline-block;
    width: 52px;
    height: 30px;
}

.cc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.cc-switch-track {
    position: absolute;
    inset: 0;
    background: var(--color-border-dark);
    border-radius: var(--radius-full);
    transition: background var(--transition);
}

.cc-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.cc-switch input:checked~.cc-switch-track {
    background: var(--color-success);
}

.cc-switch input:checked~.cc-switch-track::after {
    transform: translateX(22px);
}

.cc-switch input:focus-visible~.cc-switch-track {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.cc-switch.is-locked {
    opacity: 0.65;
}

.cc-switch.is-locked input {
    cursor: not-allowed;
}

.cc-modal-links {
    font-size: var(--fs-sm);
    margin: var(--sp-5) 0 0;
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.cc-modal-links a {
    color: var(--color-primary);
    text-decoration: underline;
}

.cc-modal-foot {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.cc-modal-foot .cc-btn {
    flex: 1 1 0;
}

.cc-modal-foot .cc-btn-choice {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border-dark);
}

.cc-modal-foot .cc-btn-choice:hover {
    border-color: var(--color-primary);
    background: var(--color-bg);
}

body.cc-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .cc-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-3);
    }

    .cc-banner-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Reject and Accept share a row equally */
    .cc-banner-actions .cc-btn-choice {
        flex: 1 1 0;
    }

    /* Customise drops to its own row as a light link to limit height */
    .cc-banner-actions .cc-btn-tertiary {
        order: 1;
        flex: 1 1 100%;
        min-height: 32px;
        padding: var(--sp-2) 0 0;
        border-color: transparent;
        text-decoration: underline;
    }
}

@media (max-width: 600px) {
    .cc-banner {
        padding: var(--sp-4);
        max-height: 85vh;
        overflow-y: auto;
    }

    .cc-modal {
        padding: 0;
        align-items: flex-end;
    }

    .cc-modal-panel {
        max-width: none;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .cc-modal-head,
    .cc-modal-body,
    .cc-modal-foot {
        padding-left: var(--sp-4);
        padding-right: var(--sp-4);
    }

    .cc-modal-foot {
        flex-wrap: wrap;
        border-radius: 0;
    }

    .cc-modal-foot .cc-btn {
        flex: 1 1 45%;
    }

    .cc-modal-foot .cc-btn-save {
        flex-basis: 100%;
        order: -1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .cc-banner,
    .cc-modal-panel,
    .cc-modal-backdrop,
    .cc-switch-track,
    .cc-switch-track::after {
        transition: none;
    }
}
