/* =========================================================================
   SPHÈRESAVE v33 — CORRECTIFS MOBILE (à charger EN DERNIER, après style.css,
   responsive-multi-devices.css et boxes-3d-cabinet.css)
   ========================================================================= */

/* 1. Hauteurs en dvh : les modales ne débordent plus quand la barre d'URL mobile
      apparaît/disparaît. Le préfixe "body" donne la priorité sur Tailwind CDN. */
body .max-h-\[42vh\]  { max-height: 42dvh; }
body .max-h-\[52vh\]  { max-height: 52dvh; }
body .max-h-\[54vh\]  { max-height: 54dvh; }
body .max-h-\[65vh\]  { max-height: 65dvh; }
body .max-h-\[72vh\]  { max-height: 72dvh; }
body .max-h-\[88vh\]  { max-height: 88dvh; }
body .max-h-\[92vh\]  { max-height: 92dvh; }
body .max-h-\[94vh\]  { max-height: 94dvh; }
body .max-h-\[95vh\]  { max-height: 95dvh; }
body .max-h-\[96vh\]  { max-height: 96dvh; }
body .h-\[92vh\]      { height: 92dvh; }

/* 2. Suppression du délai de 300 ms et du flash au toucher */
button, a, [onclick], [role="button"], select, summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 3. Zones tactiles et lisibilité sur téléphone */
@media (max-width: 767px) {
  /* Boutons icône de 24–32 px -> 40 px minimum (recommandation : 44 px) */
  button.w-6.h-6, button.w-7.h-7, button.w-8.h-8,
  a.w-6.h-6, a.w-7.h-7, a.w-8.h-8 {
    min-width: 40px;
    min-height: 40px;
  }
  /* Textes de 8–10 px -> 11 px */
  body .text-\[8px\], body .text-\[9px\], body .text-\[10px\] { font-size: 11px; line-height: 1.35; }

  /* Barre du bas : zones tactiles confortables + safe-area iOS */
  #fs-mobile-bottom-nav { padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px); }
  #fs-mobile-bottom-nav button { min-height: 48px; }

  /* Les modales gardent une marge de sécurité en haut/bas (encoche, barre de gestes) */
  [id$="-modal"] {
    padding-top: max(env(safe-area-inset-top, 0px), 8px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
  }
}

/* 4. Menu latéral fermé : sorti de l'ordre de tabulation / lecteurs d'écran
      (complète l'attribut inert posé par app-nav-history-v33.js) */
#sidebar[inert] { visibility: hidden; }
@media (min-width: 768px) { #sidebar[inert] { visibility: visible; } }

/* 5. Respect de "réduire les animations" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
