/* Catalogue « la carte d'abord » (BRIEF-DESIGN-C §5–6).
   Bureau : plein écran sans défilement de page, liste 420 px à gauche, carte à droite.
   Mobile : carte plein écran, barre flottante en haut, panneau qui remonte en bas. */

body.page-carte { height: 100vh; height: 100dvh; overflow: hidden; background: var(--c-doux); color: var(--c-texte); }
body.page-carte .pied, body.page-carte .barre-wa { display: none; }
body.page-carte #contenu { height: calc(100vh - var(--h-nav)); height: calc(100dvh - var(--h-nav)); }

.cat-c { display: grid; grid-template-columns: 420px minmax(0, 1fr); height: 100%; }

/* ---------- Colonne de gauche ---------- */
.cat-liste { display: flex; flex-direction: column; min-height: 0; background: var(--c-blanc);
  border-right: 1px solid var(--c-bordure); position: relative; z-index: 2; }
.cat-poignee, .cat-haut-mobile, .cat-filtres-tete, .cat-voir, .cat-bascule { display: none; }

.cat-filtres { padding: 14px 16px 6px; border-bottom: 1px solid var(--c-bordure); }
.cat-pastilles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pastilles > li { display: inline-flex; align-items: center; position: relative; }

.pastille { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--c-bordure); border-radius: var(--r-pastille); background: var(--c-blanc);
  color: var(--c-encre); font: 600 14px/1 "Inter", sans-serif; text-decoration: none; cursor: pointer;
  list-style: none; white-space: nowrap; max-width: 260px; }
.pastille::-webkit-details-marker { display: none; }
.pastille:hover { border-color: var(--c-accent); }
.pastille .picto-chevron { color: var(--c-attenue); stroke-width: 2.2; }
.pastille-texte { overflow: hidden; text-overflow: ellipsis; }
.pastille-active { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-blanc); }
.pastille-active:hover { background: #0E527A; }
/* Filtre actif : pastille pleine + croix collée à droite (même pilule). */
.cat-pastilles li:has(.pastille-x) .pastille { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 10px; }
.pastille-x { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px;
  padding: 0 10px 0 6px; background: var(--c-accent); color: var(--c-blanc);
  border-radius: 0 var(--r-pastille) var(--r-pastille) 0; border-left: 1px solid rgba(255, 255, 255, .35); }
.pastille-x:hover { background: #0E527A; }
.pastille-x .picto, .pastille .picto { width: 14px !important; height: 14px !important; stroke-width: 2.4; }
.pastille:focus-visible, .pastille-x:focus-visible, .option:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
/* Cibles tactiles : 36 px visibles, 44 px réels. */
.pastille, .pastille-x { position: relative; }
.pastille::after, .pastille-x::after { content: ""; position: absolute; inset: -4px 0; }

.pastille-menu { position: relative; }
.pastille-options { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 280px; max-height: 360px;
  overflow-y: auto; padding: 8px; background: var(--c-blanc); border: 1px solid var(--c-bordure);
  border-radius: 12px; box-shadow: var(--ombre-c); }
.pastille-options-titre { display: flex; align-items: center; justify-content: space-between; margin: 4px 8px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--c-texte); }
.pastille-devise { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--c-accent); font-weight: 600; }
.pastille-options ul { list-style: none; margin: 0; padding: 0; }
.option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; border-radius: 8px;
  color: var(--c-encre); text-decoration: none; font-size: 15px; font-weight: 500; }
