/* ============================================================
   Concept PVC — Header
   Breakpoints :
     - Desktop large  : >= 1440px (maquette de référence)
     - Desktop medium : 1200–1439px (compression douce)
     - Tablette       : 768–1199px (nav simplifiée)
     - Mobile         : < 768px (burger)
   ============================================================ */

:root {
    --cpvc-bleu: #263477;
    --cpvc-jaune: #F9B334;
    --cpvc-jaune-soft: #FFEFD2;
    --cpvc-border: rgba(38, 52, 119, 0.3);
    --cpvc-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Reset Twenty Twenty-Five : neutralise le wrapper de template part */
.wp-site-blocks > header.wp-block-template-part {
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Le wrapper TT5 .wp-block-template-part autour du header limite le containing
   block du sticky. On le neutralise avec display:contents pour que .cpvc-header
   devienne enfant direct de .wp-site-blocks et puisse coller au viewport. */
.wp-site-blocks > header.wp-block-template-part:has(> .cpvc-header) {
    display: contents;
}

.cpvc-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: #fff;
    font-family: var(--cpvc-font);
    color: var(--cpvc-bleu);
    padding: 22px 24px 18px;
    box-sizing: border-box;
    overflow: visible;
    transition: box-shadow .2s ease, padding .2s ease;
    --cpvc-logo-gap: 230px; /* largeur réservée pour le logo (gap dans la ligne séparatrice) */
}
.cpvc-header.is-stuck {
    box-shadow: 0 4px 20px -6px rgba(38, 52, 119, 0.18);
    padding-top: 14px;
    padding-bottom: 12px;
}
.cpvc-header.is-stuck .cpvc-header__logo img { height: 96px; }
.cpvc-header__inner {
    position: relative;
    max-width: 1600px;
    margin: 0 auto;
}

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

.cpvc-header a { color: inherit; text-decoration: none; }

/* ---------- Ligne du haut (adresse | logo | tél) ---------- */
.cpvc-header__top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding-bottom: 14px;
    /* Ligne séparatrice avec un trou central pour laisser passer le logo */
    background-image: linear-gradient(
        to right,
        var(--cpvc-border) 0,
        var(--cpvc-border) calc(50% - var(--cpvc-logo-gap) / 2),
        transparent          calc(50% - var(--cpvc-logo-gap) / 2),
        transparent          calc(50% + var(--cpvc-logo-gap) / 2),
        var(--cpvc-border) calc(50% + var(--cpvc-logo-gap) / 2),
        var(--cpvc-border) 100%
    );
    background-size: 100% 1px;
    background-position: left bottom;
    background-repeat: no-repeat;
}

.cpvc-header__address { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.cpvc-header__address strong { font-weight: 700; }
.cpvc-header__address span { font-weight: 500; }

.cpvc-header__phone {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}
.cpvc-header__phone .icon { width: 16px; height: 16px; flex: 0 0 16px; }
.cpvc-header__phone a { font-size: 18px; font-weight: 700; letter-spacing: 0.2px; }

/* ---------- Logo unique, centré sur la ligne de séparation ---------- */
.cpvc-header__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    display: block;
    line-height: 0;
}
.cpvc-header__logo img {
    display: block;
    height: 140px;
    width: auto;
    transition: height .2s ease;
}
/* Spacer dans la grille pour réserver la place et garder la nav alignée */
.cpvc-header__logo-spacer {
    width: var(--cpvc-logo-gap);
    height: 1px;
}

/* ---------- Ligne du bas (nav gauche | logo | nav droite) ---------- */
.cpvc-header__bottom {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding-top: 14px;
}

.cpvc-nav {
    display: flex;
    align-items: center;
    gap: 40px;
}
.cpvc-nav--right { justify-content: flex-end; }

.cpvc-nav__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: opacity .15s ease;
}
.cpvc-nav__item:hover { opacity: 0.75; }
.cpvc-nav__item .icon { width: 16px; height: 16px; flex: 0 0 16px; }

