/* Site-wide glassmorphism — header, mega menus, blurred page backdrop */

/*
 * Sections linked from in-page anchors (#contact on home / floating CTA sit under fixed header).
 */
#contact,
#services {
    scroll-margin-top: clamp(6.5rem, 18vmin, 9.75rem);
}

/*
 * Floating “Get a Free Estimate” — safe areas + avoids viewport overflow on narrow phones.
 */
.site-float-estimate-btn {
    position: fixed;
    z-index: 60;
    right: calc(1.25rem + env(safe-area-inset-right, 0px));
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    left: auto;
    box-sizing: border-box;
    max-width: min(20rem, calc(100vw - 2.5rem - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px)));
    border-radius: 9999px;
    background-color: #341390;
    padding: 0.75rem 1.25rem;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.045em;
    line-height: 1.35;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    transition: filter 0.2s ease;
}
.site-float-estimate-btn:hover {
    filter: brightness(1.08);
}

.site-float-estimate-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow:
        0 0 0 2px #341390,
        0 10px 24px rgba(15, 23, 42, 0.22);
}

@media (min-width: 640px) {
    .site-float-estimate-btn {
        right: calc(2rem + env(safe-area-inset-right, 0px));
        bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
        max-width: none;
        padding: 0.75rem 1.25rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

#site-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s ease, visibility 0.32s ease;
    pointer-events: none;
}

#site-menu-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.site-header-shell {
    transition:
        background-color 0.38s ease,
        box-shadow 0.38s ease,
        backdrop-filter 0.38s ease,
        -webkit-backdrop-filter 0.38s ease,
        border-color 0.38s ease;
}

/* Scrolled: ~40% transparency (0.6 opacity) + frosted glass */
.site-header-shell.is-scrolled {
    background: rgba(247, 247, 247, 0.6) !important;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 12px 40px -24px rgba(15, 23, 42, 0.12);
}

/* Interior pages: soft glass bar at rest; deepens on scroll */
.site-header-shell.site-header--interior:not(.is-scrolled) {
    background: rgba(247, 247, 247, 0.72) !important;
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.site-header-shell.site-header--interior:not(.is-scrolled) .site-top-strip,
.site-header-shell.site-header--interior:not(.is-scrolled) .site-header-brand-row,
.site-header-shell.site-header--interior:not(.is-scrolled) .site-header-nav-row {
    background: transparent !important;
}

.site-header-shell.site-header--interior.is-scrolled .site-top-strip,
.site-header-shell.site-header--interior.is-scrolled .site-header-brand-row,
.site-header-shell.site-header--interior.is-scrolled .site-header-nav-row {
    background: transparent !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) {
    background: transparent !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-top-strip {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-brand-row {
    background: transparent !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-nav-row {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Light text on hero when header is transparent */
.site-header-shell.site-header--home:not(.is-scrolled) .site-top-strip,
.site-header-shell.site-header--home:not(.is-scrolled) .site-top-strip a {
    color: rgba(255, 255, 255, 0.92);
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-top-strip .text-slate-400 {
    color: rgba(255, 255, 255, 0.45) !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-brand-row .text-slate-900,
.site-header-shell.site-header--home:not(.is-scrolled) .site-header-brand-row .text-slate-600,
.site-header-shell.site-header--home:not(.is-scrolled) .site-header-brand-row span {
    color: rgba(255, 255, 255, 0.95) !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-nav-row nav a {
    color: rgba(255, 255, 255, 0.92) !important;
    border-color: transparent !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-nav-row nav a:hover {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-glass-btn {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #fff !important;
    box-shadow: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-glass-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
}

.site-header-shell.site-header--home:not(.is-scrolled) .site-header-brand-row img {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Mobile mega dropdown */
.site-glass-dropdown {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-color: rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 25px 80px -20px rgba(15, 23, 42, 0.35);
}

/* Hover mega curtain panel — slight lift of transparency (~10%) vs prior 0.82 / scrolled 0.86 */
.site-glass-mega-curtain {
    background: rgba(247, 247, 247, 0.72) !important;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-color: rgba(255, 255, 255, 0.55) !important;
    box-shadow: 0 28px 70px -28px rgba(15, 23, 42, 0.28);
}

.site-header-shell.is-scrolled .site-glass-mega-curtain {
    background: rgba(255, 255, 255, 0.76) !important;
}

/* Frosted cards sitewide — optional subtle lift for common panels */
.site-glass-panel {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 18px 60px -36px rgba(15, 23, 42, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    #site-menu-backdrop,
    .site-header-shell,
    .site-glass-dropdown,
    .site-glass-mega-curtain,
    .site-float-estimate-btn {
        transition-duration: 0.01ms !important;
    }

    .site-float-estimate-btn:hover {
        filter: none;
    }
}

/*
 * Full-viewport hero video: first-frame poster strip + fade to video when decoded (poster `img`; native `poster` stays hidden until video fades in otherwise).
 */
.hero-video-stage .hero-video-poster-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 1;
    transition: opacity 1.05s ease-out;
    pointer-events: none;
}
.hero-video-stage.is-ready .hero-video-poster-layer {
    opacity: 0;
}
.hero-video-stage video.hero-cover {
    opacity: 0;
    transition: opacity 1.05s ease-out;
    z-index: 1;
}
.hero-video-stage.is-ready video.hero-cover {
    opacity: 1;
}
.hero-video-stage .hero-video-overlay {
    opacity: 0;
    transition: opacity 1.05s ease-out;
    z-index: 2;
}
.hero-video-stage.is-ready .hero-video-overlay {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .hero-video-stage video.hero-cover {
        opacity: 1;
        transition: none;
    }
    .hero-video-stage .hero-video-poster-layer {
        opacity: 1;
        transition: none;
    }
    .hero-video-stage.is-ready .hero-video-poster-layer {
        opacity: 1;
    }
    .hero-video-stage .hero-video-overlay {
        opacity: 0;
        visibility: hidden;
        transition: none;
    }
    .hero-video-stage.is-ready video.hero-cover {
        opacity: 1;
    }
}
