/*
 * Packs personnalisables — front
 * Styles volontairement neutres : typographie et couleurs héritées du thème.
 * Pour ajuster au thème Warehouse, surcharger dans themes/warehousechild/assets/css/custom.css
 * (les variables ci-dessous suffisent dans la plupart des cas).
 */
/* Police de la charte Sooruz (Adobe Fonts : famille « articulat-cf »), chargée par le thème */
.custompacks,
.custompacks button,
.custompacks-gallery,
.custompacks-photo-label,
.custompacks-price,
.custompacks-qv,
.custompacks-cartline,
.custompacks-lines,
.custompacks-listing-btn {
  font-family: var(--cp-font, "articulat-cf", "Articulat CF", sans-serif);
}

.custompacks {
  --cp-line: rgba(0, 0, 0, 0.12);
  --cp-strong: #111;
  --cp-missing: #111;             /* texte des choix manquants */
  --cp-done: #111;                /* texte des choix faits */
  --cp-accent: var(--cp-promo-bg, #ffe600); /* jaune Sooruz */
  --cp-muted: rgba(0, 0, 0, 0.6);
  --cp-radius: 4px;
  margin: 1.25rem 0;
}

.custompacks__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.custompacks__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111;
}
.custompacks__progress {
  margin: 0;
  font-size: 0.875rem;
  color: var(--cp-muted);
}
.custompacks__bar {
  height: 3px;
  margin: 0.5rem 0 1rem;
  background: var(--cp-line);
}
.custompacks__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cp-accent);
  transition: width 0.2s ease;
}

.custompacks__slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.custompacks__slot {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--cp-line);
  border-radius: var(--cp-radius);
}
.custompacks__slot.is-missing {
  border-color: rgba(0, 0, 0, 0.12);
}
.custompacks__slot.is-complete {
  border-color: rgba(0, 0, 0, 0.12);
}
.custompacks__slot.is-forced {
  align-items: center;
  background: rgba(0, 0, 0, 0.02);
}
.custompacks__media img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--cp-radius);
}
.custompacks__slot-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.custompacks__name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111;
}
.custompacks__sub,
.custompacks__forced {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--cp-muted);
}
.custompacks__status {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: nowrap;
  color: #8c8c8c;
}
.is-complete .custompacks__status {
  color: #111;
  font-weight: 500;
}

.custompacks__group + .custompacks__group {
  margin-top: 0.75rem;
}
.custompacks__group-label {
  margin: 0 0 0.375rem;
  font-size: 0.8125rem;
}
.custompacks__group-label strong {
  font-weight: 500;
}
.custompacks__values {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Choix manquant : libellé en couleur et zone de choix encadrée */
.custompacks__group-label {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #111;
}
.custompacks__group-label strong {
  font-weight: 700;
  color: #111;
}
/* Choix manquant : simple mention grise, sans fond ni couleur */
.custompacks__group.is-missing .custompacks__group-label strong {
  font-weight: 400;
  color: #8c8c8c;
}
.custompacks__group.is-flash,
.custompacks__slot.is-flash {
  animation: custompacks-flash 1.2s ease-out 1;
  border-radius: var(--cp-radius);
}
@keyframes custompacks-flash {
  0%, 40% { background-color: rgba(255, 230, 0, 0.35); }
  100% { background-color: transparent; }
}

/* Tailles et autres valeurs texte */
.custompacks__value {
  /* Texte parfaitement centré, quels que soient les styles de bouton du thème */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  min-width: 3rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--cp-line);
  border-radius: var(--cp-size-radius, 8px);
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.custompacks__value.is-selected {
  border-color: var(--cp-strong);
  box-shadow: inset 0 0 0 1px var(--cp-strong);
  font-weight: 600;
}
.custompacks__value.is-unavailable {
  cursor: not-allowed;
  opacity: 0.45;
  text-decoration: line-through;
}

/* Pastilles couleur */
.custompacks__value.color {
  display: inline-block;
  min-width: 0;
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  margin: 0.25rem;
  padding: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.custompacks__value.color.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cp-strong);
}
.custompacks__value.color.is-unavailable {
  position: relative;
  text-decoration: none;
}
.custompacks__value.color.is-unavailable::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: currentColor;
  transform: rotate(45deg);
}
.custompacks__value:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.custompacks__hint {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #333;
  background: #f4f4f4;
  border-left: 3px solid var(--cp-accent);
  border-radius: 0;
}
.custompacks__error {
  margin: 0.75rem 0 0;
}

