/* ==========================================================================
   ASUNA PARFUMERIE — Page Boutique (catalogue)
   Dépend de tokens.css, section.css, products.css. Comportement : shop.js, product-card.js
   Grille : 4 colonnes (>= 1024px), 3 (768–1023px), 2 (< 768px, jamais 1 seule colonne)
   Les cartes réutilisent .product-card (mêmes ovales que « Les plus appréciés ») avec la variante --grid.
   ========================================================================== */

.shop {
  --shop-gap-x: clamp(20px, 2.6vw, 40px);
  --shop-gap-y: clamp(36px, 3.4vw, 52px);
}

.shop__inner {
  max-width: var(--section-max);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
}

/* --------------------------------------------------------------------------
   Barre de catalogue
   -------------------------------------------------------------------------- */
.shop-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(22px, 2.2vw, 30px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--asuna-line);
}

.shop-bar__count {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.shop-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--asuna-border);
  border-radius: var(--asuna-radius-pill);
  background: var(--asuna-ivory-light);
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  white-space: nowrap;
}

.shop-pill svg {
  flex: none;
  width: 15px;
  height: 15px;
}

/* Bouton Filtres : utile sur mobile, où les filtres sont repliés */
.shop-bar__filters {
  display: none;
  cursor: pointer;
}

.shop-bar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--asuna-radius-pill);
  background: var(--asuna-brown);
  color: var(--asuna-on-dark);
  font-size: 10px;
  font-weight: 500;
}

.shop-bar__badge[hidden] {
  display: none;
}

/* Tri */
.shop-sort {
  padding: 0 0 0 16px;
}

.shop-sort__label {
  white-space: nowrap;
  color: var(--asuna-text-muted);
}

.shop-sort select {
  height: 100%;
  margin: 0;
  padding: 0 36px 0 0;
  border: 0;
  background: transparent;
  color: var(--asuna-brown);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.shop-sort select:focus {
  outline: none;
}

.shop-sort:focus-within {
  border-color: var(--asuna-champagne);
}

.shop-sort__chevron {
  position: absolute;
  right: 14px;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Filtres
   -------------------------------------------------------------------------- */
.shop-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 0 4px;
}

.shop-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--asuna-border);
  border-radius: var(--asuna-radius-pill);
  background: var(--asuna-ivory-light);
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.shop-chip:hover {
  border-color: var(--asuna-brown);
}

.shop-chip[aria-pressed="true"],
.price-filter.is-active > .shop-chip {
  border-color: var(--asuna-brown);
  background: var(--asuna-brown);
  color: var(--asuna-on-dark);
}

.shop-chip svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

/* Prix : liste déroulante */
.price-filter {
  position: relative;
}

.price-filter > summary {
  list-style: none;
}

.price-filter > summary::-webkit-details-marker {
  display: none;
}

.price-filter[open] > .shop-chip svg {
  transform: rotate(180deg);
}

.price-filter__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 230px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--asuna-border);
  border-radius: 14px;
  background: var(--asuna-ivory-light);
  box-shadow: 0 12px 30px rgba(39, 19, 13, 0.1);
}

.price-filter__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 13px;
  cursor: pointer;
}

.price-filter__option:hover {
  background: var(--asuna-sand);
}

.price-filter__option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--asuna-brown);
}

.shop-filters__reset {
  margin-left: auto;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--asuna-text-muted);
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.shop-filters__reset:hover {
  color: var(--asuna-brown);
}

/* --------------------------------------------------------------------------
   Grille
   -------------------------------------------------------------------------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--shop-gap-y) var(--shop-gap-x);
  margin: clamp(26px, 2.6vw, 36px) 0 0;
  padding: 0;
  list-style: none;
}

.shop-grid[hidden],
.shop-grid > [hidden] {
  display: none;
}

.shop-grid > li {
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* Variante grille de la carte produit : l'ovale suit la largeur de la colonne */
.product-card--grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* photos un peu plus petites que la colonne : la carte est centrée dans sa cellule */
  max-width: var(--shop-card-max, 236px);
}

