/* Catalogue des formations */
:root{
  --niv-deb:#5b4bb7; --niv-int:#0f6e64; --niv-av:#a14a12; --niv-tous:#1f5f99;
  --dom-voyage-1:#0f6e64; --dom-voyage-2:#1f5f99;
  --dom-compta-1:#8a5a00; --dom-compta-2:#c2410c;
  --dom-bureau-1:#2f6b2f; --dom-bureau-2:#0f6e64;
  --dom-crm-1:#5b4bb7; --dom-crm-2:#9d3a7a;
  --dom-logistique-1:#1d4e89; --dom-logistique-2:#b45309;
  --dom-sante-1:#0e7490; --dom-sante-2:#be123c;
  --dom-retail-1:#9a3412; --dom-retail-2:#a16207;
  --dom-relation-1:#5b4bb7; --dom-relation-2:#9d3a7a;
  --dom-rh-1:#3f6212; --dom-rh-2:#0f766e;
  --dom-finance-1:#8a5a00; --dom-finance-2:#c2410c;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --niv-deb:#b3a8f5; --niv-int:#4fc1b0; --niv-av:#f2a46b; --niv-tous:#8cc0f0;
  --dom-voyage-1:#0d4f48; --dom-voyage-2:#173f66;
  --dom-compta-1:#5c3d06; --dom-compta-2:#7a2c0c;
  --dom-bureau-1:#1f4a1f; --dom-bureau-2:#0d4f48;
  --dom-crm-1:#3b3080; --dom-crm-2:#6a2853;
  --dom-logistique-1:#163a66; --dom-logistique-2:#7c3a06;
  --dom-sante-1:#0b4f62; --dom-sante-2:#7f1028;
  --dom-retail-1:#62210a; --dom-retail-2:#6b4205;
  --dom-relation-1:#3b3080; --dom-relation-2:#6a2853;
  --dom-rh-1:#2a420c; --dom-rh-2:#0b4f4a;
  --dom-finance-1:#5c3d06; --dom-finance-2:#7a2c0c;
}}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.wrap-large{max-width:1320px;margin:0 auto;padding:0 16px}

/* Barre du haut : recherche */
.cat-search{flex:1;min-width:200px;max-width:440px;position:relative;display:flex;align-items:center}
.cat-search svg{position:absolute;left:12px;width:18px;height:18px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round;pointer-events:none}
.cat-search input{padding-left:38px;background:var(--bg);border-radius:999px}
.topbar nav{margin-left:auto}

/* Mise en page à deux colonnes */
.cat{display:grid;grid-template-columns:250px minmax(0,1fr);gap:32px;padding-top:20px}
.cat-main{min-width:0}

/* Colonne des filtres */
.cat-side{align-self:start;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto;padding-bottom:16px}
.cat-side-head,.cat-side-foot{display:none}
.cat-sort{display:block;margin:0 0 20px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:10px 12px 6px}
.cat-sort span{display:block;font-size:12px;font-weight:500;color:var(--muted);margin:0}
.cat-sort select{border:0;padding:4px 0;background:transparent;min-height:36px;font-weight:600;font-size:16px;outline-offset:2px}
.cat-refine{font-size:13px;font-weight:600;color:var(--muted);margin:0 0 4px}
.cat-side details{border-bottom:1px solid var(--line)}
.cat-side summary{list-style:none;cursor:pointer;display:flex;justify-content:space-between;align-items:center;font-weight:600;font-size:17px;padding:14px 0;min-height:44px}
.cat-side summary::-webkit-details-marker{display:none}
.cat-side summary::after{content:"";width:8px;height:8px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(45deg);margin:-4px 6px 0 0;transition:transform .15s}
.cat-side details[open] summary::after{transform:rotate(-135deg);margin-top:4px}
.cat-opts{display:flex;flex-direction:column;gap:2px;padding:0 0 12px}
.cat-opts label{display:flex;align-items:center;gap:10px;font-weight:400;font-size:15px;margin:0;padding:6px 0;cursor:pointer;min-height:40px}
.cat-opts input{width:20px;height:20px;min-height:0;margin:0;accent-color:var(--accent);flex:none}
.cat-opts .n{margin-left:auto;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.cat-opts label:has(input:checked) span:first-of-type{font-weight:600}

/* Puces des filtres actifs */
.cat-chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:12px}
.cat-chip{display:inline-flex;align-items:center;gap:8px;font:500 15px var(--sans);padding:8px 14px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--fg);cursor:pointer;min-height:40px}
.cat-chip span[aria-hidden]{color:var(--muted);font-size:18px;line-height:1}
.cat-chip:hover{border-color:var(--accent)}
.cat-clear{background:none;border:0;color:var(--accent);font:600 15px var(--sans);cursor:pointer;padding:8px 12px;min-height:40px}

