/* ============================================
   NAVBAR - Mobile Responsive with Hamburger Menu
   Rewritten from scratch for optimal mobile experience
   ============================================ */

/* ============================================
   BASE NAVBAR STYLES
   ============================================ */

.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100000;
    background-color: #000000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.nav-container {
    max-width: 1069px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 10px;
    min-height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.nav-left {
    padding: 4px 10px 4px 0;
    z-index: 100001;
    position: relative;
}

.nav-logo {
    font-size: 17px;
    font-weight: 600;
    line-height: normal;
    color: #f9faf7;
    text-decoration: none;
    letter-spacing: -0.17px;
    padding: 4px 10px 4px 0;
    transition: color 0.2s ease;
    display: inline-block;
}

.nav-logo:hover {
    color: rgba(249, 250, 247, 0.8);
}

/* ============================================
   DESKTOP NAVIGATION
   ============================================ */

.nav-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-link {
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: normal;
    color: #f9faf7;
    text-decoration: none;
    border-radius: 33px;
    transition: all 0.2s ease;
    background: transparent;
    white-space: nowrap;
    text-align: center;
    display: inline-block;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   HAMBURGER MENU BUTTON
   ============================================ */

.burger-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100001;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.burger-line {
    width: 20px;
    height: 2px;
    background: #f9faf7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    display: block;
}

/* Hamburger animation to X */
.burger-menu.active .burger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.burger-menu.active .burger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.burger-menu.active .burger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ============================================
   OVERLAY
   ============================================ */

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

/* ============================================
   MOBILE MENU (Hidden by default)
   ============================================ */

.menu-close-btn {
    display: none;
}

.mobile-social-links {
    display: none;
}

/* ============================================
   RESPONSIVE: TABLET & SMALLER DESKTOP
   ============================================ */

@media (max-width: 1200px) {
    .nav-container {
        max-width: 90%;
    }
}

/* ============================================
   RESPONSIVE: MOBILE (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Show hamburger menu */
    .burger-menu {
        display: flex;
    }

    /* Hide desktop nav */
    .nav-right {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background-color: #101010;
        flex-direction: column;
        align-items: stretch;
        padding: 80px 24px 40px;
        gap: 8px;
        z-index: 999999;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(100%);
        visibility: hidden;
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0.3s;
        -webkit-overflow-scrolling: touch;
    }

    /* Show menu when active */
    .nav-right.active {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0s;
    }

    /* Show overlay on mobile */
    .nav-overlay {
        display: block;
    }

    /* Close button */
    .menu-close-btn {
        display: flex !important;
        position: absolute;
        top: 24px;
        right: 24px;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        z-index: 10;
        padding: 0;
        margin: 0;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .menu-close-btn::before,
    .menu-close-btn::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 2px;
        background: #f9faf7;
        left: 50%;
        top: 50%;
        margin-left: -10px;
        margin-top: -1px;
        transition: all 0.2s ease;
    }

    .menu-close-btn::before {
        transform: rotate(45deg);
    }

    .menu-close-btn::after {
        transform: rotate(-45deg);
    }

    .menu-close-btn:hover::before,
    .menu-close-btn:hover::after {
        background: rgba(249, 250, 247, 0.8);
    }

    /* Mobile nav links */
    .nav-link {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        border-radius: 8px;
        text-align: center;
        display: block;
        margin-bottom: 4px;
        transition: all 0.2s ease;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(4px);
    }

    .nav-link.active {
        background: rgba(255, 255, 255, 0.25);
        font-weight: 600;
        color: #ffffff;
        border-left: 3px solid rgba(255, 255, 255, 0.5);
        padding-left: 21px;
    }

    /* Mobile social links */
    .mobile-social-links {
        display: flex !important;
        flex-direction: row;
        gap: 12px;
        margin-top: auto;
        padding-top: 24px;
        justify-content: center;
        align-items: center;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-social-link {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-radius: 6px;
        background: transparent;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .mobile-social-link:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.1);
    }

    .mobile-social-icon {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        object-fit: contain;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        display: block;
        filter: brightness(0) invert(1);
    }
}

/* ============================================
   PAGE-SPECIFIC VARIANTS
   ============================================ */

/* Gallery page - collapsed pill nav (Kirschberg-style) */
.nav-bar--gallery {
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Desktop: collapsed pill that expands on hover */
@media (min-width: 769px) {
    .nav-bar--gallery {
        pointer-events: none;
    }

    /* Fixed height + overflow:hidden keeps the pill locked — nothing can change its height */
    .nav-bar--gallery .nav-container {
        pointer-events: auto;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        width: 220px;
        height: 48px;
        min-height: unset;
        margin: 16px auto;
        padding: 0 20px;
        background: rgba(22, 22, 22, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 12px;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    box-shadow 0.2s ease;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    }

    .nav-bar--gallery:hover .nav-container,
    .nav-bar--gallery .nav-container:has(.nav-right.active) {
        width: min(900px, calc(100vw - 20px));
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    }

    .nav-bar--gallery .nav-left {
        flex-shrink: 0;
    }

    /* Burger: absolutely positioned, fades out on open */
    .nav-bar--gallery .burger-menu {
        display: flex;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
        transition: opacity 0.1s ease-out;
    }

    .nav-bar--gallery:hover .burger-menu:not(.active) {
        opacity: 0;
        pointer-events: none;
    }

    .nav-bar--gallery .burger-menu.active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Nav-right: absolutely positioned so it never affects container height or width */
    .nav-bar--gallery .nav-right {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        width: auto;
        min-width: unset;
        overflow: visible;
        flex-shrink: unset;
        opacity: 0;
        transition: opacity 0.18s ease-out;
    }

    .nav-bar--gallery:hover .nav-right,
    .nav-bar--gallery .nav-right.active {
        opacity: 1;
        transition: opacity 0.18s ease-out 0.12s;
    }

    .nav-bar--gallery .nav-right .nav-link {
        white-space: nowrap;
    }
}

/* Mobile: keep standard black bar for gallery */
@media (max-width: 768px) {
    .nav-bar--gallery {
        background-color: rgba(0, 0, 0, 1) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }
}

/* About page - can customize if needed */
.nav-bar--about {
    background-color: rgba(3, 3, 3, 1) !important;
}

/* ============================================
   ACCESSIBILITY & PERFORMANCE
   ============================================ */

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Smooth scrolling for mobile menu */
@media (max-width: 768px) {
    .nav-right {
        scroll-behavior: smooth;
    }
}

/* Focus states for accessibility */
.burger-menu:focus-visible,
.menu-close-btn:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid rgba(249, 250, 247, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .nav-right,
    .nav-overlay,
    .burger-line,
    .nav-link,
    .mobile-social-link {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Prevent layout shift */
.nav-bar {
    will-change: background-color, backdrop-filter;
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .nav-right {
            padding-bottom: max(40px, env(safe-area-inset-bottom));
        }
    }
}

