/**
 * Premium home — immersive ambient background + parallax image layer
 */
.premium-home {
    position: relative;
    isolation: isolate;
    overflow: clip;
    background-color: var(--premium-ambient-bottom, var(--premium-bg));
}

.premium-home-ambient {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    max-width: 100vw;
    margin-left: -50vw;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.premium-home-ambient__layer {
    position: absolute;
    inset: var(--premium-ambient-layer-inset, -8%);
}

.premium-home-ambient__layer--base {
    background:
        radial-gradient(ellipse 85% 55% at 18% 2%, var(--premium-ambient-glow-a, rgba(167, 139, 250, 0.14)) 0%, transparent 52%),
        radial-gradient(ellipse 70% 50% at 85% 22%, var(--premium-ambient-glow-b, rgba(99, 102, 241, 0.1)) 0%, transparent 50%),
        linear-gradient(180deg, var(--premium-ambient-top, #0a0a0c) 0%, var(--premium-ambient-bottom, #070708) 100%);
    transition: opacity 600ms var(--premium-ease-out);
    transform: translate3d(0, 0, 0);
}

.premium-home-ambient__layer--base::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--premium-ambient-scrim);
    pointer-events: none;
}

.premium-home-ambient__layer--glow {
    opacity: 0.62;
    background: radial-gradient(circle at 50% 18%, var(--premium-ambient-accent, rgba(167, 139, 250, 0.08)) 0%, transparent 58%);
    transform: translate3d(0, 0, 0);
}

/* Image layer — viewport-scoped (not full home height) to avoid cover zoom on tall pages */
.premium-home-ambient__layer--image {
    inset: auto;
    top: 0;
    left: calc(-1 * var(--premium-ambient-image-overscan-x, 6%));
    right: calc(-1 * var(--premium-ambient-image-overscan-x, 6%));
    width: calc(100% + (2 * var(--premium-ambient-image-overscan-x, 6%)));
    height: var(--premium-ambient-image-height, 100vh);
    min-height: 100vh;
    max-height: 110vh;
    opacity: var(--premium-ambient-image-opacity, 0.64);
    background-size: 100% auto;
    background-position: center top;
    background-repeat: no-repeat;
    filter: blur(var(--premium-ambient-image-blur, 8px)) saturate(1.1);
    transform: translate3d(0, 0, 0);
    transition: opacity 700ms var(--premium-ease-out), filter 700ms var(--premium-ease-out);
}

.premium-home-ambient__layer--image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(7, 7, 8, 0.02) 0%,
        rgba(7, 7, 8, 0.08) 60%,
        rgba(7, 7, 8, 0.2) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Ambient video — desktop only, inside image layer, no parallax */
.premium-home-ambient__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
    filter: blur(var(--premium-ambient-image-blur, 3px)) saturate(1.1);
}

.premium-home-ambient--video-active .premium-home-ambient__video {
    display: block;
    visibility: visible;
    opacity: var(--premium-ambient-image-opacity, 0.64);
}

.premium-home-ambient--video-active.premium-home-ambient--tone-hero .premium-home-ambient__video {
    opacity: var(--premium-ambient-image-opacity-hero, 0.74);
    filter: blur(var(--premium-ambient-image-blur-hero, 2px)) saturate(1.08);
}

.premium-home-ambient--video-active .premium-home-ambient__layer--image {
    opacity: 1;
    visibility: visible;
    background-image: none !important;
}

.premium-home-ambient--video-active.premium-home-ambient--no-image .premium-home-ambient__layer--image {
    opacity: 1;
    visibility: visible;
}

.premium-home-ambient--parallax-active.premium-home-ambient--video-active .premium-home-ambient__layer--image {
    will-change: auto;
}

/* Panoramic assets (Vecteezy-style wide art) — fit width, avoid vertical cover zoom */
.premium-home-ambient--panoramic .premium-home-ambient__layer--image {
    height: clamp(54vh, calc(58vw * 0.4), 76vh);
    min-height: 50vh;
    max-height: 80vh;
    background-size: 100% auto;
    background-position: center top;
}

.premium-home-ambient--portrait .premium-home-ambient__layer--image {
    height: var(--premium-ambient-image-height, 100vh);
    max-height: 110vh;
    background-size: auto 100%;
    background-position: center var(--premium-ambient-image-position-y, 16%);
}

.premium-home-ambient--parallax-active .premium-home-ambient__layer--glow {
    will-change: transform;
}

.premium-home-ambient--parallax-active .premium-home-ambient__layer--image {
    will-change: background-position;
}

.premium-home-ambient--parallax-active .premium-home-ambient__layer--base {
    will-change: auto;
}

/* Desktop parallax — pin ambient to viewport while #premium-home is visible */
.premium-home-ambient--parallax-active.premium-home-ambient--home-fixed {
    position: fixed;
    top: 0;
    left: 50%;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    margin-left: -50vw;
    bottom: auto;
    z-index: 0;
}

