/* Navigation Lock */
html.is-locked,
body.is-locked {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none !important;
}

/* Background Overlay */
.nav-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: 
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        backdrop-filter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-overlay.is-active {
    opacity: 1;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: auto;
    touch-action: none !important;
}

/* Desktop Navigation Wrapper */
.nav-wrapper {
    position: fixed;
    top: 24px;
    left: 0;
    right: 0;
    margin: 0 auto;
    transform: translateY(0);
    width: 95%; 
    max-width: 800px;
    height: 44px;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 1fr 56px 1fr; 
    align-items: start;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-radius: 28px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    overflow: hidden;
    transition: 
        height 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0s,
        max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
        padding 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
        border-radius 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
        background 0.4s ease 0.15s,
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0s;
}

.nav-wrapper.is-collapsed {
    max-width: 56px;
    padding: 0;
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-100px);
    transition: 
        max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
        padding 0.4s ease 0.15s,
        background 0.4s ease 0s,
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s;
}

.nav-logo {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px; 
    color: #1d1d1f;
    z-index: 10;
    opacity: 1 !important;
    transition: opacity 0.25s ease, transform 0.25s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-logo:hover {
    opacity: 0.75;
    transform: translateX(-50%) scale(1.05) !important;
}

.nav-logo svg {
    height: 28px;
    width: auto;
    display: block;
}

.desktop-only {
    display: flex;
}

.mobile-only {
    display: none !important;
}

.left-links, .right-links {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 44px;
    white-space: nowrap;
    transition: 
        opacity 0.3s ease 0.3s, 
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.left-links {
    grid-column: 1;
    justify-content: flex-end;
    padding-right: 32px;
}

.right-links {
    grid-column: 3;
    justify-content: flex-start;
    padding-left: 32px;
}

.nav-wrapper.is-collapsed .left-links,
.nav-wrapper.is-collapsed .right-links {
    opacity: 0;
    pointer-events: none;
    transition: 
        opacity 0.1s ease 0s, 
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0s;
}

.nav-wrapper.is-collapsed .left-links {
    transform: translateX(-40px);
}

.nav-wrapper.is-collapsed .right-links {
    transform: translateX(40px);
}

.nav-links a {
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.nav-links a:hover {
    opacity: 0.7;
}

/* Mega Menu Expansion */
.nav-wrapper.is-mega-expanded {
    max-width: 1270px;
    height: 460px;
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.94);
    transition: 
        max-width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.4s ease;
}

.mega-menu-canvas {
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100% - 56px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    isolation: isolate;
}

.nav-wrapper.is-mega-expanded .mega-menu-canvas {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease 0.1s; 
}

.mega-panel {
    position: absolute;
    inset: 0;
    padding: 48px 48px 40px 48px;
    display: grid;
    grid-template-columns: 350px 180px 180px 1fr;
    column-gap: 36px;
    align-items: start;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 12px, 0); 
    will-change: transform, opacity;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: 
        opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.4s;
}

#mega-portfolio,
#mega-about,
#mega-mentorship {
    grid-template-columns: 240px 170px 170px 1fr;
}

.mega-panel.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
}

.mega-panel.is-active .mega-column:nth-child(1) { transition-delay: 0.10s; }
.mega-panel.is-active .mega-column:nth-child(2) { transition-delay: 0.18s; }
.mega-panel.is-active .mega-column:nth-child(3) { transition-delay: 0.26s; }
.mega-panel.is-active .mega-gallery { transition-delay: 0.35s; }

.mega-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    min-width: 0;
    opacity: 0;
    transform: translate3d(0, 16px, 0);
    will-change: transform, opacity;
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: 
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.mega-panel.is-active .mega-column {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.mega-heading {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-sub);
    margin-bottom: 6px;
}

