.flipbook-widget .front_cover {
  position: absolute;
  width: 100%;
  height: 100%;
  cursor: pointer;
  transform-origin: center left;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  background-image: url("/wp-content/uploads/2025/09/flip_book_edge_shading.webp");
  z-index: 99;
}

.flipbook-widget .front_cover img.cover_image {
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.flipbook-widget .front_cover::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: #7a1732;
  /* rojo visible al girar */
  border-radius: 2.5px 5px 5px 2.5px;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  z-index: 1;
}

/* RESET CSS SOLO DENTRO DEL FLIPBOOK */
.flipbook-widget *,
.flipbook-widget *::before,
.flipbook-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* VARIABLES */
.flipbook-widget {
  --dark-color: rgb(2, 4, 8);
  --dark-hover: rgba(255, 255, 255, 0.1);

  --light-color: rgb(245, 245, 245);
  --light-hover: rgba(0, 0, 0, 0.1);

  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: monospace, sans-serif;
  font-size: 0.5rem;
  transition: background-color 0.3s;
}

/* MODO CLARO / OSCURO */
.flipbook-widget.light-mode {
  color: var(--dark-color);
  background-color: var(--light-color);
}

.flipbook-widget.light-mode #toggle-mode-btn:hover {
  background-color: var(--light-hover);
}

.flipbook-widget.dark-mode {
  color: var(--light-color);
  background-color: var(--dark-color);
}

.flipbook-widget.dark-mode #toggle-mode-btn:hover {
  background-color: var(--dark-hover);
}

/* LINKS */
.flipbook-widget a {
  text-decoration: none;
  color: var(--dark-color);
}

/* OCULTAR INPUTS */
.flipbook-widget input {
  display: none;
}

/* BOTÓN MODO */
.flipbook-widget #toggle-mode-btn {
  width: 2rem;
  height: 2rem;
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  border: none;
  border-radius: 0.5rem;
  background-color: transparent;
  transition: background-color 0.3s;
  cursor: pointer;
}

/* ENLACES */
.flipbook-widget #portfolio-link {
  padding-right: 0.5rem;
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  font-size: 0.75rem;
}

.flipbook-widget #github-link {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
}

/* FLIP BOOK */
.flipbook-widget #flip_book {
  width: 298px;
  height: 420px;
  position: relative;
  transition-duration: 1s;
  perspective: 2000px;
}

.flipbook-widget .front_cover,
.flipbook-widget .back_cover {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 2.5px 5px 5px 2.5px;
  background-image: url(/wp-content/uploads/2025/09/flip_book_edge_shading.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #7a1732;
  box-shadow: 0 0 5px 0 rgba(25, 25, 25, 0.25);
}

.flipbook-widget .front_cover {
  position: absolute;
  cursor: pointer;
  transform-origin: center left;
  transition: transform 0.5s;
  z-index: 99;
}

.flipbook-widget .front_cover label {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
}

.flipbook-widget .page {
  width: 288px;
  height: 400px;
  position: absolute;
  top: 10px;
  left: 1px;
  border-radius: 0 5px 5px 0;
  background-color: white;
  transform-origin: left;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition-duration: 0.5s;
}

.flipbook-widget .front_page,
.flipbook-widget .back_page {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
}

.flipbook-widget .front_page label,
.flipbook-widget .back_page label {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
  z-index: 100;
}

.flipbook-widget .back_page {
  transform: rotateY(180deg);
}

.flipbook-widget .edge_shading {
  width: 288px;
  height: 400px;
  position: absolute;
  z-index: 98;
}

.flipbook-widget .front_content,
.flipbook-widget .back_content {
  width: 287px;
  height: 398px;
  position: absolute;
  top: 1px;
  border-radius: 0 5px 5px 0;
  z-index: 97;
}

.flipbook-widget .back_content {
  left: 1px;
  border-radius: 5px 0 0 5px;
}

.flipbook-widget .back_cover {
  position: relative;
  z-index: -1;
}

/* CHECKBOX INTERACTIONS */
.flipbook-widget #cover_checkbox:checked ~ #flip_book {
  transform: translateX(144px);
}

.flipbook-widget #cover_checkbox:checked ~ #flip_book .front_cover {
  transform: rotateY(-180deg);
  transition: transform 1.5s, z-index 0.5s 0.5s;
  z-index: 1;
}

.flipbook-widget #cover_checkbox:checked ~ #flip_book #cover {
  width: 80%;
  height: 80%;
  position: absolute;
}

.flipbook-widget .back_page .edge_shading {
  width: 100%;

  height: 100%;

  position: absolute;
  top: 0;

  left: 0;

  z-index: 99;

  pointer-events: none;
}

.front_page h2,
.back_page h2 {
  padding-top: 20px;
  text-align: center;
  font-size: 25px;
  color: #9e002e;
  font-family: "crimson text";
}

.front_page h3,
.back_page h3 {
  text-align: center;
}

.front_page ul,
.back_page ul {
  margin-top: 10px;
  padding: 0 10px;
  max-height: 330px;
  overflow: hidden;
  font-size: 12px;
  font-family: "crimson text";
}

.front_page li,
.back_page li {
  list-style: none;
  text-align: center;
  line-height: 1.35;
}
/*RESPONSIVE*/
/****************************
 * FLIPBOOK RESPONSIVE CSS *
 ****************************/

/* Tablets */
@media (max-width: 1024px) {
  .flipbook-widget #flip_book {
    width: 240px;
    height: 340px;
  }

  .flipbook-widget .page {
    width: 230px;
    height: 320px;
  }

  .flipbook-widget .front_content,
  .flipbook-widget .back_content {
    width: 229px;
    height: 318px;
  }

  .front_page h2,
  .back_page h2 {
    font-size: 20px;
  }

  .front_page ul,
  .back_page ul {
    font-size: 13px;
    max-height: 260px;
  }
}

