.categorie-page {
  --cat-accent: var(--sm-primary);
  --cat-muted: #6c757d;
  --cat-border: rgba(198, 158, 127, 0.16);
  --cat-shadow: 0 16px 32px rgba(51, 51, 51, 0.06);
  --cat-hero: rgba(198, 158, 127, 0.12);

  padding-top: 0.5rem;

  .categorie-hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(249, 245, 241, 0.96));
    border: 1px solid var(--cat-border);
    border-radius: 18px;
    padding: 1.35rem 1.5rem;
    box-shadow: var(--cat-shadow);
    margin-bottom: 1.5rem;
  }

  .categorie-hero-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
  }

  .categorie-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: var(--cat-hero);
    color: #705846;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }

  .categorie-title {
    margin: 0.35rem 0 0;
    font-weight: 700;
    letter-spacing: 0.3px;
  }

  .categorie-subtitle {
    margin: 0.35rem 0 0;
    color: var(--cat-muted);
    max-width: 60ch;
  }

  .categorie-count {
    margin: 0.4rem 0 0;
    color: var(--cat-muted);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.2px;
  }

  .categorie-filters {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: min(260px, 100%);
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(198, 158, 127, 0.2);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(51, 51, 51, 0.06);

    span {
      font-size: 0.85rem;
      font-weight: 600;
      color: #705846;
      letter-spacing: 0.2px;
      text-transform: uppercase;
    }

    .form-select {
      border-radius: 12px;
      border-color: rgba(198, 158, 127, 0.3);
      background-color: rgba(255, 255, 255, 0.95);
      box-shadow: inset 0 1px 2px rgba(51, 51, 51, 0.06);
    }
  }

  .categorie-couleur-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cat-border);
  }

}

/* ── Sidebar catégories ─────────────────────────────────────────── */

.cat-burger-wrap {
  margin-bottom: 1rem;

  &.is-stuck {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1040;
    margin: 0;

    .cat-sidebar-burger {
      padding: 0.6rem;
      border-radius: 50%;
      width: 42px;
      height: 42px;
      justify-content: center;
      box-shadow: 0 4px 16px rgba(51, 51, 51, 0.18);
    }

    .cat-burger-label {
      display: none;
    }
  }
}

.cat-sidebar-burger {
  background: #fff;
  border: 1px solid rgba(198, 158, 127, 0.4);
  color: #705846;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  gap: 0.4rem;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  transition: padding 0.2s ease, border-radius 0.2s ease, width 0.2s ease;

  &:hover, &:focus-visible {
    background: rgba(198, 158, 127, 0.12);
    border-color: rgba(198, 158, 127, 0.7);
    color: #5c4636;
  }
}

.cat-sidebar-offcanvas {
  max-width: 280px;
}

.cat-sidebar {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(198, 158, 127, 0.18);
  border-radius: 16px;
  padding: 1rem 1rem 1.25rem;
  box-shadow: 0 12px 28px rgba(51, 51, 51, 0.07);
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.cat-sidebar-sticky-filters {
  display: none;
  overflow: hidden;

  &.cat-sticky-filters--visible {
    display: block;
    animation: cat-filters-in 0.25s cubic-bezier(0.3, 1, 0.4, 1) both;
  }
}

@keyframes cat-filters-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cat-sidebar-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #705846;
  margin-bottom: 0.4rem;
}

.cat-sidebar-select {
  border-radius: 10px;
  border-color: rgba(198, 158, 127, 0.3);
  font-size: 0.85rem;
  background-color: rgba(255, 255, 255, 0.95);

  &:focus {
    border-color: rgba(198, 158, 127, 0.7);
    box-shadow: 0 0 0 3px rgba(198, 158, 127, 0.15);
  }
}

.cat-sidebar-couleurs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;

  .cat-sidebar-couleurs-tous {
    display: block;
    width: 100%;
  }

  .cat-sidebar-couleurs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;

    .btn-couleur-couleur {
      width: 100%;
      height: auto;
      aspect-ratio: 1;
      border-radius: 50%;
    }
  }
}

.cat-sidebar-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #705846;
  margin-bottom: 0.6rem;
}

.cat-sidebar-parent {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #705846;
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;

  &:hover {
    background: rgba(198, 158, 127, 0.14);
    color: #5c4636;
  }
}

.cat-sidebar-sep {
  border-color: rgba(198, 158, 127, 0.25);
  margin: 0.6rem 0;
}

.cat-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cat-sidebar-item {
  border-radius: 10px;
  overflow: hidden;

  &--active > .cat-sidebar-link {
    background: rgba(198, 158, 127, 0.18);
    color: #5c4636;
    font-weight: 700;
  }
}

.cat-sidebar-link {
  display: block;
  padding: 0.38rem 0.6rem;
  border-radius: 10px;
  font-size: 0.875rem;
  color: #3b3b3b;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;

  &:hover, &--active {
    background: rgba(198, 158, 127, 0.14);
    color: #5c4636;
  }
}