.mega-column:nth-child(1) a {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-dark);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding-bottom: 5px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.mega-column:nth-child(2) a,
.mega-column:nth-child(3) a {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 600;
    color: var(--color-text-dark);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.mega-column a.mega-view-all-link {
    font-size: 0.88rem;
    font-weight: 600;
    color: #e11d48;
    margin-top: 4px;
}

.mega-column a:hover {
    opacity: 0.6;
    transform: translateX(4px);
}

.mega-gallery {
    grid-column: 4;
    justify-self: end;
    width: 320px;
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.98);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.mega-panel.is-active .mega-gallery {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.mega-image-placeholder {
    width: 320px;
    max-width: 100%;
    aspect-ratio: 4 / 3; 
    border-radius: 18px;
    background: #f5f5f7;
    background-position: center !important;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.04);
}

.nav-menu-btn { 
    display: none; 
}

.nav-logo,
.nav-link,
.nav-item a {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Mobile Navigation */
@media (max-width: 1024px) {
    .desktop-only { 
        display: none !important; 
    }
    
    .mobile-only { 
        display: flex !important; 
    }

    .nav-wrapper {
        box-sizing: border-box;
        position: fixed;
        top: 16px;
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        transform: translateY(0);
        width: calc(100vw - 32px) !important;
        max-width: 440px !important;
        height: 48px;
        padding: 0 18px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(25px) saturate(190%);
        -webkit-backdrop-filter: blur(25px) saturate(190%);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 28px;
        overflow: hidden;
        z-index: 1000;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
        transition: 
            width 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            padding 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            border-radius 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            height 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0s,
            background 0.3s ease 0.15s,
            box-shadow 0.3s ease 0.15s,
            transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0s;
    }

    .nav-wrapper.is-collapsed {
        width: 48px !important;
        max-width: 48px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.95);
        transform: translateY(-90px) !important;
        transition: 
            width 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
            padding 0.4s ease 0.15s,
            border-radius 0.4s ease 0.15s,
            background 0.4s ease 0s,
            transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s;
    }

    .mobile-island-link {
        font-size: 13px;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: #1d1d1f;
        text-decoration: none;
        z-index: 10;
        transform: translateX(0);
        transition: 
            opacity 0.3s ease 0.3s,
            transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
    }

    .nav-logo {
        position: absolute;
        left: 50%;
        top: 0;
        transform: translateX(-50%) !important;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
        transition: opacity 0.25s ease;
    }

    .nav-logo svg {
        height: 24px;
        width: auto;
    }

    .nav-menu-btn {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 48px;
        height: 48px;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        z-index: 20;
        transform: translateX(0);
        -webkit-tap-highlight-color: transparent;
        transition: 
            opacity 0.3s ease 0.3s,
            transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
    }

    .nav-wrapper.is-collapsed .mobile-island-link,
    .nav-wrapper.is-collapsed .nav-menu-btn {
        opacity: 0 !important;
        pointer-events: none;
        transition: 
            opacity 0.15s ease 0s,
            transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0s;
    }

    .nav-wrapper.is-collapsed .mobile-island-link {
        transform: translateX(-24px);
    }

    .nav-wrapper.is-collapsed .nav-menu-btn {
        transform: translateX(24px);
    }

    .line { 
        height: 1.5px; 
        background: #1d1d1f; 
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s ease; 
    }
    
    .line-1 { 
        width: 17px; 
    }
    
    .line-2 { 
        width: 17px; 
    }

    .nav-wrapper.is-open {
        top: 16px;
        height: 80vh;
        height: 80dvh;
        padding: 16px 24px 20px 24px;
        border-radius: 28px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(35px) saturate(200%);
        -webkit-backdrop-filter: blur(35px) saturate(200%);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-wrapper.is-open .mobile-island-link,
    .nav-wrapper.is-open .nav-logo {
        opacity: 0;
        pointer-events: none;
    }

    .nav-wrapper.is-open .line-1 { 
        transform: translateY(3.25px) rotate(45deg); 
        width: 18px; 
    }
    
    .nav-wrapper.is-open .line-2 { 
        transform: translateY(-3.25px) rotate(-45deg); 
        width: 18px; 
    }

    .mobile-nav-container {
        position: relative;
        width: 100%;
        flex: 1;
        min-height: 0;
        overflow: hidden;
        margin-top: 36px;
        opacity: 0;
        touch-action: auto !important;
        -webkit-overflow-scrolling: touch;
        transition: opacity 0.3s ease 0.1s;
    }

    .nav-wrapper.is-open .mobile-nav-container {
        opacity: 1;
    }

    .mobile-panel {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        padding: 4px 0 24px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        opacity: 0;
        visibility: hidden;
        transform: translate3d(30px, 0, 0);
        transition: 
            opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
            transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
            visibility 0.35s;
    }

    .mobile-panel::-webkit-scrollbar {
        display: none;
    }

    .mobile-panel.is-active { 
        opacity: 1; 
        visibility: visible; 
        transform: translate3d(0, 0, 0); 
    }
    
    .mobile-panel.is-exiting { 
        opacity: 0; 
        transform: translate3d(-30px, 0, 0); 
    }

    .mobile-links-wrapper { 
        display: flex; 
        flex-direction: column; 
        gap: 16px; 
    }
    
    .mobile-links-wrapper a {
        display: block;
        font-size: 24px;
        color: #1d1d1f;
        font-weight: 600;
        line-height: 1.25;
        text-transform: none;
        letter-spacing: -0.015em;
        text-decoration: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .mobile-links-wrapper a:hover,
    .mobile-links-wrapper a:active {
        opacity: 0.65;
        transform: translateX(4px);
    }

    .mobile-back-btn {
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: none;
        border: none;
        padding: 0;
        color: #1d1d1f;
        cursor: pointer;
        z-index: 20;
        opacity: 0;
        pointer-events: none;
        transform: translateX(-4px);
        transition: opacity 0.25s ease, transform 0.25s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-back-btn svg {
        width: 22px;
        height: 22px;
        display: block;
    }

    .nav-wrapper.is-open.is-in-subpanel .mobile-back-btn {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    .mobile-back-btn:hover,
    .mobile-back-btn:active {
        opacity: 0.65;
        transform: translateX(-3px);
    }

    .mobile-sub-content {
        display: flex;
        flex-direction: column;
    }

    .mobile-sub-heading {
        display: block;
        font-size: 11px;
        font-weight: 500;
        letter-spacing: -0.01em;
        color: #86868b;
        margin-bottom: 6px;
        text-transform: none;
    }

    .mobile-sub-section.is-primary {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 24px;
    }

    .mobile-sub-section.is-primary a {
        display: block;
        font-size: 24px;
        font-weight: 600;
        line-height: 1.25;
        letter-spacing: -0.015em;
        color: #1d1d1f;
        text-decoration: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .mobile-sub-section.is-primary a:hover,
    .mobile-sub-section.is-primary a:active {
        opacity: 0.65;
        transform: translateX(4px);
    }

    .mobile-sub-section.is-secondary {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 20px;
    }

    .mobile-sub-section.is-secondary a {
        display: block;
        font-size: 14px;
        font-weight: 500;
        line-height: 1.4;
        letter-spacing: -0.01em;
        color: #1d1d1f;
        text-decoration: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .mobile-sub-section.is-secondary a:hover,
    .mobile-sub-section.is-secondary a:active {
        opacity: 0.65;
        transform: translateX(3px);
    }
}

/* Small Smartphone Viewport */
@media (max-width: 480px) {
    .nav-wrapper {
        top: 12px;
        left: 12px !important;
        right: 12px !important;
        width: calc(100vw - 24px) !important;
    }

    .nav-wrapper.is-open {
        top: 12px;
        width: calc(100vw - 24px) !important;
        padding: 16px 20px 20px 20px;
    }

    .mobile-links-wrapper a {
        font-size: 22px;
    }

    .mobile-sub-section.is-primary a {
        font-size: 22px;
    }
}