/**
 * TORNEX Mobile Menu - CSS
 * Design System: Oswald + Roboto Condensed
 */

/* ==========================================================================
   CSS Variables - Design System TORNEX
   ========================================================================== */
:root {
    --tornex-jaune: #FDC103;
    --tornex-gris: #EFEFEF;
    --tornex-blanc: #F8F8F8;
    --tornex-noir-titres: #0E0E0E;
    --tornex-textes: #393939;
    --tornex-textes-reassurance: #606060;
    --tornex-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Hamburger Button
   ========================================================================== */
.tornex-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent !important;
    background-color: transparent !important;
    border: none;
    cursor: pointer;
    z-index: 10001;
    position: relative;
    box-shadow: none;
}

.tornex-hamburger:hover,
.tornex-hamburger:focus,
.tornex-hamburger:active {
    background: transparent !important;
    background-color: transparent !important;
}

.tornex-hamburger-line {
    display: block;
    height: 2.5px;
    width: 18px;
    background-color: var(--tornex-noir-titres);
    border-radius: 2px;
    transition: all var(--tornex-transition);
    transform-origin: right center;
    pointer-events: none;
}

/* Lignes asymétriques comme le SVG fourni */
.tornex-line-1 {
    width: 18px;
}

.tornex-line-2 {
    width: 24px;
    margin-top: 5px;
}

.tornex-line-3 {
    width: 18px;
    margin-top: 5px;
}

/* État ouvert - Animation vers X */
.tornex-hamburger.is-active .tornex-line-1 {
    width: 24px;
    transform: rotate(-45deg) translateY(-1px);
}

.tornex-hamburger.is-active .tornex-line-2 {
    opacity: 0;
    width: 0;
    transform: translateX(10px);
}

.tornex-hamburger.is-active .tornex-line-3 {
    width: 24px;
    transform: rotate(45deg) translateY(1px);
}

/* Cacher le hamburger quand le menu est ouvert */
body.tornex-menu-open .tornex-hamburger,
body.tornex-menu-open #tornex-hamburger,
.tornex-menu-open .tornex-hamburger,
.tornex-menu-open #tornex-hamburger {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    display: none !important;
}

/* ==========================================================================
   Overlay
   ========================================================================== */
.tornex-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(14, 14, 14, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--tornex-transition), visibility var(--tornex-transition);
    z-index: 9998;
    box-shadow: none !important;
}

.tornex-menu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ==========================================================================
   Off-Canvas Panel
   ========================================================================== */
.tornex-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background-color: var(--tornex-jaune);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.4s;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
    box-shadow: none !important;
}

#tornex-offcanvas {
    position: fixed !important;
    box-shadow: none !important;
}

.tornex-offcanvas.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

/* Bouton fermer */
.tornex-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}

#tornex-offcanvas .tornex-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
}

.tornex-close svg {
    stroke: var(--tornex-noir-titres);
}

.tornex-close:hover svg {
    stroke: var(--tornex-textes);
}

/* ==========================================================================
   Menu Content
   ========================================================================== */
.tornex-offcanvas-content {
    flex: 1;
    overflow-y: auto;
    padding: 80px 20px 20px;
    -webkit-overflow-scrolling: touch;
    background-color: var(--tornex-jaune);
}

/* Navigation principale */
.tornex-mobile-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: var(--tornex-jaune);
}

/* Items de menu */
.tornex-menu-item {
    border-bottom: 1px solid rgba(14, 14, 14, 0.1);
    background-color: var(--tornex-jaune);
}

.tornex-menu-item:last-child {
    border-bottom: none;
}

/* Bouton accordéon (items avec enfants) */
.tornex-menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 16px 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    cursor: pointer !important;
    text-align: left !important;
    font-family: 'Oswald', sans-serif !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    line-height: 120% !important;
    color: var(--tornex-noir-titres) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
}

#tornex-offcanvas .tornex-menu-toggle,
#tornex-offcanvas button.tornex-menu-toggle {
    padding: 16px 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    font-size: 16px !important;
    line-height: 120% !important;
}