/* En-tête */
.cat-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin:8px 0 24px}
.cat-head h1{font-size:clamp(26px,3.4vw,36px);line-height:1.15;margin:0 0 8px;color:var(--accent)}
.cat-head p{margin:0;color:var(--muted);font-size:17px;max-width:62ch}
.cat-count{white-space:nowrap;font-weight:600;font-size:18px;color:var(--muted)!important;padding-top:8px}
.cat-open{display:none;width:100%;margin-bottom:16px}
.cat-open svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

/* Grille de cartes */
.cat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:20px}
.cat-card{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:0 1px 2px rgb(0 0 0 / .05),0 4px 14px rgb(0 0 0 / .04);transition:transform .15s,box-shadow .15s}
.cat-card:hover{transform:translateY(-2px);box-shadow:0 2px 4px rgb(0 0 0 / .06),0 10px 24px rgb(0 0 0 / .08)}
.cat-level{--c:var(--niv-int);display:flex;align-items:center;justify-content:center;gap:8px;font-size:12px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;padding:6px 8px;color:var(--c);background:color-mix(in srgb,var(--c) 12%,var(--surface))}
.niv-debutant .cat-level{--c:var(--niv-deb)} .niv-avance .cat-level{--c:var(--niv-av)} .niv-tous .cat-level{--c:var(--niv-tous)}
.niv-barres{display:inline-flex;align-items:flex-end;gap:2px;height:12px}
.niv-barres i{width:3px;background:currentColor;opacity:.3;border-radius:1px}
.niv-barres i:nth-child(1){height:5px}.niv-barres i:nth-child(2){height:8px}.niv-barres i:nth-child(3){height:12px}
.niv-barres i.on{opacity:1}

/* Visuel (dessiné, sans photo) */
.cat-visu{--a:var(--dom-voyage-1);--b:var(--dom-voyage-2);position:relative;height:150px;overflow:hidden;color:#fff;
  background:radial-gradient(circle at 20% 110%,rgb(255 255 255 / .18) 0 30%,transparent 31%),linear-gradient(135deg,var(--a),var(--b))}
