/**
 * NAVBAR - Liquid Glass Design (Apple-inspired)
 * @package DynastyDream
 * @version 3.0
 */

/* =============== Variables CSS =============== */
:root {
    --navbar-bg: rgba(255, 255, 255, 0.72);
    --navbar-bg-scrolled: rgba(255, 255, 255, 0.13);
    --navbar-border: rgba(255, 255, 255, 0.18);
    --navbar-text: #000000;
    --navbar-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04),
                     0 2px 12px -2px rgba(0, 0, 0, 0.08);
    --navbar-shadow-scrolled: 0 0 0 0.5px rgba(0, 0, 0, 0.06),
                               0 8px 32px -8px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
    :root {
        --navbar-bg: rgba(255, 255, 255, 0.72);
        --navbar-bg-scrolled: rgba(255, 255, 255, 0.13);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* =============== Container =============== */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(16px, 5vw, 40px);
    width: 100%;
    box-sizing: border-box;
}

/* =============== Skip link =============== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    padding: .5rem .75rem;
    background: #000;
    color: #fff;
    border-radius: .5rem;
    z-index: 10000;
}

.skip-link:focus {
    left: 8px;
    top: 8px;
}

/* =============== Header =============== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    pointer-events: none; /* La navbar ne bloque pas les clics */
}

.site-header > * {
    pointer-events: auto; /* Mais ses enfants (logo, menu) peuvent recevoir les clics */
}

/* =============== Navbar - Complètement Transparente =============== */
#navbar {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
    transform: translateY(0);
    transition: all .5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#navbar.scrolled {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
}

.navbar__inner {
    display: flex;
    align-items: center;
    min-height: 88px;
    position: relative;
    padding-top: env(safe-area-inset-top);
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

/* =============== Brand / Logo =============== */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all .4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
}

.brand:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
}

.brand img {
    display: block;
    height: 56px;
    width: auto;
    max-width: 140px;
    transition: all .4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* =============== Menus =============== */
.menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu--desktop {
    display: none;
    gap: 4px;
    margin-left: auto;
    /* Transparent par défaut */
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 6px 8px;
    border-radius: 100px;
    border: 0.5px solid transparent;
    box-shadow: none;
    transition: all .5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Effet Liquid Glass au scroll uniquement */
#navbar.scrolled .menu--desktop {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(30px);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.8),
                0 8px 32px rgba(0, 0, 0, 0.15),
                0 16px 64px rgba(0, 0, 0, 0.1);
}

/* Design Liquid Glass des liens */
.menu__link {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    /* Transparent par défaut avec texte blanc et fond très léger noir */
    color: #ffffff;
    background: rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    position: relative;
    overflow: hidden;
    transition: all .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15),
                0 2px 12px rgba(0, 0, 0, 0.2);
}

/* Style au scroll - texte noir sur fond blanc */
#navbar.scrolled .menu__link {
    color: rgba(0, 0, 0, 0.9);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8),
                0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Effet de reflet liquide */
.menu__link::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform .6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.menu__link:hover::after {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

/* Hover - en haut de page (blanc sur semi-noir) */
.menu__link:not(.is-active):hover,
.menu__link:not(.is-active):focus-visible {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25),
                0 4px 16px rgba(0, 0, 0, 0.25),
                0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Hover - après scroll (noir sur blanc) */
#navbar.scrolled .menu__link:not(.is-active):hover,
#navbar.scrolled .menu__link:not(.is-active):focus-visible {
    color: #000000;
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 1),
                0 4px 16px rgba(0, 0, 0, 0.12),
                0 8px 24px rgba(0, 0, 0, 0.08);
}

/* État actif - en haut de page (blanc sur noir foncé) */
.menu__link.is-active {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2),
                0 4px 16px rgba(0, 0, 0, 0.35),
                0 8px 32px rgba(0, 0, 0, 0.3);
}

