/* ==========================================================================
   Liste des produits — views/shop/products.pug
   Chargée après product-card.css et core.css : elle ne redéfinit que la
   mise en page (en-tête de liste, grille, carte compacte). Les couleurs,
   rayons et ombres restent ceux du thème (variables --holi-*).

   Téléphone : 2 produits par ligne au lieu d'un seul (une carte occupait
   presque un écran entier, soit 7 400 px pour 10 produits).
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- En-tête : titre, nombre, catégories, tri ---------- */
.list-header {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
  text-align: center;
}
.list-header .list-title {
  margin-top: 1rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}
.list-count {
  margin: 10px 0 0;
  color: var(--holi-text-muted, #6b7280);
  font-size: 0.95rem;
}

/* Catégories : pastilles ; sur téléphone la rangée défile au doigt */
.list-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
}
.list-chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid var(--holi-border, #e8eaf0);
  border-radius: 999px;
  background: var(--holi-surface, #fff);
  color: var(--holi-text, #161a23);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.list-chip:hover { border-color: var(--holi-violet, #a855f7); color: var(--holi-violet, #a855f7); }
.list-chip.active {
  border-color: transparent;
  background: var(--brand-cta, linear-gradient(135deg, #ff7a18 0%, #ff3d77 100%));
  color: #fff;
}

.list-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--holi-text-muted, #6b7280);
  font-size: 0.9rem;
}
.list-sort select {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--holi-border, #e8eaf0);
  border-radius: 10px;
  background: var(--holi-surface, #fff);
  color: var(--holi-text, #161a23);
  font-size: 0.9rem;
}

/* ---------- Grille ---------- */
.products.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  max-width: 1240px;
  margin: 20px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* ---------- Carte ---------- */
.products-grid .product-card.pc {
  min-width: 0;
  max-width: none;
  margin: 0;
}
.pc .pc-media {
  position: relative;
  display: block;
}
.pc .product-image-container {
  height: auto;
  max-height: none;
  aspect-ratio: 1 / 1;
}
.pc .product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pc .product-info {
  gap: 8px;
  padding: 14px 14px 6px;
}
/* Nom complet sur deux lignes (il était coupé à 33 caractères) */
.pc .product-card-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 1rem;
  line-height: 1.35;
  min-height: 2.7em;
}

/* Prix : TTC en grand, HT en petit */
.pc .pc-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}
.pc .pc-price-from {
  flex-basis: 100%;
  color: var(--holi-text-muted, #6b7280);
  font-size: 0.8rem;
}
.pc .pc-price-main {
  font-size: 1.2rem;
  font-weight: 800;
}
.pc .pc-price-ht {
  color: var(--holi-text-muted, #6b7280);
  font-size: 0.8rem;
  font-weight: 500;
  /* le prix principal est en dégradé (remplissage transparent hérité) */
  -webkit-text-fill-color: currentColor;
}
.pc .card-original-price { font-size: 0.85rem; }

/* Stock : « En stock », « Plus que 4 », « Épuisé » */
.pc-stock {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
}
.pc-stock::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pc-stock-in { color: #15803d; }
.pc-stock-low { color: #c2410c; }
.pc-stock-out { color: #b91c1c; }

/* Options : pastilles de couleur ou étiquettes — toutes celles en stock */
.pc-options {
  min-width: 0;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
}
.pc-options-legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--holi-text-muted, #6b7280);
  font-size: 0.8rem;
}
.pc-options-legend strong { color: var(--holi-text, #161a23); }
.pc-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pc-option {
  position: relative;
  cursor: pointer;
}
.pc-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.pc-swatch {
  display: block;
  width: 30px;
  height: 30px;
  border: 2px solid var(--holi-surface, #fff);
  border-radius: 50%;
  background: var(--swatch, #ccc);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.pc-chip {
  display: block;
  padding: 5px 10px;
  border: 1px solid var(--holi-border, #e8eaf0);
  border-radius: 999px;
  background: var(--holi-surface, #fff);
  color: var(--holi-text, #161a23);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.pc-option input:checked + .pc-swatch { box-shadow: 0 0 0 2px var(--holi-violet, #a855f7); }
.pc-option input:checked + .pc-chip {
  border-color: var(--holi-violet, #a855f7);
  box-shadow: inset 0 0 0 1px var(--holi-violet, #a855f7);
}
.pc-option input:focus-visible + .pc-swatch,
.pc-option input:focus-visible + .pc-chip {
  outline: 2px solid var(--holi-violet, #a855f7);
  outline-offset: 2px;
}
.pc-options-more {
  display: inline-block;
  margin-top: 6px;
  color: var(--holi-violet, #a855f7);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Achat : quantité + bouton sur une ligne */
.pc .product-add-to-cart {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 14px;
}
.pc .number-input {
  flex: 0 0 auto;
  width: auto;
  height: 42px;
  border: 1px solid var(--holi-border, #e8eaf0);
  border-radius: 10px;
}
.pc .number-input .btn-input {
  width: 32px;
  height: 100%;
  padding: 0;
}
.pc .number-input input[type="number"].input-number {
  width: 36px;
  height: 100%;
  padding: 0;
  background: transparent;
  color: var(--holi-text, #161a23);
  font-size: 1rem;
}
.pc .btn-add-to-cart {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ---------- Téléphone : 2 colonnes ---------- */
@media (max-width: 600px) {
  .products.products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 10px;
  }
  /* product-card.css empile les cartes en colonne sous 768 px */
  .products.products-grid { flex-direction: initial; align-items: initial; }
  .products-grid .product-card.pc { max-width: none; margin: 0; }

  .list-categories {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-right: -16px;
    margin-left: -16px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .list-categories::-webkit-scrollbar { display: none; }
  .list-sort { justify-content: center; }

  .pc .product-info { padding: 10px 10px 4px; }
  .pc .product-card-name { font-size: 0.9rem; }
  .pc .pc-price-main { font-size: 1.05rem; }
  .pc .product-promo {
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 11px;
  }
  .pc-swatch { width: 28px; height: 28px; }

  /* Quantité au-dessus, bouton pleine largeur dessous */
  .pc .product-add-to-cart {
    flex-direction: column;
    padding: 8px 10px 10px;
  }
  .pc .number-input { width: 100%; }
  .pc .number-input .btn-input { flex: 1 1 0; width: auto; }
  .pc .number-input input[type="number"].input-number { flex: 1 1 0; width: auto; }
}

@media (prefers-color-scheme: dark) {
  .pc-stock-in { color: #4ade80; }
  .pc-stock-low { color: #fdba74; }
  .pc-stock-out { color: #fca5a5; }
  .pc-swatch { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3); }
}


/* --------------------------------------------------------------------------
   Téléphone : montrer que la rangée de catégories défile
   --------------------------------------------------------------------------
   Une pastille coupée net au bord de l'écran ressemblait à un défaut
   d'affichage. Les bords s'estompent maintenant du côté où il reste des
   catégories (classes posées par le script de la page selon la position), et
   la catégorie active est amenée à l'écran au chargement. */
@media (max-width: 600px) {
  .list-categories {
    --fade-left: 0px;
    --fade-right: 0px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent 100%);
    scroll-behavior: smooth;
    scroll-padding: 0 48px;
  }
  .list-categories.can-scroll-left { --fade-left: 44px; }
  .list-categories.can-scroll-right { --fade-right: 44px; }
}
