/*
 * Plaster Site Agent - the cookie banner, its reopen button and waiting
 * embeds (includes/consent.php, assets/consent.js).
 *
 * Self-contained: it sets everything it relies on, so it looks the same
 * whatever the theme does, and doesn't need the theme's CSS at all. Mobile
 * first. Colours, sizes and the font come from the hub as --pc-*
 * properties (a small <style> in <head>, consent-banner.php); the values
 * below are only fallbacks.
 */

/* Fallbacks only (:where has no weight, so the hub's values always win). */
:where(.plaster-consent, .plaster-consent-reopen, .plaster-embed) {
    --pc-bg: #ffffff;
    --pc-text: #1d1d1b;
    --pc-heading: #1d1d1b;
    --pc-link: #1d1d1b;
    --pc-btn1-bg: #1d1d1b;
    --pc-btn1-text: #ffffff;
    --pc-btn1-border: #1d1d1b;
    --pc-btn1-hover: #3d3d3a;
    --pc-btn2-bg: #ffffff;
    --pc-btn2-text: #1d1d1b;
    --pc-btn2-border: #1d1d1b;
    --pc-btn2-hover: #efefee;
    --pc-switch-on: #1d1d1b;
    --pc-switch-off: #8f8d87;
    --pc-focus: #2563eb;
}

.plaster-consent {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 2147483000;
    margin: 0;
    padding: 0;
    font-family: var(--pc-font, inherit);
    font-size: var(--pc-size, 15px);
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
}

.plaster-consent[hidden],
.plaster-consent [hidden],
.plaster-consent-reopen[hidden] {
    display: none !important;
}

.plaster-consent *,
.plaster-consent *::before,
.plaster-consent *::after,
.plaster-embed,
.plaster-embed *,
.plaster-embed *::before,
.plaster-embed *::after {
    box-sizing: border-box;
}

/* ---- Animation ---- */

.plaster-consent--anim-fade .plaster-consent__inner,
.plaster-consent--anim-slide .plaster-consent__inner,
.plaster-consent__backdrop {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.plaster-consent--anim-slide .plaster-consent__inner {
    transform: translateY(16px);
}

.plaster-consent--bar-top.plaster-consent--anim-slide .plaster-consent__inner {
    transform: translateY(-16px);
}

.plaster-consent.is-open .plaster-consent__inner,
.plaster-consent.is-open .plaster-consent__backdrop {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .plaster-consent__inner,
    .plaster-consent__backdrop,
    .plaster-consent__choice input,
    .plaster-consent__choice input::before {
        transition: none !important;
        transform: none !important;
    }
}

/* ---- The box ---- */

.plaster-consent__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: 0;
    padding: var(--pc-pad, 22px);
    overflow-y: auto;
    border: 1px solid color-mix(in srgb, var(--pc-text) 18%, transparent);
    border-radius: var(--pc-radius, 8px);
    background: var(--pc-bg);
    color: var(--pc-text);
    box-shadow: var(--pc-shadow, 0 10px 40px rgba(0, 0, 0, 0.28));
}

.plaster-consent__inner:focus {
    outline: none;
}

.plaster-consent__inner:focus-visible {
    outline: 2px solid var(--pc-focus);
    outline-offset: 2px;
}

.plaster-consent__head {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-right: 32px;
}

.plaster-consent__logo {
    display: block;
    width: auto;
    max-width: 120px;
    height: 32px;
    object-fit: contain;
}

.plaster-consent__title {
    margin: 0;
    padding: 0;
    color: var(--pc-heading);
    font-family: inherit;
    font-size: var(--pc-title-size, 18px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: normal;
    text-transform: none;
}

.plaster-consent__text {
    margin: 0;
    color: inherit;
    font-size: inherit;
}

.plaster-consent a {
    color: var(--pc-link);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.plaster-consent a:hover {
    text-decoration: none;
}

.plaster-consent a:focus-visible {
    outline: 2px solid var(--pc-focus);
    outline-offset: 2px;
}

.plaster-consent__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--pc-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.plaster-consent__close:hover {
    background: color-mix(in srgb, var(--pc-text) 10%, transparent);
}

.plaster-consent__close:focus-visible {
    outline: 2px solid var(--pc-focus);
}

/* ---- The choices ---- */

.plaster-consent__choices {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--pc-text) 20%, transparent);
}

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

