/* =============================================================
   INKADH — Header
   ============================================================= */

/* ── Base ── */
.inkadh-site-header {
    background: #1a1a1a;
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0 70px;
    gap: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    will-change: height;
    transition: height .38s cubic-bezier(.4, 0, .2, 1),
                box-shadow .38s cubic-bezier(.4, 0, .2, 1),
                background-color .38s cubic-bezier(.4, 0, .2, 1);
}

/* ── État compact au scroll (même design, moins de hauteur) ── */
body.inkadh-scrolled .inkadh-site-header {
    height: 66px;
    background: #171717;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
}

/* ── Logo ── */
.inkadh-header-logo {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.04em;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: auto;
    line-height: 1;
}

.inkadh-header-logo img {
    height: 72px;
    width: auto;
    display: block;
    transition: height .38s cubic-bezier(.4, 0, .2, 1);
}

/* Logo réduit mais parfaitement lisible en état compact */
body.inkadh-scrolled .inkadh-header-logo img { height: 50px; }

.inkadh-header-logo {
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.inkadh-header-logo:hover { color: #ffffff; transform: translateY(-1px); }
.inkadh-header-logo:active { transform: translateY(0); }

/* ── Navigation ── */
.inkadh-header-nav {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0 auto;
    padding: 0;
}

.inkadh-header-nav li { list-style: none; margin: 0; padding: 0; }

.inkadh-header-nav a {
    position: relative;
    display: inline-block;
    font-size: 1.05rem;
    font-weight: 400;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    transition: color .22s ease, opacity .15s ease;
}

/* Soulignement animé (GPU : transform scaleX) */
.inkadh-header-nav a::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.inkadh-header-nav a:hover { color: #c8d0ff; }
.inkadh-header-nav a:hover::before,
.inkadh-header-nav a:focus-visible::before { transform: scaleX(1); }
.inkadh-header-nav a:active { opacity: .75; }

.inkadh-header-nav .current-menu-item > a,
.inkadh-header-nav .current_page_item > a,
.inkadh-header-nav a.active {
    color: #2342F7;
    font-weight: 600;
}
.inkadh-header-nav .current-menu-item > a::before,
.inkadh-header-nav .current_page_item > a::before,
.inkadh-header-nav a.active::before { transform: scaleX(1); }

/* Chevron indicateur pour les éléments ayant un sous-menu */
.inkadh-header-nav .menu-item-has-children > a { padding-right: 16px; }
.inkadh-header-nav .menu-item-has-children > a::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 6px;
    height: 6px;
    margin-top: -4px;
    border-right: 1.7px solid currentColor;
    border-bottom: 1.7px solid currentColor;
    transform: rotate(45deg);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.inkadh-header-nav .menu-item-has-children:hover > a::after,
.inkadh-header-nav .menu-item-has-children:focus-within > a::after {
    transform: rotate(-135deg);
    margin-top: -1px;
}

/* ── Active parent when a child is active ── */
.inkadh-header-nav .current-menu-ancestor > a,
.inkadh-header-nav .current-menu-parent > a {
    color: #2342F7;
    font-weight: 600;
}

/* ── Dropdown — items with children ── */
.inkadh-header-nav .menu-item-has-children {
    position: relative;
}

/* ── Dropdown panel — card style ── */
.inkadh-header-nav .sub-menu {
    position: absolute;
    top: 100%; /* colle au bas du parent pour éviter le gap qui coupe le hover */
    left: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    min-width: 240px;
    padding: 18px 0 8px; /* padding-top = ancienne valeur du gap, garde le visuel */
    list-style: none;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity .26s cubic-bezier(.4, 0, .2, 1), transform .26s cubic-bezier(.4, 0, .2, 1);
    z-index: 10000;
}

/* Fade-in on hover / focus-within */
.inkadh-header-nav .menu-item-has-children:hover > .sub-menu,
.inkadh-header-nav .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Sub-menu list items */
.inkadh-header-nav .sub-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.inkadh-header-nav .sub-menu a {
    display: block;
    padding: 11px 22px;
    font-size: 0.9rem;
    font-weight: 400;
    color: #2b2b3d;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    border-left: 3px solid transparent;
    white-space: normal;
    line-height: 1.4;
}

.inkadh-header-nav .sub-menu a:hover {
    background: #f4f6ff;
    color: #2342F7;
    border-left-color: #2342F7;
}

/* Pas de soulignement animé dans le dropdown : l'accent vertical suffit */
.inkadh-header-nav .sub-menu a::before { display: none; }

/* Liens ancres (#) : désactiver le coloriage auto WordPress — le JS gère l'état actif */
.inkadh-header-nav .sub-menu .current-menu-item > a[href*="#"] {
    color: #2b2b3d;
    font-weight: 400;
    background: transparent;
    border-left-color: transparent;
}
/* Lien ancre actif via scroll-spy JS */
.inkadh-header-nav .sub-menu a.active,
.inkadh-header-nav .sub-menu .current-menu-item > a:not([href*="#"]) {
    color: #2342F7;
    font-weight: 600;
    background: #eef1ff;
    border-left-color: #2342F7;
    text-decoration: none;
}

/* ── Right actions ── */
.inkadh-header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Language toggle */
.inkadh-lang-toggle {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    letter-spacing: 0.03em;
    text-decoration: none;
    transition: color .2s ease, transform .18s ease;
    text-transform: uppercase;
    display: inline-block;
}

.inkadh-lang-toggle:hover { color: #c8d0ff; transform: translateY(-1px); }
.inkadh-lang-toggle:active { transform: translateY(0) scale(.94); }

/* Search button */
.inkadh-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    color: #ffffff;
    transition: color .2s ease, transform .2s cubic-bezier(.4, 0, .2, 1);
    line-height: 1;
}

.inkadh-search-btn:hover { color: #c8d0ff; transform: scale(1.12); }
.inkadh-search-btn:active { transform: scale(.9); }

.inkadh-search-btn svg {
    width: 25px;
    height: 25px;
}

/* Contact button */
.inkadh-btn-contact {
    background: #2342F7;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .22s ease, transform .2s cubic-bezier(.4, 0, .2, 1), box-shadow .22s ease;
    font-family: inherit;
    line-height: 1.4;
    box-shadow: 0 0 0 rgba(35, 66, 247, 0);
}

.inkadh-btn-contact:hover {
    background: #1a34d4;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(35, 66, 247, .32);
}
.inkadh-btn-contact:active { transform: translateY(0); box-shadow: 0 3px 10px rgba(35, 66, 247, .28); }

/* ── Hamburger ── */
.inkadh-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.inkadh-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

.inkadh-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.inkadh-hamburger.open span:nth-child(2) { opacity: 0; }
.inkadh-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav drawer ── */
.inkadh-mobile-nav {
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    padding: 6px 22px 26px;
    border-top: 1px solid rgba(255,255,255,0.08);
    position: fixed;
    top: 100px;
    left: 0;
    right: 0;
    z-index: 9998;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 44px rgba(0,0,0,.4);
    /* état fermé, animable (pas de display:none) */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-16px);
    pointer-events: none;
    transition: opacity .34s cubic-bezier(.4,0,.2,1),
                transform .34s cubic-bezier(.4,0,.2,1),
                visibility 0s linear .34s,
                top .38s cubic-bezier(.4,0,.2,1),
                max-height .38s cubic-bezier(.4,0,.2,1);
}

.inkadh-mobile-nav.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity .34s cubic-bezier(.4,0,.2,1),
                transform .34s cubic-bezier(.4,0,.2,1),
                visibility 0s,
                top .38s cubic-bezier(.4,0,.2,1),
                max-height .38s cubic-bezier(.4,0,.2,1);
}

/* Header compact → le drawer suit la nouvelle hauteur */
body.inkadh-scrolled .inkadh-mobile-nav {
    top: 66px;
    max-height: calc(100vh - 66px);
}

/* Bloque le défilement du fond quand le menu mobile est ouvert */
body.inkadh-menu-open { overflow: hidden; }

.inkadh-mobile-nav a {
    font-size: 0.98rem;
    font-weight: 400;
    color: #ffffff;
    text-decoration: none;
    padding: 15px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: color .2s ease;
    display: block;
    -webkit-tap-highlight-color: transparent;
}

.inkadh-mobile-nav a:last-child { border-bottom: none; }
.inkadh-mobile-nav a:active { color: #c8d0ff; }

.inkadh-mobile-nav .current-menu-item > a,
.inkadh-mobile-nav .current_page_item > a {
    color: #2342F7;
    font-weight: 600;
}

/* Apparition progressive des entrées (stagger) à l'ouverture */
.inkadh-mobile-nav > a,
.inkadh-mobile-nav > .inkadh-mobile-item-wrap {
    opacity: 0;
    transform: translateY(9px);
    transition: opacity .3s ease, transform .3s ease;
}
.inkadh-mobile-nav.open > a,
.inkadh-mobile-nav.open > .inkadh-mobile-item-wrap {
    opacity: 1;
    transform: translateY(0);
}
.inkadh-mobile-nav.open > *:nth-child(1) { transition-delay: .04s; }
.inkadh-mobile-nav.open > *:nth-child(2) { transition-delay: .08s; }
.inkadh-mobile-nav.open > *:nth-child(3) { transition-delay: .12s; }
.inkadh-mobile-nav.open > *:nth-child(4) { transition-delay: .16s; }
.inkadh-mobile-nav.open > *:nth-child(5) { transition-delay: .20s; }
.inkadh-mobile-nav.open > *:nth-child(6) { transition-delay: .24s; }
.inkadh-mobile-nav.open > *:nth-child(7) { transition-delay: .28s; }
.inkadh-mobile-nav.open > *:nth-child(8) { transition-delay: .32s; }

/* ── Mobile item with children ── */
.inkadh-mobile-item-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    transition: background .25s ease;
}

/* État ouvert clairement visible */
.inkadh-mobile-item-wrap.is-open {
    background: rgba(35,66,247,0.10);
}

.inkadh-mobile-item-wrap .inkadh-mobile-link {
    flex: 1;
    border-bottom: none;
    padding: 15px 10px;
}

.inkadh-mobile-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    padding: 12px 14px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s ease, background .2s ease;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}

.inkadh-mobile-toggle:hover { color: #ffffff; }
.inkadh-mobile-toggle:active { background: rgba(255,255,255,0.08); }
.inkadh-mobile-item-wrap.is-open .inkadh-mobile-toggle { color: #396AFC; }

.inkadh-mobile-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform .34s cubic-bezier(.4,0,.2,1);
}

.inkadh-mobile-toggle[aria-expanded="true"] svg {
    transform: rotate(-180deg);
}

/* Accordion panel — hauteur pilotée en JS (max-height = scrollHeight) */
.inkadh-mobile-submenu {
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height .36s cubic-bezier(.4,0,.2,1);
}

.inkadh-mobile-sublink {
    display: block;
    padding: 13px 0 13px 20px;
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: color .2s ease, padding-left .2s ease;
    border-left: 2px solid rgba(35,66,247,0.35);
    margin-left: 6px;
}

.inkadh-mobile-sublink:hover,
.inkadh-mobile-sublink:active { color: #ffffff; padding-left: 26px; }
.inkadh-mobile-sublink.current-menu-item { color: #2342F7; font-weight: 600; }

/* ── RTL overrides (Arabic) ── */
/* Logo collé à droite, actions collées à gauche, nav parfaitement centré.
   On sort le nav du flux (position:absolute) pour un centrage exact quelle
   que soit la largeur du logo / des actions. */
[dir="rtl"] .inkadh-site-header {
    justify-content: space-between;
}

[dir="rtl"] .inkadh-header-logo {
    margin: 0;              /* annule le margin-right:auto du mode LTR */
}

[dir="rtl"] .inkadh-header-actions {
    margin: 0;              /* annule le margin-left:auto du mode LTR */
}

[dir="rtl"] .inkadh-header-nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

/* En dessous de 768px le nav desktop est masqué → on rétablit le flux normal */
@media (max-width: 768px) {
    [dir="rtl"] .inkadh-header-nav { position: static; transform: none; }
}

/* Sous-menu : s'ouvre depuis la droite en RTL */
[dir="rtl"] .inkadh-header-nav .sub-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] .inkadh-header-nav .sub-menu a {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .inkadh-header-nav .sub-menu a:hover {
    border-right-color: #2342F7;
}

[dir="rtl"] .inkadh-header-nav .sub-menu a.active,
[dir="rtl"] .inkadh-header-nav .sub-menu .current-menu-item > a:not([href*="#"]) {
    border-right-color: #2342F7;
}

/* Mobile sub-liens : accent à droite en RTL */
[dir="rtl"] .inkadh-mobile-sublink {
    border-left: none;
    border-right: 2px solid rgba(35,66,247,0.35);
    padding-left: 0;
    padding-right: 20px;
    margin-left: 0;
    margin-right: 6px;
}

[dir="rtl"] .inkadh-mobile-sublink:hover,
[dir="rtl"] .inkadh-mobile-sublink:active {
    padding-left: 0;
    padding-right: 26px;
}

/* Chevron du parent (desktop) : à gauche en RTL */
[dir="rtl"] .inkadh-header-nav .menu-item-has-children > a {
    padding-right: 0;
    padding-left: 16px;
}
[dir="rtl"] .inkadh-header-nav .menu-item-has-children > a::after {
    right: auto;
    left: 0;
}

/* Soulignement animé : origine à droite en RTL */
[dir="rtl"] .inkadh-header-nav a::before { transform-origin: right center; }

/* ── Admin bar : décale le header fixe de la hauteur de la barre WP ── */
body.admin-bar .inkadh-site-header { top: 32px; }
body.admin-bar .inkadh-mobile-nav  { top: 132px; }
/* Barre admin + header compact : le drawer suit (32px + 66px) */
body.admin-bar.inkadh-scrolled .inkadh-mobile-nav { top: 98px; max-height: calc(100vh - 98px); }
@media screen and (max-width: 782px) {
    body.admin-bar .inkadh-site-header { top: 46px; }
    body.admin-bar .inkadh-mobile-nav  { top: 146px; }
    body.admin-bar.inkadh-scrolled .inkadh-mobile-nav { top: 112px; max-height: calc(100vh - 112px); }
}

/* ── Remove old Bootstrap/theme header styles when new header is active ── */
.inkadh-site-header ~ * .navbar,
body:has(.inkadh-site-header) #header.navbar {
    display: none;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .inkadh-site-header { padding: 0 40px; }
    .inkadh-header-nav { gap: 24px; }
}

@media (max-width: 768px) {
    .inkadh-site-header { padding: 0 24px; }
    .inkadh-header-nav { display: none; }
    .inkadh-hamburger { display: flex; }
}

@media (max-width: 480px) {
    .inkadh-site-header { padding: 0 16px; }
    .inkadh-header-actions { gap: 12px; }
    .inkadh-btn-contact { padding: 6px 14px; font-size: 0.68rem; }
}

/* ── Accessibilité : réduire les animations si l'utilisateur le demande ── */
@media (prefers-reduced-motion: reduce) {
    .inkadh-site-header,
    .inkadh-header-logo img,
    .inkadh-header-nav a,
    .inkadh-header-nav a::before,
    .inkadh-header-nav .menu-item-has-children > a::after,
    .inkadh-header-nav .sub-menu,
    .inkadh-btn-contact,
    .inkadh-search-btn,
    .inkadh-lang-toggle,
    .inkadh-mobile-nav,
    .inkadh-mobile-nav > a,
    .inkadh-mobile-nav > .inkadh-mobile-item-wrap,
    .inkadh-mobile-submenu,
    .inkadh-mobile-toggle svg {
        transition-duration: .01ms !important;
    }
}
