/* ══ HEADER SD INGÉNIERIE ══════════════════════════════════════
   Desktop/Tablette : top-bar-1 (34px) + top-bar-2 (84px) = 118px
   Mobile : top-bar-2 seule (70px) + sk-nav-dropdown overlay
═══════════════════════════════════════════════════════════════ */

#top-header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 118px;
    padding: 0;
}

#top-header.scrolled {
    box-shadow: 0 4px 28px rgba(13, 29, 45, .18);
}

/* ── Barre 1 : téléphone + LinkedIn ── */
#top-header .top-bar-1 {
    height: 34px;
}

#top-header .top-bar-1 a:hover {
    color: #ffffff !important;
}

/* ── Barre principale marine ── */
#top-header .top-bar-2 {
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 37, 79, .97);
    backdrop-filter: blur(16px);
    transition: box-shadow .3s;
    border-bottom: 2px solid rgba(0, 166, 180, .2) !important;
}

#top-header .top-bar-2 .wp-block-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
}

/* ── Logo ── */
#top-header .sk-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
}

#top-header .sk-logo img {
    height: 76px;
    width: auto;
}

/* ══ NAVIGATION PRINCIPALE (skuria/primary-nav) ════════════════
   Rendu via wp_nav_menu() + Skuria_Walker_Nav_Menu.
   HTML : nav#sk-nav-dropdown.sk-nav-wrapper > ul.sk-nav > li.menu-item(.sub-menu)
          button.sk-menu-toggle
   Un seul <ul.sk-nav> rendu côté serveur : .sk-nav-wrapper est la barre
   horizontale en desktop, et devient l'overlay dropdown mobile via la
   classe .is-open (voir @media max-width:768px plus bas).
═══════════════════════════════════════════════════════════════ */

/* Wrapper : prend tout l'espace entre logo et CTA */
#top-header .sk-nav-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Liste principale (niveau 1) ── */
#top-header .sk-nav {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .15rem !important;
}

/* Items niveau 1 : hauteur = top-bar-2 → top:100% positionne
   le dropdown juste sous la barre blanche                       */
#top-header .sk-nav > li {
    display: flex;
    align-items: center;
    position: relative;
    height: 70px;
}

/* Liens niveau 1 — texte clair sur fond marine */
#top-header .sk-nav > li > a {
    display: flex;
    align-items: center;
    gap: .28rem;
    padding: .45rem .85rem;
    border-radius: .5rem;
    font-size: .88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .88) !important;   /* écrase a{color:var(--sk-pk)} du global */
    text-decoration: none !important;
    transition: all .2s ease;
    font-family: var(--sk-font-body);
    white-space: nowrap;
}

/* Hover niveau 1 */
#top-header .sk-nav > li:hover > a {
    color: #ffffff !important;
    background: rgba(0, 166, 180, .22) !important;
}

/* Items actifs (page courante / ancêtre de la page courante) */
#top-header .sk-nav > li.current-menu-item > a,
#top-header .sk-nav > li.current-menu-parent > a,
#top-header .sk-nav > li.current-menu-ancestor > a,
#top-header .sk-nav > li.current-page-ancestor > a {
    color: #ffffff !important;
    background: rgba(0, 166, 180, .22) !important;
}

/* Chevron bas ↓ niveau 1 */
#top-header .sk-nav > li.menu-item-has-children > a .sub-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    transition: transform .3s ease;
    flex-shrink: 0;
}

#top-header .sk-nav > li.menu-item-has-children:hover > a .sub-arrow {
    transform: rotate(180deg);
}

/* ══ SOUS-MENUS — styles communs à TOUS les niveaux ══════════ */

#top-header .sk-nav .sub-menu {
    position: absolute;
    z-index: 300;
    /* Visibility-based toggle : permet la transition-delay (grace period souris) */
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Délai 250 ms avant fermeture → laisse le temps d'atteindre le sous-menu */
    transition: opacity .18s ease 250ms, visibility 0s linear 430ms;
    list-style: none;
    margin: 0;
    background: white;
    padding: .6rem;
    min-width: 280px;
    width: max-content;
    max-width: 520px;
    border-radius: var(--sk-r);
    border: 1px solid var(--sk-bd);
    box-shadow: 0 16px 48px rgba(13, 29, 45, .12);
}

/* Affichage au survol pour tous les niveaux */
#top-header .sk-nav li.menu-item-has-children:hover > .sub-menu,
#top-header .sk-nav li.menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* Apparition immédiate sans délai */
    transition: opacity .15s ease 0ms, visibility 0s linear 0ms;
}

/* Niveau 1 → dropdown sous la barre */
#top-header .sk-nav > li > .sub-menu {
    top: 100%;
    left: 0;
}

