/**
 * Stiv Media — header : barre principale, méga-menu et panneau mobile.
 * Les couleurs sont volontairement isolées de la palette --g410-* du reste du site.
 */

.stiv-header {
    --stiv-navy: #0B1030;
    --stiv-blue: #2B49E8;
    --stiv-pink: #E5177B;
    --stiv-body: #3A3F5C;
    --stiv-muted: #6B6F8C;
    --stiv-faint: #8A8FAB;
    --stiv-line: #DFE1EE;
    --stiv-line-soft: #ECEDF5;
    --stiv-line-card: #E4E6F2;
    --stiv-surface: #F3F4FB;
    --stiv-surface-2: #F7F8FD;
    --stiv-surface-3: #F0F1F8;
    --stiv-bar-h: 76px;

    position: sticky;
    top: 0;
    z-index: 500;
    background: #fff;
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
    color: var(--stiv-navy);
}

.stiv-header *,
.stiv-header *::before,
.stiv-header *::after {
    box-sizing: border-box;
}

/* Les panneaux sont pilotes par l'attribut [hidden] : il doit l'emporter sur
   les `display` declares plus bas (flex, grid...), sinon ils restent ouverts. */
.stiv-header [hidden] {
    display: none !important;
}

/* Entrees de menu sans destination reelle (URL vide ou #) : rendues en <span>,
   elles ne doivent pas suggerer qu'on peut cliquer. */
.stiv-header .is-static {
    cursor: default;
}

.stiv-header__shell {
    position: relative;
}

.stiv-header__bar {
    background: #fff;
    border-bottom: 1px solid var(--stiv-line-soft);
    transition: box-shadow .18s ease, border-color .18s ease;
}

.stiv-header__inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 20px;
    min-height: var(--stiv-bar-h);
    max-width: 1400px;
    margin: 0 auto;
    transition: min-height .18s ease, padding .18s ease;
}

/* ---------- Logo ---------- */

.stiv-header__brand {
    display: flex;
    align-items: center;
    flex: none;
}

.stiv-header__brand .custom-logo-link,
.stiv-header__brand .stiv-logo-text {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.stiv-header__brand .custom-logo {
    display: block;
    width: auto;
    height: auto;
    max-height: 44px;
    transition: max-height .18s ease;
}

.stiv-logo-text__main {
    font-family: 'Archivo', system-ui, sans-serif;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -.02em;
    color: var(--stiv-navy);
}

/* ---------- Navigation ---------- */

.stiv-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1 1 240px;
    min-width: 0;
}

.stiv-nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    color: var(--stiv-navy);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease;
}

.stiv-nav__link:not(.is-static):hover,
.stiv-nav__link:not(.is-static):focus-visible,
.stiv-nav__toggle[aria-expanded="true"] {
    background: var(--stiv-surface);
    color: var(--stiv-navy);
}

.stiv-nav__link[aria-current="page"] {
    color: var(--stiv-blue);
}

.stiv-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--stiv-faint);
    transition: transform .18s ease;
}

.stiv-nav__toggle[aria-expanded="true"] .stiv-caret,
.stiv-lang__toggle[aria-expanded="true"] .stiv-caret {
    transform: rotate(180deg);
}

/* ---------- Actions à droite ---------- */

.stiv-header__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 0 auto;
}

.stiv-header__ghost {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
    color: var(--stiv-body);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease;
}

.stiv-header__ghost:not(.is-static):hover,
.stiv-header__ghost:not(.is-static):focus-visible {
    color: var(--stiv-navy);
}

.stiv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.stiv-btn--navy {
    background: var(--stiv-navy);
    color: #fff;
}

.stiv-btn--navy:not(.is-static):hover,
.stiv-btn--navy:not(.is-static):focus-visible {
    background: var(--stiv-pink);
    color: #fff;
}

.stiv-btn--pink {
    background: var(--stiv-pink);
    color: #fff;
}

