/* Faunelya V3.03 — finition UX desktop / mobile
   Couche comportementale chargée en dernier : aucun changement de palette ni de direction graphique. */

/* Les zones structurelles peuvent rétrécir sans pousser la page horizontalement.
   On reste volontairement ciblé pour ne pas casser les rubans dont les cartes ont un min-width voulu. */
body.az-v12 .az-topbar-inner,
body.az-v12 .az-top-actions,
body.az-v12 .app-page-head,
body.az-v12 .app-section-head,
body.az-v12 .v13-enclosure-toolbar,
body.az-v12 .v13-enclosure-switcher,
body.az-v12 .visitor-control-grid,
body.az-v12 .visitor-detail-grid{min-width:0}
body.az-v12 .az-topbar-inner > *,
body.az-v12 .az-top-actions > *,
body.az-v12 .app-page-head > *,
body.az-v12 .app-section-head > *,
body.az-v12 .v13-enclosure-toolbar > *,
body.az-v12 .v13-enclosure-switcher > *{min-width:0}
body.az-v12 img,
body.az-v12 svg,
body.az-v12 video,
body.az-v12 canvas{max-width:100%}

/* Hauteur réellement disponible sur mobile : barre d'adresse comprise. */
@supports (height:100dvh){
  .fyn-zoo-map-viewer:fullscreen,
  .fyn-zoo-map-viewer.is-faux-fullscreen{
    height:100dvh!important;
    min-height:100dvh!important;
  }
  .fyn-map-context-sheet,
  .fyn-map-building-sheet,
  .fyn-map-buy-sheet{
    max-height:calc(100dvh - 24px)!important;
  }
}