.tornex-menu-text {
    font-family: 'Oswald', sans-serif !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    line-height: 120% !important;
    color: var(--tornex-noir-titres) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#tornex-offcanvas .tornex-menu-text {
    display: inline !important;
    visibility: visible !important;
    color: #0E0E0E !important;
}

.tornex-chevron {
    transition: transform var(--tornex-transition);
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.tornex-chevron svg {
    stroke: var(--tornex-noir-titres);
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#tornex-offcanvas .tornex-chevron svg {
    stroke: #0E0E0E !important;
    display: block !important;
    visibility: visible !important;
}

.tornex-menu-toggle[aria-expanded="true"] .tornex-chevron {
    transform: rotate(180deg);
}

/* Lien de menu simple */
.tornex-menu-link {
    display: block;
    padding: 16px 0;
    margin: 0;
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 120%;
    color: var(--tornex-noir-titres) !important;
    text-decoration: none;
    transition: transform var(--tornex-transition);
    background: transparent;
    letter-spacing: normal;
    text-transform: none;
}

#tornex-offcanvas .tornex-menu-link {
    padding: 16px 0 !important;
    margin: 0 !important;
}

.tornex-menu-link:hover,
.tornex-menu-link:focus {
    transform: translateX(4px);
    color: var(--tornex-noir-titres) !important;
}

/* ==========================================================================
   Sous-menus (Accordéon)
   ========================================================================== */
.tornex-submenu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    display: block !important;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
    background-color: var(--tornex-jaune);
}

#tornex-offcanvas .tornex-submenu,
#tornex-offcanvas ul.tornex-submenu {
    max-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.tornex-submenu.is-open {
    max-height: 500px !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 0 16px 16px !important;
    overflow: visible !important;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
}

#tornex-offcanvas .tornex-submenu.is-open,
#tornex-offcanvas ul.tornex-submenu.is-open {
    max-height: 500px !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 0 16px 16px !important;
    overflow: visible !important;
}

/* Items dans les sous-menus */
.tornex-submenu .tornex-submenu-item,
.tornex-submenu .tornex-menu-item {
    display: block !important;
    visibility: inherit !important;
    opacity: 1 !important;
}

.tornex-submenu.is-open .tornex-submenu-item,
.tornex-submenu.is-open .tornex-menu-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Liens dans les sous-menus */
.tornex-submenu .tornex-menu-link,
#tornex-offcanvas .tornex-submenu .tornex-menu-link {
    display: block !important;
    visibility: inherit !important;
    opacity: 1 !important;
    color: var(--tornex-textes) !important;
}

.tornex-submenu-item {
    border-bottom: none !important;
    background-color: var(--tornex-jaune);
}

.tornex-submenu-item .tornex-menu-link {
    padding: 10px 0;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 120%;
    color: var(--tornex-textes) !important;
}

.tornex-submenu-item .tornex-menu-link:hover,
.tornex-submenu-item .tornex-menu-link:focus {
    color: var(--tornex-noir-titres) !important;
}

/* ==========================================================================
   Footer du menu (Compte)
   ========================================================================== */
.tornex-offcanvas-footer {
    flex-shrink: 0;
    padding: 20px;
    background-color: var(--tornex-noir-titres);
}

.tornex-account-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    text-decoration: none;
    color: var(--tornex-blanc);
}

.tornex-account-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(248, 248, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.tornex-account-icon svg {
    color: var(--tornex-blanc);
}

.tornex-account-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tornex-account-text {
    display: flex;
    flex-direction: column;
}

.tornex-account-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 120%;
    color: var(--tornex-blanc);
}

.tornex-account-subtitle {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 120%;
    color: rgba(248, 248, 248, 0.6);
}

.tornex-footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.tornex-footer-links a {
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 120%;
    color: rgba(248, 248, 248, 0.6);
    text-decoration: none;
    transition: color var(--tornex-transition);
}

.tornex-footer-links a:hover {
    color: var(--tornex-blanc);
}

/* ==========================================================================
   Animations d'entrée des items
   ========================================================================== */
.tornex-offcanvas.is-open .tornex-menu-item {
    animation: tornexSlideIn 0.4s ease-out backwards;
}