.option:hover { background: var(--c-doux); }
.option-case { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none;
  border: 1.5px solid #B8C2D1; border-radius: 6px; color: var(--c-blanc); }
.option[role="radio"] .option-case { border-radius: 50%; }
.option-choisie .option-case { background: var(--c-accent); border-color: var(--c-accent); }
.option-case .picto { width: 14px; height: 14px; stroke-width: 3; }
.option-nom { flex: 1; }
.option-n { font-size: 13px; color: var(--c-texte); font-variant-numeric: tabular-nums; }

.cat-ligne-resultats { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--c-bordure); }
.cat-total { margin: 0; font-size: 14px; color: var(--c-texte); white-space: nowrap; }
.cat-total strong { color: var(--c-encre); font-weight: 800; font-size: 16px; }
.cat-tri { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.cat-tri label { color: var(--c-texte); }
.cat-tri select { min-height: 36px; padding: 0 28px 0 10px; border: 1px solid var(--c-bordure); border-radius: 8px;
  background: var(--c-blanc); color: var(--c-encre); font: 600 14px "Inter", sans-serif; cursor: pointer; }

.cat-fiches { list-style: none; margin: 0; padding: 10px 12px; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.cat-fiche-lien { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--c-bordure); border-radius: 12px;
  background: var(--c-blanc); text-decoration: none; color: inherit; transition: border-color .12s, background-color .12s; }
.cat-fiche.est-active .cat-fiche-lien, .cat-fiche-lien:hover, .cat-fiche-lien:focus-visible {
  border-color: var(--c-accent); background: var(--c-accent-pale); outline: 0; }
.cat-fiche-lien:focus-visible { box-shadow: 0 0 0 2px var(--c-accent); }
.cat-fiche-photo { flex: none; width: 96px; height: 96px; border-radius: 9px; overflow: hidden; background: #E7ECF3; }
.cat-fiche-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-fiche-corps { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cat-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-fiche-nom { color: var(--c-encre); font-weight: 800; font-size: 16px; letter-spacing: -.3px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cat-fiche-ligne { font-size: 13px; color: var(--c-texte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-fiche-prix { margin-top: auto; font-size: 13px; color: var(--c-texte); }
.cat-fiche-prix strong { color: var(--c-encre); font-size: 15px; font-weight: 800; }
.cat-aucun { padding: 28px 12px; text-align: center; font-size: 15px; }
.cat-aucun p { margin: 0 0 6px; }
.cat-aucun strong { color: var(--c-encre); }
.cat-aucun a { color: var(--c-accent); font-weight: 600; }

.cat-note { flex: none; margin: 0; padding: 10px 16px; border-top: 1px solid var(--c-bordure); background: var(--c-blanc);
  font-size: 12px; line-height: 1.45; color: var(--c-texte); }

/* ---------- Carte ---------- */
.cat-carte-zone { position: relative; min-height: 0; }
.cat-carte { position: absolute; inset: 0; background: #E9EEF2; }
.cat-carte .leaflet-control-attribution { font-size: 11px; }
.cat-zone-btn { position: absolute; z-index: 500; top: 16px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
  background: var(--c-blanc); color: var(--c-encre); border: 1px solid var(--c-bordure); border-radius: var(--r-pastille);
  box-shadow: var(--ombre-c); font: 700 14px "Inter", sans-serif; cursor: pointer; }
.cat-zone-btn[hidden] { display: none; }
.cat-zone-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
.cat-zone-btn .picto { width: 18px; height: 18px; stroke-width: 2; }
.cat-zoom { position: absolute; z-index: 500; right: 16px; bottom: 28px; display: flex; flex-direction: column;
  background: var(--c-blanc); border-radius: 12px; box-shadow: var(--ombre-c); overflow: hidden; }
.cat-zoom button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 0; background: var(--c-blanc); color: var(--c-encre); cursor: pointer; }
.cat-zoom button + button { border-top: 1px solid var(--c-bordure); }
.cat-zoom button:hover { color: var(--c-accent); background: var(--c-doux); }
.cat-zoom .picto { width: 20px; height: 20px; stroke-width: 2.2; }
.cat-zone-btn:focus-visible, .cat-zoom button:focus-visible, .cat-bascule:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---------- Mobile ---------- */
@media (max-width: 899px) {
  body.page-carte .barre-nav { display: none; }
  body.page-carte #contenu { height: 100vh; height: 100dvh; }
  .cat-c { display: block; position: relative; height: 100%; }
  .cat-carte-zone { position: absolute; inset: 0; }

  .cat-haut-mobile { display: flex; align-items: center; gap: 6px; position: absolute; z-index: 600;
    top: 10px; left: 10px; right: 10px; padding: 4px; background: var(--c-blanc); border-radius: 14px; box-shadow: var(--ombre-c); }
  .cat-retour { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    color: var(--c-encre); border-radius: 10px; flex: none; }
  .cat-resume { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    min-height: 44px; padding: 0 4px; background: none; border: 0; text-align: left; cursor: pointer; font-family: inherit; }
  .cat-resume strong, .cat-resume span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cat-resume strong { color: var(--c-encre); font-size: 15px; font-weight: 800; }
  .cat-resume span { color: var(--c-texte); font-size: 13px; }
  .cat-btn-filtres { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; flex: none;
    border: 1px solid var(--c-bordure); border-radius: 10px; background: var(--c-blanc); color: var(--c-encre);
    font: 700 14px "Inter", sans-serif; cursor: pointer; }
  .cat-btn-filtres .picto { width: 18px; height: 18px; }
  .cat-nb { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: var(--r-pastille); background: var(--c-accent); color: var(--c-blanc); font-size: 12px; }
  .cat-zone-btn { top: 74px; }
  .cat-zoom { display: none; }

  /* Panneau qui remonte : 54 % par défaut, tirable vers le haut, réductible. */
  .cat-liste { position: absolute; z-index: 550; left: 0; right: 0; bottom: 0; height: 54%;
    border-right: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(18, 35, 61, .16);
    transition: height .22s ease; }
  .cat-liste.etat-haut { height: calc(100% - 66px); }
  .cat-liste.etat-bas { height: 132px; }
  .cat-liste.en-glisse { transition: none; }
  .cat-poignee { display: flex; justify-content: center; align-items: center; height: 26px; flex: none; cursor: grab; touch-action: none; }
  .cat-poignee span { width: 40px; height: 5px; border-radius: 3px; background: #CBD3DE; }
  .cat-ligne-resultats { padding-top: 2px; }
  .cat-tri label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cat-tri select { max-width: 190px; min-height: 40px; }
  .cat-filtres { display: none; }
  .cat-note { font-size: 11px; }

  .cat-bascule { display: inline-flex; align-items: center; gap: 8px; position: absolute; z-index: 560; left: 50%;
    transform: translateX(-50%); bottom: calc(54% + 12px); min-height: 44px; padding: 0 18px;
    background: var(--c-encre); color: var(--c-blanc); border: 0; border-radius: var(--r-pastille);
    box-shadow: var(--ombre-c); font: 700 14px "Inter", sans-serif; cursor: pointer; transition: bottom .22s ease; }
  .cat-bascule .picto { width: 18px; height: 18px; }
  body.liste-haute .cat-bascule { bottom: 16px; }
  body.liste-basse .cat-bascule { bottom: 144px; }

  /* Filtres : plein écran, mêmes éléments que sur ordinateur. */
  body.filtres-ouverts .cat-filtres { display: flex; flex-direction: column; position: fixed; z-index: 1100; inset: 0;
    padding: 0; background: var(--c-blanc); border: 0; overflow-y: auto; }
  .cat-filtres-tete { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--c-bordure);
    position: sticky; top: 0; background: var(--c-blanc); z-index: 1; }
  .cat-filtres-tete h2 { margin: 0; flex: 1; font-size: 18px; font-weight: 800; color: var(--c-encre); letter-spacing: -.3px; }
  .cat-effacer { color: var(--c-accent); font-weight: 600; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
  .cat-fermer { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    border: 0; background: none; color: var(--c-encre); cursor: pointer; }
  body.filtres-ouverts .cat-pastilles { flex-direction: column; flex-wrap: nowrap; gap: 0; padding: 8px 16px 96px; }
  body.filtres-ouverts .cat-pastilles > li { display: flex; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--c-bordure); }
  body.filtres-ouverts .pastille-menu { flex: 1; }
  body.filtres-ouverts .pastille-menu > .pastille { width: 100%; max-width: none; min-height: 44px; justify-content: space-between; }
  body.filtres-ouverts .pastille-options { position: static; width: auto; max-height: none; border: 0; box-shadow: none; padding: 6px 0 0; }
  /* Dans le panneau mobile, on décoche dans la liste (ou « Tout effacer ») : pas de croix séparée. */
  body.filtres-ouverts .pastille-menu + .pastille-x { display: none; }
  body.filtres-ouverts .cat-pastilles li:has(.pastille-x) .pastille-menu .pastille { border-radius: var(--r-pastille); padding-right: 14px; }
  body.filtres-ouverts .pastille-x { min-height: 44px; }
  .cat-voir { position: fixed; z-index: 1101; left: 16px; right: 16px; bottom: 16px; min-height: 52px;
    border: 0; border-radius: 12px; background: var(--c-nav); color: var(--c-blanc); font: 700 16px "Inter", sans-serif; cursor: pointer; }
  body.filtres-ouverts .cat-voir { display: block; }
  body.filtres-ouverts { overflow: hidden; }
  /* Le panneau des filtres passe au-dessus de tout (barre flottante, bouton Liste). */
  body.filtres-ouverts .cat-liste { z-index: 1200; }
  body.filtres-ouverts .cat-bascule, body.filtres-ouverts .cat-haut-mobile { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) { .cat-liste, .cat-bascule { transition: none; } }

/* Colonne de gauche sur fond gris clair, pour la distinguer de la barre blanche (fiches, menus et champs restent blancs). */
.cat-liste, .cat-note { background: #F1F4F8; }
body.filtres-ouverts .cat-filtres, .cat-filtres-tete { background: var(--c-blanc); }
