/* =========================================
   Catalogue — Sort Bar, Filter Pills, Product Grid
   (Le hero .cat-hero est désormais géré uniquement dans catalog-pills.css —
   les anciennes règles image+overlay V1 ont été supprimées 19/05/2026 car
   elles overridaient .cat-hero { height: 30vh; min-height: 280px } et
   provoquaient un hero figé qui ne respectait plus le nav-safe-top mobile.)
   ========================================= */

/* =========================================
   Catalogue Bar (sticky sous le nav)
   ========================================= */
.catalogue-bar {
  position: sticky;
  top: 4.5rem; /* sous le nav */
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: var(--blur-nav);
  -webkit-backdrop-filter: var(--blur-nav);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  /* Non-sticky : pas de border */
  transition: box-shadow var(--transition-fast);
}
.catalogue-bar.is-stuck {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}
.catalogue-bar-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-3) var(--container-pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  min-height: 56px;
}

/* Contrôles droite (search + sort) */
.catalogue-bar-controls {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-shrink: 0;
}

/* Sort label */
.catalogue-sort label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-right: var(--space-2);
  font-weight: 600;
  white-space: nowrap;
}
.catalogue-sort select {
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--color-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b3b3b3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}
.catalogue-sort select:hover {
  border-color: rgba(0, 0, 0, 0.15);
}
.catalogue-sort select:focus {
  outline: none;
  border-color: var(--color-brand);
}

/* =========================================
   Filter Pills — wrap multi-lignes (V13 : scroll horizontal interdit)
   ========================================= */
.catalogue-filters {
  display: flex;
  gap: var(--space-2);
  overflow-x: visible;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.catalogue-filters::-webkit-scrollbar {
  display: none;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  line-height: 1.6;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.filter-pill:hover {
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}
.filter-pill.active {
  background: var(--gradient-brand);
  color: var(--color-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(155, 48, 255, 0.25);
}
.filter-pill:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* --- Search Input --- */
.catalogue-search {
  position: relative;
}
.catalogue-search input {
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--color-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  width: 180px;
  transition: border-color var(--transition-fast), width var(--transition-base);
}
.catalogue-search input::placeholder {
  color: var(--text-muted);
}
.catalogue-search input:focus {
  outline: none;
  border-color: var(--color-brand);
  width: 240px;
}
.catalogue-search svg {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* =========================================
   Product Grid — responsive fluide
   ========================================= */
.catalogue-grid {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--container-pad) var(--space-24);
  /* Fluide : auto-fill avec minmax pour toutes les tailles */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* Forcer 4 colonnes sur wide screens */
@media (min-width: 1200px) {
  .catalogue-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .catalogue-grid--5col {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 5 colonnes sur très large (si la classe est présente) */
@media (min-width: 1440px) {
  .catalogue-grid--5col {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 3 colonnes entre 900 et 1199 */
@media (min-width: 900px) and (max-width: 1199px) {
  .catalogue-grid,
  .catalogue-grid--4col,
  .catalogue-grid--5col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 2 colonnes entre 600 et 899 */
@media (min-width: 600px) and (max-width: 899px) {
  .catalogue-grid,
  .catalogue-grid--4col,
  .catalogue-grid--5col {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
  }
}

/* 2 colonnes sous 599px (densité e-commerce mobile) */
@media (max-width: 599px) {
  .catalogue-grid,
  .catalogue-grid--4col,
  .catalogue-grid--5col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
  }
}

/* 1 colonne sous 360px (très petits écrans) */
@media (max-width: 360px) {
  .catalogue-grid,
  .catalogue-grid--4col,
  .catalogue-grid--5col {
    grid-template-columns: 1fr;
  }
}

/* Rétrocompat : --4col ne force plus 4 colonnes fixes, il suit la grille fluide */
.catalogue-grid--4col {
  /* Identique à .catalogue-grid — override existant pour la migration */
}

/* --- Section heading (for packs, etc.) --- */
.catalogue-section-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.catalogue-section-title {
  font-size: clamp(1.5rem, 3vw, var(--text-2xl));
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-6);
}
.catalogue-section-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: -0.25rem 0 var(--space-4);
  max-width: 520px;
  line-height: var(--leading-normal);
}
.catalogue-section {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad) var(--space-8);
}
.catalogue-section .catalogue-grid {
  padding: var(--space-4) 0 0;
}

/* Header de section avec lien "Voir tout" */
.catalogue-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
}
@media (max-width: 599px) {
  .catalogue-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

/* --- Empty state --- */
.catalogue-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-16) 0;
  color: var(--text-muted);
  font-size: var(--text-base);
}

/* --- Archive hero (for full catalogue) --- */
.archive-hero {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--nav-safe-top) var(--container-pad) var(--space-6);
}
.archive-hero-title {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: var(--weight-display);
  color: var(--text-primary);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-2);
}
.archive-hero-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0;
  line-height: var(--leading-normal);
}

