.video-carousel {
    --video-carousel-constrained-width: min(100%, var(--video-carousel-max-width, 100%));
    display: grid;
    gap: 1rem;
    justify-items: center;
}

.video-carousel-player {
    position: relative;
    width: var(--video-carousel-constrained-width);
    aspect-ratio: var(--video-carousel-aspect-ratio, 16 / 9);
    border-radius: 1.35rem;
    overflow: hidden;
    box-shadow: 0 30px 54px rgba(15, 23, 42, 0.16);
    background: #000;
}

.video-carousel-player--single {
    box-shadow: 0 30px 54px rgba(15, 23, 42, 0.16);
}

.video-carousel-frame {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    border: 0;
}

.video-carousel-topfade {
    position: absolute;
    inset: 0 0 auto 0;
    height: 8.5rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.18) 68%, transparent 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 1;
}

.video-carousel-heading {
    position: absolute;
    top: 1.4rem;
    left: 1.5rem;
    right: 1.5rem;
    text-align: center;
    color: #fff;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.video-carousel-title {
    color: #fff;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

.video-carousel-subtitle {
    color: rgba(255, 255, 255, 0.86);
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

.video-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    z-index: 2;
    opacity: 0;
    transition: opacity 220ms ease, background 180ms ease;
    cursor: pointer;
}

.video-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.58);
}

.video-carousel-arrow--left {
    left: 1rem;
}

.video-carousel-arrow--right {
    right: 1rem;
}

.video-carousel-player.is-overlay-visible .video-carousel-topfade,
.video-carousel-player.is-overlay-visible .video-carousel-heading,
.video-carousel-player.is-overlay-visible .video-carousel-arrow {
    opacity: 1;
}

.video-carousel-meta {
    display: flex;
    justify-content: flex-end;
    width: var(--video-carousel-constrained-width);
    padding: 0 0.25rem;
}

.video-carousel-autoplay {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
}

.video-carousel-autoplay input {
    width: 1rem;
    height: 1rem;
    accent-color: #5b50e6;
}

.video-carousel-thumbnails {
    display: grid;
    width: var(--video-carousel-constrained-width);
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.95rem;
}

.video-carousel-thumb {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    border-radius: 0.8rem;
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.45);
    opacity: 0.82;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.video-carousel-thumb:hover {
    transform: translateY(-1px);
    opacity: 1;
}

.video-carousel-thumb--active {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 4px #4f46e5, 0 0 0 4px rgba(99, 102, 241, 0.32), 0 14px 28px rgba(79, 70, 229, 0.3);
}

.video-carousel-thumb-image {
    width: 100%;
    display: block;
    aspect-ratio: 1.52 / 1;
    object-fit: cover;
    pointer-events: none;
}

.video-carousel-thumb-fallback {
    display: block;
    width: 100%;
    aspect-ratio: 1.52 / 1;
    background:
        linear-gradient(180deg, rgba(79, 70, 229, 0.18) 0%, rgba(30, 41, 59, 0.55) 100%),
        linear-gradient(135deg, #c7d2fe 0%, #e2e8f0 50%, #cbd5e1 100%);
    pointer-events: none;
}

.video-carousel-thumb-overlay {
    position: absolute;
    inset: auto 0 0 0;
    height: 60%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.84) 100%);
    pointer-events: none;
}

.video-carousel-thumb-title {
    position: absolute;
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.5rem;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

@media (max-width: 960px) {
    .video-carousel-thumbnails {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .video-carousel-player {
        border-radius: 1rem;
    }

    .video-carousel-heading {
        top: 1rem;
        left: 1rem;
        right: 1rem;
    }

    .video-carousel-title {
        font-size: 1.1rem;
    }

    .video-carousel-subtitle {
        font-size: 0.82rem;
    }

    .video-carousel-arrow {
        width: 3rem;
        height: 3rem;
    }

    .video-carousel-thumbnails {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
}
