/* ==========================================================================
   ÉCRIN — Composants boutique (header, hero, produits, panier, footer)
   Scopé au front public. S'appuie sur theme.css.
   ========================================================================== */

/* ---- Header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header__bar { display: flex; align-items: center; gap: var(--sp-5); height: 76px; }
.brand { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; letter-spacing: 0.14em; color: var(--text); }
.brand span { color: var(--accent); }
.nav-primary { display: flex; gap: var(--sp-5); margin-inline: auto; }
.nav-primary a { font-size: var(--fs-sm); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: var(--sp-2) 0; position: relative; transition: color var(--t-fast); }
.nav-primary a::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 1px; background: var(--accent); transition: width var(--t); }
.nav-primary a:hover, .nav-primary a[aria-current="page"] { color: var(--text); }
.nav-primary a:hover::after, .nav-primary a[aria-current="page"]::after { width: 100%; }
.header-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-pill); color: var(--text); background: transparent; border: 1px solid transparent; cursor: pointer; position: relative; transition: background var(--t-fast); }
.icon-btn:hover { background: rgba(201,169,106,0.10); }
.icon-btn .count { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--primary); color: #fff; border-radius: var(--r-pill); }
.burger { display: none; }

/* Announcement bar */
.announce { background: linear-gradient(90deg, var(--c-bordeaux), var(--c-bordeaux-600)); color: #fff; text-align: center; font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; padding: var(--sp-2); }

/* ---- Hero -------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(var(--sp-8), 12vw, 160px); }
.hero__inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--sp-7); align-items: center; }
.hero h1 { margin-block: var(--sp-4); }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero__cta { display: flex; gap: var(--sp-3); margin-top: var(--sp-6); flex-wrap: wrap; }
.hero__media { aspect-ratio: 4/5; border-radius: var(--r-xl); background:
  linear-gradient(160deg, var(--c-noir-700), var(--c-noir-800)),
  radial-gradient(circle at 30% 20%, rgba(201,169,106,0.25), transparent 55%);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.hero__media::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 80%, rgba(110,20,35,0.4), transparent 60%); }

/* ---- Bandeau réassurance ----------------------------------------------- */
.reassurance { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.reassurance__item { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elev); }
.reassurance__item svg { flex: none; color: var(--accent); }
.reassurance__item strong { display: block; font-size: var(--fs-sm); }
.reassurance__item span { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---- Grille produits --------------------------------------------------- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
.product-card { position: relative; display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.product-card__media { aspect-ratio: 3/4; background: linear-gradient(160deg, var(--c-noir-700), var(--c-noir-800)); position: relative; overflow: hidden; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.product-card:hover .product-card__media img { transform: scale(1.05); }
.product-card__badges { position: absolute; top: var(--sp-3); left: var(--sp-3); display: flex; flex-direction: column; gap: 6px; }
.product-card__wish { position: absolute; top: var(--sp-3); right: var(--sp-3); width: 40px; height: 40px; }
.product-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.product-card__brand { font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-subtle); }
.product-card__title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; }
.product-card__price { margin-top: auto; display: flex; align-items: baseline; gap: var(--sp-2); }
.price { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.price--old { font-size: var(--fs-sm); color: var(--text-subtle); text-decoration: line-through; }
.product-card__actions { padding: 0 var(--sp-4) var(--sp-4); }
.rating { display: inline-flex; gap: 2px; color: var(--accent); font-size: var(--fs-sm); }
.rating .empty { color: var(--text-subtle); }

/* ---- Layout catalogue (filtres + grille) ------------------------------ */
.catalog { display: grid; grid-template-columns: 260px 1fr; gap: var(--sp-6); align-items: start; }
.filters { position: sticky; top: 96px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elev); padding: var(--sp-5); }
.filters__group + .filters__group { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.filters__title { font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: var(--sp-3); }
.filters__list { display: grid; gap: var(--sp-2); max-height: 220px; overflow: auto; }
.catalog__toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.catalog__count { color: var(--text-muted); font-size: var(--fs-sm); }

/* ---- Fiche produit ----------------------------------------------------- */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-7); align-items: start; }
.pdp__gallery { position: sticky; top: 96px; }
.pdp__main-img { aspect-ratio: 3/4; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-strong); background: var(--c-noir-800); }
.pdp__thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-2); margin-top: var(--sp-3); }
.pdp__thumbs button { aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); cursor: pointer; padding: 0; background: var(--c-noir-800); }
.pdp__thumbs button[aria-selected="true"] { border-color: var(--accent); }
.pdp__price { font-size: var(--fs-xl); font-weight: 600; }
.variant-group { margin-block: var(--sp-4); }
.variant-group__label { font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.swatches { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.swatch { min-width: 48px; height: 44px; padding: 0 var(--sp-3); display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); transition: border-color var(--t-fast); }
.swatch[aria-pressed="true"] { border-color: var(--accent); background: rgba(201,169,106,0.12); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-pill); overflow: hidden; }
.qty button { width: 44px; height: 44px; background: transparent; color: var(--text); border: 0; cursor: pointer; font-size: var(--fs-md); }
.qty input { width: 48px; height: 44px; text-align: center; border: 0; background: transparent; color: var(--text); font: inherit; }
.pdp__accordion summary { cursor: pointer; padding: var(--sp-4) 0; border-top: 1px solid var(--border); font-family: var(--font-display); font-size: var(--fs-md); list-style: none; display: flex; justify-content: space-between; }
.pdp__accordion summary::-webkit-details-marker { display: none; }