.product-card--grid .product-card__media {
  width: 100%;
  height: auto;
  /* ovale plus court que dans le carrousel d'accueil : 2 rangées complètes visibles à l'écran */
  aspect-ratio: 1 / 1.12;
}

.product-card--grid .product-card__fav {
  top: 3%;
  right: 3%;
  width: 34px;
  height: 34px;
}

.product-card--grid .product-card__fav svg {
  width: 15px;
  height: 15px;
}

/* Survol (maquette) : légère élévation, puis panier et favori dans une pastille sur la photo */
.product-card--grid .product-card__media {
  z-index: 2; /* au-dessus du lien de la carte : la pastille reste cliquable quand la photo s'élève */
  transition: transform 0.35s var(--asuna-ease);
}

.product-card--grid .product-card__image {
  transition: box-shadow 0.35s ease;
}

.product-card__quick {
  position: absolute;
  bottom: 9%;
  left: 50%;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--asuna-radius-pill);
  background: rgba(36, 17, 9, 0.88);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.3s ease, transform 0.35s var(--asuna-ease);
}

.product-card__quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--asuna-on-dark);
  cursor: pointer;
  text-decoration: none;
}

.product-card__quick-btn svg {
  width: 18px;
  height: 18px;
}

.product-card__quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.product-card__quick-btn:focus-visible {
  outline: 2px solid var(--asuna-champagne);
  outline-offset: 1px;
}

.product-card__quick-btn[aria-pressed="true"] svg path {
  fill: currentColor;
}