.tornex-offcanvas.is-open .tornex-menu-item:nth-child(1) { animation-delay: 0.05s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(2) { animation-delay: 0.1s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(3) { animation-delay: 0.15s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(4) { animation-delay: 0.2s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(5) { animation-delay: 0.25s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(6) { animation-delay: 0.3s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(7) { animation-delay: 0.35s; }
.tornex-offcanvas.is-open .tornex-menu-item:nth-child(8) { animation-delay: 0.4s; }

@keyframes tornexSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   Body lock when menu is open
   ========================================================================== */
body.tornex-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ==========================================================================
   Responsive - Masquer sur desktop si nécessaire
   ========================================================================== */
@media (min-width: 1024px) {
    .tornex-hamburger {
        /* Décommenter pour masquer sur desktop */
        /* display: none; */
    }
}

/* ==========================================================================
   Accessibilité - Focus states
   ========================================================================== */
.tornex-hamburger:focus-visible,
.tornex-menu-toggle:focus-visible,
.tornex-menu-link:focus-visible,
.tornex-account-link:focus-visible,
.tornex-footer-links a:focus-visible {
    outline: 2px solid var(--tornex-noir-titres);
    outline-offset: 2px;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .tornex-hamburger-line,
    .tornex-menu-overlay,
    .tornex-offcanvas,
    .tornex-chevron,
    .tornex-submenu,
    .tornex-menu-link,
    .tornex-view-all {
        transition: none;
    }
    
    .tornex-offcanvas.is-open .tornex-menu-item {
        animation: none;
    }
}

/* ==========================================================================
   Theme Override - Force TORNEX colors
   ========================================================================== */
#tornex-offcanvas,
#tornex-offcanvas * {
    box-sizing: border-box;
}

#tornex-offcanvas .tornex-mobile-nav,
#tornex-offcanvas .tornex-mobile-nav li,
#tornex-offcanvas .tornex-mobile-nav ul {
    background-color: var(--tornex-jaune) !important;
    background: var(--tornex-jaune) !important;
}

#tornex-offcanvas .tornex-menu-toggle,
#tornex-offcanvas .tornex-menu-link,
#tornex-offcanvas .tornex-menu-text {
    color: var(--tornex-noir-titres) !important;
    background: transparent !important;
    font-family: 'Oswald', sans-serif !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    line-height: 120% !important;
}

#tornex-offcanvas .tornex-submenu-item .tornex-menu-link {
    color: var(--tornex-textes) !important;
    font-family: 'Oswald', sans-serif !important;
    font-weight: 400 !important;
    font-size: 15px !important;
    line-height: 120% !important;
}

#tornex-offcanvas .tornex-submenu-item .tornex-menu-link:hover {
    color: var(--tornex-noir-titres) !important;
}

#tornex-hamburger,
.tornex-hamburger {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

#tornex-hamburger:hover,
#tornex-hamburger:focus,
#tornex-hamburger:active,
.tornex-hamburger:hover,
.tornex-hamburger:focus,
.tornex-hamburger:active {
    background: transparent !important;
    background-color: transparent !important;
}

#tornex-close,
.tornex-close {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#tornex-close:hover,
#tornex-close:focus {
    background: transparent !important;
}

/* ==========================================================================
   RESET BRUTAL - Override tous les styles du thème
   ========================================================================== */
#tornex-offcanvas button.tornex-menu-toggle,
nav#tornex-offcanvas button.tornex-menu-toggle {
    all: unset !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 16px 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-family: 'Oswald', sans-serif !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    line-height: 120% !important;
    color: #0E0E0E !important;
    box-sizing: border-box !important;
}

#tornex-offcanvas button#tornex-close,
#tornex-offcanvas button.tornex-close,
nav#tornex-offcanvas button.tornex-close,
button#tornex-close {
    all: unset !important;
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 100 !important;
}

#tornex-offcanvas button#tornex-close svg,
#tornex-offcanvas button.tornex-close svg,
button#tornex-close svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    stroke: #0E0E0E !important;
    visibility: visible !important;
    opacity: 1 !important;
}