/* État actif - après scroll (blanc sur noir opaque) */
#navbar.scrolled .menu__link.is-active {
    color: #ffffff;
    background: #000000;
    border-color: #000000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1),
                0 4px 16px rgba(0, 0, 0, 0.3),
                0 8px 32px rgba(0, 0, 0, 0.2);
}

/* =============== Hamburger =============== */
.hamburger {
    margin-left: auto;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    border: 0;
    background: rgba(0, 0, 0, 0.04);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.hamburger:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.05);
}

.hamburger__bar {
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 2px;
    transition: all .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hamburger[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.1);
}

.hamburger[aria-expanded="true"] .hamburger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .hamburger__bar:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger[aria-expanded="true"] .hamburger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =============== Overlay =============== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1200;
}

.overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.overlay[hidden].is-open {
    display: block !important;
    visibility: visible !important;
}

/* =============== Mobile Panel - Liquid Glass =============== */
.mobile-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateY(-100%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(40px);
    -webkit-backdrop-filter: saturate(180%) blur(40px);
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(env(safe-area-inset-top) + 100px) 32px 32px;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform .6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1201;
    border-top: 0.5px solid rgba(255, 255, 255, 0.3);
}

.mobile-panel.is-open {
    transform: translateY(0);
}

.mobile-panel[hidden].is-open {
    display: flex !important;
    visibility: visible !important;
}

/* =============== Panel Close Button - Glass Style =============== */
.panel-close {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 24px);
    right: 24px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    outline: none;
    transition: all .4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.5),
                0 2px 12px rgba(0, 0, 0, 0.08);
}

.panel-close:hover,
.panel-close:focus-visible {
    background: rgba(0, 0, 0, 0.92);
    color: #ffffff;
    border-color: rgba(0, 0, 0, 0.95);
    transform: rotate(90deg) scale(1.1);
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.2),
                0 8px 24px rgba(0, 0, 0, 0.2);
}

/* =============== Menu Mobile - Liquid Glass =============== */
.menu--mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(600px, 100%);
}

.menu--mobile .menu__link {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 17px;
    padding: 18px 32px;
    color: rgba(0, 0, 0, 0.85);
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 100px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all .4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7),
                0 4px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

/* Effet de reflet */
.menu--mobile .menu__link::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform .6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.menu--mobile .menu__link:hover::after {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

.menu--mobile .menu__link.is-active {
    background: rgba(0, 0, 0, 0.92);
    color: #ffffff;
    border: 1.5px solid rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15),
                0 8px 32px rgba(0, 0, 0, 0.25),
                0 16px 48px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

.menu--mobile .menu__link:not(.is-active):hover,
.menu--mobile .menu__link:not(.is-active):focus-visible {
    color: rgba(0, 0, 0, 0.95);
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-4px) scale(1.01);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8),
                0 12px 40px rgba(0, 0, 0, 0.15);
}

/* =============== Responsive =============== */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .navbar__inner {
        min-height: 72px;
    }
    
    .brand img {
        height: 48px;
        max-width: 120px;
    }
    
    .hamburger {
        width: 28px;
        height: 20px;
        padding: 6px;
    }
}

@media (min-width: 1024px) {
    .menu--desktop {
        display: flex;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        gap: 4px;
        /* Conserver les styles liquid glass définis plus haut */
    }

    .hamburger {
        display: none;
    }

    .brand img {
        height: 64px;
        max-width: none;
    }
}

/* =============== Animations =============== */
@keyframes liquidSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.mobile-panel.is-open .menu--mobile .menu__item {
    animation: liquidSlideIn .6s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards;
}

.mobile-panel.is-open .menu--mobile .menu__item:nth-child(1) { animation-delay: .1s; }
.mobile-panel.is-open .menu--mobile .menu__item:nth-child(2) { animation-delay: .15s; }
.mobile-panel.is-open .menu--mobile .menu__item:nth-child(3) { animation-delay: .2s; }
.mobile-panel.is-open .menu--mobile .menu__item:nth-child(4) { animation-delay: .25s; }
