/*
 * Consent dialog (assets/js/tracking.js). Loaded on every page of the
 * website, so everything is scoped to .vega-consent and brings its own
 * values instead of the configurator's or the theme's variables.
 *
 * Desktop: centred dialog over a dimmed page. Phones (<= 600 px): sheet
 * at the bottom. "Reject all" and "Accept all" share one style on purpose:
 * refusing has to be exactly as easy and as visible as agreeing.
 */
.vega-consent {
    --vc-red: #8a2321;
    --vc-red-dark: #6f1b19;
    --vc-green: #2f7a4f;
    --vc-warm: #f7eeee;
    --vc-line: #ecdcda;
    --vc-text: #3a3330;
    --vc-muted: #6b5a57;

    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 24px;
    font-family: verdana, arial, helvetica, sans-serif;
    text-align: left;
}

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

html.vega-consent-visible {
    overflow: hidden;
}

/* Set by tracking.js when the page had a scrollbar: keeps its space, so
   locking the scroll does not shift the layout sideways. */
html.vega-consent-visible.vega-consent-gutter {
    scrollbar-gutter: stable;
}

/*
 * Behind the dialog: dark tint (0.72; 0.6 was too light). The blur is only
 * added by tracking.js (.vega-consent--blur) where it stays smooth - see
 * blurAllowed() (hardware-accelerated graphics only); with it the tint is a little lighter,
 * since the blur already pushes the page back. Fading in only animates
 * opacity.
 */
.vega-consent__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 14, 13, 0.72);
}

.vega-consent--blur .vega-consent__backdrop {
    background: rgba(45, 14, 13, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

/* While the dialog is open, animations on the page stand still - nobody
   sees them behind the dialog, and the blur would otherwise have to be
   recomputed on every frame (e.g. the dashed frames in the configurator). */
html.vega-consent-visible body *:not(.vega-consent, .vega-consent *),
html.vega-consent-visible body *:not(.vega-consent, .vega-consent *)::before,
html.vega-consent-visible body *:not(.vega-consent, .vega-consent *)::after {
    animation-play-state: paused !important;
}

/*
 * Panel = two parts: a scrolling area (header + content) and the button box
 * below it, which never moves. overscroll-behavior: none stops phones from
 * rubber-banding the content past its edges.
 */
.vega-consent__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(520px, 100%);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    padding: 0;
    border-radius: 22px;
    background: #fff;
    box-shadow:
        0 28px 70px rgba(45, 14, 13, 0.38),
        0 2px 8px rgba(45, 14, 13, 0.12);
    color: var(--vc-text);
    font-size: 15px;
    line-height: 1.6;
    outline: none;
}

.vega-consent__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: none;
    padding: 0 30px 18px;
}

/*
 * Scrollbar: slim, rounded, in a soft red, no visible track. On desktop the
 * header stands above the scrolling area, so the bar starts below it and
 * never runs into the panel's rounded corner.
 * Chrome/Edge/Safari use the ::-webkit-scrollbar rules (they ignore them as
 * soon as scrollbar-color is set, hence that only for Firefox, which gets
 * its own thin, tinted version).
 */
.vega-consent__scroll::-webkit-scrollbar {
    width: 12px;
}

.vega-consent__scroll::-webkit-scrollbar-track {
    margin: 6px 0;
    background: transparent;
}

.vega-consent__scroll::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-radius: 999px;
    background: rgba(138, 35, 33, 0.28) padding-box;
}

.vega-consent__scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(138, 35, 33, 0.5);
}

@supports (-moz-appearance: none) {
    .vega-consent__scroll {
        scrollbar-width: thin;
        scrollbar-color: rgba(138, 35, 33, 0.35) transparent;
    }
}

/*
 * Fog: soft white at the edges of the scrolling content while there is
 * more in that direction - below (is-scrolled-up), and at the top once
 * scrolled down (is-scrolled-down); set by tracking.js.
 */
