/* ==========================================================================
   RoboPièces Distribution, design tokens
   Source de vérité pour apps/distributeur/public/style.css (copier tel quel en tête).
   Identité industrielle (SPEC 5.3). Base 20 px en 1920 × 1080, fluide en dessous.
   ========================================================================== */
:root {
  /* --- Couleurs de marque --- */
  --rp-anthracite: #2B2D31;     /* texte, en-tête */
  --rp-jaune: #F2B705;          /* accent, boutons, étiquettes de prix (toujours avec texte anthracite : 7,6:1) */
  --rp-blanc: #FFFFFF;
  --rp-acier: #8A8F98;          /* filets, icônes, jamais pour du texte sur blanc (3,3:1) */

  /* --- Dérivés --- */
  --rp-anthracite-2: #3A3D43;   /* survols sur fond anthracite */
  --rp-jaune-survol: #DDA700;
  --rp-jaune-pale: #FFF6D6;
  --rp-texte-doux: #5E636B;     /* 6,0:1 sur blanc, textes secondaires */
  --rp-fond: #F1F2F4;           /* fond de page, gris béton */
  --rp-fond-photo: #ECEDEF;     /* fond des vignettes de pièces */
  --rp-bordure: #D9DCE1;
  --rp-hachures: repeating-linear-gradient(-45deg, #F2B705 0 14px, #2B2D31 14px 28px); /* bande de signalisation */

  /* --- États du stock (pastille de la couleur SPEC, texte foncé pour la lisibilité) --- */
  --rp-stock-ok: #2E9E5B;        --rp-stock-ok-texte: #196C46;        --rp-stock-ok-fond: #E4F4EA;
  --rp-stock-faible: #F28C28;    --rp-stock-faible-texte: #A35200;    --rp-stock-faible-fond: #FDEBD8;  /* moins de 5 */
  --rp-stock-rupture: #D64541;   --rp-stock-rupture-texte: #B03A36;   --rp-stock-rupture-fond: #FBE3E2; /* 0, avec délai */

  /* --- Typographie --- */
  --rp-police-titre: "Barlow Condensed", "Arial Narrow", sans-serif;
  --rp-police: "Barlow", "Segoe UI", system-ui, sans-serif;
  --rp-base: clamp(16px, 0.42vw + 12px, 20px);
  --rp-t-xs: 0.8rem;
  --rp-t-s: 0.9rem;
  --rp-t-m: 1rem;
  --rp-t-l: 1.25rem;
  --rp-t-xl: 1.8rem;
  --rp-t-xxl: 2.6rem;
  --rp-t-hero: 3.4rem;

  /* --- Espacements --- */
  --rp-e-1: 0.2rem;
  --rp-e-2: 0.4rem;
  --rp-e-3: 0.6rem;
  --rp-e-4: 0.8rem;
  --rp-e-5: 1.2rem;
  --rp-e-6: 1.6rem;
  --rp-e-7: 2.4rem;
  --rp-e-8: 3.2rem;
  --rp-largeur-max: 1800px;

  /* --- Rayons : angles francs, industriels --- */
  --rp-r-s: 3px;
  --rp-r-m: 6px;
  --rp-r-l: 8px;

  /* --- Ombres --- */
  --rp-ombre-1: 0 1px 2px rgba(43, 45, 49, 0.08), 0 2px 6px rgba(43, 45, 49, 0.08);
  --rp-ombre-2: 0 10px 24px rgba(43, 45, 49, 0.16);
  --rp-focus: 0 0 0 4px rgba(242, 183, 5, 0.55);
}
/* ==========================================================================
   RoboPièces, feuille de style de référence (à placer après tokens.css)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--rp-base); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--rp-police); font-weight: 500; line-height: 1.45; color: var(--rp-anthracite); background: var(--rp-fond); }
a { color: var(--rp-anthracite); font-weight: 700; text-decoration-color: var(--rp-jaune); text-decoration-thickness: 3px; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--rp-focus); }
h1, h2, h3 { font-family: var(--rp-police-titre); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: 0.01em; }
h1 { font-size: var(--rp-t-xxl); text-transform: uppercase; }
h2 { font-size: var(--rp-t-xl); text-transform: uppercase; }
h3 { font-size: var(--rp-t-l); }
.chiffre { font-variant-numeric: tabular-nums; white-space: nowrap; }
.discret { color: var(--rp-texte-doux); }
.ref { font-family: var(--rp-police-titre); font-weight: 600; font-size: var(--rp-t-s); letter-spacing: 0.06em; color: var(--rp-texte-doux); }

/* ---------- Message du jour ---------- */
.message-jour { background: var(--rp-jaune); color: var(--rp-anthracite); font-weight: 700; font-size: var(--rp-t-m); display: flex; align-items: center; justify-content: center; gap: var(--rp-e-4); padding: var(--rp-e-3) var(--rp-e-5); text-align: center; }
.message-jour__etiquette { font-family: var(--rp-police-titre); text-transform: uppercase; letter-spacing: 0.08em; background: var(--rp-anthracite); color: var(--rp-jaune); padding: 0.1em 0.6em; border-radius: var(--rp-r-s); white-space: nowrap; }

/* ---------- En-tête ---------- */
.entete { background: var(--rp-anthracite); color: #fff; }
.entete__barre { max-width: var(--rp-largeur-max); margin: 0 auto; display: flex; align-items: center; gap: var(--rp-e-7); padding: var(--rp-e-4) var(--rp-e-7); }
.entete__logo img { height: 3rem; display: block; }
.entete__recherche { flex: 1; max-width: 46rem; display: flex; }
.entete__recherche input { flex: 1; font: inherit; font-size: var(--rp-t-m); font-weight: 600; min-height: 3.1rem; padding: 0 var(--rp-e-5); border: 0; border-radius: var(--rp-r-m) 0 0 var(--rp-r-m); color: var(--rp-anthracite); }
.entete__recherche button { font: inherit; font-family: var(--rp-police-titre); font-size: var(--rp-t-l); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 0; padding: 0 var(--rp-e-6); background: var(--rp-jaune); color: var(--rp-anthracite); border-radius: 0 var(--rp-r-m) var(--rp-r-m) 0; cursor: pointer; }
.entete__nav { display: flex; gap: var(--rp-e-6); margin-left: auto; font-weight: 700; }
.entete__nav a { color: #fff; text-decoration: none; padding: var(--rp-e-2) 0; border-bottom: 3px solid transparent; }
.entete__nav a:hover, .entete__nav a.actif { border-bottom-color: var(--rp-jaune); }
.bande-signal { height: 10px; background: var(--rp-hachures); }

/* ---------- Bandeau d'accueil (illustration recadrée en 3:1) ---------- */
.bandeau { position: relative; aspect-ratio: 3 / 1; max-height: 30rem; width: 100%; overflow: hidden; background: var(--rp-anthracite); }
.bandeau img { width: 100%; height: 100%; object-fit: cover; object-position: center 55%; display: block; }
.bandeau__texte { position: absolute; left: var(--rp-e-7); bottom: var(--rp-e-7); max-width: 40rem; background: var(--rp-anthracite); color: #fff; padding: var(--rp-e-6) var(--rp-e-7); border-left: 10px solid var(--rp-jaune); box-shadow: var(--rp-ombre-2); }
.bandeau__texte h1 { color: #fff; }
.bandeau__texte p { margin: var(--rp-e-3) 0 0; font-size: var(--rp-t-l); color: #E2E4E8; font-weight: 500; }

/* ---------- Mise en page ---------- */
.page { flex: 1; width: 100%; max-width: var(--rp-largeur-max); margin: 0 auto; padding: var(--rp-e-7); }
.catalogue { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: var(--rp-e-7); align-items: start; }
.catalogue__entete { display: flex; justify-content: space-between; align-items: baseline; gap: var(--rp-e-5); margin-bottom: var(--rp-e-5); flex-wrap: wrap; }
.catalogue__compte { font-size: var(--rp-t-l); font-weight: 600; color: var(--rp-texte-doux); }
.catalogue__compte strong { color: var(--rp-anthracite); }

/* ---------- Filtres ---------- */
.filtres { background: var(--rp-blanc); border: 1px solid var(--rp-bordure); border-radius: var(--rp-r-l); padding: var(--rp-e-5); position: sticky; top: var(--rp-e-5); }
.filtres__groupe + .filtres__groupe { margin-top: var(--rp-e-6); padding-top: var(--rp-e-5); border-top: 1px solid var(--rp-bordure); }
.filtres__titre { font-family: var(--rp-police-titre); font-size: var(--rp-t-l); font-weight: 700; text-transform: uppercase; margin-bottom: var(--rp-e-3); }
.modeles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--rp-e-2); }
.modele { display: flex; align-items: center; justify-content: center; min-height: 2.8rem; border: 2px solid var(--rp-bordure); border-radius: var(--rp-r-m); font-family: var(--rp-police-titre); font-size: var(--rp-t-l); font-weight: 700; text-decoration: none; background: var(--rp-blanc); }
.modele:hover { border-color: var(--rp-anthracite); }
.modele--actif { background: var(--rp-anthracite); border-color: var(--rp-anthracite); color: var(--rp-jaune); }
.categories { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.categories label { display: flex; align-items: center; gap: var(--rp-e-3); padding: var(--rp-e-2) var(--rp-e-2); border-radius: var(--rp-r-s); font-weight: 600; cursor: pointer; }
.categories label:hover { background: var(--rp-fond); }
.categories input, .filtres input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--rp-anthracite); }
.categories .compte { margin-left: auto; color: var(--rp-texte-doux); font-variant-numeric: tabular-nums; }
.filtre-actif { display: inline-flex; align-items: center; gap: var(--rp-e-2); padding: 0.3em 0.8em; background: var(--rp-anthracite); color: #fff; border-radius: var(--rp-r-s); font-weight: 700; font-size: var(--rp-t-s); }
.filtre-actif button { all: unset; cursor: pointer; color: var(--rp-jaune); font-weight: 800; }

/* ---------- Cartes de pièces ---------- */
.grille-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: var(--rp-e-5); }
.carte-piece { display: flex; flex-direction: column; background: var(--rp-blanc); border: 1px solid var(--rp-bordure); border-radius: var(--rp-r-l); overflow: hidden; text-decoration: none; color: inherit; font-weight: 500; box-shadow: var(--rp-ombre-1); transition: transform .15s, box-shadow .15s; }
.carte-piece:hover { transform: translateY(-3px); box-shadow: var(--rp-ombre-2); }
.carte-piece__photo { aspect-ratio: 1; background: var(--rp-fond-photo); display: grid; place-items: center; position: relative; }
.carte-piece__photo img { width: 100%; height: 100%; object-fit: cover; }
.carte-piece__photo img.generique { width: 38%; height: auto; opacity: 0.55; }
.carte-piece__categorie { position: absolute; top: var(--rp-e-3); left: var(--rp-e-3); background: var(--rp-anthracite); color: #fff; font-family: var(--rp-police-titre); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--rp-t-xs); padding: 0.15em 0.6em; border-radius: var(--rp-r-s); }
.carte-piece__corps { padding: var(--rp-e-4) var(--rp-e-5) var(--rp-e-5); display: flex; flex-direction: column; gap: var(--rp-e-2); flex: 1; }
.carte-piece__nom { font-family: var(--rp-police-titre); font-size: var(--rp-t-l); font-weight: 700; line-height: 1.1; }
.carte-piece__bas { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: var(--rp-e-3); padding-top: var(--rp-e-3); flex-wrap: wrap; }
.compat { display: flex; flex-wrap: wrap; gap: 4px; }
.compat__modele { font-family: var(--rp-police-titre); font-weight: 700; font-size: var(--rp-t-s); padding: 0.05em 0.5em; border: 2px solid var(--rp-anthracite); border-radius: var(--rp-r-s); }
.compat__modele--cherche { background: var(--rp-anthracite); color: var(--rp-jaune); }

/* Prix : étiquette jaune, texte anthracite */
.prix { display: inline-flex; align-items: baseline; gap: 0.3em; background: var(--rp-jaune); color: var(--rp-anthracite); font-family: var(--rp-police-titre); font-weight: 700; font-size: var(--rp-t-l); padding: 0.1em 0.55em; border-radius: var(--rp-r-s); font-variant-numeric: tabular-nums; white-space: nowrap; }
.prix small { font-size: 0.65em; font-weight: 600; }
.prix--grand { font-size: var(--rp-t-hero); padding: 0.05em 0.35em; }

/* Stock : pastille de couleur + texte, jamais la couleur seule */
.stock { display: inline-flex; align-items: center; gap: 0.45em; padding: 0.2em 0.7em; border-radius: 999px; font-weight: 700; font-size: var(--rp-t-s); white-space: nowrap; }
.stock::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 50%; flex: none; }
.stock--ok { color: var(--rp-stock-ok-texte); background: var(--rp-stock-ok-fond); }
.stock--ok::before { background: var(--rp-stock-ok); }
.stock--faible { color: var(--rp-stock-faible-texte); background: var(--rp-stock-faible-fond); }
.stock--faible::before { background: var(--rp-stock-faible); }
.stock--rupture { color: var(--rp-stock-rupture-texte); background: var(--rp-stock-rupture-fond); }
.stock--rupture::before { background: var(--rp-stock-rupture); }
.carte-piece--rupture .carte-piece__photo img { filter: grayscale(0.7); opacity: 0.7; }

/* ---------- Fiche pièce ---------- */
.fil { font-size: var(--rp-t-s); font-weight: 600; color: var(--rp-texte-doux); margin-bottom: var(--rp-e-5); }
.fiche { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--rp-e-8); align-items: start; }
.fiche__photo { background: var(--rp-fond-photo); border-radius: var(--rp-r-l); overflow: hidden; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--rp-bordure); }
.fiche__photo img { width: 100%; height: 100%; object-fit: cover; }
.fiche__titre { margin: var(--rp-e-2) 0 var(--rp-e-4); font-size: var(--rp-t-hero); text-transform: none; }
.fiche__description { font-size: var(--rp-t-l); line-height: 1.5; margin: 0 0 var(--rp-e-5); }
.fiche__ligne { display: flex; align-items: center; gap: var(--rp-e-5); flex-wrap: wrap; margin-bottom: var(--rp-e-5); }
.alerte-compat { display: flex; gap: var(--rp-e-4); align-items: center; padding: var(--rp-e-4) var(--rp-e-5); border-radius: var(--rp-r-m); background: var(--rp-jaune-pale); border-left: 8px solid var(--rp-jaune); font-weight: 600; margin-bottom: var(--rp-e-5); }
.disponibilite { display: grid; grid-template-columns: auto 1fr; gap: var(--rp-e-4) var(--rp-e-6); align-items: center; padding: var(--rp-e-5) var(--rp-e-6); background: var(--rp-blanc); border: 1px solid var(--rp-bordure); border-radius: var(--rp-r-l); margin-bottom: var(--rp-e-6); }
.disponibilite img { width: 7rem; }
.disponibilite__titre { font-family: var(--rp-police-titre); font-size: var(--rp-t-xl); font-weight: 700; line-height: 1; }
.disponibilite--ok .disponibilite__titre { color: var(--rp-stock-ok-texte); }
.paliers { width: 100%; border-collapse: collapse; background: var(--rp-blanc); border: 1px solid var(--rp-bordure); border-radius: var(--rp-r-l); overflow: hidden; font-size: var(--rp-t-l); }
.paliers caption { text-align: left; font-family: var(--rp-police-titre); font-weight: 700; font-size: var(--rp-t-xl); text-transform: uppercase; padding-bottom: var(--rp-e-3); }
.paliers th { background: var(--rp-anthracite); color: #fff; text-align: left; font-family: var(--rp-police-titre); text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--rp-t-m); padding: var(--rp-e-3) var(--rp-e-5); }
.paliers td { padding: var(--rp-e-4) var(--rp-e-5); border-top: 1px solid var(--rp-bordure); font-weight: 600; }
.paliers .num { text-align: right; font-variant-numeric: tabular-nums; }
.paliers tr.palier--courant td { background: var(--rp-jaune-pale); font-weight: 800; }
.remise-palier { display: inline-block; background: var(--rp-anthracite); color: var(--rp-jaune); font-family: var(--rp-police-titre); font-weight: 700; padding: 0 0.5em; border-radius: var(--rp-r-s); }
.note-consultation { margin-top: var(--rp-e-5); padding: var(--rp-e-4) var(--rp-e-5); background: var(--rp-blanc); border: 1px dashed var(--rp-acier); border-radius: var(--rp-r-m); color: var(--rp-texte-doux); font-weight: 600; }
.section { margin-top: var(--rp-e-8); }
.section h2 { margin-bottom: var(--rp-e-5); }

/* ---------- États vides et 404 ---------- */
.etat-vide { display: grid; justify-items: center; text-align: center; gap: var(--rp-e-4); padding: var(--rp-e-8) var(--rp-e-6); background: var(--rp-blanc); border: 1px solid var(--rp-bordure); border-radius: var(--rp-r-l); }
.etat-vide img { width: min(24rem, 70vw); }
.etat-vide__titre { font-family: var(--rp-police-titre); font-size: var(--rp-t-xxl); font-weight: 700; text-transform: uppercase; line-height: 1.05; }
.etat-vide__texte { font-size: var(--rp-t-l); color: var(--rp-texte-doux); margin: 0; max-width: 40rem; font-weight: 500; }
.code-404 { font-family: var(--rp-police-titre); font-size: 7rem; font-weight: 700; line-height: 0.9; background: var(--rp-anthracite); color: var(--rp-jaune); padding: 0.05em 0.3em; border-radius: var(--rp-r-m); }

/* ---------- Boutons ---------- */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: var(--rp-e-2); min-height: 3rem; padding: 0 var(--rp-e-6); font: inherit; font-family: var(--rp-police-titre); font-size: var(--rp-t-l); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; text-decoration: none; border-radius: var(--rp-r-m); border: 2px solid transparent; cursor: pointer; }
.bouton--principal { background: var(--rp-jaune); color: var(--rp-anthracite); }
.bouton--principal:hover { background: var(--rp-jaune-survol); }
.bouton--secondaire { background: var(--rp-blanc); color: var(--rp-anthracite); border-color: var(--rp-anthracite); }

/* ---------- Pied de page ---------- */
.argument { background: var(--rp-anthracite); color: #fff; }
.argument__contenu { max-width: var(--rp-largeur-max); margin: 0 auto; display: flex; align-items: center; gap: var(--rp-e-7); padding: var(--rp-e-5) var(--rp-e-7); flex-wrap: wrap; }
.argument img { height: 4.5rem; border-radius: var(--rp-r-m); }
.argument__titre { font-family: var(--rp-police-titre); font-size: var(--rp-t-xl); font-weight: 700; text-transform: uppercase; color: var(--rp-jaune); }
.pied { background: #1E2023; color: #C3C7CE; font-size: var(--rp-t-s); }
.pied__contenu { max-width: var(--rp-largeur-max); margin: 0 auto; display: flex; align-items: center; gap: var(--rp-e-5); padding: var(--rp-e-5) var(--rp-e-7); flex-wrap: wrap; }
.pied img { height: 1.8rem; }
.pied__droite { margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .catalogue { grid-template-columns: 1fr; }
  .filtres { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--rp-e-5); }
  .filtres__groupe + .filtres__groupe { margin-top: 0; padding-top: 0; border-top: 0; }
  .fiche { grid-template-columns: 1fr; gap: var(--rp-e-6); }
  .fiche__photo { max-width: 34rem; }
  .entete__nav { display: none; }
}
@media (max-width: 760px) {
  .entete__barre { flex-wrap: wrap; padding: var(--rp-e-4); gap: var(--rp-e-4); }
  .entete__recherche { order: 3; max-width: none; width: 100%; }
  .bandeau { aspect-ratio: auto; max-height: none; }
  .bandeau img { aspect-ratio: 16 / 9; height: auto; }
  .bandeau__texte { position: static; max-width: none; border-left-width: 6px; }
  .filtres { grid-template-columns: 1fr; }
  .page { padding: var(--rp-e-5) var(--rp-e-4); }
  .grille-pieces { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rp-e-3); }
  .message-jour { font-size: var(--rp-t-s); }
}
@media (prefers-reduced-motion: reduce) { .carte-piece { transition: none; } }
