/* ================================
   FONTS
================================ */
@import url('https://fonts.googleapis.com/css2?family=Aleo:wght@300;400;700&family=M+PLUS+Rounded+1c:wght@400;500;800&family=Public+Sans:wght@300;400;600&display=swap');

/* ================================
   VARIABLES
================================ */
:root {
  --orange-passe: #E4AB66;
  --bleu-futur: #85C2DD;
  --fond-noir: #000000;

  --ligne-y: 55%;
  --gap-ligne: 26px;
  --trait-h: 44px;
}

/* ================================
   PAGE FRISE UNIQUEMENT
================================ */
body.page-template-page-frise footer { display: none !important; }
body.page-template-page-frise main { padding-bottom: 0 !important; }
body.page-template-page-frise { overflow: hidden; }

/* ================================
   BASE
================================ */
body {
  background: #000;
  color: #fff;
  margin: 0;
}

body.futur main{
  padding-top: 90px !important;
}

footer{
  display: none;
}

h1, h2, h3, .police-logo {
  font-family: 'M PLUS Rounded 1c', sans-serif;
}

.titre-serif {
  font-family: 'Aleo', serif;
  text-align: center;
  width: 100%;
  margin: 0;
}

/* ================================
   CONTAINER FRISE
================================ */
.frise-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 90px);
  min-height: 520px;
  padding: 40px 80px;
  box-sizing: border-box;

  overflow-x: auto;
  overflow-y: hidden;

  display: flex;
  align-items: stretch;

  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

/* ================================
   ETAPES
================================ */
.etape-frise {
  position: relative;
  flex: 0 0 360px;
  height: 100%;
  scroll-snap-align: center;
  z-index: 2;
}

/* ================================
   LIGNE CENTRALE (fond neutre)
================================ */
.ligne-principale {
  position: absolute;
  top: var(--ligne-y);
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.14); /* neutre */
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
  width: 220%; /* sera override par le JS */
}

/* Progression = suit le scroll */
.progression-ligne-principale {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  background: var(--orange-passe); /* par défaut */
  transition: width 0.1s linear, background-color 0.25s ease;
  pointer-events: none;
}

/* ================================
   OBJETS 3D (dans le vide)
================================ */
.carte-circuit {
  width: 360px;
  background: transparent;
  border: none !important;
  outline: none !important;
  padding: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s ease;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1); /* Transition plus douce et pro */
  will-change: transform; /* Optimisation performance pour mobiles */
}

.zone-3d {
  width: 100%;
  height: clamp(150px, 24vh, 250px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent !important;
  border: none !important;
}

.zone-3d model-viewer {
  width: 100%;
  height: 100%;
  background: transparent !important;
  --poster-color: transparent;
}

/* ================================
   POSITION DES CARTES
================================ */
.element-haut .carte-circuit,
.element-bas .carte-circuit {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  transform: none;
}

/* HAUT */
.element-haut .carte-circuit {
  bottom: calc(100% - var(--ligne-y) + var(--gap-ligne));
  flex-direction: column;
}

/* BAS */
.element-bas .carte-circuit {
  top: calc(var(--ligne-y) + var(--gap-ligne));
  flex-direction: column-reverse;
}

/* ================================
   POINT CENTRAL
================================ */
.point-connexion {
  position: absolute;
  left: 50%;
  top: var(--ligne-y);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fond-noir);
  border: 2px solid rgba(255,255,255,0.95);
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
}

/* ================================
   TRAITS (inversés)
================================ */
.trace-verticale {
  position: absolute;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.32);
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}

/* HAUT : trait vers le bas */
.element-haut .trace-verticale {
  top: var(--ligne-y);
  height: var(--trait-h);
}

/* BAS : trait vers le haut */
.element-bas .trace-verticale {
  top: calc(var(--ligne-y) - var(--trait-h));
  height: var(--trait-h);
}

/* ================================
   DATES (inversées)
================================ */
.marqueur-date {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 5;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 10px 30px rgba(0,0,0,0.55);
  pointer-events: none;
}

/* HAUT : date sous la ligne */
.element-haut .marqueur-date {
  top: calc(var(--ligne-y) + var(--trait-h) + 10px);
}

/* BAS : date au-dessus de la ligne */
.element-bas .marqueur-date {
  top: calc(var(--ligne-y) - var(--trait-h) - 36px);
}

/* Focus : L'élément actif grossit */
.etape-frise.active .carte-circuit { 
  transform: scale(1.12); /* Grossissement plus prononcé */
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5)); /* Ombre pour détacher l'objet */
  z-index: 10; /* S'assure que l'objet passe devant les autres */
}

.etape-frise.active .marqueur-date {
  color: #fff;
  transform: translateX(-50%) scale(1.15); /* La date grossit aussi */
  text-shadow: 0 0 20px rgba(255,255,255,0.8), 0 12px 30px rgba(0,0,0,0.6);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Effet rebond */
}

