/* IA-SPORT — correctifs responsive (mobile / tablette / Android)
   À charger APRÈS styles.css  (ordre dans index.html : styles.css puis mobile-android.css) */

/* ===== Base : anti-débordement sans casser le sticky ni le layout desktop ===== */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;overflow-x:clip;scroll-behavior:smooth}
body{overflow-x:clip;width:100%;max-width:100vw;position:relative}
img,svg,video,canvas,iframe{max-width:100%}
img,video{height:auto}
h1,h2,h3,h4,p{overflow-wrap:break-word}
section[id],[id="hero"]{scroll-margin-top:90px}
.mobile-close{display:none}
.marquee-section{overflow:hidden}
.skeleton-canvas-wrapper{position:relative;width:100%;overflow:hidden}
#heroSkeletonCanvas{width:100%;height:auto;touch-action:pan-y}
.modal-overlay{overscroll-behavior:contain}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

/* ===== Tablette & mobile (<= 900px) : tout passe en une colonne ===== */
@media (max-width:900px){
  .container,.nav-container,.hero-container,.top-contact-container{
    width:100%;padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  .hero-container{display:flex;flex-direction:column;gap:32px}
  .hero-container>*,.hero-content,.hero-visual,.hero-content>*,.hero-visual>*{min-width:0;max-width:100%}

  /* Grilles multi-colonnes -> 1 colonne */
  .vision-grid,.founders-grid,.pane-grid,.demo-display-grid,.dossier-grid,.footer-container{
    display:grid;grid-template-columns:minmax(0,1fr);gap:20px}
  .vision-grid>*,.founders-grid>*,.pane-grid>*,.demo-display-grid>*,.dossier-grid>*,.footer-container>*{min-width:0}
  .span-2{grid-column:auto}
  .demo-controls{display:flex;flex-direction:column;gap:16px}
  .form-row{display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
  .analytics-row,.g-metrics-row,.metrics-grid-mini{
    display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:12px}
  .f-duo{display:flex;flex-direction:column;gap:8px}

  /* Titres */
  .hero-title{font-size:clamp(1.7rem,7.5vw,3rem);line-height:1.15}
  .hero-title *{white-space:normal!important}
  .hero-badge,.badge{white-space:normal;text-align:center;line-height:1.3;max-width:100%}
  .hero-subtitle{font-size:1rem;max-width:100%}
  .section-title{font-size:clamp(1.4rem,6vw,2rem)}

  /* Navigation */
  .nav-links,.nav-actions{display:none}
  .mobile-menu-toggle{display:inline-flex}
  .nav-container{gap:12px;justify-content:space-between}
  .brand-text-wrapper{min-width:0}
  .brand-baseline{font-size:.6rem;white-space:normal}

  /* Effets décoratifs : jamais plus larges que l'écran */
  .hero-bg-glow{width:100%;max-width:100vw;left:0;right:0;overflow:hidden;transform:none!important}

  /* Onglets Solutions : défilement horizontal doux ; filtres/mode : retour à la ligne */
  .solutions-tabs{display:flex;overflow-x:auto;-webkit-overflow-scrolling:touch;scroll-snap-type:x proximity;scrollbar-width:none;gap:8px}
  .solutions-tabs::-webkit-scrollbar{display:none}
  .solutions-tabs .tab-btn{flex:0 0 auto;scroll-snap-align:start;white-space:nowrap}
  .sports-category-filter,.canvas-mode-switcher,.engine-signals-list{display:flex;flex-wrap:wrap;gap:8px}
  .mockup-header{flex-wrap:wrap;gap:8px}
  .mockup-title,.mockup-status{min-width:0;white-space:normal}

  /* Modales */
  .modal-container,.modal-lg{max-width:calc(100vw - 24px)}
}

/* ===== Mobile (<= 768px) ===== */
@media (max-width:768px){
  /* Boutons */
  .btn,.btn-lg{white-space:normal!important;text-align:center;max-width:100%;min-height:44px;padding:12px 18px;justify-content:center}
  .hero-cta-group{display:flex;flex-direction:column;align-items:stretch;gap:12px}
  .hero-cta-group .btn,.google-actions .btn,.btn-google,.wa-btn-direct,#btnExportPDF{width:100%}
  .google-actions,.dossier-actions,.modal-btn-group{display:flex;flex-direction:column;gap:10px}

  /* Barre supérieure compacte */
  .top-info{display:none!important}
  .top-contact-container{justify-content:space-between;gap:8px;flex-wrap:wrap}
  .top-socials{width:100%;justify-content:space-between;gap:8px}
  .lang-btn,.theme-toggle-btn,.top-socials a,.mobile-menu-toggle,.modal-close{
    min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}

  /* Navbar / tiroir */
  .navbar{z-index:1600}
  .mobile-drawer{z-index:1500;height:100dvh;max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;
    padding-top:84px;padding-bottom:max(24px,env(safe-area-inset-bottom))}
  .mobile-link{min-height:48px;display:flex;align-items:center}
  .mobile-close{display:inline-flex;position:absolute;top:12px;right:12px;width:44px;height:44px;
    align-items:center;justify-content:center;background:transparent;border:0;font-size:1.6rem;color:inherit;z-index:1700}

  /* Hero */
  .hero-title{word-break:normal}
  .hero-container,.hero-content,.hero-visual{min-width:0;max-width:100%}

  /* Jauges 2x2 */
  .svg-gauges-bar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 12px;justify-items:center}
  .svg-ring-container{position:relative;width:100%;max-width:140px;height:auto;display:flex;flex-direction:column;align-items:center;text-align:center}
  .svg-ring-container svg{width:80px;height:80px}
  .svg-ring-container .ring-center-text{position:absolute;top:0;left:0;right:0;height:80px;display:flex;align-items:center;justify-content:center}
  .svg-ring-container .ring-label{position:static;margin-top:6px;font-size:.75rem;line-height:1.2;white-space:normal}

  /* Simulateur */
  .btn-group-toggle{display:grid!important;grid-template-columns:1fr;gap:8px;width:100%}
  .btn-group-toggle button,.btn-group-toggle .btn{width:100%;white-space:normal;min-height:44px}
  .chart-bars-wrapper,.narrative-box{min-width:0;max-width:100%}

  /* Sports : 2 colonnes */
  .sports-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
  .filter-btn{min-height:40px}

  /* Cartes */
  .founder-card,.google-card-body,.glass-panel{padding:clamp(18px,4vw,24px)}
  .google-card,.founder-card{max-width:100%}
  .google-badge-bar{display:flex;flex-direction:column;align-items:flex-start;gap:8px}

  /* Modales : le défilement se fait sur l'overlay (le PDF html2pdf n'est plus tronqué) */
  .modal-overlay{overflow-y:auto;-webkit-overflow-scrolling:touch;align-items:flex-start;
    padding:12px max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
  .modal-container{width:100%;max-height:none;overflow:visible;margin:auto}
  .pitch-dossier-body{padding:0}

  /* Formulaires : 16px évite le zoom automatique sur iOS/Android */
  input,select,textarea{font-size:16px!important;max-width:100%;width:100%}
}

/* ===== Petits écrans (<= 480px) ===== */
@media (max-width:480px){
  .btn,.btn-lg{width:100%}
  .hero-cta-group,.mobile-actions{width:100%}
  .sports-grid{gap:8px}
  #themeToggleLabel{display:none}
  .analytic-card{padding:12px}
  .card-value{font-size:1.3rem}
}

/* ===== Très petits écrans (<= 420px) : diagramme barycentrique ===== */
@media (max-width:420px){
  .barycenter-diagram{transform:scale(.8);transform-origin:center top;margin-bottom:-40px}
  .central-node{width:76px;height:76px}
  .s-node{font-size:.7rem;padding:4px 6px;max-width:80px}
}
@media (max-width:360px){
  .barycenter-diagram{transform:scale(.68);margin-bottom:-70px}
  .sports-grid{grid-template-columns:minmax(0,1fr)!important}
}
