/* ========================================================
    TIPOGRAFÍA GENERAL
    ========================================================= */
body {
    font-family: "Libre Baskerville", serif;
    background: #ffffff;
    color: #000000;
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem;
    line-height: 1.8;
}

/* =========================================================
    ENCABEZADO
    ========================================================= */
header h1 {
    font-size: 2.6rem;
    font-weight: 400;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #333;
    margin: 0 0 2rem 0;
}

/* =========================================================
    NAVEGACIÓN
    ========================================================= */
nav ul {
    display: flex;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 2.5rem 0;
}

nav ul li a {
    text-decoration: none;
    color: #000;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid transparent;
    padding-bottom: 4px;
    transition: border-color 0.2s;
    white-space: nowrap; /* Asegura que no se rompa en varias líneas */
}

nav ul li a:hover {
    border-bottom: 1px solid #000;
}

nav ul li a.activo {
    color: #FA8072;
    border-bottom: 1px solid #FA8072;
}

/* =========================================================
    CONTENIDO PRINCIPAL
    ========================================================= */
main.inicio {
    margin-top: 5.5rem;
    margin-bottom: 4rem;
}

.card-inicio {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
    text-align: center;
}

/* =========================================================
    TÍTULOS Y PÁRRAFOS
    ========================================================= */
h1, h2, h3 {
    font-weight: 400;
    line-height: 1.3;
    margin-top: 2.2rem;
    margin-bottom: 1rem;
    color: #000;
}

p {
    margin-bottom: 1.4rem;
}

/* =========================================================
    CONTENIDO ESPECÍFICO
    ========================================================= */
article {
    margin-bottom: 3rem;
}

.novela {
    margin-bottom: 5rem;
    text-align: justify;
}

.novela h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* =========================================================
    SECCIÓN INFANTIL - DISEÑO IMAGEN/TEXTO
    ========================================================= */
.seccion-infantil h2 {
    text-align: left;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

/* Regla general de layout-obra para móvil (aplicable a Infantil y Académico sin Flex) */
.layout-obra {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 1rem 0 2.5rem 0;
}

.imagen-obra {
    flex-shrink: 0;
}

.contenido-obra {
    flex: 1;
}

/* Hacemos estas reglas específicas para la sección Infantil para evitar conflictos */
@media (min-width: 768px) {
  .seccion-infantil .layout-obra {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .seccion-infantil .imagen-obra {
    width: 35%;
    max-width: 300px;
  }
  
  .seccion-infantil .contenido-obra {
    width: 65%;
    padding-left: 2rem;
  }
}

.ilustracion-infantil {
    max-width: 100%;
    width: 100%;
    height: auto;
    margin: 0;
}

.creditos-img {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-style: italic;
}

/* =========================================================
    ENLACES Y BOTONES
    ========================================================= */
.enlace-obra {
    display: inline-block;
    margin-top: 0.5rem;
    text-decoration: none;
    color: #000;
    border-bottom: 1px solid #000;
    transition: opacity 0.2s;
}

.enlace-obra:hover {
    opacity: 0.6;
}

.enlaces-idioma a {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.2rem;
}

button,
input[type="submit"] {
    background: #000;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 3px;
    transition: opacity 0.2s;
}

button:hover,
input[type="submit"]:hover {
    opacity: 0.85;
}

/* =========================================================
    IMÁGENES GENERALES
    ========================================================= */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
}

/* =========================================================
    PIE DE PÁGINA Y SELLO
    ========================================================= */
footer {
    text-align: center;
    margin-top: 4rem;
    font-size: 0.9rem;
    color: #555;
}

.sello {
    text-align: center;
    margin-top: 1rem;
}

.sello img {
    width: 90px;
    height: auto;
    opacity: 0.35;
    border-radius: 50%;
    filter: grayscale(100%) contrast(110%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

.sello img:hover {
    opacity: 0.6;
    transform: scale(1.05);
}

/* =========================================================
    SEPARADOR ELEGANTE PARA NOVELAS
    ========================================================= */
.novela:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 3rem;
}

.novela:last-child {
    margin-bottom: 2rem;
}

/* =========================================================
    FORMULARIO DE CONTACTO
    ========================================================= */
.formulario-contacto {
    max-width: 600px;
    margin: 0 auto;
}

.campo-formulario {
    margin-bottom: 1.5rem;
}

.campo-formulario label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #000;
}

.campo-formulario input,
.campo-formulario textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: "Libre Baskerville", serif;
    font-size: 1rem;
    box-sizing: border-box;
}

.campo-formulario input:focus,
.campo-formulario textarea:focus {
    outline: none;
    border-color: #000;
}

.formulario-contacto button {
    background: #000;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 3px;
    transition: opacity 0.2s;
}

.formulario-contacto button:hover {
    opacity: 0.85;
}

/* =========================================================
    BIOGRAFÍA - TEXTO CENTRADO Y ELEGANTE
    ========================================================= */
