@import "./design-tokens.css";

/* ========== Quick Edit ========== */
/* Header chrome, nav spacing, and mega-menu density are grouped in this file. */

/* ========== Base Layout ========== */
#siteHeader {
    position: sticky;
    z-index: 120;
    top: 0;
}

body.mobile-nav-open #siteHeader {
    position: fixed;
    z-index: 120;
    top: 0;
    right: 0;
    left: 0;
}

.site-header {
    position: relative;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 78px;
    padding: 0 clamp(20px, 6vw, 72px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
}

.brand img,
.site-header-logo {
    width: 136px;
    height: auto;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 22px;
    color: #425064;
    font-size: 15px;
}

.mobile-nav-toggle,
.mobile-nav-close,
.mobile-submenu-toggle {
    display: none;
}

.site-nav a {
    padding: 8px 0;
}

.site-nav .active {
    color: var(--accent-dark);
    font-weight: 700;
}

.site-nav-item {
    display: flex;
    align-items: center;
}

.site-nav-link-row {
    display: contents;
}

.has-mega-menu > a,
.site-nav-link-row > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    margin-top: 1px;
    line-height: 1;
}

.premium-dropdown-icon::before {
    width: 6px;
    height: 6px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    content: "";
    transform: translateY(-2px) rotate(45deg);
}

.premium-nav-menu-container {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    visibility: hidden;
    border-top: 1px solid rgba(17, 34, 51, 0.12);
    background: rgba(244, 248, 250, 0.96);
    box-shadow: 0 18px 40px rgba(17, 34, 51, 0.12);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.has-mega-menu:hover .premium-nav-menu-container,
.has-mega-menu:focus-within .premium-nav-menu-container {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.mega-menu-inner {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(42px, 8vw, 120px);
    width: min(1200px, calc(100% - 160px));
    margin: 0 auto;
    padding: 42px 0 38px;
}

.solution-columns .mega-menu-inner {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(24px, 5vw, 72px);
    width: min(1160px, calc(100% - 120px));
}

.mega-menu-column {
    min-width: 0;
}

.mega-menu-title {
    display: block;
    margin-bottom: 18px;
    padding: 0 0 18px;
    border-bottom: 1px solid rgba(23, 36, 54, 0.24);
    color: #172436;
    font-size: 18px;
    font-weight: 700;
}

.mega-menu-column ul {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mega-menu-column li a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: #34475d;
    font-size: 15px;
}

.mega-menu-column li a::before {
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
    content: "";
    transform: rotate(45deg);
}

.mega-menu-column a:hover {
    color: var(--accent-dark);
}

/* ========== Responsive ========== */
@media (max-width: 720px) {
    html,
    body {
        overflow-x: hidden;
    }

    @supports (overflow-x: clip) {
        html,
        body {
            overflow-x: clip;
        }
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .site-header {
        align-items: center;
        flex-direction: row;
        min-height: 82px;
        padding: 14px 24px;
    }

    .site-header-logo {
        width: 132px;
    }

    .mobile-nav-toggle {
        display: flex;
        flex-direction: column;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        gap: 7px;
        margin-left: auto;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .mobile-nav-toggle span {
        display: block;
        width: 30px;
        height: 3px;
        border-radius: 999px;
        background: currentColor;
        color: #172436;
    }

    .site-nav {
        position: fixed;
        z-index: 90;
        top: 0;
        right: 0;
        bottom: 0;
        display: block;
        height: 100vh;
        min-height: 100vh;
        width: min(72vw, 360px);
        padding: 92px 38px 42px;
        overflow-y: auto;
        background: rgba(8, 12, 18, 0.94);
        box-shadow: -24px 0 44px rgba(0, 0, 0, 0.34);
        color: #fff;
        opacity: 0;
        pointer-events: none;
        transform: translateX(100%);
        transition: opacity 0.22s ease, transform 0.22s ease;
    }

    @supports (height: 100dvh) {
        .site-nav {
            height: 100dvh;
            min-height: 100dvh;
        }
    }

    .site-header.is-mobile-nav-open .site-nav {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    .mobile-nav-close {
        position: absolute;
        top: 26px;
        right: 28px;
        display: block;
        width: 42px;
        height: 42px;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .mobile-nav-close::before,
    .mobile-nav-close::after {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 30px;
        height: 3px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.82);
        content: "";
    }

    .mobile-nav-close::before {
        transform: translate(-50%, -50%) rotate(45deg);
    }

    .mobile-nav-close::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    .site-nav > a,
    .site-nav-link-row > a {
        display: block;
        padding: 13px 0;
        color: #fff;
        font-size: 30px;
        font-weight: 900;
        line-height: 1.2;
    }

    .site-nav .active {
        color: #93d221;
    }

    .site-nav-item {
        display: block;
    }

    .site-nav-link-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 42px;
        align-items: center;
        gap: 8px;
    }

    .has-mega-menu > a,
    .site-nav-link-row > a {
        display: block;
    }

    .nav-caret {
        display: none;
    }

    .mobile-submenu-toggle {
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        border: 0;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .mobile-submenu-caret {
        width: 13px;
        height: 13px;
        border-top: 3px solid currentColor;
        border-left: 3px solid currentColor;
        transform: translateY(-4px) rotate(-135deg);
        transition: transform 0.18s ease;
    }

    .has-mega-menu.is-mobile-submenu-open .mobile-submenu-caret {
        transform: translateY(4px) rotate(45deg);
    }

    .premium-nav-menu-container {
        position: static;
        visibility: visible;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        border-top: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        transform: none;
        transition: max-height 0.22s ease;
    }

    .has-mega-menu.is-mobile-submenu-open .premium-nav-menu-container {
        max-height: 80vh;
    }

    .mega-menu-inner,
    .solution-columns .mega-menu-inner {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 18px;
        padding: 12px 0 18px;
    }

    .mega-menu-title {
        margin: 0 0 10px;
        padding: 0;
        border-bottom: 0;
        color: #fff;
        font-size: 24px;
        font-weight: 900;
    }

    .mega-menu-column ul {
        gap: 12px;
        padding: 0 0 0 24px;
    }

    .mega-menu-column li a {
        color: #fff;
        font-size: 18px;
        font-weight: 800;
    }

    .mega-menu-title.active,
    .mega-menu-column li a.active {
        color: #93d221;
    }

    .mega-menu-column li a::before {
        width: 5px;
        height: 5px;
        border: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.36);
        transform: none;
    }
}