/* ---- Tiroir panier (cart drawer) -------------------------------------- */
.drawer-overlay { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-drawer); opacity: 0; visibility: hidden; transition: opacity var(--t); }
.drawer-overlay.is-open { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(440px, 100%); background: var(--bg-elev); border-left: 1px solid var(--border-strong); z-index: var(--z-drawer); transform: translateX(100%); transition: transform var(--t); display: flex; flex-direction: column; }
.drawer.is-open { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--border); }
.drawer__body { flex: 1; overflow: auto; padding: var(--sp-4) var(--sp-5); }
.drawer__foot { padding: var(--sp-5); border-top: 1px solid var(--border); }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.cart-line__thumb { width: 64px; height: 80px; border-radius: var(--r-md); overflow: hidden; background: var(--c-noir-800); }
.cart-line__title { font-size: var(--fs-sm); font-weight: 500; }
.cart-line__meta { font-size: var(--fs-xs); color: var(--text-subtle); }
.cart-line__remove { background: none; border: 0; color: var(--text-subtle); cursor: pointer; font-size: var(--fs-xs); text-decoration: underline; }

/* ---- Footer ------------------------------------------------------------ */
.site-footer { margin-top: var(--sp-9); border-top: 1px solid var(--border); background: var(--bg-elev); }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--sp-6); padding-block: var(--sp-8); }
.site-footer h4 { font-family: var(--font-text); font-size: var(--fs-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: var(--sp-3); }
.site-footer a { display: block; font-size: var(--fs-sm); color: var(--text-muted); padding: 6px 0; transition: color var(--t-fast); }
.site-footer a:hover { color: var(--accent); }
.site-footer__bottom { border-top: 1px solid var(--border); padding-block: var(--sp-4); display: flex; justify-content: space-between; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--text-subtle); flex-wrap: wrap; }
.newsletter { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }

/* ---- Age gate (popup 18+) --------------------------------------------- */
.age-gate { position: fixed; inset: 0; z-index: var(--z-agegate); display: grid; place-items: center; padding: var(--sp-5); background: rgba(6,5,7,0.94); backdrop-filter: blur(6px); }
.age-gate__card { max-width: 460px; width: 100%; text-align: center; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: var(--sp-7); box-shadow: var(--shadow-lg); }
.age-gate__seal { width: 84px; height: 84px; margin: 0 auto var(--sp-4); display: grid; place-items: center; border-radius: var(--r-pill); border: 2px solid var(--accent); font-family: var(--font-display); font-size: 1.6rem; color: var(--accent); }
.age-gate__actions { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }

/* ---- Fil d'ariane ------------------------------------------------------ */
.breadcrumb { display: flex; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-subtle); padding-block: var(--sp-4); flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--accent); }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .reassurance { grid-template-columns: repeat(2, 1fr); }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .nav-primary { display: none; }
  .burger { display: inline-grid; }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__media { order: -1; aspect-ratio: 16/10; }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; }
  .pdp { grid-template-columns: 1fr; }
  .pdp__gallery { position: static; }
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .reassurance { grid-template-columns: 1fr; }
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Améliorations : réassurance raffinée + compacte, et bouton thème
   ========================================================================== */

/* Icône en pastille dorée + alignement centré pour un rendu plus premium */
.reassurance__item { align-items: center; }
.reassurance__item svg {
  width: 20px; height: 20px; padding: 9px; box-sizing: content-box;
  border-radius: var(--r-pill); background: rgba(201,169,106,0.10);
  border: 1px solid var(--border); color: var(--accent);
}
.reassurance__item strong { font-size: var(--fs-sm); line-height: 1.2; }
.reassurance__item span { line-height: 1.4; }

/* Version compacte sur la fiche produit : 2 colonnes au lieu de 4 */
.pdp .reassurance { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-top: var(--sp-5); }
.pdp .reassurance__item { padding: var(--sp-3) var(--sp-4); }
.pdp .reassurance__item strong { font-size: var(--fs-xs); letter-spacing: 0.02em; }
.pdp .reassurance__item span { font-size: 11px; }
@media (max-width: 560px) { .pdp .reassurance { grid-template-columns: 1fr; } }

