/* ==========================================
   1. Prevent Side-Scrolling Page Canvas
   ========================================== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* ==========================================
   2. Base Header Structure
   ========================================== */
.site-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--edge, #e2e8f0);
}

.site-nav .shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 24px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    z-index: 61;
}

.logo svg, .logo img {
    height: 38px;
    width: auto;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
    z-index: 61;
}

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--navy-d, #0f172a);
    transition: all 0.3s ease;
}

/* ==========================================
   3. Desktop Styles (> 768px)
   ========================================== */
@media (min-width: 769px) {
    .nav-menu {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        flex: 1;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        position: static !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .navlinks {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        gap: 28px;
        font-size: 14.5px;
        margin: 0;
        padding: 0;
        white-space: nowrap;
    }

    .navlinks a {
        text-decoration: none;
        color: var(--grey, #64748b);
        padding: 6px 12px;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

    .navlinks a:hover {
        color: var(--navy-d, #0f172a);
    }

    .navlinks a.active,
    .navlinks a.is-active {
        font-weight: 600;
        color: #0f172a;
        background-color: #e2e8f0;
    }

    .navright {
        display: flex;
        align-items: center;
        gap: 18px;
        white-space: nowrap;
    }

    .signin {
        font-size: 14.5px;
        text-decoration: none;
        color: var(--grey, #64748b);
    }

    .signin:hover {
        color: var(--navy-d, #0f172a);
    }
}

/* ==========================================
   Mobile Responsive Drawer (<= 768px)
   ========================================== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 70px);
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 32px 24px;
        box-sizing: border-box;
        z-index: 55;
        overflow-y: auto;

        visibility: hidden;
        opacity: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    }

    .nav-menu.is-open {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
    }

    /* Centered Mobile Nav Links */
    .navlinks {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column;
        align-items: center; /* Centers link elements horizontally */
        gap: 12px;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .navlinks a {
        display: block;
        width: 100%;
        font-size: 18px;
        font-weight: 500;
        color: #0f172a !important;
        text-decoration: none;
        padding: 10px 0;
        text-align: center; /* Centers the text inside each link */
        border-bottom: 1px solid #f1f5f9;
        box-sizing: border-box;
    }

    .navlinks a.active,
    .navlinks a.is-active {
        font-weight: 700;
        color: #3b82f6 !important;
    }

    .navright {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding-top: 24px;
        border-top: 1px solid var(--edge, #e2e8f0);
    }

    .navright .btn,
    .navright .signin {
        display: block;
        width: 100%;
        text-align: center;
        padding: 12px 0;
        box-sizing: border-box;
    }

    /* Hamburger Animation */
    .nav-toggle.is-active .hamburger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .nav-toggle.is-active .hamburger-bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.is-active .hamburger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}
