/* ==========================================================================
   Fiche produit — galerie, informations, options, ajout au devis,
   sections détaillées et produits de la même famille.
   ========================================================================== */

.fiche { padding-top: clamp(1.5rem, 4vw, 3rem); }
.fiche-grille { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(1.75rem, 5vw, 4.5rem); align-items: start; }

/* ---------- Galerie ---------- */
.galerie { position: sticky; top: 5.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.galerie-principale { margin: 0; aspect-ratio: 1; background: var(--surface-2); border: 1px solid var(--ligne); border-radius: var(--rayon-l); overflow: hidden; }
.galerie-principale img { width: 100%; height: 100%; object-fit: contain; transition: opacity 180ms ease; }
.galerie-principale img.est-en-transition { opacity: 0; }
.galerie-vide { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; height: 100%; color: var(--encre-3); font-size: var(--texte-s); }
.galerie-vide svg { width: 3.25rem; height: 3.25rem; color: var(--ligne-2); }
.galerie-vignettes { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.galerie-vignette { width: 4.5rem; height: 4.5rem; padding: 0; border: 2px solid var(--ligne); border-radius: var(--rayon-s); background: var(--surface-2); overflow: hidden; transition: border-color var(--transition), transform var(--transition); }
.galerie-vignette img { width: 100%; height: 100%; object-fit: cover; }
.galerie-vignette:hover { border-color: var(--encre-3); transform: translateY(-1px); }
.galerie-vignette.est-active { border-color: var(--accent); }
.galerie-vignette:focus-visible { outline-offset: 3px; }

/* ---------- Informations ---------- */
.fiche-infos { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.fiche-categorie { margin: 0 0 0.4rem; font-size: var(--texte-xs); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sable-fonce); }
.fiche-categorie a { color: inherit; }
.fiche-nom { font-size: clamp(1.75rem, 3.4vw, 2.5rem); margin-bottom: 0.35rem; text-wrap: balance; }
.fiche-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; font-size: var(--texte-s); color: var(--encre-3); }
.fiche-meta [data-reference] { font-variant-numeric: tabular-nums; color: var(--encre-2); font-weight: 500; }
.fiche-accroche { font-size: 1.1rem; color: var(--encre); font-weight: 500; margin-bottom: 0.5rem; }
.fiche-description-courte { font-size: 0.98rem; }
.fiche-description-courte p:last-child { margin-bottom: 0; }

.fiche-prix { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--ligne); }
.fiche-prix-ligne { display: flex; align-items: baseline; gap: 0.5rem; margin: 0; line-height: 1; }
.fiche-prix-prefixe { font-size: 1rem; color: var(--encre-2); }
.fiche-prix-montant { font-family: var(--police-titre); font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fiche-prix-ht { font-size: 1rem; font-weight: 600; color: var(--encre-2); }
.fiche-prix-ttc { margin: 0.4rem 0 0; font-size: var(--texte-s); color: var(--encre-3); }
.fiche-conditionnement { margin: 0.35rem 0 0; font-size: var(--texte-s); color: var(--encre-2); font-weight: 500; }

.fiche-etats { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.fiche-etat-texte { font-size: var(--texte-s); color: var(--encre-2); }

/* ---------- Options (variantes) ---------- */
.fiche-options { margin: 1.5rem 0 0; }
.fiche-options legend { font-size: 1rem; margin-bottom: 0.6rem; }
.options-liste { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.option { display: block; cursor: pointer; }
.option-corps { display: flex; flex-direction: column; gap: 0.15rem; min-width: 8rem; padding: 0.65rem 0.95rem; border: 1px solid var(--ligne-2); border-radius: var(--rayon); background: var(--surface); transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.option:hover .option-corps { border-color: var(--encre-3); }
.option input:checked + .option-corps { border-color: var(--encre); background: var(--encre); color: #fff; }
.option input:checked + .option-corps .option-prix { color: rgba(255, 255, 255, 0.75); }
.option input:focus-visible + .option-corps { box-shadow: var(--anneau); border-color: var(--accent); }
.option-nom { font-weight: 600; font-size: 0.95rem; }
.option-prix { font-size: var(--texte-xs); color: var(--encre-3); font-variant-numeric: tabular-nums; }
.fiche-options .champ-aide { margin-top: 0.7rem; }
.fiche-options .champ-aide.est-satisfaite { color: var(--succes); }

/* ---------- Ajout au devis ---------- */
.fiche-ajout { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-top: 1.5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon-l); box-shadow: var(--ombre-1); }
.fiche-quantite { flex: 0 0 auto; }
.fiche-ajout-action { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.5rem; }
.fiche-ajout-aide { margin: 0; font-size: var(--texte-xs); color: var(--encre-3); text-align: center; }
.fiche-ajout .bouton.est-ajoute { background: var(--succes); border-color: var(--succes); }

/* ---------- Sections détaillées ---------- */
.fiche-sections { margin-top: clamp(2.5rem, 6vw, 4.5rem); max-width: 52rem; }
.fiche-onglets { margin-bottom: 1.5rem; position: sticky; top: 4.5rem; background: var(--fond); z-index: 5; }
.fiche-section { padding-block: 1.25rem 2rem; scroll-margin-top: 8.5rem; }
.fiche-section + .fiche-section { border-top: 1px solid var(--ligne); }
.fiche-section h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin-bottom: 0.9rem; }
.fiche-texte { color: var(--encre-2); font-size: 1rem; line-height: 1.65; }
.fiche-texte p:last-child { margin-bottom: 0; }
.fiche-caracteristiques th { width: 34%; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--encre-2); background: var(--surface-2); }

/* ---------- Même famille ---------- */
.fiche-famille { margin-top: clamp(1.5rem, 4vw, 3rem); border-top: 1px solid var(--ligne); }
.fiche-famille-entete { margin-bottom: 1.25rem; }
.fiche-famille-entete h2 { margin: 0; }
.fiche-famille-lien { font-size: var(--texte-s); font-weight: 600; }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .fiche-grille { grid-template-columns: 1fr; }
  .galerie { position: static; }
  .fiche-onglets { top: 4.5rem; }
}
@media (max-width: 640px) {
  /* Les onglets passent à la ligne au lieu de défiler sans indice (et ne sont plus collants) */
  .fiche-onglets { flex-wrap: wrap; position: static; overflow-x: visible; }
  .fiche-section { scroll-margin-top: 5rem; }
}
@media (max-width: 520px) {
  .fiche-ajout { flex-direction: column; align-items: stretch; }
  .fiche-quantite .stepper { width: 100%; justify-content: space-between; }
  .fiche-quantite .stepper input { flex: 1; }
  .options-liste { flex-direction: column; }
  .option-corps { flex-direction: row; justify-content: space-between; align-items: center; }
}