.vega-consent__panel::before {
    content: "";
    position: absolute;
    top: 0;
    right: 12px;
    left: 0;
    z-index: 2;
    height: 40px;
    background: linear-gradient(to bottom, #fff 15%, rgba(255, 255, 255, 0));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.vega-consent__panel.is-scrolled-down::before {
    opacity: 1;
}

/* Desktop: header fixed above the scrolling area (placed there by
   tracking.js) - the top fog then hangs directly below it. */
.vega-consent__panel.has-fixed-header .vega-consent__header {
    flex: none;
    z-index: 2;
    margin: 0;
}

.vega-consent__panel.has-fixed-header::before {
    display: none;
}

.vega-consent__panel.has-fixed-header .vega-consent__header::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 12px;
    left: 0;
    height: 40px;
    background: linear-gradient(to bottom, #fff 15%, rgba(255, 255, 255, 0));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.vega-consent__panel.has-fixed-header.is-scrolled-down .vega-consent__header::after {
    opacity: 1;
}

/*
 * Header band: the winter scene runs edge to edge across the top (negative
 * margins cancel the scroll area's padding) at the image's own aspect ratio, so it
 * scales with the dialog. (Do not combine it with max-height: the browser
 * would then shrink the band's width instead of cropping the image.) The
 * white fade only starts inside the snow (snow line at about 78 % of the
 * height) - starting higher veils the red sky in a milky haze. The gradient fades the image's snow
 * (not quite pure white) into the panel, so there is no visible seam.
 */
.vega-consent__header {
    /* Scrolls away with the content (the scroll area cannot be rubber-banded,
       so nothing looks odd at the edges). */
    position: relative;
    margin: 0 -30px;
    aspect-ratio: 1240 / 388;
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0) 88%, #fff 100%),
        url("../img/consent-header.webp") center bottom / cover no-repeat,
        var(--vc-red);
}

/* Site name in the sky, like the site's own header (Georgia italic). */
.vega-consent .vega-consent__brand {
    position: absolute;
    top: 38%;
    right: 15%;
    left: 15%;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    color: #fff;
    font-family: georgia, "times new roman", serif;
    font-size: 25px;
    font-style: italic;
    font-weight: normal;
    line-height: 1.2;
    text-align: center;
    text-shadow: 0 1px 8px rgba(45, 14, 13, 0.55);
    text-wrap-style: balance;
}

/*
 * Santa's head (the customer's drawing, assets/img/consent-santa.svg) stands
 * freely on the snow at the bottom left of the header - no circle around
 * it, so it can be large enough to be noticed; a soft shadow lifts the
 * white beard off the snow. Measured: never touches the site name, also
 * not when that wraps on narrow phones.
 */
.vega-consent__icon {
    position: absolute;
    bottom: -12px;
    left: 30px;
    z-index: 1;
    width: 104px;
    height: 100px;
    margin: 0;
    pointer-events: none;
}

.vega-consent__icon-img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 3px 6px rgba(45, 14, 13, 0.35));
}

.vega-consent .vega-consent__title {
    margin: 24px 0 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--vc-red);
    font-family: georgia, "times new roman", serif;
    font-size: 23px;
    font-weight: normal;
    font-style: normal;
    line-height: 1.3;
    text-align: left;
    text-wrap-style: pretty;
}

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

.vega-consent .vega-consent__text {
    margin: 0 0 8px;
    padding: 0;
    color: var(--vc-text);
    font-size: 15px;
    line-height: 1.6;
    text-wrap-style: pretty;
}

/* Settings layer */

.vega-consent__details {
    display: grid;
    gap: 10px;
    margin: 4px 0 6px;
}

.vega-consent__details[hidden] {
    display: none;
}

.vega-consent__category {
    padding: 14px 16px;
    border: 1px solid var(--vc-line);
    border-radius: 14px;
    background: #fdf9f8;
}

.vega-consent__category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.vega-consent__category-title {
    color: var(--vc-text);
    font-size: 15px;
    font-weight: bold;
    line-height: 1.35;
}

.vega-consent__category-sub {
    display: block;
    color: var(--vc-muted);
    font-size: 13.5px;
    font-weight: normal;
}

label.vega-consent__category-title {
    cursor: pointer;
}

.vega-consent .vega-consent__category-text {
    margin: 6px 0 0;
    padding: 0;
    color: var(--vc-muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.vega-consent__badge {
    flex: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e5f1ea;
    color: var(--vc-green);
    font-size: 12.5px;
    font-weight: bold;
    white-space: nowrap;
}

/* "Learn more": the full details of a category, collapsed. */
.vega-consent__more {
    margin-top: 6px;
}

.vega-consent__more summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    color: var(--vc-red);
    font-size: 13.5px;
    cursor: pointer;
    list-style: none;
}

.vega-consent__more summary::-webkit-details-marker {
    display: none;
}

.vega-consent__more summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.vega-consent__more[open] summary::before {
    transform: rotate(45deg);
}

.vega-consent__more summary:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.vega-consent__more summary:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--vc-green);
    outline-offset: 2px;
}

/* Cookie list under "Learn more": name, storage time, purpose. */
.vega-consent__cookies {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--vc-line);
}

