/* ==========================================================================
   Hypp agency — Sections réutilisables
   .hypp-newsletter : template-parts/newsletter.php (bloc « Newsletter Hypp »)
   .hypp-cta        : template-parts/cta-projet.php (bloc « Projet Hypp »)
   Chargé par functions.php sur la page Blog et sur tout contenu qui contient
   l'un des blocs (palette et boutons .pill : style.css). Les sélecteurs à deux
   classes l'emportent sur les styles de contenu d'Astra (.entry-content h2…).
   ========================================================================== */

:is(.hypp-newsletter, .hypp-cta),
:is(.hypp-newsletter, .hypp-cta) *,
:is(.hypp-newsletter, .hypp-cta) *::before,
:is(.hypp-newsletter, .hypp-cta) *::after {
  box-sizing: border-box;
}

/* Options du bloc (hypp_section_layout() dans functions.php) ; la largeur Astra est en style en ligne.
   Couleurs : --hypp-bg, --hypp-fg et --hypp-fg-soft ne sont définies (en ligne) que si une option est choisie ;
   chaque règle garde en repli la couleur de la maquette. */
:is(.hypp-newsletter, .hypp-cta).hypp-is-spaced {
  margin-block: 48px;
}

:is(.hypp-newsletter, .hypp-cta).hypp-is-rounded {
  overflow: hidden;
  border-radius: 28px;
}

/* ==========================================================================
   S01 — Newsletter « Un conseil par mois »
   ========================================================================== */

.hypp-newsletter {
  padding: 100px 24px;
  background: var(--hypp-bg, var(--gray));
  color: var(--hypp-fg, var(--ink));
}

.hypp-newsletter .hypp-newsletter-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hypp-newsletter .hypp-newsletter-title {
  margin: 0 0 14px;
  color: inherit;
  font-family: inherit;
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
  text-wrap: balance;
}

.hypp-newsletter .hypp-newsletter-text {
  margin: 0 0 30px;
  color: var(--hypp-fg-soft, var(--ink-soft));
  font-size: 19px;
  line-height: 1.45;
  text-wrap: pretty;
}

.hypp-newsletter .hypp-newsletter-note {
  margin: 14px 0 0;
  color: var(--hypp-fg-soft, var(--ink-soft));
  font-size: 13px;
}

/* Le message d'erreur s'affiche sous la pastille : on lui laisse la place. */
.hypp-newsletter .hypp-newsletter-form:has(.wpforms-error) + .hypp-newsletter-note {
  margin-top: 42px;
}

.hypp-newsletter .hypp-newsletter-missing {
  margin: 0;
  color: var(--hypp-fg-soft, var(--ink-soft));
  font-size: 14px;
}

/* --- WPForms 117 : champ e-mail + bouton dans une pastille blanche.
   Sélecteurs en .wpforms-form pour passer devant ceux de WPForms (div.wpforms-container-full …). */

.hypp-newsletter .hypp-newsletter-form .wpforms-container {
  max-width: 480px;
  margin: 0 auto;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 980px;
  background: #fff;
  box-shadow: 0 4px 18px oklch(20% 0.02 160 / .06);
  transition: box-shadow .2s;
}