.premium-home-ambient--parallax-active.premium-home-ambient--home-fixed .premium-home-ambient__layer--image {
    top: calc(-1 * var(--premium-ambient-parallax-overscan-y, 22vh));
    height: calc(100vh + (2 * var(--premium-ambient-parallax-overscan-y, 22vh)));
    min-height: calc(100vh + (2 * var(--premium-ambient-parallax-overscan-y, 22vh)));
    max-height: none;
    background-size: 100% auto;
    background-position: center top;
}

.premium-home-ambient--parallax-active.premium-home-ambient--home-fixed.premium-home-ambient--portrait .premium-home-ambient__layer--image {
    background-size: auto calc(100% + 12vh);
    background-position: center var(--premium-ambient-image-position-y, 16%);
}

.premium-home-ambient--parallax-active.premium-home-ambient--home-fixed.premium-home-ambient--panoramic .premium-home-ambient__layer--image {
    top: calc(-1 * var(--premium-ambient-parallax-overscan-y, 22vh));
    height: calc(100vh + (2 * var(--premium-ambient-parallax-overscan-y, 22vh)));
    min-height: calc(100vh + (2 * var(--premium-ambient-parallax-overscan-y, 22vh)));
    max-height: none;
    background-size: 100% auto;
    background-position: center top;
}

.premium-home-ambient--no-image .premium-home-ambient__layer--image {
    opacity: 0;
    visibility: hidden;
    background-image: none !important;
}

.premium-home-stack {
    position: relative;
    z-index: 1;
}

.premium-home-ambient--tone-hero {
    --premium-ambient-glow-a: rgba(196, 181, 253, 0.18);
    --premium-ambient-glow-b: rgba(129, 140, 248, 0.12);
}

.premium-home-ambient--tone-hero .premium-home-ambient__layer--image {
    opacity: var(--premium-ambient-image-opacity-hero, 0.62);
    filter: blur(var(--premium-ambient-image-blur-hero, 5px)) saturate(1.08);
}

.premium-home-ambient--tone-hero.premium-home-ambient--no-image .premium-home-ambient__layer--image {
    opacity: 0;
}

.premium-home-ambient--tone-latest {
    --premium-ambient-glow-a: rgba(167, 139, 250, 0.12);
    --premium-ambient-glow-b: rgba(79, 70, 229, 0.08);
}

.premium-home-ambient--tone-media {
    --premium-ambient-glow-a: rgba(56, 189, 248, 0.1);
    --premium-ambient-glow-b: rgba(167, 139, 250, 0.12);
}

.premium-home-ambient--tone-category {
    --premium-ambient-glow-a: rgba(167, 139, 250, 0.1);
    --premium-ambient-glow-b: rgba(24, 24, 27, 0.2);
}

.premium-home-ambient--tone-default {
    --premium-ambient-glow-a: rgba(167, 139, 250, 0.08);
    --premium-ambient-glow-b: rgba(15, 16, 18, 0.15);
}

