@property --tilted-banner-white-mix {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

/* ---------- Tilted banner gallery ---------- */

.tilted-banner-gallery {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
}

.tilted-banner-gallery-viewport {
    position: relative;
    width: 100%;
    overflow: visible;
}

.tilted-banner-gallery-scale {
    position: relative;
    width: max-content;

    transform:
        translate(
            var(--tilted-banner-fit-x, 0),
            var(--tilted-banner-fit-y, 0)
        )
        scale(var(--tilted-banner-fit-scale, 1));

    transform-origin: top left;
}

.tilted-banner-gallery-row {
    position: relative;

    width: var(--tilted-banner-row-width, 1160px);
    height: var(--tilted-banner-row-height, 480px);
}

.tilted-banner-card {
    position: absolute;
    top: 0;
    left: var(--tilted-banner-slot-x, 0px);

    width: var(--tilted-banner-card-width, 320px);
    margin: 0;

    text-align: center;
    transform-origin: center center;
}

.tilted-banner-card-surface {
    position: relative;

    width: 100%;
    aspect-ratio: var(--tilted-banner-card-aspect, 320 / 480);

    box-sizing: border-box;
    overflow: hidden;

    border: 0;
    border-radius: 12px;

    background: #e8f0f8;

    box-shadow:
        0 0 0 5px #b0c0d0,
        0 4px 10px rgb(0 0 0 / 22%);
}

.tilted-banner-gallery[data-hover-scale="true"]
.tilted-banner-card-surface {
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .tilted-banner-gallery[data-hover-scale="true"]:not(.is-transitioning)
    .tilted-banner-card.is-clickable:hover
    .tilted-banner-card-surface {
        transform: scale(1.05);
    }
}

.tilted-banner-card-surface::after {
    content: "";

    position: absolute;
    inset: 0;
    z-index: 1;

    background: rgb(
        255 255 255 /
        var(--tilted-banner-white-mix, 0)
    );

    pointer-events: none;
}

.tilted-banner-card-surface img {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
    object-fit: cover;
}

.tilted-banner-live-frame {
    position: absolute;
    inset: 0;
    z-index: 0;

    display: block;
    width: 100%;
    height: 100%;

    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.25s ease;
}

.tilted-banner-card-surface.is-live-ready
.tilted-banner-live-frame {
    opacity: 1;
    pointer-events: auto;
}

.tilted-banner-card-surface.is-live-ready > img {
    visibility: hidden;
}

.tilted-banner-frame-prompt {
    position: absolute;
    inset: 0;
    z-index: 2;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;

    padding: 28px;
    box-sizing: border-box;

    background: rgb(16 25 34 / 72%);
    color: var(--color-text-inverse);
    text-align: center;

    animation: tilted-banner-frame-prompt-in 0.5s ease both;
}

.tilted-banner-frame-prompt p {
    margin: 0;
    color: inherit;
    font-size: 13px;
    line-height: 1.45;
}

.tilted-banner-frame-load {
    padding: 10px 18px;
    border: 0;
    border-radius: 999px;

    background: var(--color-accent);
    color: var(--color-text-inverse);
    cursor: pointer;

    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tilted-banner-frame-load:hover {
    background: var(--color-accent-hover);
}

.tilted-banner-frame-load:focus-visible,
.tilted-banner-frame-policy:focus-visible {
    outline: 3px solid var(--color-viewer-focus);
    outline-offset: 3px;
}

.tilted-banner-frame-policy {
    color: var(--color-text-inverse);
    font-size: 12px;
}

@keyframes tilted-banner-frame-prompt-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.tilted-banner-card-text {
    margin-top: 20px;
}

.tilted-banner-card-text span,
.tilted-banner-card-text strong {
    display: block;
}

.tilted-banner-card-text span {
    font-size: 15px;
    font-weight: 500;
    color: #777;
}

.tilted-banner-card-text strong {
    margin-top: 2px;

    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.3;
    color: #555;

    white-space: pre-line;
}

.tilted-banner-card.is-caption-empty .tilted-banner-card-text {
    display: none;
}

.tilted-banner-card.is-inactive {
    visibility: hidden;
    pointer-events: none;
}


/* ---------- Controls and interaction ---------- */

.tilted-banner-gallery-controls {
    position: absolute;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
}

.tilted-banner-gallery-button {
    position: absolute;
    top: calc(
        50% +
        var(--tilted-banner-button-offset-y, 0px)
    );

    width: 36px;
    height: 36px;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 0;
    border-radius: 50%;

    background: var(--color-nav-button);
    cursor: pointer;

    transform: translateY(-50%);
    transition:
        opacity 0.15s ease,
        background-color 0.15s ease;

    pointer-events: auto;
}

.tilted-banner-gallery-button:hover {
    background: var(--color-nav-button-hover);
}

.tilted-banner-gallery-button:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.tilted-banner-gallery-prev {
    left: -8px;
}

.tilted-banner-gallery-next {
    right: -8px;
}

.tilted-banner-gallery-button img {
    display: block;
    width: auto;
    height: 14px;
}

.tilted-banner-gallery-prev img {
    transform: translateX(-1px);
}

.tilted-banner-gallery-next img {
    transform: translateX(1px);
}

.tilted-banner-card.is-clickable {
    cursor: pointer;
}

.tilted-banner-gallery-transition-card {
    position: absolute !important;
    margin: 0 !important;
    pointer-events: none !important;
}

.tilted-banner-gallery.is-transitioning .tilted-banner-card {
    will-change: left, top, transform, opacity;
}


/* ---------- Autoplay progress ---------- */

.tilted-banner-gallery-progress {
    position: absolute;
    left: 50%;
    bottom: 0;

    width: min(320px, 58%);
    height: 4px;

    overflow: hidden;
    border-radius: 999px;
    background: rgb(176 192 208 / 35%);

    transform: translateX(-50%);
    z-index: 1001;
}

.tilted-banner-gallery-progress-fill {
    width: 0%;
    height: 100%;

    border-radius: inherit;
    background: #9eb4cc;

    transform-origin: left center;
}

.tilted-banner-gallery:not(.has-autoplay)
.tilted-banner-gallery-progress {
    display: none;
}


/* ---------- Scroll-triggered intro animation ---------- */

.tilted-banner-gallery.has-intro-animation
.tilted-banner-gallery-viewport:not(.is-ready)
.tilted-banner-card:not(.is-inactive) {
    visibility: hidden;
}

.tilted-banner-gallery.has-intro-animation
.tilted-banner-gallery-viewport.is-ready
.tilted-banner-card:not(.is-inactive) {
    visibility: visible;

    animation:
        tilted-banner-card-enter
        1200ms
        cubic-bezier(0.3, 1.0, 0.5, 1)
        both;
}



@keyframes tilted-banner-card-enter {
    0% {
        opacity: 0;

        transform:
            translateY(50px)
            rotate(0deg)
            scale(0.8);
    }

    100% {
        opacity: 1;

        transform:
            translateY(0)
            rotate(
                var(
                    --tilted-banner-final-rotation,
                    0deg
                )
            )
            scale(
                var(
                    --tilted-banner-final-scale,
                    1
                )
            );
    }
}

@media (prefers-reduced-motion: reduce) {
    .tilted-banner-frame-prompt {
        animation: none;
    }

    .tilted-banner-gallery[data-hover-scale="true"]
    .tilted-banner-card-surface {
        transition: none;
    }

    .tilted-banner-gallery.has-intro-animation
    .tilted-banner-gallery-viewport.is-ready
    .tilted-banner-card:not(.is-inactive) {
        animation-duration: 1ms;
    }
}
