/* ============================================================================
   enc-tabs.css — Systeme d'onglets/panneaux in-page de l'encyclopedie.
   SHELL PARTAGE = scope .enc-stage (hub + pages d'ordre). Le hub-specifique
   (bandeau collant, masquage grille, cartes narratives, onglet grille) reste
   scope .enc-hub. enc-tabs.js reste hub-only ; les pages d'ordre pilotent le
   panneau ID guide via enrich.js. Internals des panneaux denses = enrich.css.
   ============================================================================ */

/* ---- var de largeur (partagee) ---- */
.enc-stage{--hubMax:1040px}

/* ---- HUB SPECIFIQUE : bandeau / stage ---- */
.enc-stage .enc-pillar-toolbar button.is-on{color:var(--ink);border-bottom-color:var(--ocre)}
.enc-hub .enc-pillar-toolbar{max-width:var(--hubMax);margin-left:auto;margin-right:auto}
.enc-stage.pan-open .enc-pillar-toolbar{margin-bottom:.35rem}
/* Bandeau d'enrichment = mini-header collant, pleine largeur, sur TOUTES les pages enc (hub + ordres). 2026-09-13 */
.enc-stage .tb-wrap{position:sticky;top:var(--navH,56px);z-index:21;background:#fff;margin-inline:calc(50% - 50vw);padding-inline:calc(50vw - 50%)}
/* Desktop : respiration en haut de la barre collee (mobile inchange) */
@media(min-width:601px){.enc-stage .tb-wrap{padding-top:16px}.enc-stage .tb-wrap>.enc-pillar-toolbar{margin-top:0}}
.enc-stage.pan-open .species-grid{display:none}
.enc-stage .st{position:relative}
.enc-stage.pan-open .st{min-height:0;overflow-x:hidden}/* 2026-09-14 : etait min-height:calc(100vh - navH). Laissait 436px de blanc sous le guide d'ID en 900px de haut, 616px en 1080. Mesure a 800/900/1080/1440 : sans la regle le vide tombe a 100px partout et la page n'est jamais plus courte que l'ecran. */

/* ---- PANNEAUX (partage) ---- */
.enc-stage .pan{display:none}
.enc-stage .pan.is-on{display:block;animation:encIn .4s cubic-bezier(.22,1,.36,1)}
.enc-stage .pan.is-leaving{display:block;animation:encOut .32s cubic-bezier(.22,1,.36,1) forwards}
@keyframes encIn{from{opacity:0;transform:translateX(26px)}to{opacity:1;transform:translateX(0)}}
@keyframes encOut{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(26px)}}
@media(prefers-reduced-motion:reduce){.enc-stage .pan.is-on,.enc-stage .pan.is-leaving{animation:none}}

