/* =============================================================================
   MOBILE MENU - Slide-out Navigation (Squarespace Parity)
   ============================================================================= */

/* Mobile menu overlay */
.sw-mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--sw-z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sw-mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile slide-out panel - Dark Glassmorphic overlay */
.sw-mobile-nav {
    position: fixed;
    top: 0;
    right: -340px; /* Slightly wider to hide shadow properly */
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    /* iOS Safari FIX */
    background: rgba(10, 10, 12, 0.8); /* Slightly more transparent */
    backdrop-filter: blur(30px) saturate(180%); /* Restored high-intensity blur */
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    z-index: var(--sw-z-nav-mobile);
    padding: 80px 30px 40px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    visibility: hidden;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    
    /* Performance Optimizations */
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    
    /* Shadow */
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.5);
}

.sw-mobile-nav.active {
    right: 0;
    visibility: visible;
}

/* Mobile close button - Orange like live site */
.sw-mobile-close {
    position: absolute;
    top: 15px;
    top: calc(15px + env(safe-area-inset-top, 0px));
    right: 15px;
    right: calc(15px + env(safe-area-inset-right, 0px));
    width: 44px;
    /* HIG touch target fix */
    height: 44px;
    /* HIG touch target fix */
    min-width: 44px;
    min-height: 44px;
    background: rgba(10, 10, 14, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.sw-mobile-close span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    position: relative;
}

.sw-mobile-close span:first-child {
    transform: rotate(45deg) translate(2px, 2px);
}

.sw-mobile-close span:last-child {
    transform: rotate(-45deg) translate(2px, -2px);
}

/* Mobile nav links - Black text on white */
.sw-mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sw-mobile-nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Regular nav item links */
.sw-mobile-nav-item>a {
    display: block;
    padding: 18px 0;
    font-family: var(--sw-font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sw-mobile-nav-item>a:hover {
    color: var(--sw-primary);
}

/* Dropdown toggle container - matches regular items */
.sw-mobile-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 18px 0;
    cursor: pointer;
}

/* Links inside dropdown toggle - same style as regular items */
.sw-mobile-dropdown-toggle a {
    font-family: var(--sw-font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sw-mobile-dropdown-toggle a:hover {
    color: var(--sw-primary);
}

/* Animated triple chevron arrow indicator */
.sw-mobile-dropdown-arrow {
    display: inline-flex;
    gap: 1px;
    margin-left: 5px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sw-mobile-dropdown-arrow span {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    opacity: 0;
    animation: blink-sequence 1.2s ease-in-out infinite;
}

.sw-mobile-dropdown-arrow span:nth-child(1) {
    animation-delay: 0s;
}

.sw-mobile-dropdown-arrow span:nth-child(2) {
    animation-delay: 0.2s;
}

.sw-mobile-dropdown-arrow span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink-sequence {

    0%,
    100% {
        opacity: 0.2;
    }

    30%,
    70% {
        opacity: 1;
    }
}

.sw-mobile-dropdown-arrow.open {
    transform: rotate(90deg);
}

.sw-mobile-dropdown-arrow.open span {
    animation: none;
    opacity: 1;
}

/* Mobile sub-menu - No background, subtle indent */
.sw-mobile-dropdown {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: transparent;
}

.sw-mobile-dropdown.open {
    display: block;
}

/* Dropdown items - EXACTLY same as main nav */
.sw-mobile-dropdown li a {
    display: block;
    padding: 18px 0 18px 10px;
    font-family: var(--sw-font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sw-mobile-dropdown li a:hover {
    color: var(--sw-primary);
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
    touch-action: none;
}

/* Hamburger animation when open */
.sw-mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.sw-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.sw-mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* =============================================================================
   BACK TO TOP BUTTON - Subtle, bottom-left
   ============================================================================= */
.sw-back-to-top {
    position: fixed;
    bottom: 30px;
    left: 15px !important;
    right: auto !important;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Start invisible */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);

    /* Smooth transitions (exclude bottom/transform if animating on scroll, but transform is used for hover. Exclude bottom!) */
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                visibility 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                background 0.4s ease,
                color 0.4s ease,
                box-shadow 0.4s ease,
                border-color 0.4s ease;

    /* Subtle border */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Visible state */
.sw-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Hover state - become more visible */
.sw-back-to-top:hover {
    transform: translateY(-3px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Active state - click feedback */
.sw-back-to-top:active {
    transform: translateY(-1px) scale(1.0);
}

/* Arrow icon */
.sw-back-to-top svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .sw-back-to-top {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: 16px !important;
        left: auto !important;
        width: 44px;
        height: 44px;
        background: rgba(10, 10, 15, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    }

    /* Only place on left when page has the intelligence chatbot FAB active on the right */
    body:has(#intelFab) .sw-back-to-top {
        left: 16px !important;
        right: auto !important;
    }

    .sw-back-to-top svg {
        width: 18px;
        height: 18px;
    }
}

/* Inverted state for when overlaying the orange footer */
.sw-back-to-top.sw-inverted {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sw-back-to-top.sw-inverted svg {
    stroke: var(--sw-primary);
}