/* === Mobile === */
@media (max-width: 900px) {
  .cat-hero-overlay {
    padding: var(--container-pad-mobile);
    padding-bottom: var(--space-8);
  }
  .cat-hero-title {
    font-size: var(--text-2xl);
  }
  .catalogue-bar-inner {
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
    flex-wrap: wrap;
    gap: var(--space-3);
    min-height: auto;
  }
  .catalogue-bar-controls {
    width: 100%;
    justify-content: flex-end;
  }
  .catalogue-section {
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
  }
  .catalogue-section .catalogue-grid {
    padding-left: 0;
    padding-right: 0;
  }
  .archive-hero {
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
    padding-top: var(--space-8);
  }
  .catalogue-search input {
    width: 140px;
  }
  .catalogue-search input:focus {
    width: 180px;
  }
}

/* =========================================
   Sticky sentinel — JS helper pour is-stuck
   ========================================= */
/* Script inline dans les templates pour détecter le sticky */

/* =========================================
   CATALOG UNIFIED (partials/catalog-unified.php)
   ========================================= */

/* Plus de margin sous le hero : on colle le catalog directement */
.catalog-unified-hero { margin-bottom: 0; }

.catalog-unified {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-2) var(--container-pad) var(--space-16);
}

/* Filter bar — fixe sur la page (pas sticky : prend trop de place au scroll
   et l'utilisateur a l'habitude de remonter pour changer de catégorie). */
.cu-bar {
  padding: var(--space-2) 0;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
}

/* Niveau 1 (haut de la bar) : pills catégories — cases de sélection */
.cu-bar-row-2 {
  padding: 0 var(--space-3);
}

/* Niveau 1 : barre controles en haut du catalog (Mode + Search + Sort) */
.cu-bar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.cu-bar-controls .cu-mode-switch { flex-shrink: 0; }
.cu-bar-controls .cu-search { flex: 1 1 240px; min-width: 200px; }
.cu-bar-controls #cu-sort { flex-shrink: 0; margin-left: auto; }

/* Legacy — gardés pour rétrocompat si d'autres templates les utilisent */
.cu-bar-row-1 { display: none; }
.cu-bar-row-grid { display: none; }

/* Tools (search + sort) alignés à droite */
.cu-bar-tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* Alias rétrocompat — cu-controls reste fonctionnel si référencé ailleurs */
.cu-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* Mode switch : Matériel / Packs (segmented — slider animé Apple-style) */
.cu-mode-switch {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-full);
  background: rgba(10, 10, 20, 0.06);
  border: 1px solid rgba(10, 10, 20, 0.05);
  flex-shrink: 0;
}
/* Pilule glissante — déplacée par JS via data-mode sur .cu-mode-switch */
.cu-mode-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
  pointer-events: none;
}
.cu-mode-switch[data-active="packs"] .cu-mode-slider {
  transform: translateX(100%);
}
.cu-mode-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: color 200ms;
  white-space: nowrap;
  box-shadow: none;
}
.cu-mode-btn svg { flex-shrink: 0; }
.cu-mode-btn:hover { color: var(--text-primary); }
.cu-mode-btn.is-active {
  color: var(--color-white);
  background: transparent;
  box-shadow: none;
}

/* Deux listes de pills — switch selon data-mode sur .cu-bar */
.cu-pills.is-hidden { display: none; }
/* Ligne pills entière masquée quand les cat-cards servent de navigation (ex: /materiel/ et /evenements-packs/) */
.cu-bar-row-2.is-hidden { display: none; }
/* Barre entière masquée sur les landings event (catalog_hide_bar=true) — DOM préservé pour le JS */
.cu-bar--hidden { display: none !important; }

/* ==========================================================================
   Page event landings — extensions opt-in (catalog_hide_bar / hide_mode / top_cta)
   ========================================================================== */

