/* ===========================================================================
   BASE — reset, corps de page, typographie, conteneurs, boutons
   Valeurs issues de cahier-de-charge/README.md §4.5 et des fiches de bloc
   =========================================================================== */

*, *::before, *::after { box-sizing: inherit; }

html {
  box-sizing: border-box;
  font-size: calc(var(--font-body-scale) * 62.5%);  /* = 10px */
  height: 100%;
  scroll-behavior: smooth;
}

body {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  grid-template-columns: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-size: var(--fs-body);
  letter-spacing: var(--ls-body);
  line-height: calc(1 + 0.8 / var(--font-body-scale));   /* = 1.8 */
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--c-text-90);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

/* `hidden` doit l'emporter sur les display: flex/grid des composants */
[hidden] { display: none !important; }

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

ul, ol { list-style: none; padding: 0; margin: 0; }

/* --- Titres --------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: var(--ls-heading);
  margin: 0;
  color: var(--c-text);
}
h1, .h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2, .h2, h3, .h3 { font-size: var(--fs-h2); line-height: var(--lh-h2); }

/* --- Conteneur de page ---------------------------------------------------- */
.page-width {
  max-width: var(--page-width);           /* 1400px */
  margin: 0 auto;
  padding: 0 var(--page-padding-mobile);
}
@media screen and (min-width: 750px) {
  .page-width { padding: 0 var(--page-padding-desktop); }
}

/* Blocs pleine largeur (bannières, tickers, diaporama, séparateurs) */
.full-bleed { width: 100%; }

/* --- Accessibilité -------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: 0; z-index: 2000;
  padding: 12px 20px;
  background: var(--c-accent-1); color: #fff;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 2px solid var(--c-accent-1); outline-offset: 2px; }

/* --- Icônes Material ------------------------------------------------------ */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal;
  direction: ltr; -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  max-width: 1em; overflow: hidden; flex-shrink: 0;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
  vertical-align: bottom;
}
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1; }

/* ===========================================================================
   BOUTONS
   Mécanique exacte du thème (collection/04-carte-produit.md §5) :
   le fond est peint par ::after (rayon 18px, z-index -1)
   et l'anneau de 2px par ::before (rayon 20px, z-index -2).
   Reproduite à l'identique — voir prototype/README.md « Écarts assumés ».
   =========================================================================== */
.button {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 49px;
  padding: 0 30px;
  border: 0;
  background-color: transparent;
  color: rgb(var(--color-solid-button-labels));
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 1px;
  text-transform: none;
  text-decoration: none;
  border-radius: var(--buttons-radius-outset);
  /* live : `transition: box-shadow 0.1s` sur le bouton lui-meme */
  transition: box-shadow 0.1s, color 0.4s;
}
.button::after {
  content: "";
  position: absolute;
  /* le live encadre `::after` de la largeur de bordure (2px) */
  inset: var(--buttons-border-width);
  transition: box-shadow 0.1s;
  z-index: -1;
  background-color: var(--c-accent-1);
  border-radius: var(--buttons-radius);
}
.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: var(--buttons-radius-outset);
  box-shadow: 0 0 0 var(--buttons-border-width) inset var(--c-accent-1);
}
.button--full-width { width: 100%; }

/* Modificateur de TAILLE — la seule variation autorisee du composant.
   Aucun autre fichier ne redefinit la police, la casse ou l'interlettrage
   d'un bouton : tout passe par `.button` + eventuellement `.button--sm`. */
.button--sm {
  min-height: 38px;
  padding: 0 6px;
  /* cahier collection/04 §4 : 13px en mobile, 16px en desktop.
     A 16px, « Ajouter au panier » passait sur 2 lignes dans 143px.
     `nowrap` + interlettrage resserre : le libelle tient sur UNE ligne. */
  font-size: 13px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
/* tres petits ecrans (320px) : la carte ne fait plus que ~115px utiles */
@media screen and (max-width: 359px) {
  .button--sm { font-size: 12px; letter-spacing: 0.2px; padding: 0 4px; }
}
@media screen and (min-width: 750px) {
  .button--sm { min-height: 49px; padding: 0 16px; font-size: 16px; letter-spacing: 1px; }
}
/* Survol du live : AUCUN changement de fond. Un anneau apparait autour du
   bouton via le box-shadow de `::after`, en 0,1s :
     .button:not([disabled]):hover:after {
       --border-offset: 1.3px;
       box-shadow: 0 0 0 calc(border-width + 1.3px) rgba(label),
                   0 0 0 calc(border-width + 1px)   rgba(bouton);
     }
   `::after` est encadre de --buttons-border-width (2px) sur les 4 cotes. */
.button:not([disabled]):hover::after {
  box-shadow:
    0 0 0 calc(var(--buttons-border-width) + 1.3px) rgba(30, 30, 30, 0.9),
    0 0 0 calc(var(--buttons-border-width) + 1px)   var(--c-accent-1);
}

/* Bouton « Acheter maintenant » — contour, présent mais à hauteur 0 sur le live */
.button--secondary {
  background-color: #fff;
  color: var(--c-gold-deep);
  border: 1px solid var(--c-gold);
  border-radius: var(--buttons-radius-outset);
}
.button--secondary::after { background-color: #fff; }

/* --- Badge ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7.5px;
  min-height: 21px;
  background-color: var(--c-accent-2);
  border: 1px solid var(--c-accent-2);
  border-radius: var(--badge-radius);
  color: var(--c-charcoal);
  font-size: 10px;
  font-weight: 700;
  line-height: 19px;
  letter-spacing: 1px;
}
@media screen and (min-width: 750px) {
  .badge { font-size: 12px; line-height: 22.8px; min-height: 25px; padding: 0 9px; gap: 4.8px; }
}

/* --- Étoiles de notation -------------------------------------------------- */
/* cahier : underlay #ECECEC + overlay #FFCC00 rogné par overflow:hidden      */
.rating-stars { display: flex; align-items: center; min-height: 22px; }
.rating-stars__wrap { position: relative; display: inline-block; line-height: 0; }
.rating-stars__layer { display: flex; gap: 1px; }
.rating-stars__layer svg { width: 14px; height: 14px; }
.rating-stars__under { color: var(--c-star-empty); }
.rating-stars__over {
  position: absolute; inset: 0;
  overflow: hidden;
  color: var(--c-star-full);
}

/* --- Animations d'entrée -------------------------------------------------- */
.animate-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-item.is-visible { opacity: 1; transform: none; }
/* Cascade `animate-item--child index-N` du live : revelation sequentielle
   et non simultanee. Le delai est porte par --index pose sur l'element. */
.animate-item--child { transition-delay: calc(var(--index, 0) * 90ms); }

/* Respect de la préférence système — absent du site live, ajouté ici.
   Voir prototype/README.md « Écarts assumés ». */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .animate-item { opacity: 1; transform: none; }
}