/* Les modales de carte restent toujours récupérables, même sur un écran très bas. */
.fyn-map-context-sheet,
.fyn-map-building-sheet,
.fyn-map-buy-sheet{
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

@media(max-width:860px){
  html{scroll-padding-top:64px;scroll-padding-bottom:88px}
  body.az-v12{overflow-x:clip}

  /* Header : la trésorerie ne peut plus chasser l'avatar hors écran. */
  body.az-v12 .az-topbar-inner{min-width:0}
  body.az-v12 .az-top-actions{min-width:0;max-width:58vw}
  body.az-v12 .az-wallet{min-width:0;max-width:118px;overflow:hidden}
  body.az-v12 .az-wallet [data-wallet-value]{
    display:block;
    min-width:0;
    max-width:92px;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
  }

  /* Le contenu garde toujours une marge au-dessus de la navigation fixe. */
  body.az-v12 .az-page,
  body.az-v12 .az-page.app-shell,
  body.az-v12 .az-page.page-shell-wide,
  body.az-v12 .az-page.enclosure-shell{
    padding-bottom:calc(88px + env(safe-area-inset-bottom,0px))!important;
  }

  /* Menu Plus : hauteur dynamique, inertie tactile et header toujours visible. */
  body.az-v12 .az-mobile-sheet.az-mobile-sheet-v219{
    max-height:calc(100dvh - 92px - env(safe-area-inset-bottom,0px))!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  body.az-v12 .az-mobile-sheet-v219 .az-mobile-sheet-head{z-index:3}
  body.az-v12 .az-mobile-sheet-v219 .az-mobile-sheet-grid a{min-width:0}

  /* Tous les rubans horizontaux se comportent de la même façon au doigt. */
  body.az-v12 .v13-enclosure-tabs,
  body.az-v12 .v13-switcher-list,
  body.az-v12 .v13-upgrade-strip,
  body.az-v12 .fyn-staff-actionbar,
  body.az-v12 .fyn-health-actionbar,
  body.az-v12 .fyn-conservation-actionbar,
  body.az-v12 .fyn-achievements-actionbar,
  body.az-v12 .fyn-tutorial-actionbar,
  body.az-v12 .fyn-pedigree-actionbar,
  body.az-v12 .v269-sorts,
  body.az-v12 .v269-recent-row{
    overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x proximity;
  }
  body.az-v12 .v13-enclosure-tabs button,
  body.az-v12 .v13-switcher-card,
  body.az-v12 .fyn-staff-actionbar a,
  body.az-v12 .fyn-health-actionbar a,
  body.az-v12 .fyn-conservation-actionbar a,
  body.az-v12 .fyn-achievements-actionbar a,
  body.az-v12 .fyn-tutorial-actionbar a,
  body.az-v12 .fyn-pedigree-actionbar a,
  body.az-v12 .v269-sorts a,
  body.az-v12 .v269-recent-card{scroll-snap-align:start}

  /* Les panneaux contextuels de la carte deviennent de vraies bottom-sheets sûres. */
  .fyn-map-context-modal,
  .fyn-map-building-modal,
  .fyn-map-buy-modal{
    padding:max(8px,env(safe-area-inset-top,0px)) 8px max(8px,env(safe-area-inset-bottom,0px));
  }
  .fyn-map-context-sheet,
  .fyn-map-building-sheet,
  .fyn-map-buy-sheet{
    max-height:calc(100dvh - 16px)!important;
  }
}

@media(max-width:390px){
  body.az-v12 .az-top-actions{gap:4px;max-width:55vw}
  body.az-v12 .az-wallet{max-width:98px;padding-left:7px!important;padding-right:5px!important}
  body.az-v12 .az-wallet [data-wallet-value]{max-width:76px;font-size:9px!important}
  body.az-v12 .az-account>summary span{width:30px;height:30px}
}

/* Mobile paysage : récupérer de la hauteur sans modifier la structure des pages. */
@media(max-width:900px) and (max-height:520px){
  html{scroll-padding-top:54px;scroll-padding-bottom:66px}
  body.az-v12 .az-topbar{height:48px}
  body.az-v12 .az-brand{font-size:17px}
  body.az-v12 .az-brand-icon{width:22px;height:22px}
  body.az-v12 .az-wallet{min-height:28px}

  body.az-v12 .az-mobile-nav{
    height:calc(54px + env(safe-area-inset-bottom,0px))!important;
  }
  body.az-v12 .az-mobile-nav>a,
  body.az-v12 .az-mobile-nav>details>summary{height:54px!important}
  body.az-v12 .az-mobile-sheet.az-mobile-sheet-v219{
    bottom:calc(60px + env(safe-area-inset-bottom,0px))!important;
    max-height:calc(100dvh - 68px - env(safe-area-inset-bottom,0px))!important;
  }
  body.az-v12 .az-page,
  body.az-v12 .az-page.app-shell,
  body.az-v12 .az-page.page-shell-wide,
  body.az-v12 .az-page.enclosure-shell{
    padding-top:10px!important;
    padding-bottom:calc(68px + env(safe-area-inset-bottom,0px))!important;
  }
}

@media(prefers-reduced-motion:reduce){
  body.az-v12 *{scroll-behavior:auto!important}
}

/* =========================================================
   V3.03 — grilles dont le nombre d'entrées avait dépassé le CSS
   ========================================================= */

/* Dashboard : 7 actions réelles, 7 colonnes sur grand écran. */
@media(min-width:981px){
  body.az-v12.dashboard-page .az-actionbar{
    grid-template-columns:repeat(7,minmax(0,1fr))!important;
  }
}
@media(max-width:980px){
  body.az-v12.dashboard-page .az-actionbar>a:last-child{
    grid-column:1/-1;
  }
}

/* Progression : 7 sections réelles, plus d'onglet orphelin. */
@media(min-width:1001px){
  body.az-v12.progression-page .v224-progress-nav{
    grid-template-columns:repeat(7,minmax(0,1fr))!important;
  }
}
@media(max-width:1000px){
  body.az-v12.progression-page .v224-progress-nav>a:last-child{
    grid-column:1/-1;
  }
}

/* Fiche animal : 6 sections. Desktop = 6 colonnes, mobile = lignes équilibrées. */
@media(min-width:701px){
  body.az-v12.fyn-animal-v231 .animal-tabs{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
  }
}
@media(max-width:700px){
  body.az-v12.fyn-animal-v231 .animal-tabs{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    overflow:visible!important;
  }
  body.az-v12.fyn-animal-v231 .animal-tabs a{
    min-width:0!important;
  }
}
@media(max-width:430px){
  body.az-v12.fyn-animal-v231 .animal-tabs{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