.cu-mode-switch--hidden {
  display: none !important;
}

.cu-top-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.14);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.cu-top-cta:hover {
  background: var(--color-bg-elevated);
  border-color: rgba(0, 0, 0, 0.22);
}

.cu-top-cta svg {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.cu-top-cta:hover svg {
  transform: translate(2px, -2px);
}

@media (max-width: 768px) {
  .cu-top-cta {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
  }
}

/* Pills categories — tiles rectangulaires bento (cohesion avec le mega menu).
   Chaque pill = bouton plat ~64px de haut, fond couleur ou image (palette nav),
   texte BLANC a gauche, photo produit detouree en bas-droite (style nav-mega-item--bento).
   Layout grid auto-fit fluide : 4 cols desktop, 2 cols mobile (zone tap suffisante). */
.cu-pills {
  display: grid;
  /* Mobile/tablet : auto-fit fluide */
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: var(--space-2);
  padding: var(--space-2) 0;
}
/* Desktop ≥1024px : forcer N cols egales pour garantir 1 ligne unique.
   - Materiel : 8 cats + bouton 'Tout' = 9 pills
   - Packs    : 9 events + bouton 'Tous' = 10 pills
   Calcul à 1280px : ~1160px dispo / 10 = 116px par pill, suffisant en compact. */
@media (min-width: 1024px) {
  .cu-pills--material {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
  .cu-pills--packs {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}

.cu-pill {
  --cu-pill-bg: var(--color-bg-elevated);
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
  /* Padding lateral uniforme : le texte prend toute la largeur dispo et passe
     au-dessus de l'image au besoin (z-index 2 vs 1). Ainsi aucun mot tronque. */
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 14px;
  background: var(--cu-pill-bg);
  color: var(--color-white);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden; /* CRUCIAL : crop strict de l'image, jamais de debord visible */
  text-align: left;
  min-width: 0;
  isolation: isolate;
  transition: transform 200ms cubic-bezier(.16,1,.3,1), box-shadow 200ms;
  transform: translateZ(0);
}

.cu-pill:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.cu-pill:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.cu-pill.is-active {
  box-shadow: 0 0 0 2px var(--color-brand), 0 6px 18px rgba(155, 48, 255, 0.32);
}

/* Label texte : prend toute la largeur, passe au-dessus de l'image (z-index 2 > 1).
   Taille alignee sur les pills packs (0.85rem 800) pour homogeneite visuelle.
   Text-shadow leger pour rester lisible sur l'image qui occupe la moitie droite.
   Line-clamp 2 pour eviter overflow vertical si nom long. */
.cu-pill-name {
  position: relative;
  z-index: 2;
  /* Pas de max-width fixe : le texte prend la place dispo, wrap entre les mots
     uniquement (overflow-wrap: normal). Si chevauche l'image c'est OK -> lisible
     grace au z-index 2 + text-shadow. */
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: inherit;
  /* Important : NE casse PAS dans un mot (sinon "Projecteu | rs & ecrans") */
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  /* Cap a 2 lignes max */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Text-shadow leger pour lisibilite quand le texte chevauche l'image */
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  /* Padding-right reserve pour eviter texte qui touche le bord ou trop d'overlap */
  padding-right: 6px;
}

/* Image produit detouree : moitie droite full-height, contain.
   Le texte (z-index 2) passe au-dessus si besoin -> assume design : image
   sert d'ambiance, le texte reste lisible (texte gras + text-shadow). */
.cu-pill-product {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 55%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.28));
  /* Petit padding interne pour que l'image ne touche pas le bord absolu */
  padding: 4px 4px 4px 0;
}
.cu-pill-product img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right center;
  transition: transform 300ms cubic-bezier(.16,1,.3,1);
}
.cu-pill:hover .cu-pill-product img {
  transform: scale(1.06);
}

/* Variante background-image (packs/events — image cover style mega menu).
   Plus dark + texte plus blanc/gras/grand pour ressortir sur fond ambiance.
   Pills events sont plus carrees (padding et image inexistante : pas de produit detoure). */
