/* =============================================================================
   BWA Hero Banner
   Optimisé : PageSpeed · Accessibilité (WCAG 2.1 AA) · SEO
   ============================================================================= */

/* ── Section ──────────────────────────────────────────────────────────────── */

.bwa-hero-banner {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    border-radius: 0;
    padding: clamp(110px, 11vh, 146px) clamp(18px, 3vw, 44px) clamp(30px, 5vh, 58px);
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;

    /* Couleur de fond : visible pendant le chargement de la vidéo
       et pour les utilisateurs avec prefers-reduced-motion           */
    background-color: #071828;

    /* Dégradés de lisibilité superposés au-dessus de la vidéo */
    background-image:
        radial-gradient(120% 140% at 2% 0%, rgba(4, 34, 66, 0.72) 0%, rgba(4, 34, 66, 0.25) 42%, rgba(4, 34, 66, 0) 72%),
        linear-gradient(180deg, rgba(7, 15, 24, 0.66) 0%, rgba(7, 15, 24, 0.28) 36%, rgba(7, 15, 24, 0.6) 100%);
}

/* ── Vidéo de fond ────────────────────────────────────────────────────────── */

.bwa-hero-banner__video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;

    /* Améliore le rendu GPU */
    will-change: auto;
    transform: translateZ(0);
}

/* ── Image de fond (fallback quand pas de vidéo) ──────────────────────── */

.bwa-hero-banner__bg-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
}

/* Sans vidéo mobile dédiée : sur petit écran on affiche l'image de couverture
   plutôt que la vidéo desktop (souvent très large) rognée à l'excès.        */
.bwa-hero-banner__bg-image--mobile-fallback {
    display: none;
}

@media (max-width: 767px) {
    .bwa-hero-banner__video--no-mobile-source {
        display: none;
    }

    .bwa-hero-banner__bg-image--mobile-fallback {
        display: block;
    }
}

/* Respecte la préférence utilisateur "réduire les animations" :
   on masque la vidéo — la couleur de fond #071828 assure le visuel  */
@media (prefers-reduced-motion: reduce) {
    .bwa-hero-banner__video {
        display: none;
    }
}

/* ── Overlay de couleur (z-index: -1, entre vidéo et contenu) ─────────────── */

.bwa-hero-banner__overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background-image:
        radial-gradient(95% 120% at 100% 100%, rgba(2, 162, 214, 0.22) 0%, rgba(2, 162, 214, 0) 55%),
        radial-gradient(120% 160% at 0% 100%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 62%);
}

/* ── Inner : eyebrow + titre + sous-titre ─────────────────────────────────── */

.bwa-hero-banner__inner {
    text-align: center;
    width: min(100%, 1062px);
    display: grid;
    gap: 18px;
    justify-items: center;
    margin-top: clamp(20px, 4vh, 46px);
}