/* Tablet — static ambient image, no parallax */
@media (min-width: 768px) and (max-width: 991.98px) {
    .premium-home-ambient--tablet-static .premium-home-ambient__layer--image {
        opacity: 0.46;
        filter: blur(9px) saturate(1.06);
        transform: none !important;
        height: 100vh;
        max-height: 100vh;
    }

    .premium-home-ambient--tablet-static.premium-home-ambient--tone-hero .premium-home-ambient__layer--image {
        opacity: 0.52;
        filter: blur(7px) saturate(1.05);
    }

    .premium-home-ambient--tablet-static.premium-home-ambient--panoramic .premium-home-ambient__layer--image {
        height: clamp(52vh, calc(68vw * 0.34), 72vh);
        background-size: 100% auto;
        background-position: center top;
    }

    .premium-home-ambient--tablet-static.premium-home-ambient--no-image .premium-home-ambient__layer--image {
        opacity: 0;
        display: none !important;
    }

    .premium-home-ambient__video,
    .premium-home-ambient--video-active .premium-home-ambient__video {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* Mobile — static ambient image, no parallax (gradients + visible wallpaper) */
@media (max-width: 767.98px) {
    .premium-home {
        isolation: auto;
    }

    .premium-home-ambient {
        top: 0;
        bottom: 0;
        left: 50%;
        right: auto;
        width: 100vw;
        max-width: 100vw;
        margin-left: -50vw;
    }

    .premium-home-ambient__layer--base,
    .premium-home-ambient__layer--glow {
        inset: 0;
        will-change: auto !important;
        transform: none !important;
        transition: none !important;
    }

    .premium-home-ambient__layer--glow {
        opacity: 0.45;
    }

    .premium-home-ambient--mobile-static .premium-home-ambient__layer--image {
        display: block !important;
        visibility: visible;
        inset: auto;
        top: 0;
        left: calc(-1 * var(--premium-ambient-image-overscan-x, 2%));
        right: calc(-1 * var(--premium-ambient-image-overscan-x, 2%));
        width: calc(100% + (2 * var(--premium-ambient-image-overscan-x, 2%)));
        height: 72vh;
        min-height: 58vh;
        max-height: 85vh;
        opacity: var(--premium-ambient-image-opacity-mobile, 0.54);
        filter: blur(var(--premium-ambient-image-blur-mobile, 4px)) saturate(1.08);
        transform: none !important;
        will-change: auto !important;
        transition: opacity 700ms var(--premium-ease-out), filter 700ms var(--premium-ease-out);
        background-size: 100% auto;
        background-position: center top;
    }

    .premium-home-ambient--mobile-static.premium-home-ambient--tone-hero .premium-home-ambient__layer--image {
        opacity: var(--premium-ambient-image-opacity-mobile-hero, 0.62);
        filter: blur(var(--premium-ambient-image-blur-mobile-hero, 3px)) saturate(1.06);
    }

    .premium-home-ambient--mobile-static.premium-home-ambient--panoramic .premium-home-ambient__layer--image {
        height: clamp(46vh, calc(62vw * 0.36), 68vh);
        min-height: 42vh;
        max-height: 72vh;
        background-size: 100% auto;
        background-position: center top;
    }

    .premium-home-ambient--mobile-static.premium-home-ambient--portrait .premium-home-ambient__layer--image {
        height: 88vh;
        min-height: 72vh;
        max-height: 94vh;
        background-size: auto 100%;
        background-position: center var(--premium-ambient-image-position-y, 16%);
    }

    .premium-home-ambient--mobile-static.premium-home-ambient--no-image .premium-home-ambient__layer--image {
        display: none !important;
        opacity: 0;
        visibility: hidden;
    }

    .premium-home-ambient__video,
    .premium-home-ambient--video-active .premium-home-ambient__video {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .premium-home-ambient--mobile-static .premium-home-ambient__layer--image::after {
        background: linear-gradient(
            180deg,
            rgba(7, 7, 8, 0.04) 0%,
            rgba(7, 7, 8, 0.1) 55%,
            rgba(7, 7, 8, 0.22) 100%
        );
    }
}

body.premium.premium-scheme-light {
    --premium-ambient-image-opacity: 0.5;
    --premium-ambient-image-opacity-hero: 0.58;
    --premium-ambient-scrim: linear-gradient(180deg, rgba(238, 240, 244, 0.22) 0%, rgba(238, 240, 244, 0.4) 52%, rgba(238, 240, 244, 0.58) 100%);
}

body.premium.premium-scheme-light .premium-home-ambient__layer--image::after {
    background: linear-gradient(
        180deg,
        rgba(238, 240, 244, 0.06) 0%,
        rgba(238, 240, 244, 0.16) 58%,
        rgba(238, 240, 244, 0.34) 100%
    );
}

@media (max-width: 767.98px) {
    body.premium.premium-scheme-light .premium-home-ambient--mobile-static .premium-home-ambient__layer--image {
        opacity: 0.44;
    }

    body.premium.premium-scheme-light .premium-home-ambient--mobile-static.premium-home-ambient--tone-hero .premium-home-ambient__layer--image {
        opacity: 0.5;
    }

    body.premium.premium-scheme-light .premium-home-ambient--mobile-static .premium-home-ambient__layer--image::after {
        background: linear-gradient(
            180deg,
            rgba(238, 240, 244, 0.08) 0%,
            rgba(238, 240, 244, 0.18) 58%,
            rgba(238, 240, 244, 0.32) 100%
        );
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    body.premium.premium-scheme-light .premium-home-ambient--tablet-static .premium-home-ambient__layer--image {
        opacity: 0.34;
    }

    body.premium.premium-scheme-light .premium-home-ambient--tablet-static.premium-home-ambient--tone-hero .premium-home-ambient__layer--image {
        opacity: 0.4;
    }
}

@media (prefers-reduced-motion: reduce) {
    .premium-home-ambient__layer {
        transition: none !important;
        will-change: auto !important;
    }

    .premium-home-ambient--parallax-active.premium-home-ambient--home-fixed {
        position: absolute;
        height: auto;
        clip-path: none !important;
    }

    .premium-home-ambient--parallax-active.premium-home-ambient--home-fixed .premium-home-ambient__layer--image {
        transform: none !important;
        background-position: center top !important;
    }

    .premium-home-ambient--parallax-active.premium-home-ambient--home-fixed .premium-home-ambient__layer--base,
    .premium-home-ambient--parallax-active.premium-home-ambient--home-fixed .premium-home-ambient__layer--glow {
        transform: none !important;
    }

    .premium-home-ambient--parallax-active.premium-home-ambient--home-fixed.premium-home-ambient--portrait .premium-home-ambient__layer--image {
        background-position: center var(--premium-ambient-image-position-y, 16%) !important;
    }

    .premium-home-ambient__video,
    .premium-home-ambient--video-active .premium-home-ambient__video {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}