.cu-pill--bg-image {
  background-image: var(--cu-pill-img);
  background-size: cover;
  background-position: center;
  /* Padding lateral plus serre : pills events sans image = plus de place pour le texte */
  padding: 0 var(--space-2);
}
.cu-pill--bg-image::before {
  /* Dark overlay renforce pour mettre en valeur le texte (vs ancien 0.55/0.15) */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.42) 100%);
  z-index: 0;
}
.cu-pill--bg-image .cu-pill-name {
  /* Plus grand, plus gras, blanc franc, text-shadow plus net */
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #fff;
  line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
  /* 2 lignes max — au-dela ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Hover : overlay s'eclaircit legerement pour donner sensation d'interactivite */
.cu-pill--bg-image:hover::before {
  background: linear-gradient(135deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.32) 100%);
}
/* Active : ring brand visible sur fond image */
.cu-pill--bg-image.is-active {
  box-shadow: 0 0 0 3px var(--color-brand), 0 8px 22px rgba(155, 48, 255, 0.4);
}

/* Tres petit desktop / large tablet : densite legerement reduite */
@media (min-width: 1024px) and (max-width: 1280px) {
  .cu-pill {
    height: 64px;
    padding: 0 var(--space-2);
  }
  .cu-pill-name { font-size: 0.78rem; }
  .cu-pill--bg-image .cu-pill-name { font-size: 0.8rem; }
  /* Image plus compacte pour laisser respirer le texte sur 9 cols etriquees */
  .cu-pill:not(.cu-pill--bg-image) .cu-pill-product { width: 48%; }
}

/* Variante "Tout" / "Tous les packs" — icon + label centres, gradient brand */
.cu-pill--all {
  background: var(--gradient-brand);
  justify-content: center;
  gap: var(--space-2);
}
.cu-pill--all .cu-pill-name {
  width: auto;
  -webkit-line-clamp: 1;
}
.cu-pill-icon {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  color: var(--color-white);
  flex-shrink: 0;
}
.cu-pill--all.is-active {
  box-shadow: 0 0 0 2px var(--color-white), 0 6px 18px rgba(155, 48, 255, 0.45);
}

/* Search */
.cu-search {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(10, 10, 20, 0.05);
  border: 1px solid transparent;
  transition: background 200ms, border-color 200ms;
}
.cu-search:focus-within {
  background: var(--color-white);
  border-color: rgba(155, 48, 255, 0.3);
}
.cu-search svg { color: var(--text-muted); flex-shrink: 0; }
.cu-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-primary);
  width: 140px;
  padding: 0;
}
.cu-search input::placeholder { color: var(--text-muted); }

#cu-sort {
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  border: 1px solid rgba(10, 10, 20, 0.08);
  border-radius: var(--radius-full);
  background: var(--color-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b6b76' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Product grid — densité e-commerce standard
   ≥1440 : 5 col   /   1024-1440 : 4 col   /   tablet+mobile : 3 col
   Cards naturellement homogènes : image 1:1 + min-height titre 2 lignes + prix.
   Pas de stretch (grid-auto-rows:1fr) qui crée du vide blanc géant entre titre et prix. */
.cu-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  min-height: 400px;
}
.cu-grid-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (max-width: 1440px) {
  .cu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .cu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
}

/* Separateur entre packs et produits unitaires (mode packs avec event selectionne).
   Pleine largeur grid, label discret centre, tirets a gauche/droite. */
.cu-section-sep {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  padding: var(--space-2) 0;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.cu-section-sep span { flex-shrink: 0; }
.cu-section-sep::before,
.cu-section-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border, rgba(0,0,0,0.08));
}

/* =========================================
   Fallback card "Produit introuvable"
   Layout unifié : icône + titre + desc + CTA centrés sur la full card.
   Pas de split image/body — la card est une composition CTA cohérente.
   Hauteur calée sur card produit via aspect-ratio 1:1.32
   (image 1:1 + body ~70-100px ≈ 1:1.3 selon la grille).
   ========================================= */