.plaster-consent__choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0;
    color: inherit;
    font-size: 0.93em;
    font-weight: 400;
    cursor: pointer;
}

.plaster-consent__choice strong {
    display: block;
    color: var(--pc-heading);
    font-weight: 700;
}

/* A switch, drawn from the checkbox itself (still a checkbox without this CSS). */
.plaster-consent__choice input {
    position: relative;
    flex: none;
    width: 40px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--pc-switch-off);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.2s ease;
}

.plaster-consent__choice input::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--pc-switch-off);
    transition: transform 0.2s ease;
}

.plaster-consent__choice input:checked {
    border-color: var(--pc-switch-on);
    background: var(--pc-switch-on);
}

.plaster-consent__choice input:checked::before {
    background: var(--pc-bg);
    transform: translateX(16px);
}

.plaster-consent__choice input:focus-visible {
    outline: 2px solid var(--pc-focus);
    outline-offset: 2px;
}

.plaster-consent__choice input:disabled {
    cursor: default;
    opacity: 0.6;
}

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

.plaster-consent__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.plaster-consent__btn {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 20px;
    border: 1px solid var(--pc-btn1-border);
    border-radius: calc(var(--pc-radius, 8px) * 0.75);
    background: var(--pc-btn1-bg);
    color: var(--pc-btn1-text);
    box-shadow: none;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.plaster-consent__btn:hover {
    background: var(--pc-btn1-hover);
    border-color: var(--pc-btn1-hover);
}

.plaster-consent__btn--secondary {
    border-color: var(--pc-btn2-border);
    background: var(--pc-btn2-bg);
    color: var(--pc-btn2-text);
}

.plaster-consent__btn--secondary:hover {
    border-color: var(--pc-btn2-border);
    background: var(--pc-btn2-hover);
}

.plaster-consent__btn:focus-visible,
.plaster-consent__link:focus-visible {
    outline: 2px solid var(--pc-focus);
    outline-offset: 2px;
}

/* A button that looks like a link ("Manage choices"). */
.plaster-consent__link {
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--pc-link);
    box-shadow: none;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-transform: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.plaster-consent__link:hover {
    text-decoration: none;
}

/* ---- Layouts (phones: cards sit along the bottom) ---- */

.plaster-consent--bar-top {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
}

.plaster-consent--bar-bottom {
    right: 0;
    bottom: 0;
    left: 0;
}

.plaster-consent--bar-top .plaster-consent__inner,
.plaster-consent--bar-bottom .plaster-consent__inner {
    border-width: 1px 0;
    border-radius: 0;
}

/* A dimmed page behind (always for the box in the middle). */
.plaster-consent--backdrop {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.plaster-consent--backdrop.plaster-consent--bar-top {
    justify-content: flex-start;
}

.plaster-consent--backdrop.plaster-consent--bar-top,
.plaster-consent--backdrop.plaster-consent--bar-bottom {
    padding: 0;
}

.plaster-consent__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, var(--pc-backdrop, 0.5));
}

.plaster-consent--modal {
    align-items: center;
}

.plaster-consent--modal .plaster-consent__inner {
    width: 100%;
    max-width: var(--pc-width, 440px);
}

html.plaster-consent-open {
    overflow: hidden;
}

