/*
 * WebUp cookie consent banner, preferences dialog and blocked-embed placeholders.
 *
 * Kept out of style.css so the main stylesheet is untouched.
 *
 * "Accept all" and "Reject all" are deliberately styled identically. Making the
 * accept path easier than the refuse path is the thing the ICO actually acts on,
 * so do not give one of them a louder colour later.
 */

:root {
    --consent-ground: #0E0E0E;
    --consent-panel: #1A1A1A;
    --consent-line: #2E2E2E;
    --consent-text: #F4F4F4;
    --consent-muted: #B5B5B5;
    --consent-brand: #C5FF41;
    --consent-brand-ink: #0E0E0E;
}

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

/* ------------------------------------------------------------------ Banner */

.consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999998;
    background: var(--consent-ground);
    color: var(--consent-text);
    border-top: 2px solid var(--consent-brand);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .45);
    max-height: 85vh;
    overflow-y: auto;
}

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

.consent-banner:focus {
    outline: none;
}

.consent-banner__inner {
    max-width: 1290px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px 32px;
    align-items: center;
    justify-content: space-between;
}

.consent-banner__copy {
    flex: 1 1 420px;
    min-width: 0;
}

.consent-banner__title {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
    color: var(--consent-text);
}

.consent-banner__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--consent-muted);
}

.consent-banner__text a,
.consent-embed__note a {
    color: var(--consent-brand);
    text-decoration: underline;
}

.consent-banner__actions {
    flex: 0 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ------------------------------------------------------------------ Buttons */

.consent-btn {
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    padding: 13px 22px;
    min-width: 150px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* Accept all and Reject all both use this. Equal prominence is the point. */
.consent-btn--primary {
    background: var(--consent-brand);
    color: var(--consent-brand-ink);
    border-color: var(--consent-brand);
}

.consent-btn--primary:hover,
.consent-btn--primary:focus {
    background: #D6FF74;
    border-color: #D6FF74;
}

.consent-btn--secondary {
    background: transparent;
    color: var(--consent-text);
    border-color: var(--consent-line);
}

.consent-btn--secondary:hover,
.consent-btn--secondary:focus {
    border-color: var(--consent-text);
}

.consent-btn:focus-visible,
.consent-switch input:focus-visible + .consent-switch__track,
.consent-modal__close:focus-visible {
    outline: 3px solid #7EC8FF;
    outline-offset: 2px;
}

/* --------------------------------------------------- Preferences dialog */

.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

/* Stop the page behind the dialog scrolling away under it. */
.consent-modal-open,
.consent-modal-open body {
    overflow: hidden;
}

.consent-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .7);
}

.consent-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--consent-panel);
    color: var(--consent-text);
    border: 1px solid var(--consent-line);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.consent-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--consent-line);
}

.consent-modal__header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--consent-text);
}

.consent-modal__close {
    font: inherit;
    font-size: 26px;
    line-height: 1;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    background: transparent;
    color: var(--consent-muted);
    border: 1px solid var(--consent-line);
    border-radius: 6px;
    cursor: pointer;
}

.consent-modal__close:hover {
    color: var(--consent-text);
    border-color: var(--consent-text);
}

.consent-modal__body {
    padding: 8px 24px 20px;
    overflow-y: auto;
}

.consent-modal__intro {
    margin: 16px 0 4px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--consent-muted);
}

.consent-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 24px;
    border-top: 1px solid var(--consent-line);
}

/* ------------------------------------------------------------ Categories */

.consent-group {
    padding: 18px 0;
    border-bottom: 1px solid var(--consent-line);
}

.consent-group:last-child {
    border-bottom: 0;
}

.consent-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.consent-group__title {
    margin: 0;
    font-size: 16px;
    color: var(--consent-text);
}

.consent-group__always {
    font-size: 13px;
    font-weight: 600;
    color: var(--consent-brand);
    white-space: nowrap;
}

.consent-group__desc {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--consent-muted);
}

.consent-group__list {
    margin: 8px 0 0;
    padding: 0 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--consent-muted);
}

/* A real checkbox, restyled. Keyboard and screen-reader behaviour intact. */
.consent-switch {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.consent-switch input {
    position: absolute;
    opacity: 0;
    width: 52px;
    height: 30px;
    margin: 0;
    cursor: pointer;
}

.consent-switch__track {
    display: block;
    width: 52px;
    height: 30px;
    border-radius: 15px;
    background: #3A3A3A;
    border: 1px solid var(--consent-line);
    transition: background-color .2s ease;
}

.consent-switch__thumb {
    display: block;
    width: 22px;
    height: 22px;
    margin: 3px;
    border-radius: 50%;
    background: var(--consent-muted);
    transition: transform .2s ease, background-color .2s ease;
}

.consent-switch input:checked + .consent-switch__track {
    background: var(--consent-brand);
}

.consent-switch input:checked + .consent-switch__track .consent-switch__thumb {
    background: var(--consent-brand-ink);
    transform: translateX(22px);
}

/* ------------------------------------------------------ Blocked embeds */

/* An iframe sitting directly in the container, or a wrapper the page needs for
   layout (an aspect-ratio box, say) marked with consent-embed__slot. Both have
   to be hidden outright, or a blocked embed still reserves its full height. */
.consent-embed--blocked > iframe,
.consent-embed--blocked > .consent-embed__slot {
    display: none;
}

.consent-embed__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 220px;
    padding: 32px 24px;
    text-align: center;
    background: var(--consent-panel);
    border: 1px dashed var(--consent-line);
    border-radius: 10px;
}

/* Scoped through .consent-embed__placeholder on purpose. style.css colours
   paragraphs with descendant selectors such as ".section-box p", which outrank a
   single class and would leave this text dark on a dark panel. */
.consent-embed__placeholder .consent-embed__text {
    margin: 0;
    max-width: 46em;
    font-size: 15px;
    line-height: 1.55;
    color: var(--consent-text);
}

.consent-embed__placeholder .consent-embed__note {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--consent-muted);
}

.consent-embed__placeholder .consent-embed__note a {
    color: var(--consent-brand);
    text-decoration: underline;
}

.consent-embed__placeholder .consent-btn--primary {
    background: var(--consent-brand);
    color: var(--consent-brand-ink);
    border-color: var(--consent-brand);
}

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

@media (max-width: 767px) {
    .consent-banner {
        max-height: 80vh;
    }

    .consent-banner__inner {
        padding: 18px 16px;
        gap: 16px;
    }

    .consent-banner__actions {
        width: 100%;
    }

    .consent-btn {
        flex: 1 1 100%;
        min-width: 0;
    }

    .consent-modal {
        padding: 12px;
    }

    .consent-modal__dialog {
        max-height: 92vh;
    }

    .consent-modal__footer .consent-btn {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .consent-btn,
    .consent-switch__track,
    .consent-switch__thumb {
        transition: none;
    }
}