.cu-grid-item--fallback {
  display: flex;
  flex-direction: column;
}
.cu-fallback-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--space-4) var(--space-3);
  gap: var(--space-2);
  background: linear-gradient(140deg, rgba(155, 48, 255, 0.07), rgba(123, 156, 255, 0.04));
  border: 1.5px dashed rgba(155, 48, 255, 0.3);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
  box-sizing: border-box;
  overflow: hidden;
}
.cu-fallback-card:hover {
  border-color: var(--color-brand);
  background: linear-gradient(140deg, rgba(155, 48, 255, 0.13), rgba(123, 156, 255, 0.08));
  transform: translateY(-3px);
}
.cu-fallback-icon-wrap {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(155, 48, 255, 0.14);
  color: var(--color-brand);
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.cu-fallback-card:hover .cu-fallback-icon-wrap {
  background: rgba(155, 48, 255, 0.22);
  transform: scale(1.05);
}
.cu-fallback-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1.25;
  margin: 0;
  max-width: 18ch;
}
.cu-fallback-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 28ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cu-fallback-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-brand);
  margin-top: var(--space-1);
}
.cu-fallback-cta svg {
  transition: transform var(--transition-fast);
}
.cu-fallback-card:hover .cu-fallback-cta svg {
  transform: translateX(3px);
}

/* Tablet : padding réduit */
@media (max-width: 1024px) {
  .cu-fallback-card {
    padding: var(--space-3);
  }
}

/* Mobile : densité identique aux cards produit en 2 col */
@media (max-width: 640px) {
  .cu-fallback-card {
    padding: var(--space-3);
    gap: var(--space-1);
  }
  .cu-fallback-icon-wrap {
    width: 36px;
    height: 36px;
  }
  .cu-fallback-icon-wrap svg {
    width: 20px;
    height: 20px;
  }
  .cu-fallback-title {
    font-size: 0.85rem;
    line-height: 1.25;
    max-width: 16ch;
  }
  .cu-fallback-desc {
    font-size: 0.72rem;
    -webkit-line-clamp: 2;
    max-width: 22ch;
  }
  .cu-fallback-cta {
    font-size: 0.74rem;
  }
}

/* =========================================
   Composer card — "Compose ton pack {event}"
   Card violet plein, taille pile poil d'une card produit (aspect-ratio 1/1.32).
   Layout plein texte : eyebrow → titre display → desc → CTA, avec un gros "+"
   en filigrane fond (énergie sans bouffer l'espace texte).
   ========================================= */
.cu-grid-item--composer { display: flex; flex-direction: column; }
.cu-composer-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--space-4) var(--space-3);
  background: linear-gradient(155deg, #a13bff 0%, #6f1ad6 100%);
  border-radius: var(--radius-lg);
  text-decoration: none;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 4px 16px rgba(155, 48, 255, 0.22);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
/* Filigrane "+" géant en arrière-plan, haut-droite, semi-transparent */
.cu-composer-card::before {
  content: '';
  position: absolute;
  top: -22%;
  right: -22%;
  width: 75%;
  aspect-ratio: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.14;
  pointer-events: none;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1), opacity var(--transition-fast);
}
/* Halo radial bas-gauche pour donner de la profondeur */
.cu-composer-card::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at center, rgba(255,255,255,0.12), transparent 70%);
  pointer-events: none;
}
.cu-composer-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(155, 48, 255, 0.36);
}
.cu-composer-card:hover::before {
  transform: rotate(90deg) scale(1.05);
  opacity: 0.22;
}
.cu-composer-eyebrow {
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.82);
  margin: 0;
  position: relative;
  z-index: 1;
}
.cu-composer-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: var(--weight-bold);
  color: #fff;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
  margin: var(--space-2) 0 0;
  position: relative;
  z-index: 1;
}
.cu-composer-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin: var(--space-1) 0 0;
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}
.cu-composer-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: var(--weight-bold);
  color: #fff;
  margin-top: var(--space-2);
  padding-top: 0;
  position: relative;
  z-index: 1;
}
.cu-composer-cta svg { transition: transform var(--transition-fast); }
.cu-composer-card:hover .cu-composer-cta svg { transform: translateX(4px); }

@media (max-width: 1024px) {
  .cu-composer-card { padding: var(--space-3); }
  .cu-composer-title { font-size: 1.05rem; }
  .cu-composer-desc { font-size: 0.76rem; }
}
@media (max-width: 640px) {
  .cu-composer-card { padding: var(--space-3); }
  .cu-composer-title { font-size: 0.95rem; margin-top: var(--space-1); }
  .cu-composer-desc { font-size: 0.72rem; margin-top: var(--space-1); }
  .cu-composer-cta { font-size: 0.78rem; }
  .cu-composer-eyebrow { font-size: 0.6rem; letter-spacing: 0.14em; }
}

