/* =========================================================================
   Header Clapasson & Fils — bandeau sticky + pop-up devis + menu plein écran
   Tokens issus de assets/styles/basic_style.css (variables --color-*) et de
   la maquette Figma (nodes 4058:2558, 4019:3976, 4019:7703).
   ========================================================================= */

:root {
  --cf-header-h: 120px;
  --cf-header-h-mob: 84px;
  --cf-header-px: 40px;
  --cf-header-py: 16px;

  --cf-z-header: 1000;
  --cf-z-menu: 1100;
  --cf-z-popup: 1200;
}

/* ---- Skip link ---------------------------------------------------------- */
.cf-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 9999;
  background: var(--color-secondary, #1d1d1b);
  color: var(--color-white, #fff);
  padding: 8px 16px;
  font-family: var(--btn-font-family, "Poppins", system-ui, sans-serif);
  font-weight: 700;
  text-decoration: none;
}
.cf-skip-link:focus-visible {
  left: 8px;
}

/* ---- Bandeau ------------------------------------------------------------ */
.cf-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: var(--cf-z-header);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

html[data-scroll="0"] .cf-header {
  background: transparent;
  box-shadow: none;
}

html:not([data-scroll="0"]) .cf-header {
  background: var(--color-white, #fff);
  box-shadow: 0 5px 15px rgba(29, 29, 27, 0.05);
}

/* Menu plein écran ouvert : le bandeau redevient transparent (priorité sur
   la règle data-scroll ci-dessus) pour se fondre dans le jaune-vert. */
body.cf-menu-open .cf-header,
html body.cf-menu-open .cf-header {
  background: transparent;
  box-shadow: none;
}

.cf-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: var(--cf-header-py) var(--cf-header-px);
  margin: 0 auto;
}

/* Logo : lien vers l'accueil. Hover : léger zoom + ombre douce. */
.cf-header__logo {
  display: inline-flex;
  align-items: center;
  width: 151px;
  height: 90px;
  flex-shrink: 0;
  text-decoration: none;
  transform-origin: left center;
  transition:
    transform 0.25s ease,
    filter 0.25s ease;
}
.cf-header__logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.cf-header__logo:hover,
.cf-header__logo:focus-visible {
  transform: scale(1.04);
  filter: drop-shadow(0 6px 14px rgba(29, 29, 27, 0.18));
}
.cf-header__logo:focus-visible {
  outline: 2px solid var(--color-secondary, #1d1d1b);
  outline-offset: 4px;
}

/* Actions : conteneur des deux CTA + bouton menu. */
.cf-header__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.cf-header__cta {
  line-height: 1;
}

/* ---- Bouton menu (hamburger ↔ croix) ------------------------------------ */
.cf-header__toggle {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 360px;
  background: var(--color-primary, #ccd310);
  border: 3px solid var(--color-secondary, #1d1d1b);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.cf-header__toggle:hover {
  background: var(--color-tertiary, #8f940c);
}
.cf-header__toggle:focus-visible {
  outline: 2px solid var(--color-secondary, #1d1d1b);
  outline-offset: 3px;
}

.cf-header__toggle-icon {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 16px;
}
.cf-bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-secondary, #1d1d1b);
  border-radius: 2px;
  transition:
    transform 0.3s ease,
    opacity 0.2s ease,
    top 0.3s ease;
  transform-origin: center;
}
.cf-bar--top {
  top: 0;
}
.cf-bar--mid {
  top: 7px;
}
.cf-bar--bot {
  top: 14px;
}

/* État "ouvert" : croix (utilisé en fallback CSS — GSAP override quand dispo) */
.cf-header__toggle[aria-expanded="true"] .cf-bar--top {
  top: 7px;
  transform: rotate(45deg);
}
.cf-header__toggle[aria-expanded="true"] .cf-bar--mid {
  opacity: 0;
  transform: scaleX(0);
}
.cf-header__toggle[aria-expanded="true"] .cf-bar--bot {
  top: 7px;
  transform: rotate(-45deg);
}

/* ---- Pop-up devis ------------------------------------------------------- */
.cf-popup {
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-width: min(1100px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  width: 100%;
  overflow: visible;
  z-index: var(--cf-z-popup);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    display 0.25s ease allow-discrete,
    overlay 0.25s ease allow-discrete;
}
.cf-popup[open] {
  display: block;
  opacity: 1;
}
@starting-style {
  .cf-popup[open] {
    opacity: 0;
  }
}
.cf-popup::backdrop {
  background: rgba(20, 19, 19, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    display 0.25s ease allow-discrete,
    overlay 0.25s ease allow-discrete;
}
.cf-popup[open]::backdrop {
  opacity: 1;
}
@starting-style {
  .cf-popup[open]::backdrop {
    opacity: 0;
  }
}

.cf-popup__panel {
  position: relative;
  background: var(--color-secondary, #1d1d1b);
  border: 3px solid var(--color-white, #fff);
  padding: clamp(24px, 4vw, 60px);
  color: var(--color-white, #fff);
  box-shadow: -4px 4px 32px rgba(0, 0, 0, 0.16);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  font-family: var(--btn-font-family, "Poppins", system-ui, sans-serif);
}

.cf-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 2px solid var(--color-white, #fff);
  border-radius: 50%;
  color: var(--color-white, #fff);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
.cf-popup__close:hover {
  background: var(--color-white, #fff);
  color: var(--color-secondary, #1d1d1b);
}
.cf-popup__close:focus-visible {
  outline: 2px solid var(--color-primary, #ccd310);
  outline-offset: 2px;
}
.cf-popup__col--intro {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-bottom: 26px !important;
}
.cf-popup__intro {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cf-popup__title {
  font-family: var(--btn-font-family, "Poppins", system-ui, sans-serif);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.1;
  margin: 0 0 26px;
  color: var(--color-white, #fff);
}
.cf-popup__intro {
  font-size: 16px;
  line-height: 1.4;
}
.cf-popup__intro p {
  margin: 0 0 16px;
}
.cf-popup__intro p:last-child {
  margin-bottom: 0;
}

/* ---- WPForms à l'intérieur de la pop-up (override styles plugin) -------- */
.cf-form-host {
  width: 100%;
}
.cf-form-host .wpforms-container {
  margin: 0;
}
.cf-form-host .wpforms-field {
  width: 100% !important;
  padding: 0 0 16px !important;
  margin: 0 !important;
}
.cf-form-host .wpforms-field-medium,
.cf-form-host .wpforms-field-large,
.cf-form-host .wpforms-field-small {
  max-width: 100% !important;
}
.cf-form-host .wpforms-field label.wpforms-field-label,
.cf-form-host .wpforms-field-label,
.cf-form-host .wpforms-field-sublabel {
  font-family: var(
    --btn-font-family,
    "Poppins",
    system-ui,
    sans-serif
  ) !important;
  font-weight: 400 !important;
  font-size: 16px !important;
  color: var(--color-white, #fff) !important;
  margin-bottom: 6px !important;
}
.cf-form-host input[type="text"],
.cf-form-host input[type="email"],
.cf-form-host input[type="tel"],
.cf-form-host input[type="number"],
.cf-form-host input[type="url"],
.cf-form-host textarea,
.cf-form-host select {
  width: 100% !important;
  background: transparent !important;
  color: var(--color-white, #fff) !important;
  border: 2px solid var(--color-white, #fff) !important;
  border-radius: 0 !important;
  padding: 8px 12px !important;
  font-family: var(
    --btn-font-family,
    "Poppins",
    system-ui,
    sans-serif
  ) !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
  min-height: 39px;
}
.cf-form-host textarea {
  min-height: 115px;
  resize: vertical;
}
.cf-form-host input:focus,
.cf-form-host textarea:focus,
.cf-form-host select:focus {
  outline: 2px solid var(--color-primary, #ccd310);
  outline-offset: 2px;
}
.cf-form-host ::placeholder {
  color: rgba(255, 255, 255, 0.55);
}
.choice-1 {
  align-items: center !important;
}
.choice-1 .wpforms-field-label-inline {
  color: var(--color-white, #fff) !important;
}
#wpforms-submit-57 {
  right: 25%;
  transform: translateX(50%);
}
#wpforms-confirmation-57 p {
  color: var(--color-white, #fff) !important;
}

/* Case RGPD */
.cf-form-host .wpforms-field-gdpr-checkbox ul {
  padding: 0;
  margin: 0;
  list-style: none;
}
.cf-form-host .wpforms-field-gdpr-checkbox li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--color-white, #fff);
}
.cf-form-host input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 17px;
  background: transparent;
  border: 1px solid var(--color-white, #fff);
  border-radius: 0;
  margin: 2px 0 0;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}
.cf-form-host input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--color-white, #fff);
}
.cf-form-host .wpforms-field-required .wpforms-field-label-required {
  color: var(--color-primary, #ccd310) !important;
}

/* Submit */
.cf-form-host .wpforms-submit-container {
  padding: 0 !important;
  display: flex;
  justify-content: flex-end;
}
.cf-form-host button.wpforms-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px !important;
  border: 3px solid var(--color-white, #fff) !important;
  background: var(--color-primary, #ccd310) !important;
  color: var(--color-secondary, #1d1d1b) !important;
  font-family: var(
    --btn-font-family,
    "Poppins",
    system-ui,
    sans-serif
  ) !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  border-radius: 0 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
.cf-form-host button.wpforms-submit:hover {
  background: var(--color-primary-dark, #8f940c) !important;
  color: var(--color-white, #fff) !important;
}

/* Messages d'erreur / confirmation */
.cf-form-host .wpforms-error,
.cf-form-host label.wpforms-error {
  color: var(--color-primary, #ccd310) !important;
  font-size: 13px !important;
  margin-top: 4px !important;
}
.cf-form-host .wpforms-confirmation-container,
.cf-form-host .wpforms-confirmation-container-full {
  background: transparent !important;
  border: 2px solid var(--color-primary, #ccd310) !important;
  color: var(--color-white, #fff) !important;
  padding: 16px !important;
}

/* ---- Menu plein écran --------------------------------------------------- */
.cf-menu {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  /* Plafond : 100svh (= petite hauteur de viewport, stable malgré la barre
     d'URL mobile). Le contenu interne s'arrête à 100svh - hauteur du header
     et bascule en scroll si débordement. */
  height: 100svh;
  max-height: 100svh;
  z-index: 999;
  background: var(--color-primary, #ccd310);
  display: flex;
  overflow: hidden;
  /* Le bandeau header reste visible : on réserve l'espace en haut. */
  padding-top: 30px;
}

.cf-menu[hidden] {
  display: none;
}

/* Photo angled sur la gauche (clip-path : diagonale) */
.cf-menu__visual {
  inset: var(--cf-header-h) 0 0 0;
  pointer-events: none;
  width: 100%;
}
.cf-menu__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  clip-path: polygon(0 29%, 80% 0%, 100% 100%, 0 100%);
}

/* Liste de liens à droite — scroll si la liste dépasse le viewport. */
.cf-menu__nav {
  position: relative;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  /* `justify-content: flex-start` est OBLIGATOIRE avec overflow-y : un
     `flex-end` (ou `center`) en column rend le début du contenu inatteignable
     en scroll (le navigateur ne descend pas sous scrollTop = 0). */
  padding: 60px var(--cf-header-px);
  width: fit-content;
  min-width: 520px;
  max-height: calc(100svh - var(--cf-header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-x: hidden; /* évite un ascenseur horizontal inutile si le contenu est juste un peu trop large */

  /* Ascenseur stylisé — Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--color-secondary, #1d1d1b) transparent;
}

/* Ascenseur stylisé — Chromium / Safari */
.cf-menu__nav::-webkit-scrollbar {
  width: 8px;
}
.cf-menu__nav::-webkit-scrollbar-track {
  background: transparent;
  margin: 12px 0;
}
.cf-menu__nav::-webkit-scrollbar-thumb {
  background: var(--color-secondary, #1d1d1b);
  border-radius: 4px;
  border: 2px solid var(--color-primary, #ccd310);
  background-clip: padding-box;
}
.cf-menu__nav::-webkit-scrollbar-thumb:hover {
  background: var(--color-tertiary, #688c82);
  background-clip: padding-box;
}
.cf-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.cf-menu__list li {
  display: block;
}
.cf-menu__list a {
  position: relative;
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 10px;
  font-family: var(--btn-font-family, "Poppins", system-ui, sans-serif);
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1;
  color: var(--color-secondary, #1d1d1b);
  text-decoration: none;
  text-transform: uppercase;
  text-align: right;
  letter-spacing: 0;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.cf-menu__list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 3px;
  background: var(--color-secondary, #1d1d1b);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}
.cf-menu__list a:hover::after,
.cf-menu__list .current-menu-item > a::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* CTA "Demander un devis" sous le menu — visible uniquement ≤ 640px
   (sur desktop le bouton vit dans le bandeau header). */
.cf-menu__cta-host {
  display: none;
}

/* Bloque le scroll quand menu ou popup ouverts (html ET body pour iOS Safari
   + scrollbar-gutter pour éviter le saut horizontal au verrouillage). */
html:has(body.cf-no-scroll),
body.cf-no-scroll {
  overflow: hidden;
  scrollbar-gutter: stable;
  touch-action: none;
  overscroll-behavior: contain;
}

/* État masqué initial pour l'anim GSAP */
.cf-menu__list a,
.cf-menu__photo {
  will-change: transform, opacity;
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 10240px) {
  :root {
    --cf-header-px: 20px;
  }
  .cf-header__inner {
    gap: 12px;
  }
  .cf-header__logo {
    width: 110px;
    height: 65px;
  }
  .cf-header__cta {
    padding: 10px 16px;
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .cf-header__cta {
    display: none;
  } /* CTAs cachés au profit du menu sur mobile (devis déplacé dans le menu) */
  .cf-menu {
    padding-top: var(--cf-header-h-mob);
    flex-direction: column;
  }
  .cf-menu__visual {
    display: none !important;
  }
  .cf-menu__nav {
    margin-left: 0;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 100%;
    padding: 30px 20px;
  }
  .cf-menu__list a {
    font-size: 20px;
    width: fit-content !important;
  }
  .cf-menu__cta-host {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
  }
}

/* ---- Préférence "mouvement réduit" -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cf-bar,
  .cf-header__logo,
  .cf-menu__list a,
  .cf-popup__close {
    transition: none !important;
  }
}
