/* Cookie Consent. Restyle by overriding the --cc-* variables in the site's CSS, e.g. :root { --cc-accent: #f39200; }
   and :root[data-cc-mode="dark"] { --cc-accent: #ffd08a; } for the dark mode. */
:root {
    --cc-bg: #ffffff;
    --cc-text: #1f2937;
    --cc-muted: #4b5563;
    --cc-border: #e5e7eb;
    --cc-surface: #f9fafb;
    --cc-accent: #111827;
    --cc-accent-text: #ffffff;
    --cc-focus: #2563eb;
    --cc-radius: 12px;
    --cc-button-radius: 8px;
    --cc-font: inherit;
    --cc-shadow: 0 10px 30px rgb(0 0 0 / 0.14);
    --cc-z: 2147483000;
}

/* Dark: set by the script, which follows the site's theme (or the device, or a fixed choice; see the Theme setting). */
:root[data-cc-mode="dark"] {
    --cc-bg: #111827;
    --cc-text: #f3f4f6;
    --cc-muted: #d1d5db;
    --cc-border: #374151;
    --cc-surface: #1f2937;
    --cc-accent: #f9fafb;
    --cc-accent-text: #111827;
    --cc-focus: #93c5fd;
    --cc-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
}

.cc,
.cc-embed {
    color-scheme: light;
    font-family: var(--cc-font);
    color: var(--cc-text);
    line-height: 1.5;
}

/* Native parts (scrollbars, focus rings, the backdrop) match the banner's mode. */
:root[data-cc-mode="dark"] .cc,
:root[data-cc-mode="dark"] .cc-embed {
    color-scheme: dark;
}

.cc *,
.cc-embed * {
    box-sizing: border-box;
}

/* ---------- first layer ---------- */

.cc-banner {
    position: fixed;
    z-index: var(--cc-z);
    inset: auto 16px 16px 16px;
    width: auto;
    max-width: 26rem;
    max-height: calc(100dvh - 32px);
    margin: 0;
    padding: 20px;
    overflow: auto;
    color: var(--cc-text);
    background: var(--cc-bg);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
}

.cc-banner:not([open]) {
    display: none;
}

.cc--right .cc-banner {
    inset-inline: auto 16px;
}

.cc--center .cc-banner {
    inset-inline: 16px;
    margin-inline: auto;
}

.cc--bar .cc-banner {
    inset: auto 0 0 0;
    max-width: none;
    border-width: 1px 0 0;
    border-radius: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    padding: 16px max(16px, calc((100vw - 72rem) / 2));
}

.cc--bar .cc-banner:not([open]) {
    display: none;
}

.cc--bar .cc-banner__body {
    flex: 1 1 28rem;
}

.cc--modal .cc-banner {
    inset: 0;
    margin: auto;
    max-width: 32rem;
    height: fit-content;
}

.cc-banner::backdrop,
.cc-prefs::backdrop {
    background: rgb(0 0 0 / 0.45);
}

@media (max-width: 640px) {
    .cc--box .cc-banner {
        inset: auto 8px 8px 8px;
        max-width: none;
    }
}

.cc-title {
    margin: 0 0 6px;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--cc-text);
}

.cc-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--cc-muted);
}

.cc-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cc-gpc {
    margin: 10px 0 0;
    padding: 8px 10px;
    font-size: 0.8125rem;
    background: var(--cc-surface);
    border-radius: var(--cc-button-radius);
}

.cc-gpc[hidden] {
    display: none;
}

/* Accept and reject carry equal weight: same size, same style. */
.cc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.cc--bar .cc-actions {
    margin-top: 0;
}

.cc-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 16px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--cc-accent-text);
    background: var(--cc-accent);
    border: 1px solid var(--cc-accent);
    border-radius: var(--cc-button-radius);
    cursor: pointer;
}

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

.cc-btn:hover {
    filter: brightness(1.08);
}

