/* Mode carte /carte (22/10/2026) */
body:has(#cf) .site-footer-pro,
body:has(#cf) .tabbar,
body:has(#cf) #fb-bouton,
body:has(#cf) #fb-panneau { display: none !important; }
body:has(#cf) { overflow: hidden; }

.cf {
    --cf-h: 52px;
    position: relative; display: flex; flex-direction: column;
    height: calc(100dvh - var(--cf-top, 68px)); min-height: 420px;
    background: var(--bg, #f8fafc); color: var(--ink, #111827);
}

/* ---------- barre de filtres ---------- */
.cf-bar {
    position: relative; z-index: 20; display: flex; align-items: center; gap: 8px;
    min-height: var(--cf-h); padding: 8px 16px; background: var(--surface, #fff); border-bottom: 1px solid var(--line, #e5e7eb);
}
.cf-flex { flex: 1 1 auto; }
.cf-seg { display: inline-flex; flex: 0 0 auto; padding: 2px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--surface-2, #f1f5f9); }
.cf-seg-b {
    font: inherit; font-size: 13px; font-weight: 600; line-height: 1; padding: 7px 13px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted, #64748b); cursor: pointer; white-space: nowrap;
}
.cf-seg-b[aria-pressed="true"] { background: var(--surface, #fff); color: var(--indigo-dark, #4338ca); box-shadow: 0 1px 3px rgba(15, 23, 42, .18); }
html[data-theme="dark"] .cf-seg-b[aria-pressed="true"] { background: var(--indigo-soft, #23264d); color: #c7d2fe; box-shadow: none; }

.cf-dd { position: relative; flex: 0 0 auto; }
.cf-chip {
    display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
    padding: 8px 11px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--surface, #fff);
    color: var(--ink, #111827); cursor: pointer; white-space: nowrap;
}
.cf-chip:hover { border-color: var(--indigo, #4f46e5); }
.cf-chip.cf-actif { background: var(--indigo-soft, #eef2ff); border-color: var(--indigo, #4f46e5); color: var(--indigo-dark, #4338ca); }
html[data-theme="dark"] .cf-chip.cf-actif { color: #c7d2fe; }
.cf-car { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .6; }
.cf-chip[aria-expanded="true"] .cf-car { transform: translateY(1px) rotate(225deg); }
.cf-chip:focus-visible, .cf-seg-b:focus-visible, .cf-reset:focus-visible, .cf-liste-btn:focus-visible, .cf-item:focus-visible, .cf-poignee:focus-visible {
    outline: 2px solid var(--indigo, #4f46e5); outline-offset: 2px;
}
.cf-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 250px; padding: 12px 14px;
    background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px; box-shadow: 0 14px 34px -12px rgba(15, 23, 42, .35);
}
.cf-pop[hidden] { display: none; }
.cf-dd-droite .cf-pop { left: auto; right: 0; }
.cf-pop-t { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #64748b); }
.cf-ck { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
.cf-ck input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--indigo-btn, #4f46e5); flex: 0 0 auto; }
.cf-ck small { display: block; font-size: 12px; color: var(--muted, #64748b); }
.cf-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-duo label { display: block; font-size: 12px; font-weight: 600; color: var(--muted, #64748b); }
.cf-duo input {
    display: block; width: 100%; margin-top: 4px; padding: 8px 9px; font: inherit; font-size: 14px; color: var(--ink, #111827);
    background: var(--surface, #fff); border: 1px solid var(--line, #cbd5e1); border-radius: 8px;
}
.cf-reset { flex: 0 0 auto; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 4px; border: 0; background: transparent; color: var(--indigo-dark, #4338ca); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cf-reset[hidden] { display: none; }
html[data-theme="dark"] .cf-reset { color: #a5b4fc; }

/* ---------- corps : liste + carte ---------- */
.cf-corps { position: relative; flex: 1 1 auto; display: flex; min-height: 0; }
.cf-carte-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.cf-map { position: absolute; inset: 0; }
.cf .maplibregl-map { font: inherit; }
.cf .maplibregl-ctrl-top-right { top: 56px; }

.cf-liste { flex: 0 0 360px; width: 360px; display: flex; flex-direction: column; background: var(--surface, #fff); border-right: 1px solid var(--line, #e5e7eb); min-height: 0; z-index: 5; }
.cf-liste.cf-replie { display: none; }
.cf-poignee {
    display: block; width: 100%; padding: 12px 16px; text-align: left; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink, #111827);
    background: transparent; border: 0; border-bottom: 1px solid var(--line, #e5e7eb); cursor: default;
}
.cf-poignee-barre { display: none; }
.cf-liste-in { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.cf-items { list-style: none; margin: 0; padding: 0; }
.cf-item {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; width: 100%; padding: 11px 16px; text-align: left;
    font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--line, #eef0f4); cursor: pointer;
}
.cf-item:hover, .cf-item.cf-sel { background: var(--indigo-soft, #eef2ff); }
.cf-item b { font-size: 14px; font-weight: 700; }
.cf-item .cf-px { font-size: 14px; font-weight: 800; color: var(--indigo-dark, #4338ca); white-space: nowrap; }
html[data-theme="dark"] .cf-item .cf-px { color: #c7d2fe; }
.cf-item small { font-size: 12.5px; color: var(--muted, #64748b); }
.cf-item .cf-bad { grid-column: 2; font-size: 11.5px; font-weight: 700; color: #dc2626; text-align: right; }
.cf-item .cf-bad.cf-og { color: #059669; }
.cf-sous { padding: 10px 16px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #64748b); }
.cf-vide { margin: 0; padding: 22px 16px; font-size: 14px; line-height: 1.5; color: var(--muted, #64748b); }
.cf-vide button { font: inherit; font-weight: 600; padding: 0; border: 0; background: none; color: var(--indigo-dark, #4338ca); text-decoration: underline; cursor: pointer; }

.cf-liste-btn {
    position: absolute; z-index: 6; top: 10px; left: 10px; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--line, #e5e7eb); background: var(--surface, #fff); color: var(--ink, #111827); cursor: pointer; box-shadow: 0 3px 12px rgba(15, 23, 42, .18);
}
.cf-compteur {
    position: absolute; z-index: 5; top: 10px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 330px);
    padding: 8px 15px; font-size: 13.5px; text-align: center; border-radius: 999px; background: var(--surface, #fff); color: var(--ink, #111827);
    border: 1px solid var(--line, #e5e7eb); box-shadow: 0 3px 12px rgba(15, 23, 42, .18); pointer-events: none;
}
.cf-compteur strong { font-weight: 800; }
.cf-compteur small { color: var(--muted, #64748b); }
.cf-charge { position: absolute; z-index: 7; left: 0; right: 0; top: 0; height: 3px; overflow: hidden; opacity: 0; transition: opacity .15s; pointer-events: none; }
.cf-charge::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--indigo, #4f46e5); animation: cf-charge 1s ease-in-out infinite; }
.cf-charge.cf-on { opacity: 1; }
@keyframes cf-charge { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .cf-charge::after { animation: none; width: 100%; opacity: .5; } }

.cf-legende {
    position: absolute; z-index: 4; left: 10px; bottom: 44px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(100% - 20px);
    padding: 6px 10px; font-size: 12px; font-weight: 600; border-radius: 8px; background: rgba(255, 255, 255, .94); color: #1f2937; box-shadow: 0 2px 8px rgba(15, 23, 42, .2);
}
html[data-theme="dark"] .cf-legende { background: rgba(23, 26, 43, .94); color: #e5e7eb; }
.cf-legende[hidden], .cf-lg[hidden] { display: none; }
.cf-lg i { display: inline-block; width: 13px; height: 9px; margin-right: 6px; border: 2px solid; vertical-align: -1px; }
.cf-lg-parc { border-color: #4f46e5; background: rgba(79, 70, 229, .35); }
.cf-lg-opp { border-color: #059669; background: rgba(5, 150, 105, .35); }
.cf-lg-pluc { border-color: #c2410c; border-style: dashed !important; background: rgba(234, 88, 12, .15); }
.cf-astuce {
    position: absolute; z-index: 4; left: 50%; bottom: 26px; transform: translateX(-50%); margin: 0; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
    border-radius: 999px; background: rgba(17, 24, 39, .86); color: #fff; pointer-events: none; white-space: nowrap;
}
.cf-astuce[hidden] { display: none; }

/* ---------- popups ---------- */
.cf-popup .maplibregl-popup-content { width: 268px; padding: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 14px 34px -10px rgba(15, 23, 42, .5); background: var(--surface, #fff); color: var(--ink, #111827); font-family: inherit; }
.cf-popup .maplibregl-popup-close-button { z-index: 2; width: 28px; height: 28px; font-size: 19px; line-height: 26px; border-radius: 50%; right: 6px; top: 6px; background: rgba(255, 255, 255, .92); color: #111827; }
.cf-popup .maplibregl-popup-tip { display: none; }
.cf-fiche-ph { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2, #e2e8f0); }
.cf-fiche-ph.cf-sans { display: grid; place-items: center; font-size: 13px; color: var(--muted, #64748b); }
.cf-fiche-c { padding: 11px 14px 14px; }
.cf-fiche-px { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.cf-fiche-px s { font-size: 13px; font-weight: 500; color: var(--muted, #64748b); }
.cf-fiche-px em { font-style: normal; font-size: 12px; font-weight: 800; color: #dc2626; }
.cf-fiche-m { margin: 3px 0 0; font-size: 13.5px; line-height: 1.35; }
.cf-fiche-ag { margin: 3px 0 0; font-size: 12.5px; color: var(--muted, #64748b); }
.cf-fiche-lien { display: block; margin-top: 11px; padding: 9px 12px; text-align: center; font-size: 13.5px; font-weight: 700; border-radius: 9px; background: var(--indigo-btn, #4f46e5); color: #fff !important; text-decoration: none !important; }
.cf-fiche-lien:hover { filter: brightness(1.08); }
.cf-parc .maplibregl-popup-content { width: auto; min-width: 190px; max-width: 250px; padding: 11px 14px 12px; border-radius: 12px; background: var(--surface, #fff); color: var(--ink, #111827); box-shadow: 0 10px 28px -8px rgba(15, 23, 42, .45); font-family: inherit; }
.cf-parc .maplibregl-popup-tip { display: none; }
.cf-parc .maplibregl-popup-close-button { font-size: 17px; right: 3px; top: 1px; color: inherit; }
.cf-parc h4 { margin: 0 20px 2px 0; font-size: 15px; font-weight: 800; }
.cf-parc p { margin: 2px 0; font-size: 13px; line-height: 1.4; color: var(--ink-2, #374151); }
.cf-parc .cf-tag { display: inline-block; margin: 4px 0 0; padding: 2px 8px; font-size: 11.5px; font-weight: 700; border-radius: 999px; }
.cf-parc .cf-tag-a { background: #e0e7ff; color: #3730a3; }
.cf-parc .cf-tag-o { background: #d1fae5; color: #065f46; }
.cf-parc a { display: inline-block; margin-top: 7px; font-weight: 700; font-size: 13px; color: var(--indigo-dark, #4338ca); }
html[data-theme="dark"] .cf-parc a { color: #a5b4fc; }
.cf-tip .maplibregl-popup-content { padding: 3px 8px; font-size: 12px; font-weight: 700; border-radius: 6px; background: rgba(17, 24, 39, .9); color: #fff; pointer-events: none; }
.cf-tip .maplibregl-popup-tip { display: none; }
html[data-theme="dark"] .maplibregl-ctrl-group { background: var(--surface); }
html[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
html[data-theme="dark"] .maplibregl-ctrl-attrib { background: rgba(15, 17, 32, .8) !important; color: #a0a7bd; }
html[data-theme="dark"] .maplibregl-ctrl-attrib a { color: #a0a7bd; }
.cf-part { font-style: normal; font-weight: 700; color: #b45309; }
html[data-theme="dark"] .cf-part { color: #fbbf24; }
.cf-part-b { display: inline-block; margin: 6px 0 0; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #fef3c7; color: #92400e; }
html[data-theme="dark"] .cf-part-b { background: #3a2e12; color: #fcd34d; }

/* ---------- mobile : filtres defilants, liste en panneau bas glissant ---------- */
@media (max-width: 820px) {
    .cf-bar { gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
    .cf-bar::-webkit-scrollbar { display: none; }
    .cf-pop {
        position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 60; min-width: 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0; box-shadow: 0 -14px 40px rgba(15, 23, 42, .4);
    }
    .cf-dd-droite .cf-pop { right: 0; left: 0; }
    .cf-corps { display: block; }
    .cf-carte-wrap { position: absolute; inset: 0; }
    .cf-liste-btn { display: none; }
    .cf-compteur { top: 8px; max-width: calc(100% - 70px); font-size: 12.5px; padding: 7px 12px; }
    .cf .maplibregl-ctrl-top-right { top: 48px; }
    .cf-legende { bottom: 78px; }
    .cf-astuce { bottom: 78px; }
    .cf .maplibregl-ctrl-bottom-left, .cf .maplibregl-ctrl-bottom-right { margin-bottom: 56px; }
    .cf-liste {
        position: absolute; left: 0; right: 0; bottom: 0; width: auto; flex: none; height: 56vh; max-height: calc(100% - 40px); z-index: 12;
        border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 28px rgba(15, 23, 42, .28);
        transform: translateY(calc(100% - 54px)); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom);
    }
    .cf-liste.cf-replie { display: flex; }
    .cf-liste.cf-ouvert { transform: translateY(0); }
    .cf-liste.cf-glisse { transition: none; }
    .cf-poignee { cursor: pointer; padding: 8px 16px 12px; text-align: center; touch-action: none; }
    .cf-poignee-barre { display: block; width: 38px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--line, #cbd5e1); }
}
@media (prefers-reduced-motion: reduce) { .cf-liste { transition: none; } }
