/* =====================================================================
   CATALOGUE : tablette et mobile
   Paysage (tablette) : panneau de filtres repliable a cote des resultats.
   Portrait (tablette) : bouton « Filtres » avec compteur -> tiroir lateral.
   Mobile : bouton « Filtres » avec compteur (barre du bas) -> panneau qui
   monte du bas ; recherche plein ecran ; resultats sur une colonne.
   ===================================================================== */
.ad-cat-filt,.ad-cat-sidehead{display:none}

@media (max-width:1024px){
  /* les popovers de la barre de facettes sont des menus desktop : remplaces par le bouton Filtres */
  body .facetbar{display:none}
  body .cat-status{margin-top:18px}
  .ad-cat-filt{display:inline-flex;align-items:center;gap:10px;min-height:48px;padding:0 18px;border:1px solid var(--ink);border-radius:10px;
    background:#fff;color:var(--ink);font-family:var(--font);font-size:15px;font-weight:700;cursor:pointer}
  .ad-cat-filt svg{width:18px;height:18px}
  .ad-cat-filt .ad-n{display:inline-grid;place-items:center;min-width:24px;height:24px;padding:0 7px;border-radius:100px;background:var(--ink);color:#fff;font-size:13px}
  .ad-cat-filt .ad-n[hidden]{display:none}
  body .sortby select{min-height:48px;font-size:15px}
  body .achip{min-height:44px;font-size:14px;padding:0 14px}
  body .pg{width:48px;height:48px}
  body .fc-save{width:44px;height:44px;top:8px;right:8px}
  body .fc-actions .btn{min-height:48px}
  body .cat-search input{min-height:52px;font-size:16px}
  /* tiroir : cibles tactiles */
  body .dr-close{width:44px;height:44px}
  body .fopt{min-height:48px;padding:10px 12px}
  body .fopt input{width:20px;height:20px}
  body .fopt .fl{font-size:15px}
  body .dgrp>summary{min-height:52px}
  body .dr-foot .btn{min-height:52px}
  body .lnk{min-height:44px}
}

/* ---------- tablette paysage : panneau lateral a cote des resultats ---------- */
@media (min-width:768px) and (max-width:1024px) and (orientation:landscape){
  .ad-cat-layout{display:grid;grid-template-columns:300px 1fr;gap:24px;align-items:start;margin-top:22px}
  .ad-cat-layout.is-collapsed{grid-template-columns:1fr}
  .ad-cat-layout.is-collapsed .ad-cat-side{display:none}
  .ad-cat-side{position:sticky;top:84px;max-height:calc(100dvh - 100px);display:flex;flex-direction:column;border:1px solid var(--line);
    border-radius:14px;background:#fff;overflow:hidden}
  .ad-cat-side .drawer{position:static!important;inset:auto!important;width:auto!important;height:auto;max-height:none;box-shadow:none!important;
    border:0;border-radius:0;display:flex!important;flex-direction:column;flex:1;min-height:0;animation:none!important;transform:none!important}
  .ad-cat-side .dr-head{display:none}
  .ad-cat-side .dr-foot{display:none}
  .ad-cat-side .dr-body{overflow-y:auto}
  .ad-cat-sidehead{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
  .ad-cat-sidehead b{font-size:16px}
  .ad-cat-sidehead button{min-height:44px;border:0;background:none;font-family:var(--font);font-size:14px;font-weight:600;color:var(--ink);text-decoration:underline;cursor:pointer}
  .ad-cat-main{min-width:0}
  .ad-cat-main .cat-status{margin-top:0}
  .ad-cat-layout:not(.is-collapsed) .cat-grid{grid-template-columns:repeat(2,1fr)}
  .ad-cat-layout.is-collapsed .cat-grid{grid-template-columns:repeat(3,1fr)}
}

/* ---------- tablette portrait ---------- */
@media (min-width:768px) and (max-width:1024px) and (orientation:portrait){
  body .cat-grid{grid-template-columns:repeat(2,1fr);gap:16px}
  body .cat-status{gap:12px}
}

/* ---------- mobile ---------- */
@media (max-width:767px){
  body .cat{padding:20px 0 40px}
  body .cat-head{flex-direction:column;align-items:stretch;gap:14px}
  body .cat-head h1{font-size:28px}
  body .cat-sub{font-size:16px}
  body .cat-search{flex:none;min-width:0}
  /* la ligne de statut : nombre de resultats, puis tri ; les puces defilent */
  body .cat-status{display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px}
  body .cat-status .rc{font-size:16px}
  body .cat-status .sortby{margin:0;font-size:0;gap:0}
  body .cat-status .sortby select{max-width:170px}
  body .cat-chips{grid-column:1/-1;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -20px;padding:0 20px 4px}
  body .cat-chips::-webkit-scrollbar{display:none}
  body .cat-chips>*{flex:0 0 auto}
  body .cat-chips:empty{display:none}
  .ad-cat-filt.in-status{display:none}
  body .cat-banner{padding:16px}
  body .cat-banner .cb-t{min-width:0}
  body .cat-banner .btn{width:100%;justify-content:center}
  body .cat-grid{grid-template-columns:1fr;gap:14px}
  body .fc-media{height:132px}
  body .fc-body{padding:14px 16px}
  body .fc-meta dd{font-size:15px}
  body .fc-foot{padding:12px 16px 16px}
  body .fc-actions{width:100%;margin:0}
  body .fc-actions .btn{flex:1;justify-content:center}
  body .pager{gap:4px}
  /* filtres : panneau qui monte du bas */
  body .drawer{top:auto!important;left:0!important;right:0!important;bottom:0!important;width:auto!important;height:88dvh;
    border-radius:20px 20px 0 0;animation:ad-sheet .26s cubic-bezier(.22,.61,.36,1)}
  body .drawer::before{content:"";position:absolute;top:8px;left:50%;width:44px;height:5px;margin-left:-22px;border-radius:100px;background:var(--line2)}
  body .dr-head{padding-top:22px}
  body .dr-foot{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  body .dr-foot .btn{flex:1;justify-content:center}
  /* barre du bas du catalogue : Filtres (compteur) + Rechercher */
  .ad-bottom .ad-n{display:inline-grid;place-items:center;min-width:24px;height:24px;padding:0 7px;border-radius:100px;background:#fff;color:var(--ink);font-size:13px}
  .ad-bottom .ad-n[hidden]{display:none}
}
@keyframes ad-sheet{from{transform:translateY(100%)}to{transform:none}}
@media (prefers-reduced-motion:reduce){body .drawer{animation:none}}