.product-card__quick-btn[data-state="loading"] svg {
  animation: asuna-quick-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes asuna-quick-pulse {
  to { opacity: 0.4; }
}

@media (hover: hover) {
  .product-card--grid:hover .product-card__media {
    transform: translateY(-6px);
  }

  .product-card--grid:hover .product-card__image {
    box-shadow: 0 14px 26px rgba(59, 23, 12, 0.16);
  }

  .product-card--grid:hover .product-card__quick,
  .product-card--grid:focus-within .product-card__quick {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
}

/* Écrans tactiles : pas de survol, le bouton « Ajouter au panier » et le cœur restent disponibles */
@media (hover: none) {
  .product-card__quick {
    display: none;
  }
}

.product-card--grid .product-card__body {
  padding: 18px 2px 0;
}

.product-card--grid .product-card__name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Bouton Ajouter au panier, toujours aligné en bas de la carte */
.product-card__add {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  margin-top: auto;
  padding: 0 12px;
  border: 0;
  border-radius: var(--asuna-radius-pill);
  background: var(--asuna-brown);
  color: var(--asuna-on-dark);
  font-family: var(--asuna-font-ui);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.product-card--grid .product-card__body {
  margin-bottom: 16px;
}

.product-card__add:hover {
  background: var(--asuna-brown-2);
}

.product-card__add:active {
  transform: scale(0.98);
}

.product-card__add:focus-visible {
  outline: 2px solid var(--asuna-champagne);
  outline-offset: 3px;
}

.product-card__add-done,
.product-card__add-spinner {
  display: none;
}

.product-card__add[data-state="loading"] {
  cursor: progress;
  opacity: 0.85;
}

.product-card__add[data-state="loading"] .product-card__add-spinner {
  display: block;
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: asuna-spin 0.7s linear infinite;
}

.product-card__add[data-state="added"] {
  background: var(--asuna-caramel);
}

.product-card__add[data-state="added"] .product-card__add-label {
  display: none;
}

.product-card__add[data-state="added"] .product-card__add-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.product-card__add-done svg {
  width: 13px;
  height: 13px;
}

@keyframes asuna-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Aucun résultat, Voir plus
   -------------------------------------------------------------------------- */
.shop-empty {
  max-width: 440px;
  margin: 48px auto 8px;
  text-align: center;
}

.shop-empty__title {
  margin: 0;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-display);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

.shop-empty__text {
  margin: 10px 0 0;
  color: var(--asuna-text-muted);
  font-family: var(--asuna-font-ui);
  font-size: 13.5px;
  line-height: 1.6;
}

.shop-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  margin-top: 20px;
  padding: 0 24px;
  border: 1px solid var(--asuna-brown);
  border-radius: var(--asuna-radius-pill);
  background: transparent;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.shop-outline:hover {
  background: var(--asuna-brown);
  color: var(--asuna-on-dark);
}

.shop-more {
  margin-top: clamp(36px, 3.4vw, 52px);
  text-align: center;
}

.shop-more[hidden],
.shop-empty[hidden] {
  display: none;
}

.shop-more__progress {
  margin: 0;
  color: var(--asuna-text-muted);
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.shop-chip:focus-visible,
.shop-pill:focus-visible,
.shop-outline:focus-visible,
.shop-filters__reset:focus-visible,
.price-filter__option:focus-within {
  outline: 2px solid var(--asuna-champagne);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Tablette
   -------------------------------------------------------------------------- */
@media (max-width: 1023.98px) {
  .shop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shop {
    --shop-card-max: 196px;
  }
}

/* --------------------------------------------------------------------------
   Mobile : 2 cartes par ligne, compactes
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .shop {
    --shop-gap-x: 12px;
    --shop-gap-y: 26px;
    --shop-card-max: 88%;
  }

  .shop-bar {
    margin-top: 18px;
    padding-bottom: 12px;
  }

  .shop-bar__filters {
    display: inline-flex;
  }

  .shop-pill {
    height: 38px;
    padding: 0 13px;
  }

  .shop-sort {
    padding: 0 0 0 13px;
  }

  .shop-sort select {
    padding-right: 28px;
  }

  .shop-sort__chevron {
    right: 11px;
  }

  /* Filtres repliés derrière le bouton « Filtres » */
  .shop-filters {
    display: none;
    gap: 8px;
    padding: 14px 0 2px;
  }

  .shop-filters.is-open {
    display: flex;
  }

  .shop-chip {
    height: 34px;
    padding: 0 14px;
    font-size: 12px;
  }

  .price-filter__panel {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    min-width: 0;
  }

  .shop-filters__reset {
    margin-left: 0;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
  }

  .product-card--grid .product-card__fav {
    width: 30px;
    height: 30px;
  }

  .product-card--grid .product-card__fav svg {
    width: 13px;
    height: 13px;
  }

  .product-card--grid .product-card__body {
    margin-bottom: 12px;
    padding-top: 12px;
  }

  .product-card--grid .product-card__name {
    font-size: 11.5px;
  }

  .product-card--grid .product-card__brand {
    font-size: 9px;
  }

  .product-card--grid .product-card__price {
    font-size: 12.5px;
  }

  .product-card__add {
    height: 36px;
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: 0.05em;
  }
}

/* Très petits écrans : libellé court, même action */
@media (max-width: 359.98px) {
  .product-card__add-label-long {
    display: none;
  }
}

@media (min-width: 360px) {
  .product-card__add-label-short {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-card--grid .product-card__media,
  .product-card__quick,
  .shop-chip,
  .shop-chip svg,
  .product-card__add,
  .shop-outline {
    transition: none;
  }

  .product-card__add[data-state="loading"] .product-card__add-spinner {
    animation-duration: 2s;
  }
}

@media (max-width: 767.98px) {
  /* Mobile : « Trier par » masqué visuellement, la valeur choisie suffit */
  .shop-sort__label-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Prix sur demande : libellé plus discret, bouton de commande WhatsApp */
.product-card__price--request {
  font-style: italic;
}

.product-card__add--whatsapp {
  text-decoration: none;
}

.product-card__add--whatsapp svg {
  flex: none;
  width: 17px;
  height: 17px;
}