.cat-sidebar-sublist {
  list-style: none;
  padding: 0 0 0.25rem 0.85rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  border-left: 2px solid rgba(198, 158, 127, 0.3);
  margin-left: 0.6rem;
  margin-top: 0.15rem;
}

.cat-sidebar-sublink {
  display: block;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #6c757d;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;

  &:hover {
    background: rgba(198, 158, 127, 0.12);
    color: #5c4636;
  }
}

/* ── Squelette de chargement ─────────────────────────────────────── */

@keyframes cat-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.cat-skeleton-card {
  width: 250px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(198, 158, 127, 0.12);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;

  .cat-sk-img {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(90deg, #f5ede6 25%, #ede0d7 50%, #f5ede6 75%);
    background-size: 200% 100%;
    animation: cat-shimmer 1.4s ease-in-out infinite;
  }

  .cat-sk-line {
    height: 12px;
    border-radius: 6px;
    width: 80%;
    background: linear-gradient(90deg, #f5ede6 25%, #ede0d7 50%, #f5ede6 75%);
    background-size: 200% 100%;
    animation: cat-shimmer 1.4s ease-in-out infinite;

    &--lg { width: 100%; height: 14px; }
    &--sm { width: 45%; }
  }
}

/* ── Fin sidebar ─────────────────────────────────────────────────── */

.reference-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.reference-cards-modern .card,
.reference-cards .card {
  box-shadow: rgba(99, 99, 99, 0.2) 0 2px 8px 0;
  padding: 20px;
  width: 250px;
  text-align: center;
  text-decoration: none;
  border-radius: 16px;
  border: 1px solid rgba(198, 158, 127, 0.12);
  background: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reference-cards-modern .card:hover,
.reference-cards .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(51, 51, 51, 0.14);
}

.reference-cards-modern .card .image,
.reference-cards .card .image {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(99, 99, 99, 0.12);
  margin-bottom: 10px;
}

.reference-cards-modern .card .content h5,
.reference-cards .card .content h5 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

}

.reference-cards .card,
.reference-cards-modern .card {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.reference-cards .card.is-visible,
.reference-cards-modern .card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-spinner {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.scroll-spinner::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid rgba(198, 158, 127, 0.3);
  border-top-color: var(--sm-primary, #c69e7f);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.reference-cards img,
.reference-cards-modern img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.reference-cards img.is-loaded,
.reference-cards-modern img.is-loaded {
  opacity: 1;
}


/* --- Badges vignette (charte logo rubanstore) --- */
.reference-cards .ref-badges {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.reference-cards .ref-coloris-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: #c69e7f;
  background: #ffffff;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 0 0 1px #c69e7f inset;
}

.reference-cards .ref-taille-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: #ffffff;
  background: #c69e7f;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: none;
}


/* == REFONTE-VIGNETTE (porte de comptoirsaintmerri, charte #c69e7f) == */
/* Structure DOM inchangee (a.ref-link > .card > .image > img, .content).
   Surcharge les anciennes regles par cascade. Badges definis plus haut. */

.reference-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  justify-content: initial;
}

@media (max-width: 991.98px) {
  .reference-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767.98px) {
  .reference-cards { grid-template-columns: repeat(2, 1fr); gap: 0.9rem; }
}

.reference-cards > .ref-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.reference-cards .card,
.reference-cards-modern .card {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: auto;
  padding: 14px 14px 16px;
  text-align: left;
  border: 1px solid rgba(198, 158, 127, 0.16);
  box-shadow: 0 16px 32px rgba(51, 51, 51, 0.06);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
}

.reference-cards .card:hover,
.reference-cards-modern .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(51, 51, 51, 0.16);
  border-color: #c69e7f;
}

.reference-cards .card .image,
.reference-cards-modern .card .image {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #f4efe9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
}

.reference-cards .card .image img,
.reference-cards-modern .card .image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.reference-cards .card:hover .image img,
.reference-cards-modern .card:hover .image img {
  transform: scale(1.06);
}

.reference-cards .card .content,
.reference-cards-modern .card .content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.reference-cards .card .content h5,
.reference-cards-modern .card .content h5 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  color: #372f28;
  margin: 0 0 0.35rem;
  min-height: 2.55em;
}

.reference-cards .ref-ref {
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: #8a7f74;
  margin: 0 0 0.6rem;
  font-variant-numeric: tabular-nums;
}

.reference-cards .ref-price {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(198, 158, 127, 0.16);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.reference-cards .ref-price b {
  font-size: 1.12rem;
  font-weight: 700;
  color: #c69e7f;
  font-variant-numeric: tabular-nums;
}

.reference-cards .ref-price span {
  font-size: 0.76rem;
  color: #8a7f74;
}

.reference-cards .ref-cond {
  font-size: 0.72rem;
  color: #8a7f74;
  margin: 0.28rem 0 0;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .reference-cards .card,
  .reference-cards .card .image img {
    transition: none;
  }
}