.vega-consent .vega-consent__cookies-heading {
    margin: 0 0 4px;
    padding: 0;
    color: var(--vc-text);
    font-size: 13px;
    font-weight: bold;
}

.vega-consent .vega-consent__cookie-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vega-consent .vega-consent__cookie {
    margin: 0;
    padding: 6px 0;
    color: var(--vc-muted);
    font-size: 13px;
    line-height: 1.5;
    list-style: none;
}

.vega-consent .vega-consent__cookie + .vega-consent__cookie {
    border-top: 1px solid #f3e9e7;
}

.vega-consent__cookie-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.vega-consent .vega-consent__cookie-name {
    padding: 1px 6px;
    border-radius: 5px;
    background: #f5ecea;
    color: var(--vc-text);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 12.5px;
}

.vega-consent__cookie-duration {
    flex: none;
    color: var(--vc-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.vega-consent__cookie-purpose {
    display: block;
    margin-top: 2px;
}

/* Switch: a real checkbox (role="switch") over a drawn track. */
.vega-consent__switch {
    position: relative;
    flex: none;
    width: 48px;
    height: 28px;
}

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

.vega-consent__switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbbdbb;
    transition: background-color 0.18s ease;
}

.vega-consent__switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.vega-consent__switch input:checked + .vega-consent__switch-track {
    background: var(--vc-green);
}

.vega-consent__switch input:checked + .vega-consent__switch-track::after {
    transform: translateX(20px);
}

.vega-consent__switch input:focus-visible + .vega-consent__switch-track {
    outline: 3px solid var(--vc-green);
    outline-offset: 2px;
}

/* Buttons */

.vega-consent__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.vega-consent .vega-consent__btn {
    box-sizing: border-box;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--vc-red);
    box-shadow: none;
    color: #fff;
    font-family: verdana, arial, helvetica, sans-serif;
    font-size: 15px;
    font-weight: normal;
    line-height: 1.25;
    text-transform: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.vega-consent .vega-consent__btn:hover {
    background: var(--vc-red-dark);
}

.vega-consent .vega-consent__btn:active {
    transform: scale(0.98);
}

.vega-consent .vega-consent__btn:focus-visible {
    outline: 3px solid var(--vc-green);
    outline-offset: 2px;
}

.vega-consent__btn--wide {
    grid-column: 1 / -1;
}

.vega-consent__btn[hidden] {
    display: none;
}

/* Secondary links: settings / back, imprint, privacy policy */

.vega-consent__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 22px;
    margin-top: 14px;
}

.vega-consent .vega-consent__link,
.vega-consent .vega-consent__link:visited {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 32px;
    margin: 0;
    padding: 6px 2px;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--vc-muted);
    font-family: verdana, arial, helvetica, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    text-decoration: underline;
    text-decoration-color: rgba(107, 90, 87, 0.45);
    text-underline-offset: 3px;
    cursor: pointer;
}

.vega-consent .vega-consent__link:hover {
    color: var(--vc-red);
    text-decoration-color: currentColor;
}

.vega-consent .vega-consent__link:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--vc-green);
    outline-offset: 2px;
}

.vega-consent__link[hidden] {
    display: none;
}

/*
 * Footer: just the low blue snow wave of the website's footer (bottom strip
 * of theme images/bottomback), edge to edge along the bottom of the panel.
 * The full cloud band was tried and was too tall.
 */
/*
 * Button box: its own part of the panel below the scrolling area - buttons,
 * links and the wave never move. The shadow only appears while more content
 * lies above it, still to be scrolled to.
 */
.vega-consent__bottom {
    position: relative;
    z-index: 1;
    flex: none;
    padding: 14px 30px 0;
    border-top: 1px solid var(--vc-line);
    background: #fff;
}