/* Pill outline jaune (Nos produits) */
.cpvc-nav__item--pill {
    position: relative;
    padding: 15px 22px;
    border: 2px solid var(--cpvc-jaune);
    border-radius: 30px;
    cursor: pointer;
    transition: background-color .18s ease, border-radius .18s ease, padding .18s ease;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.cpvc-nav__item--pill:focus { outline: none; }
.cpvc-nav__item--pill:focus-visible { outline: 2px solid var(--cpvc-bleu); outline-offset: 2px; }
.cpvc-nav__pill-close { display: none; }

/* État actif : fond jaune plein, coins arrondis en haut seulement,
   barre jaune horizontale prolongée sous le bouton */
.cpvc-header.is-products-open .cpvc-nav__item--pill {
    background: var(--cpvc-jaune);
    border-color: var(--cpvc-jaune);
    border-radius: 16px 16px 0 0;
    padding: 18px 22px 24px;
}
.cpvc-header.is-products-open .cpvc-nav__item--pill::after {
    content: "";
    position: absolute;
    left: var(--cpvc-bar-left, 0);
    width: var(--cpvc-bar-w, var(--cpvc-drawer-w, 820px));
    bottom: -6px;
    height: 6px;
    background: var(--cpvc-jaune);
    z-index: -1;
}
.cpvc-header.is-products-open .cpvc-nav__pill-chevron { display: none; }
.cpvc-header.is-products-open .cpvc-nav__pill-close { display: inline-block; }

/* ---------- Panneau "Nos produits" ---------- */
:root {
    --cpvc-drawer-w: min(50vw, 820px);
    --cpvc-drawer-left: 0px;
    --cpvc-drawer-top: 0px;
}
.cpvc-products-overlay {
    position: fixed;
    top: var(--cpvc-drawer-top);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(38, 52, 119, 0.35);
    z-index: 998;
    animation: cpvc-fade .2s ease;
}
@keyframes cpvc-fade { from { opacity: 0; } to { opacity: 1; } }

.cpvc-products-panel {
    position: fixed;
    top: var(--cpvc-drawer-top);
    left: var(--cpvc-drawer-left);
    width: var(--cpvc-drawer-w);
    max-width: 92vw;
    height: calc(100vh - var(--cpvc-drawer-top));
    background: var(--cpvc-bleu);
    color: #FDFDFD;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: transform .28s ease, opacity .22s ease, visibility 0s linear .28s;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cpvc-products-panel::-webkit-scrollbar { width: 0; height: 0; display: none; }
.cpvc-products-panel[aria-hidden="false"] {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    transition: transform .28s ease, opacity .22s ease, visibility 0s linear 0s;
}
.cpvc-products-panel__inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 32px 24px 160px 0;
}
.cpvc-products-panel__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 0 6px 80px;
    color: #FDFDFD;
    font: 600 14px/1.2 var(--cpvc-font);
    text-decoration: none;
    transition: opacity .15s ease;
}
.cpvc-products-panel__item:hover { opacity: 0.85; }
.cpvc-products-panel__all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 6px 80px;
    color: var(--cpvc-jaune);
    font: 700 15px/1.2 var(--cpvc-font);
    text-decoration: none;
    transition: gap .15s ease, opacity .15s ease;
}
.cpvc-products-panel__all:hover { gap: 16px; opacity: 0.9; }
.cpvc-products-panel__all-arrow { font-size: 17px; line-height: 1; }
.cpvc-products-panel__thumb {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08) center/cover no-repeat;
    outline: 1px solid var(--cpvc-jaune);
    outline-offset: 0;
}
.cpvc-products-panel__sep {
    height: 1px;
    background: rgba(253, 253, 253, 0.20);
    margin: 0 24px 0 80px;
}

@media (max-width: 1199px) {
    :root { --cpvc-drawer-w: min(60vw, 560px); }
    .cpvc-products-panel__item,
    .cpvc-products-panel__all { padding-left: 48px; }
    .cpvc-products-panel__sep { margin-left: 48px; }
}
@media (max-width: 767px) {
    :root { --cpvc-drawer-w: 100vw; }
    .cpvc-products-panel { max-width: 100vw; }
    .cpvc-products-panel__item,
    .cpvc-products-panel__all { padding-left: 24px; }
    .cpvc-products-panel__sep { margin-left: 24px; }
}