/* Niveau 2+ → flyout vers la droite */
#top-header .sk-nav .sub-menu .sub-menu {
    top: -0.6rem;      /* compense le padding du conteneur parent */
    left: calc(100% + .4rem);
    max-width: 400px;
}

/* Items dans les sous-menus */
#top-header .sk-nav .sub-menu li {
    display: block;
    position: relative;
}

/* ── Liens dans les sous-menus (tous niveaux) ── */
#top-header .sk-nav .sub-menu a {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: .7rem .8rem !important;
    border-radius: .6rem !important;
    color: var(--sk-nv) !important;
    text-decoration: none !important;
    font-size: .84rem;
    font-family: var(--sk-font-body);
    transition: background .15s, color .15s;
}

/* Hover sous-menu (tous niveaux) */
#top-header .sk-nav .sub-menu a:hover {
    background: var(--sk-pk-a) !important;
    color: var(--sk-pk) !important;
}

/* Item actif dans les sous-menus (page en cours) */
#top-header .sk-nav .sub-menu li.current-menu-item > a,
#top-header .sk-nav .sub-menu li.current-page-ancestor > a,
#top-header .sk-nav .sub-menu li.current-menu-ancestor > a {
    background: var(--sk-pk-a) !important;
    color: var(--sk-pk) !important;
    font-weight: 600 !important;
}

/* ── Icône emoji ── */
#top-header .sk-nav .sub-menu a em {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 9px !important;
    background: var(--sk-pk-a) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    font-style: normal !important;
    font-size: 1rem;
    transition: background .15s;
}

#top-header .sk-nav .sub-menu a:hover em {
    background: rgba(0, 166, 180, .14) !important;
}

/* ── Texte sur 2 lignes (span + small) ──
   :not(.sub-arrow) pour ne pas écraser le chevron → */
#top-header .sk-nav .sub-menu a span:not(.sub-arrow) {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 1;
}

#top-header .sk-nav .sub-menu a small {
    display: block !important;
    font-size: .75rem !important;
    font-weight: 400 !important;
    opacity: .65 !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
}

/* ── Chevron droit → niveau 2+ (items avec enfants) ── */
#top-header .sk-nav .sub-menu li.menu-item-has-children > a .sub-arrow--right {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
    flex: 0 0 auto !important;   /* ne pas laisser flex:1 du span l'écraser */
    opacity: .45;
    transition: opacity .2s;
}

#top-header .sk-nav .sub-menu li.menu-item-has-children:hover > a .sub-arrow--right {
    opacity: 1;
}

/* Niveau 2+ : pas d'emoji → liens plus compacts */
#top-header .sk-nav .sub-menu .sub-menu a {
    padding: .6rem .8rem !important;
    gap: 8px !important;
    font-size: .82rem;
}

/* ── CTA Bouton header ── */
#top-header .sk-header-cta {
    flex-shrink: 0;
    margin: 0 !important;
}