/* Bouton natif désactivé tant qu'un choix manque */
.custompacks-disabled,
.custompacks-disabled:hover {
  cursor: not-allowed;
  opacity: 0.55;
}
.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* Petits écrans : vignette plus petite, tailles en grille */
@media (max-width: 575px) {
  .custompacks__slot {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .custompacks__media img {
    width: 56px;
    height: 56px;
  }
  .custompacks__values.is-text {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.375rem;
  }
  .custompacks__values.is-text .custompacks__value {
    display: flex;
    width: 100%;
    min-width: 0;
    padding: 0 0.25rem;
  }
}

/* Détail du pack : panier, panier latéral, modale, e-mails */
.custompacks-lines {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 0.8125rem;
}
.custompacks-lines li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.custompacks-lines__variant {
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.custompacks-cartline {
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}
.custompacks-cartline__edit {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  text-decoration: underline;
}

/* Aperçu rapide */
.custompacks-qv {
  margin: 1rem 0;
}
.custompacks-qv__title {
  margin: 0 0 0.5rem;
  font-weight: 500;
}
.custompacks-qv__list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.custompacks-qv__list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
}
.custompacks-qv__detail,
.custompacks-qv__note {
  font-size: 0.8125rem;
  color: rgba(0, 0, 0, 0.6);
}
.custompacks-qv__cta {
  display: block;
  width: 100%;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .custompacks__bar span {
    transition: none;
  }
  .custompacks__group.is-flash,
  .custompacks__slot.is-flash {
    animation: none;
    background-color: rgba(255, 230, 0, 0.25);
  }
}

/* Galerie « articles choisis » (remplace les photos du produit pack) */
.custompacks-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.custompacks-gallery__tile {
  margin: 0;
}
.custompacks-gallery__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: pointer;
}
.custompacks-gallery__btn img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.custompacks-gallery__tile figcaption {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.125rem 0;
  font-size: 0.8125rem;
}
.custompacks-gallery__name {
  font-weight: 500;
}
.custompacks-gallery__variant {
  color: #111;
  text-align: right;
}
.custompacks-gallery__tile.is-missing .custompacks-gallery__variant {
  color: #666;
}
/* Un seul article : pleine largeur ; nombre impair : le dernier prend toute la ligne */
.custompacks-gallery__tile:only-child,
.custompacks-gallery__tile:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Économie : dans le bloc de choix */
.custompacks__savings {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  font-size: 1.0625rem;
  color: #111;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--cp-radius);
}
.custompacks__savings del {
  font-weight: 500;
  color: #6b6b6b;
}
.custompacks__savings strong {
  padding: 0.3125rem 0.75rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--cp-promo-fg, #000);
  background: var(--cp-promo-bg, #ffe600);
  border-radius: 4px;
}
@media (max-width: 575px) {
  .custompacks__savings,
  .custompacks__savings strong {
    font-size: 0.9375rem;
  }
}

/* Économie : à côté du prix du thème */
.custompacks-price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-left: 0.75rem;
  font-size: 0.9375rem;
}
.custompacks-price__was del {
  color: rgba(0, 0, 0, 0.55);
}
.custompacks-price__pct {
  padding: 0.125rem 0.375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--cp-promo-fg, #000);
  background: var(--cp-promo-bg, #ffe600);
  border-radius: 3px;
}

/* Stock limité pour les choix en cours */
.custompacks__stock {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111;
}


/* Étiquette « nom du produit » sur les photos de la galerie du pack */
.custompacks-photo-label {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  max-width: calc(100% - 1.5rem);
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: #111;
  border-radius: 3px;
  pointer-events: none;
}
.custompacks-photo-label span {
  font-weight: 400;
  color: var(--cp-promo-bg, #ffe600);
}

/* Onglets de la galerie du pack : Tout · article 1 · article 2 */
.custompacks-tabs {
  display: flex;
  gap: 1.5rem;
  margin: 0 0 1rem;
  padding: 0 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  font-family: var(--cp-font, "articulat-cf", "Articulat CF", sans-serif);
  scrollbar-width: none;
}
.custompacks-tabs::-webkit-scrollbar {
  display: none;
}
.custompacks-tabs__tab {
  flex: 0 0 auto;
  margin: 0 0 -1px;
  padding: 0.75rem 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #8c8c8c;
  white-space: nowrap;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.custompacks-tabs__tab:hover {
  color: #111;
}
.custompacks-tabs__tab.is-active {
  font-weight: 700;
  color: #111;
  border-bottom-color: #111;
}
.custompacks-tabs__tab:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

/* Texte du pack (récapitulatif / description) au-dessus des choix */
.custompacks__intro {
  margin: 0 0 1.25rem;
  font-family: var(--cp-font, "articulat-cf", "Articulat CF", sans-serif);
}
/* Placé sous « Ajouter au panier » */
.custompacks__intro.is-below {
  margin: 1.25rem 0;
}
.custompacks__desc {
  position: relative;
  max-height: 7.5em; /* environ 5 lignes */
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #333;
}
.custompacks__desc > :first-child {
  margin-top: 0;
}
.custompacks__desc > :last-child {
  margin-bottom: 0;
}
.custompacks__desc.is-open {
  max-height: none;
}
.custompacks__desc:not(.is-open)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2em;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
  pointer-events: none;
}
.custompacks__more {
  margin: 0.375rem 0 0;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  cursor: pointer;
}
.custompacks__more[hidden] {
  display: none;
}
