/* ============================================================
   SNG top_ai v2
   Desktop header + mega menu
   ============================================================ */

@media (min-width: 992px) {

    .header-v1,
    .header-v1 * {
        box-sizing: border-box;
    }

    .header-v1 {
        position: relative;
        z-index: 1001;
        width: 100%;
        background: #fff;
    }

    /* ---------- main header row ---------- */

    .header-v1 .sng-header-main {
        position: static;
        display: flex;
        align-items: center;
        width: 100%;
        height: 118px;
        margin-left: auto;
        margin-right: auto;
        padding-top: 0;
        padding-bottom: 0;
        background: #fff;
    }

    .header-v1 .sng-header-logo {
        display: flex;
        align-items: center;
        flex: 0 0 75px;
        width: 75px;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .header-v1 .sng-header-logo .logo,
    .header-v1 .sng-header-logo .logo a {
        display: flex;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    .header-v1 .sng-header-logo img {
        display: block;
        width: auto;
        max-width: 62px;
        height: auto;
        margin: 0;
    }

    .header-v1 .sng-header-description {
        display: flex;
        align-items: center;
        flex: 0 0 315px;
        width: 315px;
        height: 100%;
        padding: 0 25px 0 0;
    }

    .header-v1 .sng-header-description .top-description {
        margin: 0;
        padding: 0;
        color: #999;
        font-size: 13px;
        font-weight: 400;
        line-height: 1.4;
    }

    .header-v1 .sng-header-description .slogan {
        margin: 0 0 2px;
        padding: 0;
        color: #222;
        font-size: 15px;
        font-weight: 500;
        line-height: 1.3;
    }

    .header-v1 .sng-header-description__text {
        color: #999;
        font-size: 13px;
        line-height: 1.35;
    }

    /* ---------- menu area ---------- */

    .header-v1 .sng-header-menu,
    .header-v1 .sng-header-menu .nav-main-collapse,
    .header-v1 .sng-header-menu .menu-only,
    .header-v1 .sng-top-menu {
        position: static;
        height: 100%;
    }

    .header-v1 .sng-header-menu {
        display: flex;
        align-items: stretch;
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        padding: 0;
    }

    .header-v1 .sng-header-menu .nav-main-collapse,
    .header-v1 .sng-header-menu .menu-only,
    .header-v1 .sng-top-menu {
        display: flex !important;
        align-items: stretch;
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .header-v1 .sng-top-menu ul,
    .header-v1 .sng-top-menu li {
        list-style: none !important;
    }

    .header-v1 .sng-top-menu li::marker {
        content: "";
    }

    .header-v1 .sng-top-menu li:before {
        display: none !important;
        content: none !important;
    }

    .header-v1 .sng-top-menu__root {
        position: static;
        display: flex;
        align-items: stretch;
        justify-content: flex-end;
        gap: 20px;
        width: 100%;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent;
        border: 0;
    }

    .header-v1 .sng-top-menu__item {
        position: static;
        display: flex;
        align-items: stretch;
        float: none !important;
        width: auto;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent;
        border: 0;
    }

    .header-v1 .sng-top-menu__link {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: auto;
        height: 100%;
        min-height: 0;
        margin: 0 !important;
        padding: 0 18px !important;
        color: #171717 !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        font-family: inherit;
        font-size: 15px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
        text-align: center;
        text-decoration: none !important;
        white-space: nowrap;
        transition: color .18s ease;
    }

    .header-v1 .sng-top-menu__item:hover > .sng-top-menu__link,
    .header-v1 .sng-top-menu__item.is-open > .sng-top-menu__link,
    .header-v1 .sng-top-menu__item.is-active > .sng-top-menu__link {
        color: #00569c !important;
    }

    .header-v1 .sng-top-menu__link:after {
        content: "";
        position: absolute;
        left: 18px;
        right: 18px;
        bottom: 0;
        display: block;
        height: 3px;
        background: #00569c;
        opacity: 0;
        transform: none;
        transition: opacity .18s ease;
    }

    .header-v1 .sng-top-menu__item:hover > .sng-top-menu__link:after,
    .header-v1 .sng-top-menu__item.is-open > .sng-top-menu__link:after,
    .header-v1 .sng-top-menu__item.is-active > .sng-top-menu__link:after {
        opacity: 1;
    }

    .header-v1 .sng-top-menu__chevron {
        display: inline-block;
        flex: 0 0 7px;
        width: 7px;
        height: 7px;
        margin-top: -4px;
        border: 0;
        border-right: 1px solid #777;
        border-bottom: 1px solid #777;
        transform: rotate(45deg);
        transition: transform .18s ease, border-color .18s ease;
    }

    .header-v1 .sng-top-menu__item.is-open .sng-top-menu__chevron {
        margin-top: 4px;
        border-color: #00569c;
        transform: rotate(225deg);
    }

    /* ========================================================
       MEGA MENU
       Absolute positioning is relative to .header-v1, not menu-row.
       This lets it extend left toward the logo.
       ======================================================== */

    .header-v1 .sng-mega {
        position: absolute;
        top: 100%;
        left: 50%;
        right: auto;
        z-index: 1005;

        width: calc(100% - 30px);
        max-width: 1400px;

        margin: 0;
        padding: 22px 24px 14px;

        background: #fff;
        border: 1px solid #e3e8ed;
        border-top: 3px solid #00569c;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 18px 45px rgba(17, 38, 58, .14);

        transform: translate(-50%, 6px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transition:
            opacity .14s ease,
            transform .14s ease,
            visibility 0s linear .14s;
    }

    .header-v1 .sng-top-menu__item.is-open > .sng-mega {
        transform: translate(-50%, 0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    /* Always 4 cards on normal desktop. */
    .header-v1 .sng-mega__grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        margin: 0;
        padding: 0;
        column-gap: 0;
        row-gap: 0;
    }

    .header-v1 .sng-mega__card {
        min-width: 0;
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) 16px;
        align-items: center;
        gap: 14px;
        min-height: 88px;
        padding: 13px 16px;
        color: #172333 !important;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf0f3;
        border-bottom: 1px solid #edf0f3;
        text-decoration: none !important;
        transition: background .18s ease;
    }

    .header-v1 .sng-mega__card:nth-child(4n) {
        border-right: 0;
    }

    .header-v1 .sng-mega__card:hover,
    .header-v1 .sng-mega__card.is-active {
        background: #f6fafe;
    }

    .header-v1 .sng-mega__icon {
        position: relative;
        display: block;
        width: 48px;
        height: 48px;
        color: #00569c;
        background: #edf6fd;
        border-radius: 10px;
    }

    .header-v1 .sng-mega__icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-v1 .sng-mega__icon img {
        display: block;
        width: 24px;
        height: 24px;
        object-fit: contain;
    }

    .header-v1 .sng-mega__icon--empty {
        background: #f5f8fa;
        border: 1px solid #e6edf2;
    }

    .header-v1 .sng-mega__content {
        display: block;
        min-width: 0;
    }

    .header-v1 .sng-mega__title {
        display: block;
        color: #172333;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
    }

    .header-v1 .sng-mega__desc {
        display: block;
        margin-top: 4px;
        color: #7b8794;
        font-size: 12.5px;
        font-weight: 400;
        line-height: 1.35;
    }

    .header-v1 .sng-mega__arrow {
        color: #00569c;
        font-size: 21px;
        font-weight: 300;
        line-height: 1;
        transition: transform .18s ease;
    }

    .header-v1 .sng-mega__card:hover .sng-mega__arrow {
        transform: translateX(3px);
    }

    .header-v1 .sng-mega__footer {
        display: flex;
        justify-content: flex-end;
        padding: 13px 8px 3px;
    }

    .header-v1 .sng-mega__all {
        color: #00569c !important;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none !important;
    }

    .header-v1 .sng-mega__all span {
        display: inline-block;
        margin-left: 4px;
        transition: transform .18s ease;
    }

    .header-v1 .sng-mega__all:hover span {
        transform: translateX(3px);
    }

    /* Licenses use the same wide container, but shorter cards. */
    .header-v1 .sng-mega.is-license .sng-mega__card {
        min-height: 72px;
    }

    .header-v1 .sng-mega.is-license .sng-mega__icon {
        width: 42px;
        height: 42px;
    }

    /* ---------- page overlay ---------- */

    .sng-menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 900;
        background: rgba(18, 35, 51, .58);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .18s ease, visibility 0s linear .18s;
    }

    .sng-menu-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        transition-delay: 0s;
    }
}

/* 992–1150: 3 columns so cards do not become too narrow. */
@media (min-width: 992px) and (max-width: 1150px) {
    .header-v1 .sng-header-description {
        flex-basis: 245px;
        width: 245px;
    }

    .header-v1 .sng-top-menu__link {
        padding-left: 10px !important;
        padding-right: 10px !important;
        font-size: 13px !important;
    }

    .header-v1 .sng-top-menu__link:after {
        left: 10px;
        right: 10px;
    }

    .header-v1 .sng-mega {
        width: calc(100% - 20px);
        padding-left: 16px;
        padding-right: 16px;
    }

    .header-v1 .sng-mega__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .header-v1 .sng-mega__card:nth-child(4n) {
        border-right: 1px solid #edf0f3;
    }

    .header-v1 .sng-mega__card:nth-child(3n) {
        border-right: 0;
    }
}

/* Mobile menu is intentionally untouched by top_ai. */
@media (max-width: 991px) {
    .sng-menu-overlay {
        display: none;
    }

    .sng-top-menu {
        display: none;
    }
}