.cc-btn:focus-visible,
.cc-close:focus-visible,
.cc-switch:focus-visible,
.cc-link:focus-visible,
.cc-services summary:focus-visible,
.cc-settings-link:focus-visible {
    outline: 2px solid var(--cc-focus);
    outline-offset: 2px;
}

/* ---------- preferences ---------- */

/* Centred explicitly: CSS resets (Tailwind's preflight) remove the dialog's auto margin. */
.cc-prefs {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    width: min(40rem, calc(100vw - 16px));
    max-height: min(44rem, calc(100dvh - 16px));
    padding: 0;
    color: var(--cc-text);
    background: var(--cc-bg);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
}

.cc-prefs[open] {
    display: flex;
}

.cc-prefs__inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: inherit;
    margin: 0;
}

.cc-prefs__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cc-border);
}

.cc-prefs__head .cc-title {
    margin: 0;
}

.cc-close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--cc-text);
    background: transparent;
    border: 0;
    border-radius: var(--cc-button-radius);
    cursor: pointer;
}

.cc-prefs__body {
    flex: 1;
    padding: 16px 20px;
    overflow: auto;
}

.cc-prefs__actions {
    margin: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--cc-border);
}

.cc-categories {
    display: grid;
    gap: 10px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.cc-category {
    padding: 12px 14px;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-button-radius);
}

.cc-category__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cc-category__label {
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
}

.cc-always {
    font-size: 0.8125rem;
    color: var(--cc-muted);
}

.cc-category__desc {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: var(--cc-muted);
}

.cc-switch {
    appearance: none;
    position: relative;
    flex: none;
    width: 44px;
    height: 24px;
    margin: 0;
    background: var(--cc-border);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.cc-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
    transition: transform 0.15s;
}

.cc-switch:checked {
    background: var(--cc-accent);
}

.cc-switch:checked::after {
    transform: translateX(20px);
    background: var(--cc-accent-text);
}

@media (forced-colors: active) {
    .cc-switch {
        border: 1px solid CanvasText;
    }

    .cc-switch:checked::after {
        background: Highlight;
    }
}

.cc-services {
    margin-top: 8px;
    font-size: 0.8125rem;
}

.cc-services summary {
    cursor: pointer;
    color: var(--cc-muted);
}

.cc-services ul {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.cc-service {
    padding: 8px 0;
    border-top: 1px solid var(--cc-border);
}

.cc-service p {
    margin: 0;
}

.cc-service__name {
    font-weight: 600;
}

.cc-service__provider {
    font-weight: 400;
    color: var(--cc-muted);
}

.cc-service__purpose {
    color: var(--cc-muted);
}

.cc-service__cookies {
    margin: 4px 0 !important;
    color: var(--cc-muted);
}

.cc-service code,
.cc-id code {
    font-size: 0.75rem;
    word-break: break-all;
}

.cc-id {
    margin: 14px 0 0;
    font-size: 0.75rem;
    color: var(--cc-muted);
}

.cc-id[hidden] {
    display: none;
}

/* ---------- footer link ---------- */

.cc-settings-link {
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

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

.cc-embed {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
}

.cc-embed--map {
    aspect-ratio: 4 / 3;
}

.cc-embed--loaded {
    display: block;
    background: transparent;
    border: 0;
}

.cc-embed__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.cc-embed__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.25;
}

.cc-embed__body {
    position: relative;
    max-width: 30rem;
    padding: 20px;
    text-align: center;
}

.cc-embed__title {
    margin: 0 0 4px;
    font-weight: 600;
}

.cc-embed__text {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--cc-muted);
}

/* The buttons need the script; without it only the "Open on …" link shows. */
.cc-embed__actions {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.cc-js .cc-embed__actions {
    display: flex;
}

.cc-embed__link {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
    .cc-switch,
    .cc-switch::after {
        transition: none;
    }
}

@media print {
    .cc {
        display: none !important;
    }
}