.stiv-btn--pink:not(.is-static):hover,
.stiv-btn--pink:not(.is-static):focus-visible {
    background: var(--stiv-navy);
    color: #fff;
}

.stiv-btn--sm {
    padding: 9px 13px;
    border-radius: 8px;
    font-size: 13px;
}

/* ---------- Sélecteur de langue ---------- */

.stiv-lang {
    position: relative;
}

.stiv-lang__toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--stiv-line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--stiv-body);
    cursor: pointer;
    transition: border-color .15s ease;
}

.stiv-lang__toggle:hover,
.stiv-lang__toggle:focus-visible {
    border-color: #B9BDD4;
}

.stiv-lang__flag {
    font-size: 14px;
    line-height: 1;
}

.stiv-lang__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-width: 150px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--stiv-line);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(11, 16, 48, .13);
}

.stiv-lang__option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--stiv-body);
    text-decoration: none;
}

.stiv-lang__option:hover,
.stiv-lang__option:focus-visible {
    background: var(--stiv-surface);
    color: var(--stiv-navy);
}

.stiv-lang__option.is-current {
    background: var(--stiv-surface);
    color: var(--stiv-navy);
    font-weight: 600;
}

/* ---------- Méga-menu ---------- */

.stiv-eyebrow {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--stiv-faint);
}

.stiv-mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--stiv-line);
    box-shadow: 0 22px 44px rgba(11, 16, 48, .13);
}

.stiv-mega__inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 28px;
    padding: 30px 20px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.stiv-mega__col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stiv-mega__col--promo {
    gap: 16px;
}

.stiv-mega__cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stiv-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.stiv-card:not(.is-static):hover,
.stiv-card:not(.is-static):focus-visible {
    background: var(--stiv-surface-2);
    border-color: var(--stiv-line-card);
}

.stiv-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 9px;
    background: var(--stiv-card-fill, var(--stiv-surface-3));
    color: #fff;
    font-size: 18px;
    line-height: 1;
}

.stiv-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.stiv-card__title {
    font-family: 'Archivo', system-ui, sans-serif;
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.25;
    color: var(--stiv-navy);
}

.stiv-card__desc {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--stiv-muted);
}

.stiv-mega__links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stiv-mega__link {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--stiv-body);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.stiv-mega__link:not(.is-static):hover,
.stiv-mega__link:not(.is-static):focus-visible {
    background: var(--stiv-surface-2);
    color: var(--stiv-navy);
}

/* Encarts promotionnels */

.stiv-promo {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px;
    border: 1px solid var(--stiv-line);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .15s ease;
}

.stiv-promo:not(.is-static):hover,
.stiv-promo:not(.is-static):focus-visible {
    border-color: var(--stiv-navy);
}

.stiv-promo--dark {
    gap: 10px;
    padding: 22px;
    border: 0;
    background: var(--stiv-navy);
}

.stiv-promo__title {
    font-family: 'Archivo', system-ui, sans-serif;
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.3;
    color: var(--stiv-navy);
}

.stiv-promo--dark .stiv-promo__title {
    font-size: 16px;
    color: #fff;
}

.stiv-promo__desc {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--stiv-muted);
}

.stiv-promo--dark .stiv-promo__desc {
    font-size: 13px;
    line-height: 1.5;
    color: #B6BAD2;
}

.stiv-promo__btn {
    align-self: flex-start;
    margin-top: 4px;
    padding: 9px 15px;
    border-radius: 8px;
    background: var(--stiv-pink);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.stiv-promo__btn:not(.is-static):hover,
.stiv-promo__btn:not(.is-static):focus-visible {
    background: #fff;
    color: var(--stiv-navy);
}

/* ---------- État compact (après 80 px de défilement) ---------- */

.stiv-header.is-compact .stiv-header__bar {
    border-bottom-color: var(--stiv-line-card);
    box-shadow: 0 6px 18px rgba(11, 16, 48, .07);
}

.stiv-header.is-compact .stiv-header__inner {
    min-height: 56px;
    padding: 8px 14px;
}

.stiv-header.is-compact .stiv-header__brand .custom-logo {
    max-height: 32px;
}

.stiv-header.is-compact .stiv-logo-text__main {
    font-size: 17px;
}

.stiv-header.is-compact .stiv-nav__link {
    padding: 7px 9px;
    font-size: 14px;
}

.stiv-header.is-compact .stiv-btn {
    padding: 8px 14px;
    font-size: 13px;
}

.stiv-header.is-compact .stiv-header__ghost {
    padding: 7px 10px;
    font-size: 13px;
}

/* ---------- Bouton menu + panneau mobile ---------- */

.stiv-header__mobile {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.stiv-burger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--stiv-line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.stiv-burger__bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--stiv-navy);
    transition: transform .18s ease, opacity .18s ease;
}

