* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

html {
  min-height: 100lvh;
  /* altura máxima: cubre la barra del navegador */
  background-color: #1B1717;
  /* respaldo si el degradado no alcanza */
  background-image: linear-gradient(to bottom right, #810100, #1B1717);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body {
  width: 100%;
  min-height: 100lvh;
  overflow: hidden;
  /* evita scroll por el libro rotado */
  background: transparent;
  /* se ve el degradado de html */
}


/* ==========================================
   DECLARACIÓN DE FUENTES
   ========================================== */

/* Título de la página */
@font-face {
  font-family: 'Kalnia';
  src: url('fonts/kalnia/Kalnia-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Lora: una sola familia, dos pesos */
@font-face {
  font-family: 'Lora';
  src: url('fonts/lora/Lora-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lora';
  src: url('fonts/lora/Lora-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kings';
  src: url('fonts/kings/Kings-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Love Light';
  src: url('fonts/love_light/LoveLight-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Bodoni Moda';
  src: url('fonts/bodoni_moda/BodoniModa_18pt-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playfair';
  src: url('fonts/playfair/Playfair_9pt-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Montserrat: UNA familia, un @font-face por peso */
@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat/Montserrat-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat/Montserrat-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


/* ==========================================
   VARIABLES
   ========================================== */
:root {
  /* Títulos de la página */
  --font-titulo: 'Kalnia', serif;
  --weight-titulo: 600;

  /* Títulos de libro */
  --font-libro: 'Kings', serif;

  /* Texto decorativo / letra bonita */
  --font-decorativa: 'Love Light', cursive;

  /* Destacados editoriales */
  --font-bodoni: 'Bodoni Moda', serif;
  --weight-bodoni: 600;
  --font-playfair: 'Playfair', serif;
  --weight-playfair: 900;

  /* Lectura (cuerpo) */
  --font-body: 'Lora', serif;
  --weight-body-regular: 400;
  --weight-body-bold: 700;

  /* Interfaz / botones / menús */
  --font-ui: 'Montserrat', sans-serif;
  --weight-ui-regular: 400;
  --weight-ui-bold: 700;
}


/* ==========================================
   LAYOUT
   ========================================== */
.principal {
  --book-w: min(200px, 55vw);
  /* todo el libro se escala desde aquí */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 8vh, 45px);
  height: 100dvh;

  /* respeta notch y esquinas */
  padding-top: max(16px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
}

/* ==========================================
   TÍTULO
   ========================================== */
.presentacion {
  font-family: var(--font-titulo);
  font-weight: 600;
  color: #EDEBDD;
  font-size: clamp(24px, 6vw, 40px);
  text-transform: uppercase;
  text-align: center;
  animation: caer-titulo 1.2s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes caer-titulo {
  from {
    opacity: 0;
    transform: translateY(-100vh);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   LIBRO
   ========================================== */
.content_book .book_close {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: aparecer-libro 1.5s ease-out 3s forwards;
}

@keyframes aparecer-libro {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.book .book_close {
  width: var(--book-w);
  aspect-ratio: 2 / 3;
  padding: calc(var(--book-w) * 0.075);
  border-radius: 5px;
  border: 3.5px solid transparent;
  background:
    linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
    linear-gradient(to bottom right, #D89A26, #925F00) border-box;
  transform: rotate(-11deg) translateX(calc(var(--book-w) * 0.09));
}



.book_ext {
  height: 100%;
  width: 100%;
}

.book_int {
  padding: calc(var(--book-w) * 0.1);
  height: 100%;
  border-radius: 5px;
  border: 2.5px solid transparent;
  background:
    linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
    linear-gradient(to bottom right, #D89A26, #925F00) border-box;
}

.book_int .title {
  font-family: var(--font-libro);
  background: radial-gradient(circle, #F8A100, #925F00);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-size: calc(var(--book-w) * 0.19);
  line-height: 1.05;
  transform: translateY(50%);
  font-weight: 400;
}

.book_int .title_two,
.book_int .title_four {
  text-align: right;
  padding-right: calc(var(--book-w) * 0.05);
}




/* libro abierto  */

/* página 1 */

.book_open {

  .book_der,
  .book_izq {
    width: 330px;
    height: 280px;
    padding: 15px;
    border-radius: 5px;
    border: 2.5px solid transparent;

  }

  .pagina-one,
  .pagina-two {
    .book_izq {
      background:
        linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
        linear-gradient(to bottom right, #D89A26, #925F00) border-box;

      .book_ext {

        .book_int {
          border-radius: 5px;
          border: 2.0px solid transparent;
          background:
            linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
            linear-gradient(to bottom right, #D89A26, #925F00) border-box;
          display: flex;
          align-items: center;
          flex-direction: column;
          justify-content: center;
          gap: 5px;

          .titulo {
            font-family: var(--font-decorativa);
            font-weight: 400;
            color: white;
            text-align: center;
            font-size: 28px;
          }

          .cap_img {
            width: 100%;
            height: auto;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            position: relative;
          }

          .cap_img img {
            width: 120%;
            display: flex;
            justify-content: center;
            align-items: center;
            object-fit: cover;
            opacity: 0.2;
          }

          span {
            font-family: var(--font-bodoni);
            font-weight: 600;
            color: #571b89;
            font-size: 10px;
            text-transform: uppercase;
          }

          h3 {
            font-family: var(--font-body);
            font-weight: 400;
            text-transform: uppercase;
            font-weight: bold;
            color: white;
            font-size: 25px;
            margin: 5px 0;
          }
        }
      }
    }

    .book_der {
      background:
        linear-gradient(to bottom, #F2E5C6, #F2E5C6) padding-box,
        linear-gradient(to bottom right, #D89A26, #925F00) border-box;

      .book_int {
        border-radius: 5px;
        border: 2.5px solid black;
        background:
          #F2E5C6;
        display: flex;
        flex-direction: column;
        gap: 7px;
        padding: 12px;
        justify-content: start;

        align-items: start;

        .titulo_principal {
          font-family: var(--font-playfair);
          font-weight: 900;
          font-size: 25px;
        }

        .historia,
        .fecha,
        .regalo {
          font-family: var(--font-ui);
          font-weight: 400;

        }

        .historia {
          font-size: 10.5px;
        }

        .fecha {
          font-size: 10px;
        }

        .regalo {
          font-size: 10px;

          a {
            color: #0D0320;
          }
        }
      }

    }
  }

  .pagina-two .book_int,
  .pagina-two .titulo_principal {
    text-align: center;

    display: flex;
    flex-direction: column;
    justify-content: center !important;
    align-items: center;
  }

  .pagina-two .titulo_principal {
    width: 100%;
  }


  .pagina-three {

    .book_der,
    .book_izq {
      background:
        linear-gradient(to bottom, #F2E5C6, #F2E5C6) padding-box,
        linear-gradient(to bottom right, #D89A26, #925F00) border-box;

      .book_ext {

        .book_int {
          border-radius: 5px;
          border: 2.5px solid black;
          background:
            #F2E5C6;
          display: flex;
          flex-direction: column;
          gap: 7px;
          padding: 12px;
          justify-content: start;
          align-items: start;


          .historia {
            display: flex;
            justify-content: center;
            flex-direction: column;
            align-items: center;
            font-family: var(--font-ui);
            font-weight: 400;
            font-size: 11.5px;
            width: 100%;
            text-align: center;
          }
        }
      }

    }
  }

  .pagina-four {
    .book_der {
      background:
        linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
        linear-gradient(to bottom right, #D89A26, #925F00) border-box;
      overflow: hidden;

      .book_ext {
        position: relative;

        img {
          overflow: visible;
          width: 57%;
          height: 84%;
          position: absolute;
          object-fit: cover;
          top: 74px;
          right: 43px;
          opacity: 19%;
          z-index: 1;
        }

        .book_int {
          z-index: 20;
          border-radius: 5px;
          border: 2.0px solid transparent;
          background:
            linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
            linear-gradient(to bottom right, #D89A26, #925F00) border-box;

          .partes {
            display: flex;
            align-items: center;
            flex-direction: column;
            justify-content: flex-end;
            align-items: center;
            gap: 80px;
            height: 100%;

            .bloque_1 {
              width: 100%;
            }

            h2,
            h3 {
              font-family: var(--font-decorativa);
              font-weight: 400;
              display: flex;
              justify-content: center;
              align-items: center;
              color: white;
              flex: 2;
            }

            h2 {
              font-size: 20px;
            }

            h3 {
              font-size: 45px;
              text-align: center;
              width: 100%;
            }

            .subtitulo {
              font-family: var(--font-bodoni);
              font-weight: 600;
              font-size: 8px;
              color: #571b89;
              text-align: center;
              width: 100%;
              transform: translateY(-10px);
            }

            .content_partes {
              display: flex;
              justify-content: center;
              align-items: center;
              flex-direction: column;




              .final_chapter,
              .class_message {
                font-family: var(--font-body);
                font-size: 8px;
                color: white;
              }

              .final_chapter {
                font-weight: 700;
                padding-bottom: 3px;
              }

              .class_message {
                font-weight: 500;
                font-size: 5px;
              }
            }
          }





        }
      }
    }

    .book_izq {
      background:
        linear-gradient(to bottom, #F2E5C6, #F2E5C6) padding-box,
        linear-gradient(to bottom right, #D89A26, #925F00) border-box;

      .book_ext {
        position: relative;

        .book_int {
          border-radius: 5px;
          border: 2.5px solid black;
          background:
            #F2E5C6;
          display: flex;
          flex-direction: column;
          gap: 5px;
          padding: 15px;
          justify-content: center;

          align-items: center;

          .img_page {
            width: 120px;
            height: 175px;
            border: 3px solid transparent;
            border-radius: 15px;
            overflow: hidden;
            position: relative;
            background:
              url('img/juntos.png') top center / cover no-repeat padding-box,
              linear-gradient(to bottom right, #D89A26, #925F00) border-box;
          }

          .img_page img {
            width: 0%;
          }

          h2 {
            font-family: var(--font-playfair);
            font-weight: 900;
            font-size: 9px;
            text-transform: uppercase;
          }

          h3 {
            font-family: var(--font-decorativa);
            font-weight: 400;
            text-align: center;
            font-size: 24px;
            text-transform: capitalize;
          }

          span {
            font-family: var(--font-body);
            font-size: 9px;
          }

          .heart_svg {
            width: 40px;
          }
        }
      }

    }
  }





  .btn {
    font-family: var(--font-ui);
    font-weight: 400;
    border: none;
    background-color: transparent;
    font-size: 8px;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .btn_atras {
    color: white;
    justify-content: flex-start !important;
  }

  .btn_delante {

    padding-top: 2px;
    justify-content: flex-end;
    color: black;
  }
}

.pagina-three .btn_atras,
.pagina-four .btn_atras {
  color: black;
  justify-content: flex-start !important;
}

.pagina-four .btn_delante {
  color: white;
}







/* ==========================================
   CELULAR EN HORIZONTAL
   ========================================== */
@media (orientation: landscape) and (max-height: 600px) {
  .principal {
    --book-w: min(320px, 50dvh);
    /* el libro mide ~57% del alto de pantalla */
    flex-direction: row;
    /* título a la izquierda, libro a la derecha */
    justify-content: space-evenly;
    gap: 1vw;
  }

  .presentacion {
    font-size: clamp(18px, 4.5vw, 34px);
    max-width: 45%;
  }
}

/* ==========================================
   ACCESIBILIDAD
   ========================================== */
@media (prefers-reduced-motion: reduce) {

  .presentacion,
  .content_book {
    animation-duration: 0.01s;
  }
}

/* ==========================================
   SECCIONES OCULTAS
   ========================================== */

.principal {
  perspective: 2000px;
}

/* Reserva el lugar de la portada cerrada */
.content_book {
  position: relative;
  width: var(--book-w);
  aspect-ratio: 2 / 3;
  transform-style: preserve-3d;
}

/* El libro mide 260 x 390; JS le da escala y posición */
.book {
  --book-w: 260px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 390px;
  margin-top: -195px;
  transform-style: preserve-3d;
  transform-origin: left center;
  transform: translate(var(--tx0, -52px), var(--ty0, 0px)) rotate(-11deg) scale(var(--k0, 0.77));
  transition: transform 1s cubic-bezier(0.5, 0.1, 0.2, 1);
}

/* Abierto: se endereza, se centra y el lomo queda en el medio */
.book.open {
  transform: translate(var(--tx1, 0px), var(--ty1, 0px)) rotate(0deg) scale(var(--k1, 1));
}

.book_open {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.book.is-closed .leaf+.leaf {
  visibility: hidden;
}

/* Hojas: cada una gira sobre el lomo */
.leaf {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.5, 0.1, 0.2, 1);
}

.leaf.flipped {
  transform: rotateY(-180deg);
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.face.back {
  transform: rotateY(180deg);
}

/* Sombra suave junto al lomo */
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 10%);
}

.face.back::after {
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.18), transparent 10%);
}

/* Tu portada pasa a ser la cara delantera de la primera hoja */
.book .leaf>.book_close {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  transform: none;
  cursor: pointer;
}

.backcover {
  border: 3.5px solid transparent;
  border-radius: 10px 3px 3px 10px;
  background:
    linear-gradient(to bottom, #2C0548, #0D0320) padding-box,
    linear-gradient(to bottom right, #D89A26, #925F00) border-box;
}

/* Cada página ocupa toda su cara */
.book_open .face>div,
.book_open .face .book_izq,
.book_open .face .book_der {
  width: 100%;
  height: 100%;
}

.book_open .book_ext {
  position: relative;
}

/* Botones */
.book_open .btn {
  cursor: pointer;
  display: flex;

}

.book_open .btn.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.book_open.is-last {
  cursor: pointer;
}

/* Título "Look A Me": sale al abrir y vuelve a caer al cerrar */
@keyframes titulo-sale {
  to {
    opacity: 0;
    transform: translateY(-40px);
  }
}

.principal.is-opening .presentacion {
  animation: titulo-sale 0.6s ease forwards;
}


/* Close */




.principal {
  position: relative;
}

.content_finally_ed{
  display: none;
}

/* Título final: mismo estilo y misma animación que "presentacion" */
.final_presentacion_ed {
  font-family: var(--font-titulo);
  font-weight: 600;
  color: #EDEBDD;
  font-size: clamp(15px, 6vw, 20px);
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 5px;
}

.principal.is-finished .presentacion {
  display: none;
}

.principal.is-finished  .content_finally_ed {
  display: flex;
  width: 30%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.principal.is-finished .final_presentacion_ed {
  display: block;
  animation: caer-titulo 1.2s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

/* Si se vuelve a abrir el libro, "Look A Me" no reaparece de golpe */
.principal.is-reopened .presentacion {
  display: none;
}


/* Mensaje: aparece 3s después del título final */
.principal.is-finished  .content_finally_ed span {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-family: var(--font-body);
  font-size: clamp(7px, 1.5vw, 9px);
  line-height: 1.5;
  color: #EDEBDD;
  opacity: 0;
}

.content_finally_ed a {

  font-family: var(--font-ui);
  color: #D89A26;
  font-size: 10px;
  text-align: center;
  opacity: 0;
}

.principal.is-finished .content_finally_ed span {
  display: flex;
  animation: aparecer-libro 1.5s ease-out 3s forwards;
}
.principal.is-finished .content_finally_ed a {
  display: block;
  animation: aparecer-libro 3s ease-out 3s forwards;
}

@media (prefers-reduced-motion: reduce) {

  .presentacion,
  .final_presentacion_ed,
  .content_book {
    animation-duration: 0.01s;
  }
}