.bwa-hero-banner__eyebrow {
    margin: 0;
    /* Ratio de contraste ≥ 4.5 : 1 — WCAG AA */
    color: rgba(255, 255, 255, 0.90);
    font-family: var(--font-primary);
    font-size: clamp(12px, 0.9vw, 14px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

/* h1 — grand texte : ratio ≥ 3 : 1, ici blanc pur sur fond sombre ≫ 7 : 1 */
.bwa-hero-banner__title {
    margin: 0;
    color: #ffffff;
    max-width: 1062px;
    font-family: var(--font-primary);
    font-size: clamp(30px, 3.2vw, 40px);
    line-height: 1.2;
    letter-spacing: -0.05em;
    font-weight: 500;
    text-wrap: balance;
}

.bwa-hero-banner__title > span {
    display: block;
}

.bwa-hero-banner__subtitle {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.90);
    max-width: 68ch;
    font-family: var(--font-primary);
    font-size: clamp(14px, 1.08vw, 18px);
    line-height: 1.35;
}

/* ── Panel : recherche + suggestions ──────────────────────────────────────── */

.bwa-hero-banner__panel {
    width: min(100%, 800px);
    margin-top: 0;
    display: grid;
    gap: 14px;
    justify-items: center;
}

/* ── Formulaire de recherche (reset navigateur) ───────────────────────────── */

.bwa-hero-banner__search-form {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 800px;
    position: relative;
    overflow: visible;
    z-index: 0;
}

body:not(.wp-admin) .bwa-hero-banner .bwa-hero-banner__search-form {
    display: block;
    gap: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

body:not(.wp-admin) .bwa-hero-banner .bwa-hero-banner__search-form label.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Barre de recherche ───────────────────────────────────────────────────── */

.bwa-hero-banner__search-shell {
    /* Fond blanc + bordure bleue, comme dans la maquette Figma */
    position: relative;
    height: 70px;
    border-radius: 90px;
    padding: 12px 12px 12px 24px;
    background: #ffffff;
    border: 2px solid #02a2d6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 800px;
    isolation: isolate;
    overflow: visible;
    z-index: 1;
}

.bwa-hero-banner__search-glow {
    position: absolute;
    left: -8px;
    right: -8px;
    top: -7px;
    bottom: -10px;
    border-radius: 120px;
    z-index: 0;
    pointer-events: none;
    transform-origin: center;
    --glow-translate-y: 0px;
    animation: bwa-hero-search-breath 1s ease-in-out infinite;
}

.bwa-hero-banner__search-glow--one {
    --glow-opacity-min: 0.2;
    --glow-opacity-max: 0.3;
    background: linear-gradient(42deg, rgba(26, 163, 255, 0.44) 0%, rgba(2, 162, 214, 0.12) 58%, rgba(32, 123, 199, 0.42) 100%);
    filter: blur(11px);
    --glow-translate-y: 2px;
    animation-delay: 0s;
}

.bwa-hero-banner__search-glow--two {
    --glow-opacity-min: 0.24;
    --glow-opacity-max: 0.44;
    left: -10px;
    right: -10px;
    top: -9px;
    bottom: -13px;
    background: linear-gradient(118deg, rgba(2, 162, 214, 0.34) 0%, rgba(26, 163, 255, 0.07) 52%, rgba(32, 123, 199, 0.31) 100%);
    filter: blur(16px);
    --glow-translate-y: 4px;
    animation-delay: 0.22s;
}

.bwa-hero-banner__search-glow--three {
    --glow-opacity-min: 0.22;
    --glow-opacity-max: 0.4;
    left: -6px;
    right: -6px;
    top: -5px;
    bottom: -9px;
    background: linear-gradient(165deg, rgba(32, 123, 199, 0.28) 0%, rgba(2, 162, 214, 0.08) 46%, rgba(30, 201, 255, 0.24) 100%);
    filter: blur(13px);
    --glow-translate-y: 3px;
    animation-delay: 0.45s;
}

@keyframes bwa-hero-search-breath {
    0%,
    100% {
        opacity: var(--glow-opacity-min, 0.25);
        transform: translateY(var(--glow-translate-y, 0px)) scale(1);
    }

    50% {
        opacity: var(--glow-opacity-max, 0.5);
        transform: translateY(var(--glow-translate-y, 0px)) scale(1.015);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bwa-hero-banner__search-glow {
        animation: none;
        opacity: var(--glow-opacity-min, 0.25);
    }

    .bwa-hero-banner__ai-chip-blob {
        animation: none;
    }
}

.bwa-hero-banner__search {
    flex: 1;
    min-width: 0;
}

/* Input de recherche — fond transparent (parent blanc) */
.bwa-hero-banner__native-search {
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    background: transparent;
    /* Texte #023056 sur fond blanc : ratio ≈ 10 : 1 — WCAG AAA */
    color: #023056;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.1;
    padding: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.bwa-hero-banner__native-search::placeholder {
    color: #023056;
    opacity: 0.95;
}

/* Focus visible sur l'input */
.bwa-hero-banner__native-search:focus-visible {
    outline: none; /* focus géré sur le shell */
}

.bwa-hero-banner__search-shell:focus-within {
    border-color: #1aa3ff;
    outline: 2px solid rgba(2, 162, 214, 0.35);
    outline-offset: 2px;
}

/* ── AI label + chip ──────────────────────────────────────────────────────── */

.bwa-hero-banner__ai {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-right: 6px;
    /* Caché aux AT via aria-hidden dans le template */
}

.bwa-hero-banner__ai-label {
    /* Texte gradient bleu (comme dans la maquette) */
    background: linear-gradient(38deg, #207bc7 4%, #02a2d6 57%, #207bc7 101%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.bwa-hero-banner__ai-chip {
    width: 62px;
    height: 40px;
    border-radius: 40px;
    background: #1AA3FF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    /* Reset <button> */
    border: none;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.18s ease;
}

.bwa-hero-banner__ai-chip:hover { opacity: 0.88; }

.bwa-hero-banner__ai-chip:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.bwa-hero-banner__ai-chip svg {
    display: block;
}

.bwa-hero-banner__ai-chip-icon {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bwa-hero-banner__ai-chip-blob {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    z-index: 1;
    filter: blur(9px);
    opacity: 0.62;
    will-change: transform;
}

.bwa-hero-banner__ai-chip-blob--one {
    width: 36px;
    height: 36px;
    top: -12px;
    left: -12px;
    background: #207BC7;
    animation: bwa-ai-chip-blob-one 1.8s cubic-bezier(0.42, 0, 0.27, 1) infinite;
}

.bwa-hero-banner__ai-chip-blob--two {
    width: 34px;
    height: 34px;
    right: -12px;
    bottom: -12px;
    background: #207BC7;
    animation: bwa-ai-chip-blob-two 1.7s cubic-bezier(0.45, 0, 0.32, 1) infinite;
    animation-delay: 0.08s;
}

.bwa-hero-banner__ai-chip-blob--three {
    width: 26px;
    height: 26px;
    top: 8px;
    right: -12px;
    background: #207BC7;
    animation: bwa-ai-chip-blob-three 2s cubic-bezier(0.44, 0, 0.31, 1) infinite;
    animation-delay: 0.15s;
}

.bwa-hero-banner__ai-chip-blob--four {
    width: 24px;
    height: 24px;
    left: 8px;
    bottom: 6px;
    background: #207BC7;
    animation: bwa-ai-chip-blob-four 1.85s cubic-bezier(0.47, 0, 0.3, 1) infinite;
    animation-delay: 0.24s;
}

@keyframes bwa-ai-chip-blob-one {
    0%,
    100% {
        transform: translate(-6px, -4px) scale(0.92);
    }

    50% {
        transform: translate(12px, 8px) scale(1.08);
    }
}

@keyframes bwa-ai-chip-blob-two {
    0%,
    100% {
        transform: translate(6px, 4px) scale(0.9);
    }

    50% {
        transform: translate(-13px, -9px) scale(1.1);
    }
}

@keyframes bwa-ai-chip-blob-three {
    0%,
    100% {
        transform: translate(2px, -8px) scale(0.88);
    }

    50% {
        transform: translate(-10px, 11px) scale(1.04);
    }
}

@keyframes bwa-ai-chip-blob-four {
    0%,
    100% {
        transform: translate(-5px, 6px) scale(0.9);
    }

    50% {
        transform: translate(11px, -10px) scale(1.06);
    }
}

/* ── Suggestions — Swiper carousel ───────────────────────────────────────── */

.bwa-hero-banner__suggestions-swiper {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    /* Swiper exige overflow:hidden pour le défilement */
    overflow: hidden;
}

/* Fallback sans JS : flex-wrap centré */
.bwa-hero-banner__suggestions-swiper .swiper-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    /* Swiper override ces props via son init JS */
    transition-timing-function: ease;
}

/* Une fois Swiper initialisé, on retire le fallback wrap */
.bwa-hero-banner__suggestions-swiper.swiper-initialized .swiper-wrapper {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
}

/* Chaque slide prend la largeur de son contenu */
.bwa-hero-banner__suggestions-swiper .swiper-slide.bwa-hero-banner__suggestion-slide {
    width: auto;
    flex-shrink: 0;
}

/* Chip de suggestion */
.bwa-hero-banner__suggestion-chip {
    /* Reset <a> */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    border: none;
    /* Blanc sur fond semi-transparent foncé : ratio > 4.5 : 1 */
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 30px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;

    /* Espace entre slides (sync avec spaceBetween Swiper : 9px) */
    margin-right: 9px;
}

/* Dernier chip : pas de margin-right */
.bwa-hero-banner__suggestion-slide:last-child .bwa-hero-banner__suggestion-chip {
    margin-right: 0;
}

.bwa-hero-banner__suggestion-chip:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Focus visible clavier — WCAG 2.4.11 */
.bwa-hero-banner__suggestion-chip:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.18);
}

.bwa-hero-banner__suggestion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 13px;
    flex-shrink: 0;
}

/* ── Shortcode fallback (éditeur) ────────────────────────────────────────── */

.bwa-hero-banner__shortcode-fallback {
    border: 1px dashed rgba(255, 255, 255, 0.32);
    border-radius: 14px;
    background: rgba(11, 21, 35, 0.45);
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 13px;
    padding: 10px 14px;
}


/* ── Responsive — tablette (≤ 1024 px) ──────────────────────────────────── */

@media (max-width: 1024px) {
    .bwa-hero-banner {
        min-height: 100vh;
        border-radius: 0;
        padding-top: clamp(96px, 11vh, 132px);
    }

    .bwa-hero-banner__inner {
        margin-top: 18px;
    }

    .bwa-hero-banner__title {
        font-size: clamp(30px, 4vw, 38px);
    }

    .bwa-hero-banner__search-shell {
        height: 66px;
        border-radius: 76px;
        padding: 10px 16px 10px 20px;
    }

    .bwa-hero-banner__ai {
        justify-content: flex-end;
        padding: 0 2px 0 0;
    }

    .bwa-hero-banner__suggestions-swiper .swiper-wrapper {
        justify-content: flex-start;
    }
}

/* ── Responsive — mobile (≤ 767 px) ─────────────────────────────────────── */

@media (max-width: 767px) {
    .bwa-hero-banner {
        min-height: 100svh;
        border-radius: 0;
        padding-top: 88px;
        padding-bottom: 26px;
    }

    .bwa-hero-banner__inner {
        width: 100%;
        margin-top: 0;
        gap: 14px;
    }

    .bwa-hero-banner__title {
        font-size: clamp(28px, 8.2vw, 34px);
        line-height: 1.18;
    }

    .bwa-hero-banner__panel {
        width: 100%;
        gap: 10px;
    }

    .bwa-hero-banner__search-shell {
        height: 60px;
        border-radius: 44px;
        padding: 10px 12px 10px 16px;
    }

    .bwa-hero-banner__search input[type="search"],
    .bwa-hero-banner__search input[type="text"],
    .bwa-hero-banner__search .facetwp-search,
    .bwa-hero-banner__native-search {
        height: auto;
        padding: 0;
        /* 12px permet au placeholder complet de tenir sans troncature
           une fois le label "Powered by AI" masqué (cf. règle plus bas). */
        font-size: 12px;
        /* Filet de sécurité si un placeholder plus long est utilisé un jour. */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bwa-hero-banner__ai {
        justify-content: flex-end;
        padding-right: 0;
    }

    /* Le label texte "Powered by AI" prend une place précieuse sur mobile
       et écrase le placeholder de recherche : on ne garde que la puce. */
    .bwa-hero-banner__ai-label {
        display: none;
    }

    .bwa-hero-banner__ai-chip {
        width: 56px;
        height: 38px;
    }

    .bwa-hero-banner__suggestion-chip {
        font-size: 12px;
        line-height: 26px;
        padding: 4px 12px 4px 8px;
    }

    /* Sur mobile, les suggestions sont empilées verticalement plutôt
       qu'affichées comme un carrousel horizontal (Swiper désactivé,
       voir hero-banner.js). */
    .bwa-hero-banner__suggestions-swiper {
        width: 100%;
        overflow: visible;
    }

    .bwa-hero-banner__suggestions-swiper .swiper-wrapper,
    .bwa-hero-banner__suggestions-swiper.swiper-initialized .swiper-wrapper {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
    }

    .bwa-hero-banner__suggestions-swiper .swiper-slide.bwa-hero-banner__suggestion-slide {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .bwa-hero-banner__suggestions-swiper .bwa-hero-banner__suggestion-chip {
        width: 100%;
        justify-content: center;
        margin-right: 0;
    }
}