/* Bouton bascule thème : affiche l'icône du mode vers lequel on va */
#theme-toggle .ic-moon { display: none; }
#theme-toggle .ic-sun  { display: block; }
[data-theme="light"] #theme-toggle .ic-sun  { display: none; }
[data-theme="light"] #theme-toggle .ic-moon { display: block; }

/* ==========================================================================
   RESPONSIVE MOBILE — corrections globales (PC + mobile opérationnels)
   ========================================================================== */

/* Jamais de scroll horizontal */
html, body { overflow-x: hidden; max-width: 100%; }
img, table { max-width: 100%; }

/* Menu mobile déroulant (le burger ouvre .nav-primary) */
@media (max-width: 860px) {
  .nav-primary {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; margin: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg); padding: var(--sp-2) var(--sp-4) var(--sp-4);
  }
  .nav-primary.is-open { display: flex; }
  .nav-primary a { padding: var(--sp-4) var(--sp-2); font-size: var(--fs-md); border-bottom: 1px solid var(--border); }
  .nav-primary a::after { display: none; }
  .only-mobile { display: block; }

  /* Sur mobile, on ne garde que thème + panier en icônes ; le reste passe dans le menu */
  .header-actions a[aria-label="Rechercher"],
  .header-actions a[aria-label="Mon compte"],
  .header-actions a[aria-label="Mes favoris"] { display: none; }
  .site-header__bar { gap: var(--sp-2); height: 64px; }
  .brand { font-size: 1.4rem; margin-right: auto; }
}
.only-mobile { display: none; }

/* Replie TOUTES les grilles en style inline sur mobile (checkout, panier, compte, avis…) */
@media (max-width: 768px) {
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .section { padding-block: var(--sp-7); }
  .container { padding-inline: var(--sp-4); }
  h1 { font-size: clamp(1.9rem, 8vw, 2.4rem); }

  /* Tableaux (panier, compte) scrollables si trop larges */
  .table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Sélecteur quantité + bouton ajouter : pleine largeur sur la fiche produit */
  .pdp .btn--gold { width: 100%; }
}

/* Très petit écran : une seule colonne produits pour plus de lisibilité */
@media (max-width: 400px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   THÈME CLAIR — cohérence des zones média + contrastes lisibles
   (les zones image utilisaient un fond sombre codé en dur -> illisible en clair)
   ========================================================================== */
[data-theme="light"] .product-card__media,
[data-theme="light"] .pdp__main-img,
[data-theme="light"] .pdp__thumbs button,
[data-theme="light"] .hero__media,
[data-theme="light"] .cart-line__thumb {
  background: linear-gradient(160deg, #EFE7DA, #E4DACB) !important;
}
[data-theme="light"] .product-card__media { border-bottom: 1px solid var(--border); }

/* Contrastes texte en thème clair (marque, prix barré, sous-titres) */
[data-theme="light"] .product-card__brand,
[data-theme="light"] .price--old,
[data-theme="light"] .catalog__count { color: #7A6A62; }
[data-theme="light"] .product-card__title { color: var(--text); }

/* Cartes produit : séparer visuellement média et corps dans les deux thèmes */
.product-card__body { border-top: 1px solid var(--border); }

/* ==========================================================================
   CORRECTIF THÈME CLAIR — le fond de page doit VRAIMENT être clair
   (le body ne basculait pas ; on force fond + textes en clair)
   ========================================================================== */
[data-theme="light"] body { background: #F6F1E9 !important; color: #23181C !important; }
[data-theme="light"] body::before {
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(110,20,35,0.05), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201,169,106,0.10), transparent 55%) !important;
}
[data-theme="light"] main,
[data-theme="light"] .section { background: transparent !important; }

/* Textes bien contrastés en clair */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] .product-card__title,
[data-theme="light"] .price,
[data-theme="light"] .brand { color: #23181C !important; }
[data-theme="light"] .lead,
[data-theme="light"] .muted,
[data-theme="light"] .reassurance__item span { color: #5C4E52 !important; }
[data-theme="light"] .nav-primary a { color: #5C4E52; }
[data-theme="light"] .nav-primary a:hover,
[data-theme="light"] .nav-primary a[aria-current="page"] { color: #23181C; }

/* ==== CORRECTIF THÈME CLAIR : header visible ==== */
[data-theme="light"] .site-header { background: rgba(251,248,243,0.90) !important; border-bottom: 1px solid rgba(110,20,35,0.12) !important; }
[data-theme="light"] .brand,
[data-theme="light"] .icon-btn { color: #23181C !important; }
[data-theme="light"] .nav-primary a { color: #5C4E52 !important; }
[data-theme="light"] .nav-primary a:hover,
[data-theme="light"] .nav-primary a[aria-current="page"] { color: #23181C !important; }
[data-theme="light"] .announce { color: #fff !important; }