/* ── HAMBURGER ── */
#top-header .sk-menu-toggle {
    display: none;
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #ffffff;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#top-header .sk-menu-toggle svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* ══ MOBILE — ≤768px ══════════════════════════════════════════
   .sk-nav-wrapper (même <ul.sk-nav> qu'en desktop) devient l'overlay
   dropdown via .is-open, ajoutée par menu-mobile.js sur clic hamburger.
   Sélecteurs préfixés #top-header pour garantir la priorité sur les
   règles desktop non scopées (flex-direction: row, etc.) plus haut.
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    body { overflow-x: hidden; }

    #top-header {
        position: relative !important;
        height: 70px !important;
    }

    #top-header .top-bar-1 {
        display: none !important;
    }

    #top-header .top-bar-2 {
        height: 70px;
    }

    #top-header .sk-logo img {
        height: 62px;
    }

    /* Le CTA "Devis" reste accessible sur toutes les résolutions (CDC 4.5.1) ;
       seul le bouton secondaire "Contact" est masqué pour laisser la place
       au hamburger, l'action contact restant disponible dans le menu. */
    #top-header .sk-header-cta-secondary {
        display: none !important;
    }

    #top-header .sk-header-cta {
        margin-left: auto;
    }

    /* Cache la nav par défaut, montre le hamburger */
    #top-header .sk-nav-wrapper {
        display: none;
    }

    #top-header .sk-menu-toggle {
        display: flex !important;
    }

    /* Ouverte : devient l'overlay dropdown plein écran */
    #top-header .sk-nav-wrapper.is-open {
        display: block;
        position: fixed;
        top: 70px; /* hauteur top-bar-2 sur mobile */
        left: 0;
        right: 0;
        background: #ffffff;
        z-index: 999;
        overflow-y: auto;
        max-height: calc(100vh - 70px);
        box-shadow: 0 8px 32px rgba(13, 29, 45, .13);
    }

    /* Menu mobile : liste plate */
    #top-header .sk-nav-wrapper .sk-nav {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        padding: 0.5rem 0;
    }

    #top-header .sk-nav-wrapper .sk-nav .menu-item {
        display: block;
        height: auto;
        position: static;
    }

    #top-header .sk-nav-wrapper .sk-nav .menu-item > a {
        display: flex !important;
        align-items: center;
        padding: 14px 24px !important;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--sk-nv) !important;
        text-decoration: none !important;
        border-bottom: 1px solid var(--sk-bd);
        gap: 0 !important;
    }

    #top-header .sk-nav-wrapper .sk-nav > .menu-item:last-child > a {
        border-bottom: none;
    }

    /* Mobile : masquer emoji et descriptions */
    #top-header .sk-nav-wrapper .sk-nav a em,
    #top-header .sk-nav-wrapper .sk-nav a small,
    #top-header .sk-nav-wrapper .sk-nav a .sub-arrow {
        display: none !important;
    }

    /* Mobile : sous-menus en liste indentée */
    #top-header .sk-nav-wrapper .sk-nav .sub-menu {
        position: static;
        display: block;
        /* Reset des états visibility/opacity du desktop */
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: none;
        padding: 0;
        margin: 0;
        background: var(--sk-bg);
        box-shadow: none;
        border: none;
        border-radius: 0;
        max-width: none;
        width: 100%;
    }

    #top-header .sk-nav-wrapper .sk-nav .sub-menu .menu-item > a {
        padding: 12px 24px 12px 44px !important;
        font-size: 0.88rem !important;
        font-weight: 400 !important;
        color: var(--sk-mu) !important;
        border-bottom: 1px solid rgba(13, 29, 45, .05) !important;
    }

    #top-header .sk-nav-wrapper .sk-nav .sub-menu .menu-item:last-child > a {
        border-bottom: none !important;
    }

    /* Mobile : sous-sous-menus encore plus indentés */
    #top-header .sk-nav-wrapper .sk-nav .sub-menu .sub-menu .menu-item > a {
        padding-left: 64px !important;
    }

    #top-header .sk-nav-wrapper .sk-nav .sub-menu .sub-menu .sub-menu .menu-item > a {
        padding-left: 84px !important;
    }
}

@media (min-width: 769px) {
    #top-header .sk-menu-toggle {
        display: none !important;
    }
}

/* ══ TABLET — ≤1024px ═════════════════════════════════════════ */
@media (max-width: 1024px) {
    #top-header .sk-header-cta-secondary {
        display: none !important;
    }
}

/* ══ BARRE ADMIN WORDPRESS ════════════════════════════════════ */
body.admin-bar #top-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar #top-header {
        top: 46px;
    }
}

/* ══ FOOTER SKURIA ════════════════════════════════════════════ */

#sk-footer {
    background: var(--sk-nv);
    color: rgba(255, 255, 255, .7);
    padding: 3.5rem 0 1.5rem;
}

@media (max-width: 768px) {
    #sk-footer {
        padding: 3rem 0 1.5rem;
    }
}

/* Logo + description */
.sk-footer-brand .sk-footer-logo img {
    max-height: 36px;
    width: auto;
    margin-bottom: 1rem;
}

.sk-footer-brand p {
    font-size: .82rem;
    color: rgba(255, 255, 255, .5);
    line-height: 1.7;
    max-width: 260px;
    margin-bottom: 1.2rem;
}

/* Colonne Contact : zones tactiles suffisantes (taille + espacement) */
.sk-footer-col--contact p {
    margin: 0 0 .6rem;
}

.sk-footer-col--contact p:last-of-type {
    margin-bottom: 0;
}

.sk-footer-col--contact p a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: .25rem 0;
}

/* Colonne de liens */
.sk-footer-col h4 {
    font-family: var(--sk-font-title);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .9);
    margin: 0 0 1rem;
}

.sk-footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.sk-footer-col ul li a {
    font-size: .82rem;
    color: rgba(255, 255, 255, .52);
    text-decoration: none;
    transition: color .2s;
}

.sk-footer-col ul li a:hover {
    color: rgba(255, 255, 255, .9);
}

/* Social links */
.sk-footer-social {
    display: flex;
    gap: .65rem;
    margin-top: .8rem;
}

.sk-footer-social .wp-block-social-link {
    list-style: none;
}

.sk-footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .6);
    text-decoration: none;
    transition: background .2s, color .2s;
    font-size: .9rem;
}

.sk-footer-social a:hover {
    background: var(--sk-pk);
    color: #fff;
}

/* wp-block-library est désactivé : ces règles compensent les styles manquants */
.sk-footer-social svg {
    fill: currentColor;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.wp-block-social-link-label.screen-reader-text {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {

    .sk-footer-brand {
        grid-column: 1 / -1;
    }
}