/* Empty state — [hidden] doit gagner contre display:flex */
.cu-empty[hidden] { display: none !important; }
.cu-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-16) var(--space-4);
  color: var(--text-secondary);
  text-align: center;
}
.cu-empty svg { color: var(--text-muted); }
.cu-empty p { font-size: 0.95rem; font-weight: var(--weight-semibold); color: var(--text-primary); margin: 0; }
.cu-reset {
  padding: 0.55rem 1.2rem;
  border: 1.5px solid rgba(155, 48, 255, 0.3);
  border-radius: var(--radius-full);
  background: rgba(155, 48, 255, 0.08);
  color: var(--color-brand);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background 200ms, color 200ms;
}
.cu-reset:hover {
  background: var(--gradient-brand);
  color: var(--color-white);
  border-color: transparent;
}

/* Responsive bar layout */
@media (max-width: 760px) {
  .cu-bar-row-1 {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  .cu-bar-tools { flex-wrap: wrap; }
  .cu-search input { width: 120px; }
}

/* Tablet : 3 cols pour rester lisible */
@media (max-width: 900px) {
  .cu-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Mobile : 2 cols, hauteur tap-friendly maintenue (56px = > 44px Apple HIG) */
@media (max-width: 640px) {
  .cu-bar { padding: var(--space-2) 0; }
  .cu-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .cu-pill { height: 56px; padding: 0 var(--space-3); border-radius: 12px; }
  .cu-pill-name { font-size: 0.78rem; }
  .cu-pill-product { width: 40px; height: 40px; right: 4px; bottom: 4px; }
  .cu-search input { width: 90px; }
  #cu-sort { font-size: 0.75rem; padding: 0.45rem 1.8rem 0.45rem 0.65rem; }
}

/* Spacing visuel entre le bottom set et la grille produits */
.cu-bar-row-2--bottom {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}
.cu-bar-row-2--top {
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   Sub-cat pills (3e ligne — raffinage dans une cat parente)
   Apparaît dynamiquement quand une cat parente avec sub-cats est active.
   Style chip flat, juste texte. Espacement compact et régulier.
   ========================================================================== */
.cu-subpills-row {
  padding: 8px var(--space-3) 0;
  animation: cu-subpills-in 200ms cubic-bezier(.16,1,.3,1);
}
.cu-subpills-row.is-hidden { display: none; }

@keyframes cu-subpills-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

.cu-subpills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cu-subpill {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(10, 10, 20, 0.04);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: var(--weight-medium);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 160ms, color 160ms, box-shadow 160ms;
  white-space: nowrap;
}
.cu-subpill[hidden] { display: none; }

.cu-subpill:hover {
  background: rgba(10, 10, 20, 0.08);
  color: var(--text-primary);
}

.cu-subpill.is-active {
  background: var(--gradient-brand);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(155, 48, 255, 0.22);
}

.cu-subpill.is-active:hover {
  background: var(--gradient-brand);
  color: var(--color-white);
}

/* Bouton "Tout" : violet par défaut (= aucune sub-cat sélectionnée) */
.cu-subpill--all {
  font-weight: var(--weight-bold);
}

@media (max-width: 640px) {
  .cu-subpills-row { padding: 6px 0 0; }
  .cu-subpills { gap: 5px; }
  .cu-subpill {
    font-size: 0.75rem;
    padding: 0.32rem 0.7rem;
  }
}

/* ==========================================================================
   MOBILE — Layout réordonné, compact, espaces réguliers
   Ordre vertical (via flex order, le HTML reste partagé avec desktop) :
     1. controls (mode + sort + search)
     ── trait fin ──
     2. pills cat (chips avec mini-img ronde)
     ── trait fin ──
     3. sub-pills (chip texte simple, si visible)
     4. grid produits
   Espaces : 6px entre chips, 10px de respiration de chaque côté du trait.
   ========================================================================== */
@media (max-width: 640px) {
  /* Réordonne les blocs sans toucher au HTML (partagé avec desktop) */
  .catalog-unified {
    display: flex;
    flex-direction: column;
  }
  .catalog-unified > .cu-bar-controls { order: 1; }
  .catalog-unified > .cu-bar          { order: 2; }
  .catalog-unified > .cu-grid         { order: 3; }
  .catalog-unified > .cu-empty        { order: 4; }

  /* Section 1 — Controls en haut (les traits de séparation legacy ont été retirés
     20/05/2026 — l'espacement 8px suffit visuellement, plus besoin de border). */
  .cu-bar-controls {
    flex-wrap: wrap;
    gap: var(--space-2);
    border: 0;
    padding: 0 0 10px;
    margin: 0 0 10px;
  }
  .cu-bar-controls .cu-mode-switch { order: 1; }
  .cu-bar-controls #cu-sort {
    order: 2;
    margin-left: auto;
    width: auto;
  }
  .cu-bar-controls .cu-search {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
  }

  /* Mode switch un poil plus compact */
  .cu-mode-btn {
    padding: 0.42rem 0.85rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  /* Section 2 — Pills cat : design bento mobile (2 cols grid, tap-friendly).
     Le design ancien chip rond a ete retire : on garde le meme look bento que desktop
     pour la coherence avec le mega menu. */
  .cu-bar { margin-bottom: 0; }
  .cu-bar-row-2 { padding: 0; }
  /* Le grid 2 cols + dimensions pill sont definis plus haut (@media max-width: 640px) */

  /* Section 3 — Sub-pills (trait fin legacy retiré 20/05/2026, l'espacement 8px suffit) */
  .cu-subpills-row:not(.is-hidden) {
    border: 0;
    padding: 10px 0 0;
    margin-top: 10px;
  }
  .cu-subpills { gap: 6px; }

  /* Espace homogène entre la dernière section et la grille */
  .cu-bar { margin-bottom: var(--space-3); }
}

/* ==========================================================================
   MOBILE COMPACT (≤768px) — refonte 2026-05-19
   Hiérarchie verticale :
     1. controls   = [Matériel/Packs] [Popularité] [🔍] sur 1 ligne nowrap
     2. dropdown   = <select> native iOS/Android, full-width
     3. sub-pills  = chips compactes, wrap propre (JAMAIS scroll horizontal)
     4. grille     = produits

   Règle critique iOS Safari : tout <input>/<select> doit avoir font-size ≥ 16px
   pour empêcher l'auto-zoom au focus (UX que Nils déteste).
   ========================================================================== */

/* Desktop : select dropdown invisible (les pills suffisent) */
.cu-mobile-cat-row { display: none; }

@media (max-width: 768px) {

  /* === Espacement vertical entre les blocs (consistant via tokens) === */
  /* Hero a un padding-bottom var(--space-5) qui crée la séparation visuelle.
     La barre catalog commence avec son propre padding-top, pas de marge négative. */

  /* === 0) Reset des paddings/margins parasites mobile : tout est piloté ici === */
  .catalog-unified { padding-top: var(--space-2) !important; padding-bottom: var(--space-16); }

  /* === 1) Controls (mode switch + sort + search) : 1 ligne nowrap === */
  .cu-bar-controls {
    flex-wrap: nowrap;
    gap: var(--space-2);
    padding: 0;                    /* aucun padding propre — gap parent gère */
    margin: 0 0 var(--space-2);    /* 8px entre controls et dropdown */
  }

  /* Mode switch : compact, slider Apple-style conservé */
  .cu-mode-switch { padding: 3px; flex-shrink: 0; }
  .cu-mode-btn {
    padding: 0.42rem 0.7rem;
    font-size: 0.74rem;
    gap: 0.3rem;
    line-height: 1;
  }
  .cu-mode-btn svg { width: 12px; height: 12px; }

  /* Sort (popularité…) : compact, ordre stable au milieu */
  .cu-bar-controls #cu-sort {
    order: 2;
    padding: 0.55rem 1.6rem 0.55rem 0.7rem;
    /* iOS no-zoom : 16px minimum */
    font-size: 16px;
    line-height: 1;
    max-width: 130px;
    flex-shrink: 0;
    background-position: right 0.55rem center;
  }

  /* Search : icon-only au repos, expand au focus-within (click sur l'icône
     focus l'input via le <label> qui le wraps).
     Pas de placeholder visible au repos pour éviter le tronquage "Recherc…". */
  .cu-bar-controls .cu-search {
    order: 3;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    gap: 0;
    justify-content: center;
    align-items: center;
    cursor: text;
    overflow: hidden;
    background: rgba(10, 10, 20, 0.05);
    border-radius: var(--radius-full);
    transition: flex-basis 240ms cubic-bezier(.16,1,.3,1),
                width      240ms cubic-bezier(.16,1,.3,1),
                padding    240ms cubic-bezier(.16,1,.3,1),
                background 200ms;
  }
  .cu-search svg { color: var(--text-secondary); }

  .cu-search input {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    /* iOS no-zoom : 16px minimum (rule Safari mobile) */
    font-size: 16px;
    line-height: 1.2;
    transition: width 240ms cubic-bezier(.16,1,.3,1),
                opacity 180ms 60ms;
  }

  /* Focus : la search prend toute la largeur de la barre.
     Mode switch + sort sont masqués pendant le focus (les autres filtres restent
     accessibles via le dropdown sub-cat juste en dessous). */
  .cu-bar-controls:has(.cu-search:focus-within) .cu-mode-switch,
  .cu-bar-controls:has(.cu-search:focus-within) #cu-sort {
    display: none;
  }
  .cu-bar-controls .cu-search:focus-within {
    flex: 1 1 100%;
    width: 100%;
    height: 42px;
    padding: 0 0.95rem;
    gap: 0.5rem;
    background: var(--color-white);
    box-shadow: 0 0 0 2px rgba(155, 48, 255, 0.18);
  }
  .cu-search:focus-within input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
  }

  /* === 2) Pills cat/pack : entièrement sorties du flow (display: none sur la row complète,
         sinon row-2 reste flex child et génère un gap fantôme) === */
  .cu-pills--material,
  .cu-pills--packs { display: none !important; }
  .cu-bar-row-2 { display: none !important; }

  /* === 3) Select dropdown catégorie / event === */
  .cu-mobile-cat-row {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0;
    margin: 0 0 var(--space-2);    /* 8px entre dropdown et subpills */
  }

  /* Affiche UN seul select selon le mode */
  .cu-bar[data-mode="material"] .cu-mobile-cat-select[data-target="packs"],
  .cu-bar[data-mode="packs"]    .cu-mobile-cat-select[data-target="material"] {
    display: none;
  }

  .cu-mobile-cat-select {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(10, 10, 20, 0.10);
    border-radius: var(--radius-md);
    background: var(--color-white);
    padding: 0.7rem 2.4rem 0.7rem 0.95rem;
    font-family: inherit;
    /* iOS no-zoom : 16px minimum */
    font-size: 16px;
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(10, 10, 20, 0.04);
    transition: border-color 200ms, box-shadow 200ms;
  }
  .cu-mobile-cat-select:focus {
    outline: none;
    border-color: rgba(155, 48, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(155, 48, 255, 0.10);
  }

  .cu-mobile-cat-caret {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
  }

  /* === 4) Sub-pills (raffinage) : chips compactes wrap propre, jamais scroll === */
  .cu-subpills-row {
    padding: 0 !important;
    margin: 0 !important;
    border-top: 0;
  }
  .cu-subpills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    /* Aucun scroll horizontal, jamais — overflow: visible */
    overflow: visible;
  }
  .cu-subpill {
    padding: 0.36rem 0.7rem;
    font-size: 0.74rem;
    line-height: 1.15;
    font-weight: var(--weight-medium);
    /* Anti-overflow : si un label dépasse la viewport, on laisse wrap intra-mot */
    white-space: nowrap;
    max-width: 100%;
    flex: 0 0 auto;
  }
  .cu-subpill--all { font-weight: var(--weight-semibold); }

  /* === Bar globale : reset, plus de padding ni margin-top fantôme.
       Le rythme vertical est piloté par les margin-bottom individuels des sections
       (cu-bar-controls 8, cu-mobile-cat-row 8) — pas par gap, pour éviter qu'un
       child caché continue à compter dans le gap flex. === */
  .cu-bar {
    padding: 0 !important;
    margin: 0 0 var(--space-2);  /* 8px entre subpills et grille */
    display: block;              /* flat block, pas flex (évite gaps fantômes) */
    border-radius: 0;
  }
}

/* Très petits écrans : densifier encore */
@media (max-width: 380px) {
  .cu-mode-btn      { padding: 0.4rem 0.6rem; font-size: 0.72rem; }
  .cu-bar-controls #cu-sort { max-width: 110px; padding-left: 0.6rem; padding-right: 1.5rem; }
  .cu-mobile-cat-select { padding: 0.62rem 2.2rem 0.62rem 0.85rem; }
  .cu-subpill       { padding: 0.32rem 0.6rem; font-size: 0.72rem; }
}
