/* L'espace foncier épuré (src/foncier-epure.js ; Henri, 15/10/2026 : « il faut épurer l'interface », « des menus
   déroulants pour tous les modes », « la sidebar de gauche reste »).
   Préfixe :is(html, html[data-theme]) :is(.page-app, body) .pg : instrument.css et onglets.css posent leurs règles à
   ce poids ; cette feuille se charge après elles (scripts/modules.json). */

/* ── 1. Le mode en menu déroulant, à toutes les largeurs (sous 700 px : onglets.css fait déjà la même chose) ── */
@media (min-width: 700px) {
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre { position: relative; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-choix { display: inline-flex; flex: none; align-items: center; gap: 8px; height: 30px; padding: 0 9px 0 12px; border: 0; border-radius: var(--r-moyen); background: var(--survol); box-shadow: inset 0 0 0 1px var(--filet); color: var(--encre); font: inherit; font-size: var(--t-14); font-weight: 600; cursor: pointer; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-choix:hover { background: var(--actif); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-choix svg { flex: none; width: 12px; height: 12px; opacity: .7; transition: transform .15s; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-choix svg { transform: rotate(180deg); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre .og-onglets { display: none; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-onglets { display: flex; flex-direction: column; align-items: stretch; gap: 2px; position: absolute; z-index: 30; top: calc(100% + 2px); left: 86px; width: 380px; padding: 6px; border-radius: var(--r-panneau); background: var(--surface-panneau); box-shadow: 0 0 0 1px var(--filet-2), 0 16px 40px rgba(0, 0, 0, .4); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-onglets > button { display: grid; justify-items: start; gap: 2px; width: 100%; height: auto; min-height: 50px !important; padding: 8px 12px; border-radius: var(--r-moyen); background: none; box-shadow: none; text-align: left; white-space: normal; font-size: var(--t-15); color: var(--encre); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-onglets > button:hover { background: var(--survol); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-onglets > button[aria-selected="true"] { background: var(--actif); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-long { display: inline; font-weight: 600; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-court { display: none; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg .og-barre.og-ouvert .og-desc { display: block; white-space: normal; font-size: var(--t-13); font-weight: 400; line-height: 1.35; color: var(--encre-3); }
}

/* ── 3. Le champ de recherche de la barre ── */
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-recherche { position: relative; flex: 0 1 440px; min-width: 160px; max-width: none; height: 30px; margin: 0 4px; display: flex; align-items: center; border-radius: var(--r-moyen); background: var(--survol); box-shadow: inset 0 0 0 1px var(--filet); }
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-recherche:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.pg .fe-recherche .fe-loupe { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--encre-3); pointer-events: none; }
:is(html, html[data-theme]) :is(.page-app, body) .pg.pg .fe-recherche input { width: 100%; height: 30px; min-height: 0; padding: 0 10px 0 29px; border: 0; border-radius: var(--r-moyen); background: transparent; color: var(--encre); font: inherit; font-size: var(--t-14); -webkit-appearance: none; appearance: none; }
.pg .fe-recherche input::placeholder { color: var(--encre-3); }
.pg .fe-recherche input:focus { outline: none; box-shadow: none; }
.pg .fe-recherche input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.pg .fe-recherche .suggestions { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: min(480px, 72vw); max-height: 60vh; overflow-y: auto; margin: 0; padding: 4px; list-style: none; border: 0; border-radius: var(--r-carte); background: var(--surface-panneau); box-shadow: 0 0 0 1px var(--filet-2), 0 16px 40px rgba(0, 0, 0, .4); }
.pg .fe-recherche .suggestions[hidden] { display: none; }
.pg .fe-recherche .suggestions a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; padding: 6px 10px; border-radius: var(--r-bouton); color: var(--encre); font-size: var(--t-13); text-decoration: none; }
.pg .fe-recherche .suggestions a:hover, .pg .fe-recherche .suggestions [aria-selected="true"] a { background: var(--actif); }
.pg .fe-recherche .suggestions small { color: var(--encre-3); font-size: var(--t-12); white-space: nowrap; }
.pg .fe-recherche .suggestions-titre { padding: 8px 10px 4px; font-size: var(--t-11); color: var(--encre-4); }
@media (max-width: 699px) { :is(html, html[data-theme]) :is(.page-app, body) .pg .fe-recherche { display: none; } }

/* ── 2. Les filtres en puces, sur la carte (bureau) ── */
.pg .fe-puces { position: absolute; z-index: 4; top: 10px; left: 10px; max-width: calc(100% - 360px); display: flex; flex-wrap: wrap; gap: 6px; }
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-puce { display: inline-flex; align-items: center; gap: 5px; max-width: 280px; height: 32px; min-height: 0; padding: 0 9px 0 11px; border: 0; border-radius: var(--r-moyen); background: var(--panneau); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--ombre-flottant); color: var(--encre-2); font: inherit; font-size: var(--t-13); font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; }
.pg .fe-puce > span, .pg .fe-puce > b { overflow: hidden; text-overflow: ellipsis; }
.pg .fe-puce > b { color: var(--encre); font-weight: 600; }
.pg .fe-puce > b::before { content: '·'; margin-right: 5px; color: var(--encre-4); font-weight: 400; }
.pg .fe-puce > svg { flex: none; width: 11px; height: 11px; opacity: .6; transition: transform .15s; }
.pg .fe-puce:hover { color: var(--encre); }
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-puce.fe-on { background: var(--encre); color: var(--fond); }
.pg .fe-puce.fe-on > b { color: inherit; }
.pg .fe-puce.fe-on > b::before { color: inherit; opacity: .6; }
.pg .fe-puce.fe-on > svg { opacity: .9; transform: rotate(180deg); }
.pg .fe-puce-colonne { padding-left: 9px; color: var(--encre-3); }
.pg .fe-puce-colonne > svg { width: 14px; height: 14px; transform: none !important; }
.pg .fe-puce-colonne[aria-pressed="true"] { color: var(--encre); }
:is(html, html[data-theme]) :is(.page-app, body) .pg.fe-colonne .fe-puces .fe-puce:not(.fe-puce-colonne) { display: none; }
@media (max-width: 899px) { .pg .fe-puces { display: none; } }

@media (min-width: 900px) {
  /* la colonne des filtres se cache ; la carte prend sa place */
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne) > .pg-appli { position: relative; grid-template-columns: 0 minmax(0, 1fr) !important; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne) > .pg-appli > .pg-reglages { display: none; }
  /* la colonne cachée ne compte plus dans la grille : le plateau (carte et résultats) se place lui-même dans la seconde */
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne) > .pg-appli > .fc-plateau { grid-column: 2; grid-row: 1; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne) > .pg-appli > .pg-poignee-x:not(.pg-poignee-droite) { display: none; }
  /* la rubrique ouverte : le panneau du module devient un panneau flottant sous sa puce, réduit à cette rubrique */
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne)[data-fe-ouverte] > .pg-appli > .pg-reglages { display: flex; flex-direction: column; gap: 8px; position: absolute; z-index: 26; top: var(--fe-y, 52px); left: var(--fe-x, 10px); width: 352px; max-height: calc(100% - var(--fe-y, 52px) - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px 14px; border: 0; border-radius: var(--r-panneau); background: var(--surface-panneau); box-shadow: 0 0 0 1px var(--filet-2), 0 16px 40px rgba(0, 0, 0, .35); }
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne)[data-fe-ouverte] > .pg-appli > .pg-reglages > :not([data-fe-vu]) { display: none !important; }
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne)[data-fe-ouverte] > .pg-appli > .pg-reglages > h2[data-fe-vu] { margin-top: 2px; }
  /* un menu déroulant du module (Communes, Zones) s'ouvre dans le panneau, pas par-dessus */
  :is(html, html[data-theme]) :is(.page-app, body) .pg.fe:not(.fe-colonne)[data-fe-ouverte] > .pg-appli > .pg-reglages .fc-deroulant .fc-menu { position: static; width: 100%; min-width: 0; max-height: 340px; margin-top: 6px; box-shadow: inset 0 0 0 1px var(--filet-2); }
}

/* ── 4. La fiche courte d'une parcelle, sur la carte : ancrée près du centre de la parcelle (--fe-fx/--fe-fy,
   posés par positionnerFiche dans foncier-epure.js), repliée dans le cadre ; tant qu'elle n'est pas encore
   calée (chargement), elle part du coin haut-droit comme avant ── */
.pg .fe-fiche { position: absolute; z-index: 6; top: var(--fe-fy, 54px); left: var(--fe-fx, auto); right: 10px; width: 320px; max-width: calc(100% - 20px); max-height: calc(100% - 70px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; border-radius: var(--r-panneau); background: var(--surface-panneau); color: var(--encre); box-shadow: 0 0 0 1px var(--filet-2), 0 16px 40px rgba(0, 0, 0, .35); }
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-fiche .fe-x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: var(--r-bouton); background: none; color: var(--attenue); cursor: pointer; }
.pg .fe-fiche .fe-x:hover { background: var(--actif); color: var(--encre); }
.pg .fe-fiche .fe-x svg { width: 14px; height: 14px; }
.pg .fe-fiche .fe-sur { margin: 0 28px 2px 0; color: var(--encre-3); font-size: var(--t-12); font-variant-numeric: tabular-nums; }
.pg .fe-fiche h3 { margin: 0 0 10px; font-size: var(--t-17); font-weight: 600; letter-spacing: -.01em; }
.pg .fe-dl { margin: 0; }
.pg .fe-dl > div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--filet); font-size: var(--t-13); }
.pg .fe-dl dt { color: var(--encre-3); }
.pg .fe-dl dd { margin: 0; min-width: 0; color: var(--encre); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pg .fe-dl dd small { display: block; color: var(--encre-3); font-size: var(--t-12); }
.pg .fe-dl .fe-rouge { color: #D9534F; font-weight: 600; }
.pg .fe-fiche .fe-note { margin: 8px 0 0; color: var(--encre-3); font-size: var(--t-12); line-height: 1.4; }
.pg .fe-fiche .fe-actions { display: flex; gap: 8px; margin-top: 12px; }
:is(html, html[data-theme]) :is(.page-app, body) .pg .fe-fiche .fe-actions .bouton { flex: 1; justify-content: center; margin: 0; height: var(--h-bouton); }
@media (max-width: 899px) { .pg .fe-fiche { top: 10px; right: 10px; left: 10px; width: auto; max-height: calc(100% - 20px); } }
/* Au téléphone, la fiche d'une parcelle cliquée s'ouvre en haut de la carte, là où flotte la pastille Couches · Fond du
   panneau D2 (z-index 41, même contexte d'empilement) : la fiche passe devant (vu dans Safari iOS, 29/10/2026) */
@media (max-width: 899px) { :is(html, html[data-theme]) :is(.page-app, body) .pg .fe-fiche { z-index: 45; } }