/* Le contour de focus est porté par la pastille entière, pas par le champ seul. */
.hypp-newsletter .hypp-newsletter-form .wpforms-form:focus-within {
  box-shadow: 0 0 0 3px var(--accent), 0 4px 18px oklch(20% 0.02 160 / .06);
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form:has(input.wpforms-error) {
  box-shadow: 0 0 0 2px oklch(55% 0.19 25);
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form .wpforms-field-container {
  flex: 1;
  min-width: 0;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form .wpforms-field {
  position: relative;
  margin: 0;
  padding: 0;
}

/* Masqué visuellement, conservé pour les lecteurs d'écran. */
.hypp-newsletter .hypp-newsletter-form .wpforms-form .wpforms-field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form input[type="email"] {
  width: 100%;
  max-width: none;
  height: 44px;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 980px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: 0;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form input[type="email"]::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form :is(label, em).wpforms-error {
  position: absolute;
  top: calc(100% + 18px);
  left: 12px;
  margin: 0;
  padding: 0;
  color: oklch(50% 0.18 25);
  font-size: 13px;
  font-style: normal;
  text-align: left;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form .wpforms-submit-container {
  display: flex;
  flex: none;
  margin: 0;
  padding: 0;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form button.wpforms-submit {
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 11px 22px;
  border: 0;
  border-radius: 980px;
  background-color: var(--accent) !important;
  box-shadow: none;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .2s;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form button.wpforms-submit:hover {
  background-color: var(--accent-dark) !important;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-form button.wpforms-submit:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}

/* Le libellé « en cours d'envoi » du bouton suffit ; le spinner déborderait de la pastille. */
.hypp-newsletter .hypp-newsletter-form .wpforms-form .wpforms-submit-spinner {
  display: none;
}

.hypp-newsletter .hypp-newsletter-form [submit-success] > .wpforms-confirmation-container-full,
.hypp-newsletter .hypp-newsletter-form .wpforms-confirmation-container-full {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 22px;
  border: 0;
  border-radius: 980px;
  background: #fff;
  color: var(--accent);
  font-weight: 600;
}

.hypp-newsletter .hypp-newsletter-form .wpforms-confirmation-container-full p {
  margin: 0;
}

/* ==========================================================================
   S02 — CTA « Un projet en tête ? »
   ========================================================================== */

.hypp-cta {
  padding: 130px 24px;
  background: var(--hypp-bg, var(--dark));
  color: var(--hypp-fg, #fff);
  text-align: center;
}

.hypp-cta .hypp-cta-title {
  max-width: 900px;
  margin: 0 auto 22px;
  color: inherit;
  font-family: inherit;
  font-size: clamp(40px, 7vw, 92px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.hypp-cta .hypp-cta-text {
  max-width: 640px;
  margin: 0 auto 36px;
  color: var(--hypp-fg-soft, var(--on-dark-soft));
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.45;
  text-wrap: pretty;
}

.hypp-cta .hypp-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

/* :hover inclus : prend le pas sur « .hypp-blog a:hover » quand le bandeau est dans le blog. */
.hypp-cta a,
.hypp-cta a:hover {
  text-decoration: none;
}

.hypp-cta .pill-mint:hover {
  background: #fff;
  color: var(--dark);
}

.hypp-cta .hypp-cta-email {
  color: var(--hypp-fg, var(--mint));
  font-size: 17px;
  overflow-wrap: anywhere;
}

/* Le second « content » masque le chevron aux lecteurs d'écran. */
.hypp-cta .hypp-cta-email::after {
  content: ' ›';
  content: ' ›' / '';
}

/* Avec une couleur de texte choisie, le blanc au survol pourrait disparaître : soulignement à la place. */
.hypp-cta .hypp-cta-email:hover {
  color: var(--hypp-fg, #fff);
}

.hypp-cta[style*="--hypp-fg"] .hypp-cta-email:hover {
  text-decoration: underline;
}

/* L'anneau vert par défaut manque de contraste sur le fond sombre ; il suit la couleur du texte si elle est choisie. */
.hypp-cta a:focus-visible {
  outline: 3px solid var(--hypp-fg, var(--mint));
  outline-offset: 4px;
}

/* ==========================================================================
   S03 — Responsive
   ========================================================================== */

@media (max-width: 600px) {

  :is(.hypp-newsletter, .hypp-cta).hypp-is-spaced {
    margin-block: 32px;
  }

  :is(.hypp-newsletter, .hypp-cta).hypp-is-rounded {
    border-radius: 22px;
  }

  .hypp-newsletter {
    padding: 64px 20px;
  }

  .hypp-newsletter .hypp-newsletter-text {
    font-size: 17px;
  }

  .hypp-newsletter .hypp-newsletter-form .wpforms-form input[type="email"] {
    padding: 0 12px;
  }

  .hypp-newsletter .hypp-newsletter-form .wpforms-form button.wpforms-submit {
    padding-inline: 18px;
  }

  .hypp-cta {
    padding: 80px 20px;
  }

  .hypp-cta .hypp-cta-text {
    margin-bottom: 28px;
  }
}