.dom-compta .cat-visu{--a:var(--dom-compta-1);--b:var(--dom-compta-2)}
.dom-bureau .cat-visu{--a:var(--dom-bureau-1);--b:var(--dom-bureau-2)}
.dom-crm .cat-visu{--a:var(--dom-crm-1);--b:var(--dom-crm-2)}
.dom-logistique .cat-visu{--a:var(--dom-logistique-1);--b:var(--dom-logistique-2)}
.dom-sante .cat-visu{--a:var(--dom-sante-1);--b:var(--dom-sante-2)}
.dom-retail .cat-visu{--a:var(--dom-retail-1);--b:var(--dom-retail-2)}
.dom-relation .cat-visu{--a:var(--dom-relation-1);--b:var(--dom-relation-2)}
.dom-rh .cat-visu{--a:var(--dom-rh-1);--b:var(--dom-rh-2)}
.dom-finance .cat-visu{--a:var(--dom-finance-1);--b:var(--dom-finance-2)}
.cat-visu::before{content:"";position:absolute;inset:0;background-image:radial-gradient(rgb(255 255 255 / .22) 1px,transparent 1.5px);background-size:14px 14px;mask-image:linear-gradient(90deg,transparent 30%,#000)}
.cat-visu svg{fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.cat-visu-ic{position:absolute;left:50%;top:50%;width:64px;height:64px;transform:translate(-50%,-55%);filter:drop-shadow(0 2px 6px rgb(0 0 0 / .25))}
.cat-visu-bg{position:absolute;right:-24px;bottom:-30px;width:150px;height:150px;opacity:.14;stroke-width:1}
.cat-ribbon{position:absolute;top:12px;right:0;display:inline-flex;align-items:center;gap:6px;background:var(--surface);color:var(--fg);font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;padding:5px 10px 5px 14px;clip-path:polygon(0 0,100% 0,100% 100%,0 100%,8px 50%)}
.cat-ribbon .rib{width:14px;height:14px;stroke:var(--accent);stroke-width:2}
.is-soon .cat-ribbon{color:var(--muted)}
.cat-visu-lbl{position:absolute;left:12px;bottom:10px;font:600 12px var(--mono);letter-spacing:.04em;background:rgb(0 0 0 / .28);padding:3px 8px;border-radius:6px}
.is-soon .cat-visu{filter:saturate(.55)}
.cat-strip{display:flex;justify-content:space-between;gap:8px;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:6px 12px;background:color-mix(in srgb,var(--fg) 5%,var(--surface));color:var(--muted);border-bottom:1px solid var(--line)}
.cat-strip span:last-child{text-align:right}
.cat-body{display:flex;flex-direction:column;flex:1;padding:16px 18px 18px}
.cat-body h3{font-size:18px;line-height:1.3;margin:0 0 8px;font-weight:600}
.cat-resume{color:var(--muted);font-size:14.5px;margin:0 0 14px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.cat-meta{list-style:none;padding:0;margin:auto 0 16px;display:flex;flex-wrap:wrap;gap:6px 16px;font-size:14px;color:var(--muted)}
.cat-meta li{display:inline-flex;align-items:center;gap:6px}
.cat-meta svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.cat-actions{display:flex;gap:10px;flex-wrap:wrap}
.cat-body .cat-actions .btn{flex:1;min-height:44px;font-size:15px}
.cat-soon{background:var(--line);border-color:var(--line);color:var(--muted);cursor:default}
.cat-empty{margin-top:8px;text-align:center}

/* Sections par catégorie */
.cat-nav{display:flex;gap:8px;overflow-x:auto;padding:2px 0 12px;margin:0 0 8px;scrollbar-width:thin}
.cat-nav a{flex:none;display:inline-flex;align-items:center;gap:8px;padding:8px 14px;min-height:40px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--fg);text-decoration:none;font-size:14.5px;font-weight:500;white-space:nowrap}
.cat-nav a:hover{border-color:var(--accent);color:var(--accent)}
.cat-nav b{font-size:12px;font-weight:600;color:var(--muted);background:var(--bg);border-radius:999px;padding:1px 8px}
.cat-groupe{scroll-margin-top:16px;margin:0 0 40px}
.cat-groupe-tete{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap;border-bottom:2px solid var(--line);padding-bottom:8px;margin-bottom:8px}
.cat-groupe-tete h2{margin:0;font-size:clamp(20px,2.4vw,24px);line-height:1.25}
.cat-groupe-n{font-size:14px;font-weight:600;color:var(--muted)}
.cat-groupe-desc{margin:0 0 16px;color:var(--muted);font-size:15px;max-width:75ch}

.cat-why{padding-top:48px}
.cat-why .grid{grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}

/* Fiche détaillée */
.cat-dialog{width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 32px);border:1px solid var(--line);border-radius:14px;padding:24px;background:var(--surface);color:var(--fg)}
.cat-dialog::backdrop{background:rgb(0 0 0 / .5)}
.cat-dialog h2{margin:4px 40px 12px 0;font-size:24px;line-height:1.2}
.cat-dialog h3{font-size:16px;margin:20px 0 6px}
.cat-dialog p{margin:0 0 8px}
.cat-dialog .cat-meta{margin:0 0 8px}
.cat-dialog .cat-meta li{background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:2px 10px}
.cat-dialog .note{margin-top:20px}
.cat-dialog .cat-actions{margin-top:12px}
.cat-dlg-tag{font:600 12px var(--mono);color:var(--accent);text-transform:uppercase;letter-spacing:.04em}
.cat-notions{margin:0;padding-left:20px;color:var(--muted)}
.cat-notions li{margin-bottom:4px}
.cat-dialog-x{position:absolute;top:12px;right:12px;margin:0}
.cat-dialog-x button,.cat-close{width:40px;height:40px;border-radius:50%;border:1px solid var(--line);background:var(--bg);color:var(--fg);font-size:22px;line-height:1;cursor:pointer}

/* Tablette et mobile : filtres dans un panneau */
@media (max-width:860px){
  .cat{grid-template-columns:1fr;gap:0;padding-top:12px}
  .cat-open{display:inline-flex}
  .cat-side{position:fixed;z-index:50;inset:0 auto 0 0;width:min(340px,88vw);height:100vh;height:100dvh;max-height:none;top:0;bottom:auto;background:var(--surface);padding:0 16px;transform:translateX(-105%);transition:transform .2s;box-shadow:4px 0 24px rgb(0 0 0 / .2);display:flex;flex-direction:column}
  .cat-side>*{flex-shrink:0}
  .cat-side.open{transform:none}
  .cat-side-head{display:flex;justify-content:space-between;align-items:center;padding:12px 0;position:sticky;top:0;background:var(--surface);z-index:1;font-size:18px}
  .cat-side-foot{display:block;position:sticky;bottom:0;background:var(--surface);padding:12px 0;margin-top:auto}
  .cat-side-foot .btn{width:100%}
  .cat-voile{position:fixed;inset:0;z-index:40;background:rgb(0 0 0 / .45)}
  .cat-head{flex-direction:column;gap:4px;margin-bottom:16px}
  .cat-count{padding-top:0;font-size:16px}
}
@media (max-width:640px){
  .topbar .cat-search{order:3;flex-basis:100%;max-width:none;margin-bottom:8px}
  .cat-grid{grid-template-columns:1fr;gap:16px}
  .cat-visu{height:130px}
  .cat-head p{font-size:16px}
  .cat-dialog{padding:20px 16px}
}

/* v19 : formations recommandées par le questionnaire de profil */
.cat-reco{position:absolute;left:12px;top:12px;background:#fff;color:#2E2A9E;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;padding:4px 9px;border-radius:99px;box-shadow:0 1px 4px rgba(0,0,0,.18)}
.cat-guide{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;background:var(--accent-soft);border-radius:10px;padding:12px 16px;margin:0 0 16px;font-size:15px}
.cat-guide b{color:var(--accent)}