.stiv-burger[aria-expanded="true"] .stiv-burger__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.stiv-burger[aria-expanded="true"] .stiv-burger__bar:nth-child(2) {
    opacity: 0;
}

.stiv-burger[aria-expanded="true"] .stiv-burger__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.stiv-drawer {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 62px);
    overflow-y: auto;
    background: #fff;
    border-bottom: 1px solid var(--stiv-line);
}

.stiv-drawer__langs {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--stiv-line-soft);
}

.stiv-drawer__lang {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--stiv-line);
    border-radius: 9px;
    font-weight: 600;
    font-size: 14px;
    color: var(--stiv-body);
    text-align: center;
    text-decoration: none;
}

.stiv-drawer__lang.is-current {
    border-color: transparent;
    background: var(--stiv-navy);
    color: #fff;
    font-weight: 700;
}

.stiv-drawer__label {
    padding: 18px 16px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--stiv-faint);
}

.stiv-drawer__cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

.stiv-drawer__card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid var(--stiv-line-card);
    border-radius: 11px;
    text-decoration: none;
}

.stiv-drawer__card .stiv-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 15px;
}

.stiv-drawer__card .stiv-card__title {
    font-size: 15px;
}

.stiv-drawer__card .stiv-card__desc {
    font-size: 12.5px;
    line-height: 1.35;
}

.stiv-drawer__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px;
}

.stiv-drawer__chip {
    padding: 11px 14px;
    border-radius: 100px;
    background: var(--stiv-surface);
    font-size: 14px;
    font-weight: 600;
    color: var(--stiv-body);
    text-decoration: none;
}

.stiv-drawer__rows {
    display: flex;
    flex-direction: column;
    padding: 20px 16px 0;
}

.stiv-drawer__row {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-top: 1px solid var(--stiv-line-soft);
    font-size: 16px;
    font-weight: 600;
    color: var(--stiv-navy);
    text-decoration: none;
}

.stiv-drawer__row:last-child {
    border-bottom: 1px solid var(--stiv-line-soft);
}

.stiv-drawer__cta {
    padding: 18px 16px 22px;
}

.stiv-drawer__cta .stiv-btn {
    width: 100%;
    min-height: 52px;
    border-radius: 11px;
    font-size: 16px;
}

/* ---------- Bascule desktop / mobile ---------- */

@media (max-width: 1024px) {
    /* Sur mobile le header n'est pas collant : le panneau doit pousser le contenu. */
    .stiv-header {
        position: relative;
        --stiv-bar-h: 62px;
    }

    .stiv-header__inner {
        flex-wrap: nowrap;
        gap: 12px;
        padding: 0 16px;
    }

    .stiv-header .stiv-nav,
    .stiv-header .stiv-header__actions,
    .stiv-header .stiv-mega {
        display: none;
    }

    .stiv-header__mobile {
        display: flex;
    }

    .stiv-header.is-compact .stiv-header__inner {
        min-height: 62px;
        padding: 0 16px;
    }

    .stiv-header.is-compact .stiv-header__brand .custom-logo {
        max-height: 40px;
    }
}

@media (min-width: 1025px) {
    .stiv-header .stiv-drawer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stiv-header *,
    .stiv-drawer * {
        transition: none !important;
    }
}
