/* =============================================================
   Pots-Étiques — hero-recherche.css (wt #1012)
   Formulaire de recherche produits, tout en haut du hero.

   Fichier à part : style.css dépasse déjà la limite de 750 lignes.
   Chargé APRÈS style.css : il lit ses jetons (--color-*, --p-*).

   Contraintes (demande du 2026-12-02) :
   - le champ fait 60 px de haut, ni plus ni moins (--hero-recherche-h) ;
   - le titre est caché (h2.sr-only dans le balisage), seul le champ et
     son placeholder sont visibles ;
   - emprise minimale : une seule rangée, pas de marge au-dessus du
     strict nécessaire.
   Le bouton loupe est DANS le champ (superposé à droite) : il ne
   rajoute aucune hauteur et reste une cible de 44 px.
   ============================================================= */

.hero-recherche {
  --hero-recherche-h:      60px;   /* hauteur imposée du champ */
  --hero-recherche-bouton: 44px;   /* cible tactile minimale (WCAG 2.5.8 confortable) */
  --hero-recherche-max:    100%;  /* largeur maximale en desktop */

  position: relative;
  width: 100%;
  max-width: var(--hero-recherche-max);
  margin-top: 0.75rem;
}

.hero-recherche__champ {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: var(--hero-recherche-h);
  /* Le texte ne passe pas sous la loupe : bouton + ses deux marges. */
  padding: 0 calc(var(--hero-recherche-bouton) + 1.25rem) 0 1.5rem;
  border: 3px solid color-mix(in srgb, var(--color-ink) 66%, transparent);
  border-radius: 9999px;
  background: color-mix(in srgb, white 80%, transparent);
  color: var(--color-ink);
  font: inherit;
  font-size: 1.25rem;          /* ≥ 16 px : iOS ne zoome pas au focus */
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 10px 26px -14px rgba(0,0,0,0.35);
  transition: border-color 0.2s ease, background-color 0.55s ease,
              color 0.55s ease, box-shadow 0.2s ease;
}
.hero-recherche__champ::placeholder {
  color: color-mix(in srgb, var(--color-ink) 72%, transparent);
  opacity: 1;
}
/* La croix native de WebKit, sans fond ni décalage. */
.hero-recherche__champ::-webkit-search-decoration { -webkit-appearance: none; }

.hero-recherche__champ:focus { outline: none; }
.hero-recherche:focus-within .hero-recherche__champ {
  border-color: var(--color-leaf);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-leaf) 35%, transparent);
}

.hero-recherche__bouton {
  position: absolute;
  top: 50%;
  right: calc((var(--hero-recherche-h) - var(--hero-recherche-bouton)) / 2);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--hero-recherche-bouton);
  height: var(--hero-recherche-bouton);
  border: 0;
  border-radius: 9999px;
  background: var(--color-rose);
  color: #fff;
  cursor: pointer;
  transition: filter 0.2s ease, background-color 0.55s ease;
}
.hero-recherche__bouton:hover { filter: brightness(1.1); }
.hero-recherche__bouton:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}
.hero-recherche__bouton svg { width: 18px; height: 18px; fill: currentColor; }

/* --- Forêt sombre / forêt wide : fond sombre, contraste AA ----------- */
/* Rayon = celui des .btn-pill de ces thèmes (style.css), pour que le champ
   et les boutons du hero parlent la même langue. */
[data-theme="foret-sombre"] .hero-recherche__champ,
[data-theme="foret-wide"] .hero-recherche__champ {
  border-radius: var(--radius-md);
  border-color: rgba(196,225,90,0.35);
  background: color-mix(in srgb, var(--p-leaf-vd) 72%, transparent);
  color: var(--p-paper);
}
[data-theme="foret-sombre"] .hero-recherche__champ::placeholder,
[data-theme="foret-wide"] .hero-recherche__champ::placeholder {
  color: color-mix(in srgb, var(--p-paper) 78%, transparent);
}
[data-theme="foret-sombre"] .hero-recherche:focus-within .hero-recherche__champ,
[data-theme="foret-wide"] .hero-recherche:focus-within .hero-recherche__champ {
  border-color: var(--p-lime);
  box-shadow: 0 0 0 3px rgba(196,225,90,0.30);
}
/* Même vert que le bouton « Boutique en ligne » du header (blanc ≥ 4,5:1). */
[data-theme="foret-sombre"] .hero-recherche__bouton,
[data-theme="foret-wide"] .hero-recherche__bouton {
  background: var(--p-leaf-d);
  border-radius: var(--radius-sm);
}
[data-theme="foret-sombre"] .hero-recherche__bouton:focus-visible,
[data-theme="foret-wide"] .hero-recherche__bouton:focus-visible {
  outline-color: var(--p-lime);
}
