/* Cookie consent card (views/partials/_cookieConsent.handlebars, public/js/ost/cookie-consent.js).
   One card in the bottom-right corner. data-view="banner" asks for a choice; data-view="settings" shows the
   categories. The card stays anchored to the bottom, so it grows upward when it expands. */
.vm-cc-card,
.vm-cc-open-settings {
    --cc-bg: #ffffff;
    --cc-text: #1a1a1a;
    --cc-muted: #6b6560;
    --cc-border: #e4e1dc;
    --cc-soft: #f6f5f3;
    --cc-primary: #000000;
    --cc-on-primary: #ffffff;
    --cc-track: #b7b1aa;
    --cc-speed: 0.28s;
    --cc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
body.dark .vm-cc-card,
body.dark .vm-cc-open-settings {
    --cc-bg: var(--dark800, #121212);
    --cc-text: var(--dark-text-primary, #f1f1f1);
    --cc-muted: var(--darktext, #bfbfbf);
    --cc-border: var(--dark-border, #3c3e3e);
    --cc-soft: var(--dark700, #1b1b1b);
    --cc-primary: #ffffff;
    --cc-on-primary: #000000;
    --cc-track: #5c5a58;
}

.vm-cc-card {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    width: 400px;
    max-width: calc(100vw - 32px);
    background: var(--cc-bg) !important;
    color: var(--cc-text);
    border: 1px solid var(--cc-border);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    font-family: var(--font-sans, "Inter", "Helvetica Neue", Arial, sans-serif);
    overflow: hidden;
    outline: none;
    box-sizing: border-box;
    /* Shown and hidden with a short fade and lift */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--cc-speed) var(--cc-ease), transform var(--cc-speed) var(--cc-ease), height var(--cc-speed) var(--cc-ease);
}
.vm-cc-card.is-open { opacity: 1; transform: none; }
.vm-cc-card[hidden],
.vm-cc-details[hidden],
.vm-cc-card [role="tabpanel"][hidden] { display: none !important; }
.vm-cc-card * { box-sizing: border-box; }

/* Views: only the active one takes space; it fades in after a switch */
.vm-cc-card__content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.vm-cc-view { display: none; min-height: 0; }
.vm-cc-card[data-view="banner"] .vm-cc-view--banner,
.vm-cc-card[data-view="settings"] .vm-cc-view--settings { display: flex; flex-direction: column; animation: vm-cc-fade var(--cc-speed) var(--cc-ease); }
@keyframes vm-cc-fade { from { opacity: 0; } to { opacity: 1; } }

.vm-cc-view--banner { padding: 18px 20px 0; }
.vm-cc-banner__title { margin: 0 0 6px; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--cc-text) !important; }
.vm-cc-banner__text { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--cc-muted) !important; }

.vm-cc-view--settings { flex: 1 1 auto; }
.vm-cc-tabs { display: flex; align-items: center; gap: 18px; padding: 16px 20px 4px; flex: 0 0 auto; }
.vm-cc-scroll { flex: 1 1 auto; min-height: 0; max-height: 330px; overflow-y: auto; padding: 4px 20px 10px; }
.vm-cc-scroll p { font-size: 13px; line-height: 1.55; color: var(--cc-muted) !important; }
.vm-cc-scroll a,
.vm-cc-banner__text a { color: var(--cc-text) !important; text-decoration: underline; }

/* Bottom row: the same three buttons in both views */
.vm-cc-actions { display: flex; align-items: center; gap: 8px; padding: 0 20px 16px; flex: 0 0 auto; }
.vm-cc-card[data-view="settings"] .vm-cc-actions { padding-top: 12px; border-top: 1px solid var(--cc-border); }
.vm-cc-actions .vm-cc-btn--primary { margin-left: auto; }
.vm-cc-label--settings,
.vm-cc-card[data-view="settings"] .vm-cc-label--banner { display: none; }
.vm-cc-card[data-view="settings"] .vm-cc-label--settings { display: inline; }
.vm-cc-icon--close,
.vm-cc-card[data-view="settings"] .vm-cc-icon--customise { display: none; }
.vm-cc-card[data-view="settings"] .vm-cc-icon--close { display: block; }

/* Buttons. Colours use !important so the site's button styles (and styles-dark.css) cannot override them. */
.vm-cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    background: var(--cc-bg) !important;
    border: 1px solid var(--cc-border) !important;
    color: var(--cc-text) !important;
    box-shadow: none !important;
    transition: background-color 0.15s;
}
.vm-cc-btn:hover { background: var(--cc-soft) !important; }
.vm-cc-btn--primary,
.vm-cc-btn--primary:hover,
a.vm-cc-btn.vm-cc-open-settings,
a.vm-cc-btn.vm-cc-open-settings:hover,
a.vm-cc-btn.vm-cc-open-settings:focus {
    background: var(--cc-primary) !important;
    border-color: var(--cc-primary) !important;
    color: var(--cc-on-primary) !important;
    text-decoration: none;
}
.vm-cc-btn--primary:hover { opacity: 0.88; }
.vm-cc-btn--icon { width: 34px; padding: 0; }
a.vm-cc-open-settings { margin: 4px 0 8px; }

.vm-cc-tab,
.vm-cc-link {
    padding: 0;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    font: inherit;
    cursor: pointer;
}
.vm-cc-tab { font-size: 15px; font-weight: 600; color: var(--cc-muted) !important; }
.vm-cc-tab.is-active,
.vm-cc-link { color: var(--cc-text) !important; }
.vm-cc-link { text-decoration: underline; }

/* Focus: a ring for keyboard users only */
.vm-cc-card button:focus:not(:focus-visible),
.vm-cc-card a:focus:not(:focus-visible) { outline: none !important; box-shadow: none !important; }
.vm-cc-btn:focus-visible,
.vm-cc-tab:focus-visible,
.vm-cc-link:focus-visible,
.vm-cc-switch input:focus-visible + .vm-cc-switch__track { outline: 2px solid #2f6fed; outline-offset: 2px; }

/* Categories */
.vm-cc-category { padding: 10px 0; }
.vm-cc-category + .vm-cc-category { border-top: 1px solid var(--cc-border); }
.vm-cc-category__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vm-cc-category__title { margin: 0; font-size: 14px; font-weight: 600; color: var(--cc-text) !important; }
.vm-cc-category__text { margin: 4px 0 0; }

/* Toggle. The site's checkbox styles are switched off on the hidden input. */
.vm-cc-switch { position: relative; display: inline-block; flex: 0 0 auto; width: 36px; height: 20px; margin: 0; padding: 0; border: 0; background: none !important; box-shadow: none !important; cursor: pointer; }
.vm-cc-switch input,
.vm-cc-switch input:checked,
.vm-cc-switch input:disabled {
    position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0;
    opacity: 0 !important; background: none !important; border: 0 !important;
    -webkit-appearance: none; appearance: none; outline: none !important; box-shadow: none !important; cursor: pointer;
}
.vm-cc-switch input::before,
.vm-cc-switch input::after { content: none !important; display: none !important; }
.vm-cc-switch__track { position: absolute; inset: 0; border-radius: 999px; background: var(--cc-track); transition: background 0.15s; }
.vm-cc-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.vm-cc-switch input:checked + .vm-cc-switch__track { background: var(--cc-primary); }
.vm-cc-switch input:checked + .vm-cc-switch__track::after { transform: translateX(16px); }
body.dark .vm-cc-switch input:checked + .vm-cc-switch__track::after { background: #000; }
.vm-cc-switch.is-locked,
.vm-cc-switch.is-locked input { cursor: not-allowed; }
.vm-cc-switch.is-locked input:checked + .vm-cc-switch__track { background: var(--cc-track); }
body.dark .vm-cc-switch.is-locked input:checked + .vm-cc-switch__track::after { background: #fff; }

/* Cookie details */
.vm-cc-details { margin-top: 8px; border: 1px solid var(--cc-border); border-radius: 12px; }
.vm-cc-cookie { padding: 10px 12px; }
.vm-cc-cookie + .vm-cc-cookie { border-top: 1px solid var(--cc-border); }
.vm-cc-cookie dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0 0 6px; }
.vm-cc-cookie dt { font-size: 12px; font-weight: 500; color: var(--cc-text) !important; }
.vm-cc-cookie dd { margin: 1px 0 0; font-size: 12px; color: var(--cc-muted) !important; word-break: break-word; }
.vm-cc-cookie p { margin: 0; font-size: 12px !important; }

@media (max-width: 575px) {
    .vm-cc-card { right: 12px; bottom: 12px; left: 12px; width: auto; max-width: none; }
    .vm-cc-scroll { max-height: 55vh; }
    .vm-cc-cookie dl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .vm-cc-card { transition: none; }
    .vm-cc-view { animation: none !important; }
}