/* Bouton loupe rond outline */
.cpvc-search {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--cpvc-jaune);
    background: #fff;
    color: var(--cpvc-bleu);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease;
}
.cpvc-search:hover { background: var(--cpvc-jaune-soft); }
.cpvc-search .icon { width: 16px; height: 16px; }

/* CTA "Votre devis sur-mesure" */
.cpvc-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px 5px 24px;
    background: var(--cpvc-jaune);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cpvc-bleu);
    transition: filter .15s ease;
}
.cpvc-cta:hover { filter: brightness(1.05); }
.cpvc-cta__icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cpvc-jaune-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
}
.cpvc-cta__icon .icon { width: 16px; height: 16px; }

/* ---------- Burger (mobile/tablette) ---------- */
.cpvc-burger {
    display: none;
    background: none !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 8px;
    cursor: pointer;
    color: var(--cpvc-bleu);
    -webkit-tap-highlight-color: transparent;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    position: relative;
}
.cpvc-burger:focus,
.cpvc-burger:focus-visible,
.cpvc-burger:active,
.cpvc-burger:hover { outline: none !important; border: 0 !important; box-shadow: none !important; background: none !important; }
.cpvc-burger .bar { display: block; width: 24px; height: 2px; background: currentColor; margin: 4px 0; border-radius: 1px; transition: transform .2s ease, opacity .2s ease; transform-origin: center; }

/* ============================================================
   Desktop medium : compression douce (1200–1439px)
   ============================================================ */
@media (max-width: 1439px) {
    .cpvc-header { padding: 20px 48px 16px; }
    .cpvc-nav { gap: 28px; }
    .cpvc-header__top, .cpvc-header__bottom { gap: 18px; }
    .cpvc-nav__item--pill { padding: 13px 16px; }
    .cpvc-header__logo img { height: 140px; }
    .cpvc-header { --cpvc-logo-gap: 240px; }
}

/* ============================================================
   Tablette (768–1199px) : on garde 2 lignes, logo plus petit,
   on cache "Actus et promos" (gardé dans le burger éventuel)
   ============================================================ */
@media (max-width: 1199px) {
    .cpvc-header { padding: 16px 32px 14px; }
    .cpvc-header__address span { display: none; }     /* on garde "Showroom et ateliers" */
    .cpvc-header__phone span:first-child { display: none; } /* on cache "Tél." */
    .cpvc-nav { gap: 20px; }
    .cpvc-nav__item--pill { padding: 11px 14px; }
    .cpvc-header__logo img { height: 118px; }
    .cpvc-header { --cpvc-logo-gap: 200px; }
    .cpvc-cta { padding: 5px 6px 5px 18px; font-size: 13px; }
    .cpvc-nav-extra { display: none; } /* "Actus et promos" caché */
}

/* ============================================================
   Mobile (< 768px) : 1 ligne logo + burger + CTA compact
   ============================================================ */