/* Optionnel : Assombrir légèrement les étapes non-actives pour faire ressortir l'active */
.etape-frise:not(.active) {
  filter: blur(3px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

/* ================================
   SCROLLBAR INVISIBLE
================================ */
#conteneurDefilement { -ms-overflow-style: none; scrollbar-width: none; }
#conteneurDefilement::-webkit-scrollbar { display: none; }

/* ================================
   NAVIGATION
================================ */
#btnPrecedent,
#btnSuivant {
  position: fixed;
  top: 0; /* ✅ sera écrasé par JS */
  transform: translateY(-50%);
  z-index: 999;
  font-size: 25px;
}

#btnPrecedent { left: 18px; }
#btnSuivant   { right: 18px; }

/* ================================
   MODAL
================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}
.modal-overlay.active { display: flex; }

div.modal-content.container {
  display: flex;
  flex-direction: row !important;
  width: 70%;
  max-width: 92%;
  height: 420px;
  overflow: hidden;
  position: relative;
  box-shadow: -2px -2px 8px #77B6D6, 2px 2px 8px #71C5B2 !important;
}

.modal-left, .modal-right {
  flex: 1;
  padding: 20px;
  display: flex;
  width: 50%;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.modal-left model-viewer {
  width: 100%;
  height: 100%;
  max-height: 400px;
  background: transparent;
  --poster-color: transparent;
}

.modal-right {
  color: #fff;
  font-family: 'Aleo', serif;
  font-size: 1.1rem;
  overflow-y: auto;
  max-height: 380px;
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  z-index: 2;
  user-select: none;
  transition: color 0.2s ease;
}
.modal-close:hover { color: var(--orange-passe); }

body.modal-open { overflow: hidden !important; }

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 768px) {
  :root { --gap-ligne: 18px; --trait-h: 36px; }

  .frise-container {
    height: calc(100vh - 70px);
    padding: 30px 34px;
    gap: 90px;
  }

  .etape-frise { flex-basis: 320px; }
  .marqueur-date { font-size: 22px; }
  .zone-3d { height: clamp(140px, 26vh, 220px); }

  /* L’étape au centre grossit un peu */
.etape-frise .carte-circuit {
  transition: transform 0.35s ease, filter 0.35s ease;
  transform: scale(1);
}

.etape-frise.active .carte-circuit{
  transform: scale(3);
  filter: drop-shadow(0 18px 40px rgba(0,0,0,0.65));
}


  .modal-content { flex-direction: column; width: 92%; height: auto; }
  .modal-left, .modal-right { padding: 12px; }
  .modal-right { max-height: none; }
}

/* ================================
   RESPONSIVE MOBILE (Frise 3D)
================================ */
@media (max-width: 768px) {
  /* 1. On resserre l'espace vertical pour que tout rentre sur l'écran */
  :root { 
    --gap-ligne: 15px; 
    --trait-h: 25px; 
  }

  /* 2. Le conteneur principal */
  .frise-container {
    height: calc(100vh - 80px); /* Ajuste selon la hauteur de ton header */
    padding: 0; /* On enlève le padding latéral pour faciliter le swipe */
    gap: 0; 
  }

  /* 3. Chaque étape prend 100% de l'écran (1 objet à la fois) */
  .etape-frise { 
    flex: 0 0 100vw; 
    display: flex;
    justify-content: center;
  }

  /* 4. La taille des cartes et de la zone 3D */
  .carte-circuit {
    width: 80%; /* La carte prend 80% de l'écran pour laisser respirer les bords */
    max-width: 320px;
  }

  .zone-3d { 
    height: clamp(150px, 35vh, 250px); /* Ajustement pour les petits écrans */
  }

  /* 5. L'animation de Focus (On remplace le scale(3) par quelque chose de propre) */
  .etape-frise .carte-circuit {
    transform: scale(0.85); /* Les objets sur le côté sont légèrement réduits */
    opacity: 0.4; /* Et à moitié transparents */
    transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
  }

  .etape-frise.active .carte-circuit {
    transform: scale(1.1); /* L'objet au centre grossit raisonnablement */
    opacity: 1;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
  }

  .etape-frise.active .marqueur-date {
    transform: translateX(-50%) scale(1.1); /* La date grossit aussi un peu */
  }

  /* 6. Ajustement des Dates pour ne pas déborder */
  .marqueur-date { 
    font-size: 18px; 
  }
  .element-haut .marqueur-date {
    top: calc(var(--ligne-y) + var(--trait-h) + 5px);
  }
  .element-bas .marqueur-date {
    top: calc(var(--ligne-y) - var(--trait-h) - 28px);
  }

  /* 7. FLÈCHES DE NAVIGATION : Plus grosses pour les doigts */
  #btnPrecedent, #btnSuivant {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #btnPrecedent { left: 5px; }
  #btnSuivant   { right: 5px; }

  /* 8. MODAL (Popup quand on clique sur l'objet) */
  div.modal-content.container { 
    flex-direction: column !important; /* Force l'empilement (Objet en haut, texte en bas) */
    width: 90%; 
    height: 80vh; /* S'adapte à la hauteur de l'écran */
    overflow-y: auto; /* Permet de scroller si le texte est long */
  }
  
  .modal-left, .modal-right { 
    width: 100%; 
    padding: 15px; 
    height: auto;
  }
  
  .modal-left {
    min-height: 250px; /* Donne assez de place pour manipuler l'objet 3D */
  }
  
  .modal-right { 
    max-height: none; 
    text-align: center; /* Centre le texte descriptif sur mobile */
  }
}