/* ============================================================
   Auto Plus 01 — page catalogue (filtres + grille de véhicules)
   ============================================================ */

/* ---------- En-tête : fil d'Ariane, titre, tri, chips ---------- */
.cat-head {
  display: flex; flex-direction: column; gap: 22px;
  padding-block: 48px 28px;
}
.cat-head__row {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
}
.cat-head__text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* Lien du fil d'Ariane : cible de 24 × 24 px au moins (WCAG 2.5.8) */
.cat-head .breadcrumb a { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; }
.cat-title { font-size: 48px; line-height: 1.02; }
.cat-count { font-size: 15px; color: var(--text-dim); }

.cat-sort { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cat-sort__label { font-size: 14px; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
.cat-sort .input { min-height: 44px; width: auto; font-size: 14px; }

.cat-chips { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.cat-chips__group { display: flex; align-items: center; gap: 8px; }
.cat-chips__label { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-right: 4px; white-space: nowrap; }
.cat-chips__list { display: flex; align-items: center; gap: 8px; }

/* ---------- Grille : filtres + résultats ---------- */
.cat-layout {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; align-items: start;
  padding-block: 12px 48px;
}
.cat-mobilebar { display: none; grid-column: 1 / -1; }

.cat-aside {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 24px;
}
/* Collante seulement quand elle tient dans la fenêtre : rien n'est masqué sur les écrans bas */
@media (min-height: 1080px) and (min-width: 1101px) {
  .cat-aside { position: sticky; top: calc(var(--header-h) + 24px); }
}
.cat-filtres { display: flex; flex-direction: column; gap: 24px; }
.cat-aside__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cat-reset {
  min-height: 44px; padding: 0 12px; border: 0; background: transparent;
  color: var(--accent-soft); font-size: 13px; font-weight: 700; cursor: pointer; border-radius: 8px;
}
.cat-reset:hover { color: var(--text); }

.cat-group { margin: 0; padding: 0; border: 0; min-width: 0; display: block; }
.cat-group__title {
  display: block; padding: 0; margin: 0;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
}
.cat-group__title + * { margin-top: 12px; }
.cat-group__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-group__hint { font-size: 13px; color: var(--text-muted); }
/* Cases à cocher : toute la ligne (libellé compris) est une cible de 44 px, à toutes les largeurs */
.cat-marques { display: flex; flex-direction: column; gap: 0; }
.cat-marques .checkbox { min-height: 44px; }
.cat-field { gap: 4px; }
.cat-field__label { font-size: 12px; color: var(--text-dim); }

.cat-help { border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.cat-help__title { font-family: var(--font-display); font-stretch: 110%; font-weight: 800; font-size: 16px; line-height: 1.2; }
.cat-help__text { font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.cat-help__btn { min-height: 44px; font-size: 14px; width: 100%; }
/* Chemin vers l'estimation de reprise (objectif principal du site) */
.cat-help__reprise { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.cat-help__link { font-size: 14px; white-space: normal; }
/* Bouton "Voir les N véhicules" : ferme le panneau de filtres, visible seulement quand il est repliable (≤ 1100px) */
.cat-apply { display: none; }

/* Résultats */
.cat-results { position: relative; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
/* Néon de l'atelier au-dessus du parc de voitures (direction « L'affichette », 28/09/2026) :
   tube lumineux et cône de lumière derrière les premières cartes */
.cat-results::before {
  content: ""; position: absolute; z-index: 2; top: -14px; left: 6%; right: 6%; height: 3px; border-radius: 2px;
  background: rgb(var(--light));
  box-shadow: 0 0 12px 2px rgba(var(--light), 0.5), 0 0 44px 12px rgba(var(--light), 0.14);
  pointer-events: none;
}
.cat-results::after {
  content: ""; position: absolute; z-index: 0; top: -12px; left: 0; right: 0; height: 520px; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--light), 0.09), rgba(var(--light), 0.02) 60%, rgba(var(--light), 0));
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
}
.cat-grid, .cat-message { position: relative; z-index: 1; }
/* Pendant le chargement du stock : place réservée pour la grille, le pied de page ne remonte pas
   puis redescend à l'arrivée des cartes (CLS). Classe retirée par js/catalogue.js. */
.cat-results.is-loading { min-height: 100vh; }
.cat-pagination__gap { min-width: 24px; text-align: center; color: var(--text-dim); font-weight: 700; }
.pagination__btn--text { padding: 0 16px; }
/* "Précédent" / "Suivant" sur la première / dernière page : affichés mais inactifs */
.cat-pagination .is-disabled { opacity: .5; pointer-events: none; }   /* .5 : contraste 5:1 minimum */
.cat-message { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.cat-message__text { max-width: 520px; }
.cat-message__actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
/* Navigateur sans JavaScript (adresse avec filtres, servie telle quelle) : pas de « Chargement du stock… »
   sans fin, seul le message <noscript> reste (règle ici : la CSP interdit le <style> en ligne) */
@media (scripting: none) {
  .cat-message { display: none; }
  .cat-results.is-loading { min-height: 0; }
}

/* Bouton "Filtres" (mobile) */
.cat-filtres-btn { gap: 8px; }
.cat-filtres-btn .i { font-size: 18px; }
.cat-filtres-btn__count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-pill); background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1;
}
.cat-filtres-btn[aria-expanded="true"] { border-color: var(--text); }

/* ---------- Tablette et header mobile (≤ 1100px) ---------- */
@media (max-width: 1100px) {
  .cat-head { padding-block: 32px 20px; gap: 18px; }
  .cat-title { font-size: clamp(32px, 6vw, 44px); }
  .cat-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 4px 40px; }
  .cat-mobilebar { display: flex; }
  /* Le néon ne doit pas toucher le bouton « Filtres » juste au-dessus */
  .cat-results { padding-top: 14px; }
  .cat-results::before { top: 0; }
  .cat-results::after { top: 2px; }
  .cat-aside {
    position: static; max-height: none; overflow: visible;
    display: none;
  }
  .cat-aside.is-open { display: block; }
  .cat-marques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
  .cat-apply { display: inline-flex; }
  /* Le séparateur vertical n'a plus de sens dès que les chips passent à la ligne */
  .cat-chips__divider { display: none; }
}

/* ---------- Petites tablettes (≤ 860px) ---------- */
@media (max-width: 860px) {
  .cat-head__row { flex-direction: column; align-items: stretch; gap: 16px; }
  /* Rangée qui défile : fondu à droite pour montrer qu'il y a une suite, marge de fin
     pour que la dernière pastille sorte du fondu une fois la rangée défilée */
  .cat-chips {
    flex-wrap: nowrap; gap: 20px; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter) calc(var(--gutter) + 32px);
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--gutter) - 32px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - var(--gutter) - 32px), transparent);
  }
  .cat-chips::-webkit-scrollbar { display: none; }
  .cat-chips__group { flex-shrink: 0; }
  .cat-chips__divider { flex-shrink: 0; }
}