.vega-consent__bottom::before {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 100%;
    left: 0;
    height: 56px;
    margin-bottom: 1px;
    background: linear-gradient(to top, #fff 10%, rgba(255, 255, 255, 0));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.vega-consent__panel.is-scrolled-up .vega-consent__bottom::before {
    opacity: 1;
}

.vega-consent__footer {
    margin: 8px -30px 0;
    aspect-ratio: 1040 / 41;
    background: url("../img/consent-footer.webp") center bottom / 100% 100% no-repeat;
}

/* Entrance */

@media (prefers-reduced-motion: no-preference) {
    .vega-consent:not([hidden]) .vega-consent__backdrop {
        animation: vega-consent-fade 0.2s ease-out;
    }

    .vega-consent:not([hidden]) .vega-consent__panel {
        animation: vega-consent-rise 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
    }
}

@keyframes vega-consent-fade {
    from {
        opacity: 0;
    }
}

@keyframes vega-consent-rise {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
}

/* Phones: sheet at the bottom */

@media (max-width: 600px) {
    .vega-consent {
        place-items: end stretch;
        padding: 0;
    }

    .vega-consent__panel {
        width: 100%;
        max-height: calc(100dvh - 32px);
        border-radius: 22px 22px 0 0;
    }

    .vega-consent__scroll {
        padding: 0 20px 14px;
    }

    .vega-consent__header {
        margin: 0 -20px;
    }

    .vega-consent__bottom {
        padding: 12px 20px 0;
    }

    /* Phones have overlay scrollbars: the fog can reach the edge. */
    .vega-consent__panel::before,
    .vega-consent__bottom::before {
        right: 0;
    }

    /* The wave plus, on phones with a home bar, its blue below it. */
    .vega-consent__footer {
        margin: 6px -20px 0;
        padding-bottom: env(safe-area-inset-bottom);
        background:
            url("../img/consent-footer.webp") center top / 100% auto no-repeat,
            linear-gradient(to bottom, transparent calc(100% - env(safe-area-inset-bottom)), #d8f0f9 0);
    }

    .vega-consent .vega-consent__brand {
        top: 38%;
        right: 13%;
        left: 13%;
        font-size: 19px;
    }

    /* Phones: half over the lower edge of the header. */
    .vega-consent__icon {
        bottom: -36px;
        left: 20px;
        width: 84px;
        height: 80px;
    }

    .vega-consent .vega-consent__title {
        margin-top: 46px;
    }

    .vega-consent .vega-consent__title {
        font-size: 20px;
    }

    .vega-consent__actions {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) and (prefers-reduced-motion: no-preference) {
    .vega-consent:not([hidden]) .vega-consent__panel {
        animation-name: vega-consent-sheet;
    }
}

@keyframes vega-consent-sheet {
    from {
        opacity: 0.6;
        transform: translateY(40px);
    }
}

/*
 * Footer menu: "Cookie settings" (added by Tracking::addFooterLink()) made
 * the theme's single row overflow, leaving it alone on a second line. With
 * the width capped, the items wrap into two balanced rows (6 + 5) instead.
 * Phones keep the theme's own footer layout.
 */
@media (min-width: 768px) {
    ul.bottom_menue:has(> .vega-consent-menu-item) {
        max-width: 600px;
        margin-right: auto;
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vega-consent__panel::before,
    .vega-consent__bottom::before,
    .vega-consent__header::after,
    .vega-consent__switch-track,
    .vega-consent__switch-track::after {
        transition: none;
    }
}

/*
 * Cookie table in the privacy policy (PrivacyPolicyText). Five columns need
 * about 820 px (long German words do not wrap); the theme's text column is
 * narrower (559 px on desktop), so whenever the column is too narrow every
 * row becomes a small card with the column names taken from data-label.
 */
.vega-privacy-cookies {
    container: vega-privacy / inline-size;
}

.vega-privacy-cookie-table {
    width: 100%;
    margin: 0 0 1em;
    border-collapse: collapse;
    /* Same size as the theme's paragraphs (p: 0.8em, line-height 1.6). */
    font-size: 0.8em;
    line-height: 1.6;
}

.vega-privacy-cookie-table th,
.vega-privacy-cookie-table td {
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    text-align: left;
    vertical-align: top;
}

.vega-privacy-cookie-table th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: bold;
}

.vega-privacy-cookie-table code {
    white-space: nowrap;
}

@container vega-privacy (max-width: 819px) {
    .vega-privacy-cookie-table,
    .vega-privacy-cookie-table tbody,
    .vega-privacy-cookie-table tr,
    .vega-privacy-cookie-table td {
        display: block;
    }

    .vega-privacy-cookie-table thead {
        display: none;
    }

    .vega-privacy-cookie-table tr {
        margin: 0 0 10px;
        padding: 6px 0;
        border: 1px solid rgba(0, 0, 0, 0.15);
        border-radius: 6px;
    }

    .vega-privacy-cookie-table td {
        padding: 2px 10px;
        border: 0;
    }

    .vega-privacy-cookie-table td::before {
        content: attr(data-label) ": ";
        font-weight: bold;
    }
}

/* Long URLs in these sections wrap instead of widening the page on phones. */
.vega-privacy-ads a,
.vega-privacy-cookies a {
    overflow-wrap: anywhere;
}
