@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

/* === RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: #555;
  display: flex;
  flex-direction: column; /* pour flipbook + controls */
  justify-content: center;
  align-items: center;
  overflow: hidden; /* empêche le scroll */
}

#zoom-viewport {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    transform-origin: center center;
}


/* === FLIPBOOK PRINCIPAL === */
.flipbook-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: none !important;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.flipbook-ready {
    opacity: 1;
}

.flipbook {
  height: 90vh;
  width: calc(90vh * 1.414);
  max-width: 95vw;
  max-height: 95vh;
  background: none;
  margin-bottom: 1.2rem; /* espace entre flipbook et controls */
}

.flipbook-viewport {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #555;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none; 
}

/* === PAGES === */
.flipbook .page {
  background: #000;
  border: none;
  width: 100%;
  height: 100%;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* garde l’image entière */
  background: #000;
  display: block;
}

/* === COUVERTURES === */
.flipbook .hard {
  background: #555;
  color: #fff;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  font-size: 2rem;
}

.flipbook .hard small {
  font-style: italic;
  font-weight: lighter;
  opacity: 0.8;
  font-size: 1rem;
  margin-top: 8px;
}

/* === BARRE DE CONTROLES EN DESSOUS === */
/* Barre de contrôle pleine largeur */
.flipbook-controls {
  display: flex;
  align-items: center;
  justify-content: center; /* ou space-around si tu veux plus d'espacement */
  gap: 1rem;
  background: rgba(0,0,0,0.6);
  padding: 0.6rem 1rem;
  width: 100vw; /* prend toute la largeur de la page */
  box-sizing: border-box;
  position: relative; /* reste relative pour le flex */
  flex-wrap: wrap; /* pour mobile */
}

/* Slider */
#pageSlider {
  flex: 1;
  width: 100%;
  max-width: 600px; /* largeur maximale pour ne pas étirer trop sur desktop */
  height: 6px;
  accent-color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
  #pageSlider {
    max-width: 90%; /* limite le slider sur mobile */
  }
  .flipbook-controls {
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
  }
  .flipbook-controls button {
    padding: 0.3rem 0.6rem;
    font-size: 1rem;
  }
}


/* Boutons */
.flipbook-controls button {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  padding: 0.6rem 0.9rem;
  font-size: 1.4rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.flipbook-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Compteur */
#pageCounter {
  color: #fff;
  font-size: 1rem;
  margin-left: 1rem;
  white-space: nowrap;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .flipbook {
    width: 100vw;
    height: calc(100vw * 1.414);
  }
  #pageSlider {
    max-width: 200px;
  }
  .flipbook-controls button {
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
  }
  
  
  
}

/* === MODE MOBILE (une seule page A4 portrait) === */
@media (max-width: 768px) {

  .flipbook-viewport {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* 📌 Le conteneur qui impose le ratio A4 portrait */
  .flipbook-wrapper {
    width: auto;
    aspect-ratio: 1860 / 2631 !important; /* ratio A4 portrait */
    height: 30vh; /* hauteur fixe */
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .flipbook {
    width: 100%;
    height: 100%;
    margin: 0;
  }

  .flipbook .page,
  .flipbook .page img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 🔥 plus AUCUNE bande noire */
    background: #000;
  }
}
