/* RESET / GLOBAL */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-image: url('../media/wood.jpeg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  display: flex;
  justify-content: center;
  align-items: center;

  font-family: sans-serif;
  overflow: hidden;
}

/* ===========================
   RESPONSIVE BOOK CONTAINER
   =========================== */

.book-open {
  display: flex;
  width: min(90vw, 1100px);           /* shrink proportionally, max on big screens */
  aspect-ratio: 3 / 2;                /* PERFECT book shape */
  height: auto;                       /* let aspect-ratio handle height */
  
  box-shadow: 0 0 20px rgba(0,0,0,0.25);
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

/* ===========================
   RESPONSIVE PAGES
   =========================== */

.page {
  flex: 1;
  background-color: #fffefb;
  cursor: pointer;
  position: relative;

  /* responsive padding: 20px → 40px */
  padding: clamp(20px, 4vw, 40px);

  /* responsive text */
  font-size: clamp(12px, 1.4vw, 16px);
  line-height: 1.35;
  text-align: justify;
  
  transition: background 0.3s;
}

.page:hover {
  background-color: #f5eed3;
}

/* CENTER LINE */
.page::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d4c7a3;
}

.left::before { right: 0; }
.right::before { left: 0; }

/* ================================
   PAGE MODE SWITCHING
   ================================ */

/* Default → Two pages only on WIDE screens */
@media (min-aspect-ratio: 4/3) and (min-width: 900px) {
  .book-open {
    flex-direction: row;
    aspect-ratio: 3 / 2;
  }

  .page {
    height: auto;
  }

  .page::before {
    display: block;
  }
}

/* Tablet & iPad-like screens → ONE PAGE MODE */
@media (max-aspect-ratio: 4/3), (max-width: 900px) {
  .book-open {
    flex-direction: column;
    width: 90vw;
    height: 90vh;
    aspect-ratio: auto;
  }

  .page {
    flex: 1;
    height: 100%;
  }

  .page::before {
    display: none; /* hide spine line in single-page mode */
  }
}

/* ===========================
   TYPOGRAPHY
   =========================== */

.page h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 26px);
  text-align: center;
  color: #5c4a2d;
  text-shadow: 0 0 2px rgba(255,255,255,0.4);
}

.page p {
  font-size: clamp(12px, 1.4vw, 16px);
  text-align: justify;
  color: #000;
}

.page ul.texto, .page p.texto {
  font-family: Spectral, Garamond, serif;
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.35;
  color: #5c4a2d;
  text-shadow: 0 0 0.7px rgba(0,0,0,0.1);
}

/* ===========================
   SPECIAL PAGES
   =========================== */

.page.anteportada {
  padding: clamp(40px, 7vw, 90px);
  text-align: center;
}

.page.centered {
  display: flex;
  justify-content: center;
  align-items: center;
}

.centered-image {
  max-width: 100%;
  max-height: 100%;
}

/* ===========================
   MOBILE BREAKPOINT
   =========================== */

@media (max-width: 700px) {
  .book-open {
    flex-direction: column;
    aspect-ratio: auto;
    height: min(95vh, 1000px);
    width: 90vw;
  }

  .page::before {
    display: none;         /* center line disappears */
  }

  .page {
    flex: unset;
    height: 50%;
  }
}
