.hero-carousel {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 1rem auto 0;
    padding: 0 1rem;
    box-sizing: border-box;
    --hero-blur-duration: 1.15s;
    --hero-blur-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --hero-glass-bg: rgba(255, 255, 255, 0.14);
    --hero-glass-border: rgba(255, 255, 255, 0.28);
}

.hero-carousel__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: #0f0a1f;
    box-shadow:
        0 12px 40px rgba(45, 23, 110, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    isolation: isolate;
}

.hero-carousel__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-carousel__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
    pointer-events: none;
}

.hero-carousel__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 3;
    pointer-events: auto;
}

.hero-carousel__slide.is-active .hero-carousel__image {
    filter: blur(0);
    transform: scale(1.06);
}

.hero-carousel__slide.is-active .hero-carousel__caption-glass {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* ── Glass blur: enter ── */
.hero-carousel__slide.is-entering {
    visibility: visible;
    z-index: 4;
    pointer-events: none;
    animation: heroGlassFadeIn var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-entering-next .hero-carousel__parallax {
    animation: heroParallaxEnterNext var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-entering-prev .hero-carousel__parallax {
    animation: heroParallaxEnterPrev var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-entering .hero-carousel__image {
    animation: heroImageBlurIn var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-entering .hero-carousel__caption-glass {
    animation: heroGlassCaptionIn var(--hero-blur-duration) var(--hero-blur-ease) 0.2s forwards;
}

/* ── Glass blur: leave ── */
.hero-carousel__slide.is-leaving {
    visibility: visible;
    z-index: 2;
    pointer-events: none;
    animation: heroGlassFadeOut var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-leaving-next .hero-carousel__parallax {
    animation: heroParallaxLeaveNext var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-leaving-prev .hero-carousel__parallax {
    animation: heroParallaxLeavePrev var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-leaving .hero-carousel__image {
    animation: heroImageBlurOut var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel__slide.is-leaving .hero-carousel__caption-glass {
    animation: heroGlassCaptionOut 0.55s var(--hero-blur-ease) forwards;
}

@keyframes heroGlassFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes heroGlassFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes heroImageBlurIn {
    from {
        filter: blur(18px) brightness(1.15);
        transform: scale(1.14);
    }
    to {
        filter: blur(0) brightness(1);
        transform: scale(1.06);
    }
}

@keyframes heroImageBlurOut {
    from {
        filter: blur(0) brightness(1);
        transform: scale(1.06);
    }
    to {
        filter: blur(20px) brightness(0.85);
        transform: scale(1);
    }
}

@keyframes heroParallaxEnterNext {
    from { transform: translateX(6%) scale(1.04); }
    to   { transform: translateX(0) scale(1); }
}

@keyframes heroParallaxEnterPrev {
    from { transform: translateX(-6%) scale(1.04); }
    to   { transform: translateX(0) scale(1); }
}

@keyframes heroParallaxLeaveNext {
    from { transform: translateX(0) scale(1); }
    to   { transform: translateX(-5%) scale(0.98); }
}

@keyframes heroParallaxLeavePrev {
    from { transform: translateX(0) scale(1); }
    to   { transform: translateX(5%) scale(0.98); }
}

@keyframes heroGlassCaptionIn {
    from {
        opacity: 0;
        transform: translateY(24px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes heroGlassCaptionOut {
    from {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateY(16px);
        filter: blur(8px);
    }
}

/* Frosted sweep during transition */
.hero-carousel__glass-sweep {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(
        105deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.18) 45%,
        rgba(255, 255, 255, 0.08) 55%,
        rgba(255, 255, 255, 0) 100%
    );
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
}

.hero-carousel.is-transitioning .hero-carousel__glass-sweep {
    animation: heroGlassSweep var(--hero-blur-duration) var(--hero-blur-ease) forwards;
}

.hero-carousel.is-transitioning.is-direction-next .hero-carousel__glass-sweep {
    animation-name: heroGlassSweepNext;
}

.hero-carousel.is-transitioning.is-direction-prev .hero-carousel__glass-sweep {
    animation-name: heroGlassSweepPrev;
}

@keyframes heroGlassSweepNext {
    0%   { opacity: 0; transform: translateX(-30%); backdrop-filter: blur(0); }
    35%  { opacity: 1; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
    100% { opacity: 0; transform: translateX(30%); backdrop-filter: blur(0); }
}

@keyframes heroGlassSweepPrev {
    0%   { opacity: 0; transform: translateX(30%); backdrop-filter: blur(0); }
    35%  { opacity: 1; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
    100% { opacity: 0; transform: translateX(-30%); backdrop-filter: blur(0); }
}

.hero-carousel__link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.hero-carousel__link--static {
    cursor: default;
}

.hero-carousel__parallax {
    position: absolute;
    inset: -4%;
    will-change: transform;
    transition: transform 0.4s ease-out;
}

.hero-carousel__image-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-carousel__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    will-change: filter, transform;
    transition: filter 0.4s ease, transform 0.4s ease;
}

.hero-carousel__slide.is-active .hero-carousel__image {
    animation: heroIdleDrift 12s ease-in-out infinite alternate;
}

@keyframes heroIdleDrift {
    from { transform: scale(1.06) translate(0, 0); }
    to   { transform: scale(1.1) translate(-1%, -0.5%); }
}

.hero-carousel__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(45, 23, 110, 0.35) 0%, transparent 50%),
        linear-gradient(to top, rgba(8, 4, 20, 0.65) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

.hero-carousel__caption-wrap {
    position: absolute;
    left: 1.75rem;
    right: 1.75rem;
    bottom: 2rem;
    z-index: 2;
    transition: transform 0.45s ease-out;
}

.hero-carousel__caption-glass {
    display: inline-block;
    max-width: min(540px, 90%);
    padding: 1.15rem 1.4rem;
    background: var(--hero-glass-bg);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--hero-glass-border);
    border-radius: 14px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
}

.hero-carousel__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.1rem, 2.6vw, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.hero-carousel__text {
    margin: 0;
    font-size: clamp(0.85rem, 1.7vw, 1rem);
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
}

.hero-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    opacity: 0;
}

.hero-carousel:hover .hero-carousel__arrow,
.hero-carousel:focus-within .hero-carousel__arrow {
    opacity: 1;
}

.hero-carousel__arrow:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-50%) scale(1.07);
}

.hero-carousel__arrow--prev { left: 1.75rem; }
.hero-carousel__arrow--next { right: 1.75rem; }

.hero-carousel__dots {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-carousel__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: width 0.4s var(--hero-blur-ease), background 0.35s ease;
}

.hero-carousel__dot.is-active {
    width: 28px;
    background: #e30613;
}

.hero-carousel__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 6;
    overflow: hidden;
}

.hero-carousel__progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #e30613, rgba(255, 255, 255, 0.85));
}

.hero-carousel.is-playing .hero-carousel__progress-bar {
    animation: heroProgress var(--autoplay-duration, 6s) linear forwards;
}

@keyframes heroProgress {
    from { width: 0%; }
    to   { width: 100%; }
}

@media (max-width: 992px) {
    .hero-carousel__viewport {
        aspect-ratio: 16 / 9;
    }

    .hero-carousel__arrow {
        width: 40px;
        height: 40px;
        opacity: 1;
    }

    .hero-carousel__arrow--prev { left: 0.85rem; }
    .hero-carousel__arrow--next { right: 0.85rem; }

    .hero-carousel__caption-wrap {
        left: 1rem;
        right: 1rem;
        bottom: 1.75rem;
    }
}

@media (max-width: 576px) {
    .hero-carousel {
        padding: 0 0.75rem;
        margin-top: 0.75rem;
    }

    .hero-carousel__viewport {
        aspect-ratio: 4 / 3;
        border-radius: 10px;
    }

    .hero-carousel__caption-wrap {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 1.5rem;
    }

    .hero-carousel__caption-glass {
        max-width: 100%;
        padding: 0.9rem 1rem;
        border-radius: 10px;
    }

    .hero-carousel__arrow {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-carousel__slide.is-entering,
    .hero-carousel__slide.is-leaving,
    .hero-carousel__slide.is-entering .hero-carousel__image,
    .hero-carousel__slide.is-leaving .hero-carousel__image,
    .hero-carousel__slide.is-entering .hero-carousel__parallax,
    .hero-carousel__slide.is-leaving .hero-carousel__parallax,
    .hero-carousel__slide.is-entering .hero-carousel__caption-glass,
    .hero-carousel__slide.is-leaving .hero-carousel__caption-glass,
    .hero-carousel.is-transitioning .hero-carousel__glass-sweep {
        animation: none !important;
    }

    .hero-carousel__slide.is-active .hero-carousel__image {
        animation: none;
        transform: scale(1.04);
        filter: none;
    }

    .hero-carousel__slide.is-active .hero-carousel__caption-glass {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .hero-carousel__progress-bar {
        animation: none !important;
        width: 100%;
    }

    .hero-carousel__arrow {
        opacity: 1;
    }
}
