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

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

/* ========== Base Layout ========== */
#siteHeader,
#siteHeader * {
    box-sizing: border-box;
}

#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-submenu-toggle {
    display: none;
}

.site-nav a {
    padding: 8px 0;
    color: inherit;
    font-family: inherit;
    text-decoration: none;
}

.ai-nav-fire {
    display: inline-block;
    margin-left: 4px;
    font-size: 13px;
    line-height: 1;
    transform: translateY(-33%);
}

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

.site-nav a.ai-nav-pulse {
    position: relative;
    color: var(--color-brand-green);
    font-weight: 900;
    animation: aiNavPulse 2.8s ease-in-out infinite;
}

.site-nav a.ai-nav-pulse::after {
    position: absolute;
    right: 0;
    bottom: 3px;
    left: 0;
    height: 2px;
    border-radius: 999px;
    content: "";
    background: linear-gradient(90deg, var(--color-brand-blue), var(--color-brand-green));
    opacity: 0.72;
    transform: scaleX(0.82);
    transform-origin: center;
    animation: aiNavPulseLine 2.8s ease-in-out infinite;
}

@keyframes aiNavPulse {
    0%,
    100% {
        color: var(--color-brand-green);
        text-shadow: 0 0 0 rgba(142, 195, 30, 0);
    }

    50% {
        color: var(--color-brand-blue);
        text-shadow: 0 0 14px rgba(142, 195, 30, 0.42);
    }
}

@keyframes aiNavPulseLine {
    0%,
    100% {
        opacity: 0.54;
        transform: scaleX(0.72);
    }

    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

.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;
}

.site-nav .mega-menu-title {
    display: block;
    margin-bottom: 18px;
    padding: 0 0 18px;
    border-bottom: 1px solid rgba(23, 36, 54, 0.24);
    color: #34475d;
    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);
}

/* ========== Responsive ========== */
@media (max-width: 760px) {
    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: 54px;
        padding: 7px 16px;
    }

    .brand img,
    .site-header-logo {
        width: 92px;
    }

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

    .mobile-nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        color: #172436;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .site-header.is-mobile-nav-open .mobile-nav-toggle span:first-child {
        transform: translateY(7px) rotate(45deg);
    }

    .site-header.is-mobile-nav-open .mobile-nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-header.is-mobile-nav-open .mobile-nav-toggle span:last-child {
        transform: translateY(-7px) rotate(-45deg);
    }

    .site-nav {
        position: absolute;
        z-index: 90;
        top: 100%;
        right: 0;
        left: 0;
        display: block;
        height: calc(100vh - 54px);
        width: 100%;
        padding: 14px 18px 28px;
        overflow-y: auto;
        background: #fff;
        box-shadow: none;
        color: #172436;
        clip-path: inset(0 0 100% 0);
        opacity: 0;
        pointer-events: none;
        transform-origin: top;
        transition: clip-path 0.28s ease, opacity 0.2s ease;
    }

    @supports (height: 100dvh) {
        .site-nav {
            height: calc(100dvh - 54px);
        }
    }

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

    .site-nav > a,
    .site-nav-link-row > a {
        display: flex;
        min-height: 52px;
        align-items: center;
        padding: 14px 0;
        color: #172436;
        font-size: 16px;
        font-weight: 400;
        line-height: 24px;
    }

    .site-nav .active {
        color: #172436;
        font-weight: 400;
    }

    .site-nav a.ai-nav-pulse {
        color: #172436;
        font-weight: 400;
        animation: none;
    }

    .site-nav a.ai-nav-pulse::after {
        display: none;
    }

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

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

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

    .nav-caret {
        display: none;
    }

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

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

    .has-mega-menu.is-mobile-submenu-open .mobile-submenu-caret {
        transform: translateY(2px) 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: none;
    }

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

    .site-nav .mega-menu-title {
        display: flex;
        min-height: 52px;
        align-items: center;
        margin: 0 0 0 18px;
        padding: 0;
        border-bottom: 0;
        color: #999999;
        font-size: 16px;
        font-weight: 400;
    }

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

    .mega-menu-column li a {
        min-height: 52px;
        align-items: center;
        color: #172436;
        font-size: 16px;
        font-weight: 400;
    }

    .mega-menu-title.active,
    .mega-menu-column li a.active {
        color: #172436;
        font-weight: 400;
    }

    .mega-menu-column a:hover {
        color: #172436;
    }

    .mega-menu-column li a::before {
        display: none;
    }
}
