/* ==========================================================================
   Produits en stock : pastille « In stock » et page « In stock » (vignettes
   des familles, sous-catégories, menu compact avec volet au survol, grille de
   produits). Chargé sur les pages boutique et sur la page qui contient
   [papco_stock_catalog] (inc/stock.php). Les vignettes et les listes de
   sous-catégories reprennent le style de la page « Catalog » (catalog.css).
   ========================================================================== */

/* --- Pastille « In stock » --- */
.papco-stock-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--papco-navy, #0f1d3a);
  color: var(--papco-white, #fff);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.products .product > .papco-stock-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
}

.summary > .papco-stock-badge {
  margin: 0 0 0.75rem;
}

/* --- Page « In stock » --- */
.papco-stock {
  margin: 0 0 2rem;
  scroll-margin-top: 6rem;
}

.papco-stock.is-loading {
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

/* --- Menu compact (une sous-catégorie est choisie) : familles | grande carte | autres sous-catégories --- */
.papco-stock__menu {
  display: grid;
  grid-template-columns: 15rem 14.5rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: stretch;
  min-height: 16rem;
  margin: 0 0 2rem;
}

.papco-entry .entry-content .papco-stock ul.papco-stock__families {
  margin: 0;
  padding: 0;
  list-style: none;
}

.papco-entry .entry-content .papco-stock ul.papco-stock__families li {
  margin: 0;
  padding: 0;
}

/* Les noms des familles tiennent sur 2 lignes au plus. */
.papco-entry .entry-content .papco-stock a.papco-stock__family {
  display: block;
  padding: 0.875rem 0.75rem;
  border-left: 0.1875rem solid transparent;
  border-bottom: 0.0625rem solid var(--papco-border, #d9e0e7);
  color: var(--papco-navy, #0f1d3a);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.papco-entry .entry-content .papco-stock a.papco-stock__family:hover,
.papco-entry .entry-content .papco-stock a.papco-stock__family:focus-visible {
  color: var(--papco-red, #b41412);
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock a.papco-stock__family.is-active {
  border-left-color: var(--papco-red, #b41412);
  background: var(--papco-white, #fff);
  color: var(--papco-red, #b41412);
}

/* La sous-catégorie choisie occupe toute la hauteur du menu. */
.papco-entry .entry-content .papco-stock a.papco-stock__selected {
  display: flex;
  flex-direction: column;
  border: 0.0625rem solid var(--papco-border, #d9e0e7);
  background: var(--papco-white, #fff);
  color: var(--papco-navy, #0f1d3a);
  text-align: center;
  text-decoration: none;
}

.papco-stock__selected-img {
  position: relative;
  display: block;
  flex: 1 1 0;
  min-height: 0;
  background: var(--papco-gray, #f3f5f7);
}

.papco-entry .entry-content .papco-stock__selected-img img,
.papco-entry .entry-content .papco-stock__sub-img img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
}

.papco-entry .entry-content .papco-stock__selected-img img {
  position: absolute;
  inset: 0;
}

.papco-stock__selected-name {
  display: block;
  padding: 0.75rem;
  border-top: 0.0625rem solid var(--papco-border, #d9e0e7);
  font-size: 0.8125rem;
  font-weight: 700;
}

/* --- Volet des autres sous-catégories : se déploie vers la droite au survol du menu --- */
.papco-stock__flyout {
  position: relative;
  min-width: 0;
}

.papco-stock__hint {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  color: var(--papco-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}

.papco-stock__hint::after {
  content: "\2192";
  margin-left: 0.5rem;
}

.papco-stock__panel-box {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  background: var(--papco-white, #fff);
  clip-path: inset(0 100% 0 0);
  pointer-events: none;
  transition: clip-path 0.3s ease;
}

.papco-stock__panel-box.is-open {
  z-index: 1;
  clip-path: inset(0 0 0 0);
  pointer-events: auto;
  transition: clip-path 0.75s ease 0.1s;
}

.papco-stock__menu.is-open .papco-stock__hint {
  opacity: 0;
}

.papco-entry .entry-content .papco-stock ul.papco-stock__subs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.papco-entry .entry-content .papco-stock ul.papco-stock__subs li {
  margin: 0;
  padding: 0;
  opacity: 0;
  transform: translateX(-0.75rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Les éléments arrivent colonne par colonne, de gauche à droite, avec un fondu. */
.papco-entry .entry-content .papco-stock .papco-stock__panel-box.is-open ul.papco-stock__subs li {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease calc(0.3s + var(--c, 0) * 0.15s), transform 0.5s ease calc(0.3s + var(--c, 0) * 0.15s);
}

.papco-entry .entry-content .papco-stock a.papco-stock__sub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 0.0625rem solid var(--papco-border, #d9e0e7);
  color: var(--papco-navy, #0f1d3a);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.2s ease;
}

.papco-entry .entry-content .papco-stock a.papco-stock__sub:hover,
.papco-entry .entry-content .papco-stock a.papco-stock__sub:focus-visible {
  color: var(--papco-red, #b41412);
  text-decoration: none;
}

.papco-stock__sub-img {
  flex: none;
  width: 3rem;
  height: 3rem;
}

/* --- Résultats --- */
.papco-stock__results {
  scroll-margin-top: 6rem;
}

.papco-entry .entry-content h2.papco-stock__family-title,
.papco-stock__family-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  color: var(--papco-red, #b41412);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.papco-stock__family-title,
.papco-stock .papco-catalog__panel-title {
  scroll-margin-top: 6rem;
}

.papco-stock__family-title::before {
  content: "";
  flex: none;
  width: 2.25rem;
  height: 0.1875rem;
  background: var(--papco-red, #b41412);
}

.papco-stock__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
}

.papco-entry .entry-content h3.papco-stock__bar-title,
.papco-stock__bar-title {
  margin: 0;
  color: var(--papco-navy, #0f1d3a);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.papco-stock__sorts {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  color: var(--papco-muted, #64748b);
  font-size: 0.8125rem;
}

.papco-entry .entry-content .papco-stock a.papco-stock__sort {
  color: var(--papco-navy, #0f1d3a);
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock a.papco-stock__sort.is-active {
  color: var(--papco-red, #b41412);
  font-weight: 700;
}

/* Lien vers la catégorie du catalogue (là, les produits en stock passent avant les autres). */
.papco-stock__catalog-link {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
}

.papco-entry .entry-content .papco-stock__catalog-link a {
  color: var(--papco-red, #b41412);
  font-weight: 700;
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock__catalog-link a::after {
  content: "\2192";
  margin-left: 0.5rem;
  display: inline-block;
  transition: transform 0.2s ease;
}

.papco-entry .entry-content .papco-stock__catalog-link a:hover {
  color: var(--papco-navy, #0f1d3a);
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock__catalog-link a:hover::after {
  transform: translateX(0.25rem);
}

.papco-entry .entry-content .papco-stock__results ul.products {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.papco-entry .entry-content .papco-stock__results ul.products li {
  margin: 0;
}

/* Cartes : liens et boutons gardent le style des cartes du catalogue, pas celui des liens du texte. */
.papco-entry .entry-content .papco-stock__results .product a {
  color: var(--papco-navy, #0f1d3a);
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock__results .product a.button {
  color: var(--papco-white, #fff);
}

.papco-stock__results .papco-cat-intro {
  margin-top: 1.5rem;
}

.papco-stock__pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin: 0 0 1rem;
}

.papco-entry .entry-content .papco-stock a.papco-stock__page {
  min-width: 2.25rem;
  padding: 0.5rem 0.75rem;
  border: 0.0625rem solid var(--papco-border, #d9e0e7);
  background: var(--papco-white, #fff);
  color: var(--papco-navy, #0f1d3a);
  font-size: 0.8125rem;
  text-align: center;
  text-decoration: none;
}

.papco-entry .entry-content .papco-stock a.papco-stock__page.is-active {
  border-color: #8f0f0e;
  background: #8f0f0e;
  color: var(--papco-white, #fff);
}

.papco-stock__empty {
  margin: 0 0 1.5rem;
  color: var(--papco-muted, #64748b);
}

/* --- Écrans sans survol (tactile) : le volet reste ouvert --- */
@media (hover: none) {
  .papco-stock__panel-box {
    display: none;
  }

  .papco-stock__panel-box[data-current] {
    display: block;
    clip-path: none;
  }

  .papco-stock__hint {
    display: none;
  }

  .papco-entry .entry-content .papco-stock ul.papco-stock__subs li {
    opacity: 1;
    transform: none;
  }
}

/* --- Tablette et mobile --- */
@media (max-width: 64rem) {
  .papco-stock__menu {
    grid-template-columns: 13rem 12rem minmax(0, 1fr);
    gap: 1rem;
  }

  .papco-entry .entry-content .papco-stock ul.papco-stock__subs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 48rem) {
  .papco-stock__menu {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .papco-entry .entry-content .papco-stock ul.papco-stock__families {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .papco-entry .entry-content .papco-stock a.papco-stock__family {
    padding: 0.625rem 0.875rem;
    border: 0.0625rem solid var(--papco-border, #d9e0e7);
  }

  .papco-entry .entry-content .papco-stock a.papco-stock__family.is-active {
    border-color: var(--papco-red, #b41412);
  }

  /* Mobile : uniquement du texte, aucune image dans les menus. */
  .papco-stock .papco-catalog__tile-img,
  .papco-stock .papco-catalog__sub-img,
  .papco-stock .papco-stock__selected-img,
  .papco-stock .papco-stock__sub-img {
    display: none;
  }

  .papco-stock ul.papco-catalog__groups {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .papco-stock .papco-catalog__tile-name {
    padding: 0.875rem 1rem;
    text-align: left;
  }

  .papco-stock ul.papco-catalog__subs {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .papco-entry .entry-content .papco-stock a.papco-stock__selected {
    border-left: 0.1875rem solid var(--papco-red, #b41412);
    text-align: left;
  }

  .papco-stock__selected-name {
    border-top: 0;
  }

  .papco-stock__hint {
    display: none;
  }

  .papco-stock__panel-box {
    position: static;
    display: none;
    clip-path: none;
  }

  .papco-stock__panel-box[data-current] {
    display: block;
  }

  .papco-entry .entry-content .papco-stock ul.papco-stock__subs li {
    opacity: 1;
    transform: none;
  }
}