.biografia {
    max-width: 660px;
    margin: 0 auto;
    text-align: justify;
    line-height: 1.9;
}

.biografia p {
    margin-bottom: 1.5rem;
    text-indent: 1rem;
}

/* Estilo para el título de la obra */
.titulo-obra {
    font-family: "Libre Baskerville", serif;
    font-size: 1.4rem; /* Ligeramente más grande */
    font-weight: 400;
    line-height: 1.4;
    margin-top: 1.6rem; 
    margin-bottom: 0.6em; 
}

/* ================================
    ESTILOS EXCLUSIVOS PARA ACADÉMICO
    ================================ */

.seccion-academico .layout-obra {
    margin-bottom: 4rem; 
}

/* APLICAMOS FLEXBOX AL CONTENEDOR DE IMAGEN Y TEXTO */
.seccion-academico .cuerpo-obra {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem;
    margin-top: 0.5rem; 
}

/* Imagen (Columna 1) */
.seccion-academico .imagen-obra {
    flex-shrink: 0;
    flex: 0 0 30%;
    max-width: 200px;
}

.seccion-academico .imagen-obra img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0; 
}

/* Texto (Columna 2) */
.seccion-academico .contenido-obra {
    flex-grow: 1; 
} 

/* Alinear perfectamente el texto con la imagen */
.seccion-academico .contenido-obra > :first-child {
    margin-top: 0;
}

/* AUMENTO DEL MARGEN ENTRE HEADER Y EL MAIN */
main {
  padding-top: 20px;
}

/* ===========================================
   EPÍGRAFE PARA LA SECCIÓN INFANTIL
   =========================================== */
.epigrafe-infantil {
    text-align: right;
    margin: 2.5rem 0 3rem 0;
    font-style: italic;
    color: #444;
    line-height: 1.7;
    width: 75%;
    margin-left: 25%;
}

.epigrafe-infantil p {
    margin: 0 0 0.5rem 0;
}

.epigrafe-autor {
    text-align: right;
    font-style: normal;
    font-size: 0.9rem;
    color: #666;
}

.franja-gracias {
    width: 100%;
    height: auto;
    display: block;
    margin: 12rem 0;
}

main.gracias {
    margin-top: 6rem;
}

.franja-gracias {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    margin: 6rem 0 4rem 0;
}

/* Botón hamburguesa (oculto en escritorio) */
.menu-toggle {
  display: none;
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

/* Tres barritas */
.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  margin: 4px 0;
  background: #000;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Estado “X” */
.menu-toggle.abierto span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle.abierto span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.abierto span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Para posicionar bien el botón respecto al contenido */
body {
  position: relative;
}

/* =========================================================
   AJUSTES RESPONSIVOS GENERALES PARA MÓVILES (≤600px)
   ========================================================= */
@media (max-width: 600px) {

  /* Texto más legible en móvil */
  body {
    padding: 1.2rem;
    font-size: 1.05rem;  /* ligeramente más grande */
    line-height: 1.8;
  }

  /* La biografía, tamaño de letra un poco mayor aún */
  .biografia {
    font-size: 1.2rem;
    line-height: 1.9;
  }
.biografia p {
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
  }
  /* Navegación en móvil: menú hamburguesa */
  .menu-toggle {
    display: block;
    z-index: 1001;
  }

  nav {
    position: relative;
  }

  nav ul {
    position: absolute;
    top: 3.2rem;          /* justo debajo del botón */
    right: 0;
    background: #ffffff;
    border: 1px solid #000;
    padding: 1rem 1.5rem;
    list-style: none;
    margin: 0;
    display: none;        /* oculto por defecto */
    flex-direction: column;
    gap: 0.8rem;
    z-index: 1000;
  }

  nav ul li a {
    font-size: 0.9rem;
    white-space: nowrap;
  }

  nav ul.abierto {
    display: flex;
  }


  /* Títulos un poco más contenidos */
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  /* Secciones tipo .novela con algo de margen lateral */
  .novela {
    margin-bottom: 3rem;
    padding: 0 0.5rem;
  }

  /* Pie de página más compacto */
  footer {
    font-size: 0.8rem;
    padding: 1rem;
  }

  /* ACADÉMICO: imagen arriba, texto debajo */
  .seccion-academico .cuerpo-obra {
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
  }

  .seccion-academico .imagen-obra {
    max-width: 100%;
    flex: 0 0 auto;
  }

  .seccion-academico .contenido-obra {
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {

  /* Reducir el espacio vertical entre imagen y título SOLO en la sección Infantil */
  .seccion-infantil .layout-obra {
    gap: 0.8rem;  /* Ajusta: 0.8rem, 0.6rem, 0.5rem… según veas */
  }

  /* También podemos ajustar el margen superior del título */
  .seccion-infantil .titulo-obra {
    margin-top: 0.8rem;  /* En vez de los 1.6rem actuales */
  }
}