/* ---------- Mobile (≤ 640px) ---------- */
@media (max-width: 640px) {
  .cat-head { padding-block: 24px 16px; gap: 16px; }
  /* Titre long ("Voitures d'occasion en stock dans l'Ain") : un peu plus petit sur téléphone */
  .cat-title { font-size: clamp(26px, 7.4vw, 32px); }
  .cat-count { font-size: 14px; }
  .cat-sort { width: 100%; }
  .cat-sort .input { flex: 1; width: 100%; }
  .cat-layout { gap: 16px; padding-block: 0 32px; }
  .cat-mobilebar .btn { width: 100%; }
  .cat-aside { padding: 20px 18px; border-radius: 16px; }
  .cat-filtres { gap: 20px; }
  .cat-marques { grid-template-columns: minmax(0, 1fr); }
  .cat-chips {
    flex-wrap: wrap; gap: 12px; overflow: visible;
    margin-inline: 0; padding-inline: 0;
  }
  .cat-chips__group { width: 100%; flex-wrap: wrap; }
  .cat-chips__list { flex-wrap: wrap; }
  .cat-results { gap: 20px; }
  .cat-message { padding: 32px 18px; }
  .cat-message__actions { flex-direction: column; width: 100%; }
  .cat-message__actions .btn { width: 100%; }
}

@media print {
  .cat-results::before, .cat-results::after { display: none; }
}
