/* ============================================================
   base.css — reset léger + styles globaux
   ============================================================ */

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

html { scroll-behavior: smooth; overflow-x: hidden; }

/* Garantit que l'attribut hidden l'emporte toujours, même si un
   composant définit son propre display (flex/grid/block...).
   Sans cette règle, un élément avec hidden peut rester visible
   si sa classe fixe un display explicite ailleurs. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-navy-900);
  background: var(--color-white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
  /* Filet de sécurité : un élément trop large ne doit jamais élargir la page
     (sinon Chrome mobile agrandit la zone d'affichage et le header fixe déborde) */
  overflow-x: hidden;
  overflow-x: clip;
  /* Le header est en position fixed (toujours visible) : ce padding
     réserve sa place en haut de chaque page pour que le contenu ne
     passe pas dessous. */
  padding-top: var(--header-height);
  /* Empêche un mot ou une chaîne sans espace (URL, texte collé depuis
     une autre source...) de forcer toute la mise en page à s'élargir
     au-delà de l'écran. Hérité par tous les éléments du site. */
  overflow-wrap: anywhere;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-navy-950);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}

h1 { font-size: clamp(34px, 5.5vw, 58px); }
h2 { font-size: clamp(26px, 3.4vw, 40px); }
h3 { font-weight: 800; }

/* Grands titres : Oswald gras, majuscules (voir --font-display) */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.08;
  text-wrap: balance;
}

p { margin: 0 0 var(--space-3); color: var(--color-steel-500); }

a { color: inherit; }

img { max-width: 100%; display: block; }

button, input, select, textarea { font-family: inherit; }

.btn--secondary {
  background: var(--color-white);
  color: var(--color-navy-900);
  border: 1px solid var(--color-steel-300);
}

.btn--secondary:hover { border-color: var(--color-navy-900); }

.btn--outline {
  background: transparent;
  color: var(--color-navy-900);
  border: 1px solid var(--color-steel-300);
  padding: 8px 16px;
}

.btn--outline:hover { border-color: var(--color-accent-500); color: var(--color-accent-500); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--new { background: var(--color-accent-500); color: var(--color-white); }
.badge--verified { background: var(--color-success); color: var(--color-white); }
.badge--promo { background: var(--color-navy-950); color: var(--color-white); }

.empty-state {
  text-align: center;
  padding: var(--space-6);
  color: var(--color-steel-500);
  font-style: italic;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto var(--space-4);
  padding: 0 var(--space-4);
}

.section-heading__link {
  font-weight: 600;
  color: var(--color-accent-500);
  text-decoration: none;
  white-space: nowrap;
}

main > section {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-4);
}

/* Skeleton loaders génériques */
.skeleton {
  background: linear-gradient(90deg, var(--color-steel-100) 25%, #f6f7f9 37%, var(--color-steel-100) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* Prix avec promotion (prix barré + badge de réduction) — généré par
   renderPriceHtml() dans products.js, utilisé partout où un prix est
   affiché (cartes produit, fiche produit, panier). */
.price-current { font-weight: 700; }
.price-current--sale { color: var(--color-danger); }
.price-compare-at {
  text-decoration: line-through;
  color: var(--color-steel-500);
  font-weight: 400;
  font-size: 0.85em;
  margin-left: 6px;
}
.price-discount-badge {
  display: inline-block;
  background: var(--color-danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  margin-left: 6px;
  vertical-align: middle;
}

/* ============================================================
   Étiquette énergétique UE — flèche « affichage imbriqué »
   (généré par renderEnergyBadge() dans energy-label.js)
   ============================================================ */
.energy-arrow {
  --h: 24px;
  --tip: calc(var(--h) / 2);
  display: inline-flex;
  align-items: stretch;
  height: var(--h);
  padding: 1.5px;
  border: none;
  margin: 0;
  background: #1a1a1a;
  clip-path: polygon(0 0, calc(100% - var(--tip)) 0, 100% 50%, calc(100% - var(--tip)) 100%, 0 100%);
  font-family: Calibri, Carlito, 'Arial Narrow', Arial, sans-serif;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  cursor: default;
  flex-shrink: 0;
}
button.energy-arrow, a.energy-arrow { cursor: pointer; transition: transform 0.15s ease; }
button.energy-arrow:hover, a.energy-arrow:hover { transform: scale(1.06); }
button.energy-arrow:focus-visible, a.energy-arrow:focus-visible { outline: none; filter: drop-shadow(0 0 3px var(--color-accent-500)); }

.energy-arrow__scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1px 3px;
  background: #fff;
  color: #1a1a1a;
  font-size: calc(var(--h) * 0.3);
  position: relative;
}
.energy-arrow__class {
  display: flex;
  align-items: center;
  padding: 0 calc(var(--tip) + 2px) 0 6px;
  margin-left: 1.5px;
  background: var(--energy-color, #00a651);
  color: #fff;
  font-size: calc(var(--h) * 0.62);
  letter-spacing: -0.02em;
  text-shadow: 0 0 1px #000, 0 0 1px #000;
  clip-path: polygon(0 0, calc(100% - var(--tip) + 1px) 0, 100% 50%, calc(100% - var(--tip) + 1px) 100%, 0 100%);
}
.energy-arrow--dark .energy-arrow__class { color: #1a1a1a; text-shadow: none; }
.energy-arrow--lg { --h: 38px; }

.product-card__energy { margin: 6px 0 0; line-height: 0; }

/* Visionneuse de l'étiquette */
.energy-viewer {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(10, 15, 26, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: energy-fade 0.15s ease;
}
.energy-viewer__panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  max-width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.energy-viewer__panel img { display: block; width: 100%; height: auto; }
.energy-viewer__close {
  position: absolute;
  top: 8px; right: 8px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-steel-100);
  font-size: 16px;
  cursor: pointer;
}
@keyframes energy-fade { from { opacity: 0; } to { opacity: 1; } }

/* Texte réservé aux lecteurs d'écran */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