@media (max-width: 767px) {
    .cpvc-header {
        padding: 12px 14px 12px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .cpvc-header__inner { display: contents; }
    .cpvc-header__top,
    .cpvc-header__bottom { display: none; }
    .cpvc-header__logo {
        position: static;
        transform: none;
        order: 0;
        flex: 0 0 auto;
        text-align: left;
        margin: 0 auto 0 0;
        padding: 0;
        line-height: 0;
        display: inline-flex;
        align-items: center;
    }
    .cpvc-header__logo img { height: 64px; margin: 0; display: block; }
    .cpvc-header__logo-spacer { display: none; }
    .cpvc-burger { display: inline-flex; flex-direction: column; order: 1; }
    .cpvc-mobile-cta {
        order: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px; height: 42px;
        border-radius: 50%;
        background: var(--cpvc-jaune);
        color: var(--cpvc-bleu);
    }
    .cpvc-mobile-cta .icon { width: 18px; height: 18px; }

    /* Menu déroulant mobile */
    .cpvc-mobile-menu {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: #fff;
        border-top: 1px solid var(--cpvc-border);
        padding: 16px 20px 24px;
        display: none;
        flex-direction: column;
        gap: 14px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    }
    .cpvc-header.is-open .cpvc-mobile-menu { display: flex; }
    .cpvc-header.is-open .cpvc-burger .bar:nth-child(1),
    .cpvc-header.is-burger-x .cpvc-burger .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .cpvc-header.is-open .cpvc-burger .bar:nth-child(2),
    .cpvc-header.is-burger-x .cpvc-burger .bar:nth-child(2) { opacity: 0; }
    .cpvc-header.is-open .cpvc-burger .bar:nth-child(3),
    .cpvc-header.is-burger-x .cpvc-burger .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    .cpvc-mobile-menu a { font-size: 16px; font-weight: 600; padding: 8px 0; border-bottom: 1px solid rgba(38,52,119,0.08); }
    .cpvc-mobile-menu .cpvc-mobile-info { font-size: 13px; font-weight: 500; padding-top: 8px; border-top: 1px solid var(--cpvc-border); }
    .cpvc-mobile-menu .cpvc-mobile-info strong { display: block; font-weight: 700; margin-bottom: 4px; }
    .cpvc-mobile-menu .cpvc-mobile-info a { font-size: 18px; font-weight: 700; border: 0; padding: 6px 0; }
}

@media (min-width: 768px) {
    .cpvc-mobile-menu, .cpvc-mobile-cta { display: none !important; }
}

/* ============================================================
 * Overlay de recherche
 * ============================================================ */
.cpvc-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px;
    font-family: 'Poppins', sans-serif;
}
.cpvc-search-overlay.is-open { display: flex; }
.cpvc-search-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(38, 52, 119, 0.75);
    backdrop-filter: blur(8px);
    animation: cpvc-srch-fade 0.2s ease;
}
.cpvc-search-overlay__panel {
    position: relative;
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 720px;
    padding: 48px 44px 36px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    animation: cpvc-srch-pop 0.25s ease;
}
@keyframes cpvc-srch-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cpvc-srch-pop { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.cpvc-search-overlay__close {
    position: absolute;
    top: 16px; right: 16px;
    appearance: none;
    border: none;
    background: #F4F5FF;
    color: #263477;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.cpvc-search-overlay__close:hover { background: #F9B334; }
.cpvc-search-overlay__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #263477;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}
.cpvc-search-overlay__field {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #263477;
    border-radius: 999px;
    padding: 8px 8px 8px 22px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cpvc-search-overlay__field:focus-within {
    border-color: #F9B334;
    box-shadow: 0 0 0 4px rgba(249, 179, 52, 0.18);
}
.cpvc-search-overlay__icon { flex: 0 0 24px; }
.cpvc-search-overlay__field input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font: 500 17px/1.4 'Poppins', sans-serif;
    color: #263477;
    padding: 8px 0;
    min-width: 0;
}
.cpvc-search-overlay__field input::placeholder { color: #26347788; }
.cpvc-search-overlay__submit {
    appearance: none;
    border: none;
    background: #F9B334;
    color: #263477;
    font: 600 14px/1 'Poppins', sans-serif;
    padding: 12px 22px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.cpvc-search-overlay__submit:hover { transform: translateX(2px); }
.cpvc-search-overlay__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 22px;
}
.cpvc-search-overlay__suggestions-label {
    font-size: 13px;
    color: #26347799;
    margin-right: 4px;
}
.cpvc-search-overlay__suggestions a {
    display: inline-flex;
    background: #F4F5FF;
    color: #263477;
    font: 600 12px/1 'Poppins', sans-serif;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.18s;
}
.cpvc-search-overlay__suggestions a:hover {
    background: #263477;
    color: #fff;
}
@media (max-width: 600px) {
    .cpvc-search-overlay { padding: 40px 16px 16px; }
    .cpvc-search-overlay__panel { padding: 40px 22px 24px; border-radius: 18px; }
    .cpvc-search-overlay__field { padding: 6px 6px 6px 16px; gap: 8px; }
    .cpvc-search-overlay__field input { font-size: 15px; }
    .cpvc-search-overlay__submit { padding: 10px 14px; font-size: 12px; }
    .cpvc-search-overlay__submit svg { display: none; }
}