@media (min-width: 640px) {
    .plaster-consent {
        right: 24px;
        bottom: 24px;
        left: 24px;
    }

    .plaster-consent__btn {
        flex: 0 0 auto;
    }

    .plaster-consent--card-left .plaster-consent__inner,
    .plaster-consent--card-right .plaster-consent__inner,
    .plaster-consent--card-centre .plaster-consent__inner {
        width: var(--pc-width, 440px);
        max-width: calc(100vw - 48px);
    }

    .plaster-consent--card-left:not(.plaster-consent--backdrop) { right: auto; }
    .plaster-consent--card-right:not(.plaster-consent--backdrop) { left: auto; }
    .plaster-consent--card-centre:not(.plaster-consent--backdrop) { display: flex; justify-content: center; pointer-events: none; }
    .plaster-consent--card-centre:not(.plaster-consent--backdrop) .plaster-consent__inner { pointer-events: auto; }

    .plaster-consent--backdrop { padding: 24px; }
    .plaster-consent--backdrop.plaster-consent--card-left { align-items: flex-start; }
    .plaster-consent--backdrop.plaster-consent--card-right { align-items: flex-end; }
    .plaster-consent--backdrop.plaster-consent--card-centre { align-items: center; }
    .plaster-consent--modal { justify-content: center; }

    .plaster-consent--bar-top,
    .plaster-consent--bar-bottom {
        right: 0;
        left: 0;
    }

    .plaster-consent--bar-bottom { bottom: 0; }
    .plaster-consent--bar-top { top: 0; bottom: auto; }

    .plaster-consent--bar-top .plaster-consent__inner,
    .plaster-consent--bar-bottom .plaster-consent__inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px 32px;
        align-items: center;
        padding-right: max(24px, calc((100vw - 1200px) / 2));
        padding-left: max(24px, calc((100vw - 1200px) / 2));
    }

    .plaster-consent--bar-top .plaster-consent__head,
    .plaster-consent--bar-top .plaster-consent__text,
    .plaster-consent--bar-top .plaster-consent__choices,
    .plaster-consent--bar-bottom .plaster-consent__head,
    .plaster-consent--bar-bottom .plaster-consent__text,
    .plaster-consent--bar-bottom .plaster-consent__choices {
        grid-column: 1;
    }

    .plaster-consent--bar-top .plaster-consent__buttons,
    .plaster-consent--bar-bottom .plaster-consent__buttons {
        grid-row: 1 / span 3;
        grid-column: 2;
        justify-content: flex-end;
        max-width: 460px;
    }

    .plaster-consent--bar-top .plaster-consent__choices,
    .plaster-consent--bar-bottom .plaster-consent__choices {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .plaster-consent--modal .plaster-consent__inner {
        padding: calc(var(--pc-pad, 22px) + 6px);
    }
}

/* ---- The floating reopen button ---- */

.plaster-consent-reopen {
    position: fixed;
    bottom: 16px;
    z-index: 2147482999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--pc-btn2-border);
    border-radius: 999px;
    background: var(--pc-btn2-bg);
    color: var(--pc-btn2-text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font-family: var(--pc-font, inherit);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.plaster-consent-reopen--icon {
    width: 44px;
    padding: 0;
}

.plaster-consent-reopen--left { left: 16px; }
.plaster-consent-reopen--right { right: 16px; }

.plaster-consent-reopen:hover {
    background: var(--pc-btn2-hover);
}

.plaster-consent-reopen:focus-visible {
    outline: 2px solid var(--pc-focus);
    outline-offset: 2px;
}

/* ---- Embeds waiting for consent (in the page's own colours) ---- */

.plaster-embed {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 200px;
    aspect-ratio: 16 / 9;
    margin: 0;
    padding: 24px;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, currentColor 6%, transparent);
    font-size: 15px;
    line-height: 1.45;
    text-align: left;
}

.plaster-embed--spotify,
.plaster-embed--soundcloud,
.plaster-embed--mixcloud,
.plaster-embed--instagram,
.plaster-embed--facebook,
.plaster-embed--x,
.plaster-embed--tiktok {
    aspect-ratio: auto;
}

/* Inside WordPress's own ratio box: fill it. */
.wp-has-aspect-ratio .plaster-embed {
    position: absolute;
    inset: 0;
    min-height: 0;
    aspect-ratio: auto;
}

.plaster-embed p {
    margin: 0;
}

/* Outlined in the text's own colour, so it reads on any theme. */
.plaster-embed .plaster-consent__btn {
    flex: 0 0 auto;
    margin-right: 10px;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font-size: 15px;
}

.plaster-embed .plaster-consent__btn:hover {
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.plaster-embed .plaster-consent__link {
    min-height: 0;
    color: inherit;
}

/* ---- [plaster_cookie_table] ---- */

.plaster-cookie-table {
    width: 100%;
    border-collapse: collapse;
}

.plaster-cookie-table th,
.plaster-cookie-table td {
    padding: 8px 10px;
    border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    text-align: left;
    vertical-align: top;
}
