/* Base générale */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  font-family: sans-serif;
}

/* Conteneur du livre */
#book {
  position: relative;
  width: 90vw;
  height: calc(90vw / 1.444);
  perspective: 2000px;
  max-width: 100%;
  max-height: 100vh;
}

/* Pages du livre */
.page {
  position: absolute;
  width: 50%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.8s ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  top: 0;
  display: block;
}

/* Côté gauche */
.page.left {
  left: 0;
  transform-origin: left;
}

/* Côté droit */
.page.right {
  left: 50%;
  transform-origin: right;
}

/* Effet de retournement */
.page.flipped {
  transform: rotateY(-180deg);
}

/* Couverture avant */
.cover {
  z-index: 100;
}

/* Livre fermé */
#book.closed .page:not(.cover) {
  display: none;
}

/* Debug (numéro de page) */
.page::after {
  content: attr(data-index);
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,0.7);
  color: black;
  padding: 2px 6px;
  font-size: 14px;
  border-radius: 3px;
  pointer-events: none;
  user-select: none;
}

/* 📱 Ajustements mobiles */
@media (max-width: 600px) {
  #book {
    width: 100vw;
    height: calc(100vw / 1.444);
  }
  .page::after {
    font-size: 10px;
  }
}