/* Móviles grandes */
@media (max-width: 768px) {
  .flipbook-widget #flip_book {
    width: 180px;
    height: 260px;
  }

  .flipbook-widget .page {
    width: 170px;
    height: 240px;
  }

  .flipbook-widget .front_content,
  .flipbook-widget .back_content {
    width: 169px;
    height: 238px;
  }

  .front_page h2,
  .back_page h2 {
    font-size: 16px;
  }

  .front_page ul,
  .back_page ul {
    font-size: 11px;
    max-height: 200px;
  }
}

/* Barra inferior estilo DFlip */
.flipbook-widget .flipbook-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem;
  background: #f4f4f4;
  border-top: 1px solid #ddd;
  font-family: sans-serif;
  font-size: 14px;
}

.flipbook-widget .flipbook-toolbar button {
  background: crimson;
  color: white;
  border: none;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: background 0.3s;
}

.flipbook-widget .flipbook-toolbar button:hover {
  background: darkred;
}

.flipbook-widget .flip-status {
  min-width: 60px;
  text-align: center;
  font-weight: bold;
}

/* Pantalla completa */
.flipbook-widget.fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flipbook-widget.fullscreen #flip_book {
  margin: auto;
}
/***********************
 * SCROLL HORIZONTAL MÓVIL
 * (sin cambiar tamaños ni estructura)
 ***********************/
@media (max-width: 768px) {
  /* Cuando se abre la portada en móvil, que no se vaya a la izquierda */
  .flipbook-widget #cover_checkbox:checked ~ #flip_book {
    transform: translateX(85px) !important; /* ajusta este valor */
    margin: 0 auto;
  }

  .flipbook-widget {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .flipbook-widget #flip_book {
    transform-origin: center center;
  }

  .front_page h2,
  .back_page h2 {
    font-size: 14px;
  }

  .front_page ul,
  .back_page ul {
    font-size: 9px;
    max-height: 200px;
  }

  .front_page h2,
  .back_page h2 {
    padding-top: 10px;
    text-align: center;
    font-family: "crimson text";
  }
}

/*desactivar clicks al estar la animiacion*/
.flipbook-widget.animating label {
  pointer-events: none;
}

.front_page h2,
.front_page ul,
.back_page h2,
.back_page ul {
  position: relative;
  z-index: 10; /* por encima de las imágenes */
}
.front_page img.back_content,
.back_page img.back_content {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1; /* detrás del texto */
  width: 100%;
  height: 100%;
  object-fit: cover; /* opcional */
}

@media (min-width: 1025px) {
  .flipbook-widget #flip_book {
    width: 417px;
    height: 588px;
  }

  .flipbook-widget .page {
    width: 403px;
    height: 560px;
  }

  .flipbook-widget .front_content,
  .flipbook-widget .back_content {
    width: 402px;
    height: 557px;
  }

  /* Ajustar tipografía proporcionalmente */
  .front_page h2,
  .back_page h2 {
    font-size: 35px; /* antes 25px */
  }

  .front_page ul,
  .back_page ul {
    font-size: 20px; /* antes 15px */
    max-height: 460px;
  }
}

/* === SLIDER DE CARDS === */
.flipbook-cards-slider {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  width: 100%;
}

.flipbook-card {
  flex: 0 0 100%; /* ocupa todo el ancho */
  position: relative;
  scroll-snap-align: start;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.flipbook-card img {
  width: 100%;
  height: auto; /* mantiene proporción */
  display: block;
}

.flipbook-card .bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.flipbook-card .page-content {
  position: absolute;
  inset: 0;
  padding: 1rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flipbook-card h2 {
  text-align: center;
  color: #9e002e;
  font-size: 18px;
  font-family: "crimson text";
  margin-bottom: 0.5rem;
}

.flipbook-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  max-height: 100%;
  overflow-y: auto;
}

.flipbook-card li {
  line-height: 1.4;
  text-align: center;
}

/* Responsive: solo móvil */
@media (min-width: 769px) {
  .flipbook-cards-slider {
    display: none;
  }
  .flipbook-card {
    flex: 0 0 100%;
    position: relative;
    scroll-snap-align: start;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
  }

  .flipbook-card .bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1; /* capa fondo */
  }

  .flipbook-card .page-content {
    position: relative;
    z-index: 2; /* contenido encima */
    padding: 1rem;
    text-align: center;
  }

  .flipbook-card h2 {
    color: #9e002e;
    font-family: "crimson text";
    margin-bottom: 0.5rem;
  }

  .flipbook-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
}

.flipbook-cards-wrapper {
  position: relative;
  width: 100%;
}

.flipbook-cards-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  width: 100%;
  scroll-behavior: smooth; /* animación al mover */
}

.flipbook-card {
  flex: 0 0 100%;
  position: relative;
  scroll-snap-align: start;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
/* === Toolbar abajo del libro === */
.flipbook-cards-toolbar {
  margin-top: 0.5rem; /* espacio debajo del libro */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  font-family: sans-serif;
  font-size: 14px;
  width: 100%;
}

.flipbook-nav {
  background: crimson;
  color: white;
  border: none;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.flipbook-nav:hover {
  background: darkred;
}

.flip-status {
  min-width: 60px;
  text-align: center;
  font-weight: bold;
}
/* Mostrar solo en móvil */
.flipbook-cards-wrapper {
  position: relative;
  width: 100%;
}

.flipbook-cards-slider {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  width: 100%;
  scroll-behavior: smooth; /* animación al mover */
}

/* Ocultar en desktop */
@media (min-width: 769px) {
  .flipbook-cards-wrapper {
    display: none !important;
  }
}