/* ---- EN-TETE COMMUNE (partage) ---- */
.enc-stage .tpl{max-width:var(--hubMax);margin:0 auto;width:100%;box-sizing:border-box;padding:0 0 44px}
.enc-stage .tpl-head{display:flex;align-items:flex-end;justify-content:space-between;gap:28px;padding:4px 0 16px}
.enc-stage .tpl:not(:has(.card)){padding-bottom:0}
.enc-stage .tpl-head .htxt{min-width:0}
.enc-stage .tpl-eb{font:700 11px/1 'Lato',sans-serif;text-transform:uppercase;letter-spacing:.16em;color:var(--ocre)}
.enc-stage .tl-row{display:flex;align-items:center;gap:11px;margin-top:.25rem}
.enc-stage .tpl-title{font:600 1.5rem/1.2 'Lato',sans-serif;letter-spacing:0;text-transform:none;color:var(--ink);margin:0}
.enc-stage .intro-tog{flex:0 0 auto;border:0;background:none;color:var(--ocre);font-size:21px;line-height:1;cursor:pointer;padding:0 2px;display:inline-flex;align-items:center;transition:color .2s}
.enc-stage .intro-tog i{transition:transform .25s cubic-bezier(.22,1,.36,1)}
.enc-stage .intro-tog:hover{color:var(--ocre-deep)}
.enc-stage .intro-tog.open i{transform:rotate(45deg)}
.enc-stage .tpl-intro{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows .35s ease,opacity .3s ease,margin .35s ease;margin:0}
.enc-stage .tpl-intro>div{overflow:hidden}
.enc-stage .tpl-intro.open{grid-template-rows:1fr;opacity:1;margin:0 0 16px}
.enc-stage .tpl-intro p{font:400 16px/1.7 'Lato',sans-serif;color:#3f3a33;margin:0 0 .8rem;max-width:80ch}

/* ---- HUB SPECIFIQUE : cartes narratives (Overview/Habitats/Threats) ---- */
.enc-hub .card-media::after,.enc-hub .tshow-stage:after,.enc-hub .tpop-show .tshow-stage:after{content:none!important;background:none!important;display:none!important}
.enc-hub .card{border-radius:2px;overflow:hidden;background:var(--bg-dark)}
.enc-hub .card-media{position:relative;aspect-ratio:16/9;background:var(--bg-dark);box-shadow:none}
.enc-hub .card-media img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center bottom;opacity:0;transition:opacity .7s ease}
.enc-hub .card-media img.on{opacity:1}
.enc-hub .card-cap{background:var(--bg-dark);color:#fff;padding:18px clamp(20px,3vw,32px) 24px}
.enc-hub .cap-row{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:.5rem}
.enc-hub .cap-row h3{font:600 clamp(19px,2.1vw,24px)/1.15 'Oswald',sans-serif;text-transform:uppercase;letter-spacing:.01em;color:#fff;margin:0}
.enc-hub .card-cap .tshow-ctrl{position:static;flex:0 0 auto}
.enc-hub .card-cap p{font:400 15px/1.6 'Lato',sans-serif;color:#d7cdbd;margin:0;max-width:80ch}
/* Pop-ups Context/Habitats/Menaces : cadre plafonné en hauteur pour tenir dans l'écran sans scroll (desktop). Ratio 16/9 conservé -> image jamais rognée. */
@media(min-width:721px){.enc-hub .card{max-width:max(460px,calc((100dvh - 388px) * 16 / 9));margin-inline:auto}}

/* ---- PANNEAUX DENSES (partage sauf reglages hub) ---- */
.enc-stage .densewrap{max-width:var(--hubMax);margin:0 auto;width:100%;box-sizing:border-box;padding:0 0 44px;overflow-x:hidden}
/* HUB uniquement : son ID guide (onglets texte) veut modal-body sans padding + cadre.
   Les pages d'ordre gardent le padding natif du modal-body (le sélecteur d'images
   utilise des marges -26px qui en dépendent). */
.enc-hub .densewrap .modal-body{overflow:visible!important;max-height:none!important}
.enc-stage:not(.enc-hub) .densewrap{overflow-x:clip}
.enc-stage:not(.enc-hub) .densewrap .modal-body{overflow:visible;max-height:none;overscroll-behavior:auto}
.enc-hub .densewrap .cl-head{margin-top:0}
.enc-hub .densewrap .modal-body>.psub,.enc-hub .densewrap .cl-head .psub{margin-top:0}

.enc-stage .densewrap .modal-body.idg{border:1px solid var(--line);border-radius:3px;overflow:hidden}
.enc-hub .pan[data-panel="m-id"] .densewrap{padding:0 0 44px}

/* ---- FAQ desktop (hub) ---- */
.enc-stage .densewrap .faq{max-width:none;margin:0}
.enc-stage .densewrap .faq details:has(+ details[open]){border-bottom-color:transparent}
.enc-stage .densewrap .faq-foot{max-width:none;margin:20px 0 0;padding:18px 0 0}

/* ---- onglet grille (hub) ---- */
.enc-stage .enc-pillar-toolbar button.tab-home{position:relative;padding-right:clamp(16px,2.4vw,30px);margin-right:2px}
.enc-stage .enc-pillar-toolbar button.tab-home::after{content:'';position:absolute;right:0;top:1px;bottom:11px;width:1px;background:#d8d3ca}
.enc-stage .enc-pillar-toolbar button.tab-home i{font-size:18px;color:var(--ink)}
.enc-stage .enc-pillar-toolbar button.tab-home.is-on i,.enc-stage .enc-pillar-toolbar button.tab-home:hover i{color:var(--ocre)}
.enc-stage .enc-pillar-toolbar button.tab-home.is-on,.enc-stage .enc-pillar-toolbar button.tab-home:hover{border-bottom-color:transparent}
.enc-stage .enc-pillar-toolbar button.tab-home::before{content:'';position:absolute;left:11px;transform:translateX(-50%);bottom:-1px;width:28px;height:2px;background:transparent;transition:background .16s}
.enc-stage .enc-pillar-toolbar button.tab-home.is-on::before,.enc-stage .enc-pillar-toolbar button.tab-home:hover::before{background:var(--ocre)}

/* ======================= MOBILE (<=600px) ======================= */
@media(max-width:600px){
  /* commun */
  .enc-stage .tpl{padding:0 20px 34px}
  .enc-stage .tpl-head{flex-direction:column;align-items:flex-start;gap:12px}

  /* HUB uniquement */
  .enc-stage.pan-open .enc-pillar-toolbar{position:static;top:auto;z-index:auto;padding-top:0}
  .enc-stage.pan-open .st{margin-left:-1rem;margin-right:-1rem}
  .enc-stage .densewrap{padding:0 0 34px}
  .enc-hub .card-media{aspect-ratio:16/9}
  .enc-hub .intro-tog{display:none}
  .enc-hub .tpl-intro{grid-template-rows:1fr;opacity:1;margin:0 0 14px}
  .enc-hub .tshow-count{display:none}
  .enc-hub .card-media .tshow-ctrl{position:absolute;right:12px;bottom:12px;top:auto;left:auto;z-index:3;display:flex;align-items:center;gap:20px}
  .enc-hub .cap-row{display:block;margin-bottom:.45rem}
  .enc-hub .cap-row h3{width:100%}
  /* pages d'ordre : plein-écran bord à bord pour TOUS les panneaux (harmonie) */
  .enc-stage .pan .modal-body.idg{border:0;border-radius:0}
}

.enc-stage .densewrap .modal-body .splist{margin-left:-12px;margin-right:-12px}

/* pages d'ordre : clip horizontal quand un panneau est ouvert (tue tout micro-débordement du plein-écran), sans conteneur de scroll */
.enc-pillar.pan-open .species-section{overflow-x:clip}

/* === Guide d'ID du HUB : sélecteur v2 en tuiles-TEXTE (pas de miniature ; le
   collage vit dans le panneau juste en dessous). Même moteur #idsel que les
   pages d'ordre, look texte propre au hub. ================================= */
body.enc-hub .idg2 .idsel{border-top:1px solid var(--line);border-bottom:1px solid var(--line);background:#fff}
body.enc-hub .idg2 .idtile{width:auto;flex:0 0 auto;overflow:visible}
body.enc-hub .idg2 .idtile .im{aspect-ratio:auto;height:auto;display:block;overflow:visible;padding:0}
body.enc-hub .idg2 .idtile .im img{display:none}
body.enc-hub .idg2 .idtile .lbl{display:block;position:static;font:700 12px/1 'Lato',sans-serif;text-transform:uppercase;letter-spacing:.08em;color:#6a6459;padding:13px 16px;white-space:nowrap;border-bottom:2px solid transparent;transition:color .15s,border-color .15s}
body.enc-hub .idg2 .idtile:hover .lbl{color:var(--ink)}
body.enc-hub .idg2 .idtile[aria-selected="true"] .lbl{color:var(--ink);border-bottom-color:var(--ocre)}

@media(min-width:601px){body.enc-hub.pan-open .pan{scroll-margin-top:calc(var(--navH,56px) + var(--tbH,52px) + 8px)}}
/* Guide d'ID du hub : gouttière autour des panneaux détail (la barre de tuiles
   #idsel reste pleine largeur ; le contenu ne colle plus au cadre à droite). */
body.enc-hub .idg2 #s2-detail{padding:22px 24px 26px;margin-left:0;margin-right:0}

/* === MOBILE (<=600px) : bandeau d'enrichment en BARRE DEFILANTE horizontale
   (chips compactes, une seule ligne, swipe) au lieu du wrap en escalier.
   Bouton grille epingle a gauche (toujours accessible). ===================== */
@media(max-width:600px){
  body.enc-stage .enc-pillar-toolbar{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;justify-content:flex-start;gap:2px;margin-bottom:0;scrollbar-width:none;-webkit-overflow-scrolling:touch;position:relative;scroll-padding-inline:52px;scroll-behavior:smooth}
  body.enc-stage .enc-pillar-toolbar::-webkit-scrollbar{display:none}
  body.enc-stage .tb-wrap{margin-top:1.6rem}
  body.enc-stage .tb-wrap .enc-pillar-toolbar{margin-top:0}
  body.enc-stage .tb-track{display:block;position:absolute;top:0;height:3px;pointer-events:none}
  body.enc-stage .tb-track .tb-thumb{position:absolute;top:0;left:0;height:3px;border-radius:3px;background:#c3bcb0}
  body.enc-stage .enc-pillar-toolbar.tb-noscroll ~ .tb-track{display:none}
  body.enc-stage .enc-pillar-toolbar .tb-cue{display:block;position:sticky;right:0;flex:0 0 48px;width:48px;align-self:stretch;box-sizing:border-box;margin:0;margin-inline-start:-2px;padding:0;border:0;z-index:4;cursor:pointer;-webkit-appearance:none;appearance:none;background-color:#fff;background-repeat:no-repeat;background-position:center;background-size:18px}
  body.enc-stage .enc-pillar-toolbar .tb-cue::before{content:'';position:absolute;left:0;top:12px;bottom:16px;width:1px;background:#d8d3ca}
  body.enc-stage .enc-pillar-toolbar.tb-noscroll .tb-cue{display:none}
  body.enc-stage .enc-pillar-toolbar button{flex:0 0 auto;white-space:nowrap;min-height:46px;padding:9px 14px 10px;gap:7px;font-size:13px;margin-bottom:-1px}
  body.enc-stage .enc-pillar-toolbar button i{font-size:13px}
  body.enc-stage .enc-pillar-toolbar button.tab-home i{font-size:21px}
  body.enc-stage .enc-pillar-toolbar button.tab-home{position:sticky;left:0;z-index:2;background:#fff;padding:9px 16px 10px 6px;margin-right:2px}
  body.enc-stage .enc-pillar-toolbar button.tab-home::before{left:19px;width:24px}
  body.enc-stage .enc-pillar-toolbar button.tab-home::after{top:12px;bottom:16px}
}

/* scroll-cue button: hidden by default, shown only in the mobile strip */
.enc-stage .enc-pillar-toolbar .tb-cue{display:none}
.enc-stage .tb-track{display:none}


/* ============================================================================
   BARRE GROUPEE v2  —  2026-09-14
   Premier groupe invariant sur toutes les pages enc : Catalogue | Checklist.
   Puis les outils propres a la page. Puis FAQ. Les groupes sont separes par un filet.
   S'applique aux barres qui portent la classe .tb2 ; l'ancienne barre reste intacte.
   ========================================================================== */
.enc-pillar-toolbar.tb2{gap:0;align-items:stretch;flex-wrap:wrap}
.enc-pillar-toolbar.tb2.hub-centered{justify-content:center;justify-content:safe center}
/* une barre centree qui deborde rend son DEBUT inatteignable : sous 1000px on ne centre plus */
@media(max-width:1000px){.enc-pillar-toolbar.tb2.hub-centered{justify-content:flex-start}}
.tb2 .tb-grp{display:inline-flex;gap:clamp(14px,2.2vw,30px);padding:0 clamp(12px,1.8vw,24px);position:relative}
.tb2 .tb-grp:first-child{padding-inline-start:0}
.tb2 .tb-grp:last-child,.tb2 .tb-grp:last-of-type{padding-inline-end:0}
.tb2 .tb-grp+.tb-grp::before{content:'';position:absolute;inset-inline-start:0;top:1px;bottom:11px;width:1px;background:#d8d3ca}
.enc-stage .enc-pillar-toolbar.tb2 .tb-view.is-on{color:var(--ink);border-bottom-color:var(--ocre)}
/* la bascule Catalogue / Checklist s'anime comme les panneaux : meme courbe, meme duree */
body.enc-stage .species-grid.encIn,body.enc-stage .listview.encIn{animation:encIn .4s cubic-bezier(.22,1,.36,1)}
@media(prefers-reduced-motion:reduce){body.enc-stage .species-grid.encIn,body.enc-stage .listview.encIn{animation:none}}
/* Le bouton grille devient un bouton libelle « Catalogue ». Il doit se comporter
   EXACTEMENT comme ses voisins : meme ligne de base, meme soulignement anime.
   On annule donc ses specificites d'ancienne icone (filet ::after, barre ::before,
   padding-right du filet, epinglage mobile) sans rien redefinir d'autre : le
   padding vient de la regle commune .enc-pillar-toolbar button. */
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home{padding-right:0;margin-right:0}
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home::after,
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home::before{display:none}
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home i{font-size:14px;color:var(--ocre)}
/* l'ancien bouton grille n'avait pas de soulignement (il avait sa propre barre) : on le remet */
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home.is-on,
.enc-stage .enc-pillar-toolbar.tb2 button.tab-home:hover{border-bottom-color:var(--ocre)}

/* ---- vue Checklist : la liste du site a la place du catalogue ---- */
.listview{max-width:var(--hubMax,1040px);margin:1.2rem auto 0;padding:0 0 2rem}
.listview .cl-head{margin-top:.2rem}
.lv-search{position:relative;display:flex;align-items:center;margin:0 0 1rem}
.lvs-ic{position:absolute;inset-inline-start:16px;color:var(--ocre);font-size:14px;pointer-events:none}
.lv-search input{width:100%;box-sizing:border-box;border:1.5px solid #d8c3a8;border-radius:2px;background:#fff;padding-block:13px;padding-inline:44px 132px;font:400 15px/1.3 'Lato',sans-serif;color:var(--ink);outline:none;transition:border-color .15s,box-shadow .15s}
.lv-search input::-webkit-search-cancel-button,.lv-search input::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}
.lv-search input::placeholder{color:var(--muted)}
.lv-search input:focus{border-color:var(--ocre);box-shadow:0 0 0 3px rgba(192,106,44,.12)}
.lvs-x{position:absolute;inset-inline-end:104px;border:0;background:var(--beige);color:#7a7266;width:22px;height:22px;border-radius:50%;cursor:pointer;font-size:11px;transition:.15s}
.lvs-x:hover{background:var(--ocre);color:#fff}
.lvs-count{position:absolute;inset-inline-end:16px;font:700 11px/1 'Lato',sans-serif;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);pointer-events:none}
.lv-none{margin:0 0 1rem;font:400 14.5px/1.5 'Lato',sans-serif;color:var(--muted-strong)}
.splist .row.is-out,.splist details.is-out,.splist .ord-lbl.is-out{display:none}
mark.lvm{background:none;color:var(--ocre);font-weight:700}
body.listmode .species-grid,body.listmode .hub-facts{display:none}

@media(max-width:600px){
  /* l'ancien bouton grille etait epingle a gauche : prevu pour une icone de 24px,
     pas pour un bouton libelle qui mangerait un tiers de l'ecran */
  body.enc-stage .enc-pillar-toolbar.tb2 button.tab-home{position:static;padding:9px 14px 10px;margin-right:0;background:none;z-index:auto}
}
@media(max-width:760px){
  .tb2 .tb-grp{padding:0 10px;gap:4px}
  .tb2 button[data-short] .tb-lbl{display:none}
  .tb2 button[data-short]::after{content:attr(data-short)}
  .lv-search input{padding-block:12px;padding-inline:40px 14px}
  .lvs-x,.lvs-count{display:none}
  .listview{padding:0 0 1.5rem}
}

/* bande mobile : plus de bouton epingle a gauche, seul le chevron de droite mange de la place */
@media(max-width:600px){
  body.enc-stage .enc-pillar-toolbar.tb2{scroll-padding-inline:0 56px}
}
