/* =========================================================
   iphone-fixes.css
   Correctifs ciblés Safari iOS (tous iPhone récents + anciens)
   A placer APRES tous les autres styles.
   ========================================================= */

/* ---------- 1. Normalisation viewport / zoom auto ---------- */
html {
  -webkit-text-size-adjust: 100% !important; /* empêche Safari d’agrandir certaines polices */
  height: 100%;
  overscroll-behavior-y: none;
}
body {
  min-height: 100%;
  margin: 0;
  font-smooth: antialiased;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:#000;
  color:#fff;
  overflow-x: hidden;
  /* Intègre les encoches / Dynamic Island */
  padding:
    env(safe-area-inset-top,0)
    env(safe-area-inset-right,0)
    env(safe-area-inset-bottom,0)
    env(safe-area-inset-left,0);
}

/* ---------- 2. Conteneur principal : éviter sauts de hauteur ---------- */
main {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow: visible;
}

/* ---------- 3. Empêcher “scroll horizontal fantôme” sur certains flex ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
img, video, canvas, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- 4. Navigation : burger toujours + overlay fluide ---------- */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  padding:
    calc(env(safe-area-inset-top,0) + 8px)
    clamp(1rem,4vw,2.2rem)
    8px
    clamp(1rem,4vw,2.2rem);
  gap: clamp(.8rem,3vw,2.2rem);
  min-height: 60px;
}

/* Forcer l’affichage du toggle sur desktop aussi (si besoin) */
.menu-toggle {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 46px;
  height: 42px;
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1000;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.menu-toggle span {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: #fff;
  transition: transform .45s ease, opacity .35s ease;
}
.menu-toggle.open span:nth-child(1){ transform: translateY(9px) rotate(45deg); }
.menu-toggle.open span:nth-child(2){ opacity: 0; }
.menu-toggle.open span:nth-child(3){ transform: translateY(-9px) rotate(-45deg); }

/* Menu déroulant (toujours caché par défaut) */
.nav-links {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  flex-direction: column;
  justify-content: flex-start;
  background: rgba(0,0,0,.94);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  padding: clamp(1.4rem,5vw,2.2rem) clamp(1rem,6vw,2rem);
  gap: clamp(1rem,3.8vw,1.8rem);
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease, transform .45s ease;
  border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 38px -14px rgba(0,0,0,.85);
}
.nav-links.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.nav-links a {
  font-size: clamp(.85rem,4vw,1.1rem);
  width: 100%;
  text-align: center;
  position: relative;
}
.nav-links a::after {
  content:"";
  position:absolute;
  left:50%; bottom:0;
  width:0; height:2px;
  background: linear-gradient(to right,#0055A4,#ff1100);
  transform:translateX(-50%);
  transition:width .35s;
  border-radius:2px;
}
.nav-links a:focus-visible::after,
.nav-links a:hover::after { width:85%; }

/* Désactive layout desktop (si déjà défini) */
@media (min-width: 841px){
  .nav-links { /* on garde le mode “overlay” aussi sur large */
    position: absolute;
  }
}

/* ---------- 5. Vidéo d’arrière-plan : stabilité ---------- */
#bg-video,
.video_cao,
.video_cao_2,
.video_cao_3 {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  transform: translateZ(0);          /* Force compositing pour fluidité */
  backface-visibility: hidden;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}

/* iOS supprime parfois l’autoplay si pas muted : tu l’as déjà – on bloque picture-in-picture */
video::-webkit-media-controls { display:none !important; }

/* ---------- 6. Cercles (aspect-ratio fallback + centrage) ---------- */
.sf__circle,
.circle,
.cfd-bubble {
  aspect-ratio: 1/1;
}
@supports not (aspect-ratio: 1/1) {
  .sf__circle,
  .circle,
  .cfd-bubble { height: auto; }
}

/* Correction zoom agressif Safari sur transform scale + flou */
.sf__media,
.circle-video,
.cfd-img,
.cfd-video {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ---------- 7. Carousels / tracks : éviter jitter & overflow ---------- */
.carousel-track,
.screen-track,
.screen-track-mask,
.remote-screen,
.circles-container,
.sf__circles {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}

/* Ajuste la translation pour limiter le “blurry text” en sous-pixel */
.screen-track,
.carousel-track {
  transform: translate3d(0,0,0);
}

/* ---------- 8. Boutons / interactions : supprimer double‑tap zoom ---------- */
a, button, .btn-primary, .btn-primary-5, .btn-retour {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- 9. Scroll top / overlays safe-area ---------- */
.scroll-top-btn,
.scroll-top,
#scrollTopBtn,
#scrollTopBtnLegal {
  bottom: calc(env(safe-area-inset-bottom,0) + clamp(1.2rem,4vw,2rem)) !important;
  right: calc(env(safe-area-inset-right,0) + clamp(1.2rem,4vw,2rem)) !important;
}

/* ---------- 10. Fullscreen overlay images / vidéos : force rendu net ---------- */
.fs-overlay,
.img-fs-overlay {
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
  backdrop-filter: blur(4px) saturate(1.1);
  contain: layout paint style;
}
.fs-image,
#imgFsMedia {
  image-rendering: -webkit-optimize-contrast;
  transform: translateZ(0);
}

/* ---------- 11. Typo responsive cohérente (réduction mini iPhone SE) ---------- */
@media (max-width: 380px) {
  .sf-title,
  .legal-title,
  .sf__title { font-size: clamp(1.4rem,9vw,1.9rem) !important; }
  .legal-text,
  .sf-text { font-size: clamp(.85rem,4.4vw,1rem) !important; }
  .btn-primary,
  .btn-retour { font-size: clamp(.7rem,3.8vw,.85rem) !important; }
}

/* ---------- 12. Fix position:sticky “saute” après transform parents ---------- */
/* Si un parent a transform, Safari casse sometimes sticky; on neutralise sur parents critiques */
[class*="wrapper"],
[class*="container"],
.remote-body,
.remote-screen {
  transform: translateZ(0); /* pas de scale/translate parent qui casse sticky */
}

/* ---------- 13. Préférences utilisateur (motion) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 14. Safe-area pour footer si home indicator chevauche ---------- */
.site-footer-legal {
  padding-bottom: calc(env(safe-area-inset-bottom,0) + clamp(2rem,6vw,3rem));
}

/* ---------- 15. Désactivation sur‑contraste auto images (iOS 17) ---------- */
img, video {
  color-scheme: dark;
}

/* ---------- 16. Correction potentiel “blanchiment” gradient clip ---------- */
.gradient-text {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: #fff; /* fallback (tu utilises du blanc) */
}

/* ---------- 17. Limiter sursauts de layout fonts Orbitron (FOIT) ---------- */
@font-face {
  font-family: 'Orbitron';
  font-display: swap;
  src: local('Orbitron'); /* laisser les sources principales dans ton CSS d'origine */
}

/* ---------- 18. Sélection de texte (optionnel) ---------- */
::selection {
  background: rgba(255,17,0,.6);
  color:#fff;
}
