/* ================================================
   HOJA DE ESTILOS
   Cumple WCAG 2.1 AA
   ================================================ */

/* =================================
   IMPORTAR FUENTES
   ================================= */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Open+Sans:wght@400;600;700&display=swap');

/* ====================================================================
   PALETA GABINETE LITERARIO (Accesible)
   ==================================================================== */
:root {
  --fondo:          #F6F1E4;
  --fondo-alt:      #E2D9C0;
  --texto:          #1A2C1A;
  --texto-suave:    #3D5C3D;
  --acento:         #2E6B3E;
  --acento-hover:   #1E4F2C;
  --detalle:        #B87333;
  --blanco:         #f1f6ed;
  --accesible:      #DB7B2C;  /* Naranja que contrasta más para enlaces */
  --boton:          #a65b1e;  /* Naranja para el fondo del botón principal */
}

/* =================================
   ESENCIALES - RESET Y BASE
   ================================= */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}
html { 
  font-size: 1.25rem; /* Base: 20px para legibilidad (min) */
  scroll-behavior: smooth; 
}
body {
  background-color: var(--fondo);
  color: var(--texto);
  font-family: 'Open Sans', Arial, sans-serif;
  line-height: 1.7;
  padding-top: 74px;
}

/* =================================
   BARRA DE NAVEGACIÓN (Fija)
   ================================= */
nav {
  background-color: var(--texto);
  border-bottom: 3px solid var(--detalle);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}

nav .contenedor-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

nav .contenedor-nav > a {
  color: var(--fondo-alt);
  font-size: 1rem;
  text-decoration: none;
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
}

nav .enlaces { 
  display: flex; 
  gap: 1.5rem; 
  flex-wrap: wrap; 
}

nav .enlaces a {
  color: var(--fondo-alt);
  text-decoration: none;
  font-size: 0.85rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
nav .enlaces a:hover { 
  color: var(--detalle); 
  border-bottom-color: var(--detalle); 
}

/* =================================
   SECCIONES GENERALES
   ================================= */
section {
  padding: 4rem 5%;
  background-color: var(--fondo);
}

section:nth-child(even) {
  background-color: var(--fondo-alt);
}

section h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--detalle);
  display: inline-block;
}

/* =================================
   HERO (CON VIDEO DE FONDO)
   ================================= */
.hero {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 74px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.video-fondo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.55));
  z-index: 1;
}

.hero-contenido {
  position: relative;
  z-index: 2;
  max-width: 700px;
  padding-right: 7rem;
  padding-left: 7rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  color: var(--blanco);
}

.hero-contenido h1 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-contenido p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.hero-contenido ul {
  list-style: none;
  margin: 1.5rem auto;
  display: inline-block;
  text-align: left;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 1rem;
  padding: 1rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-contenido li { 
  padding: 0.5rem;
  font-size: 1rem;
}

.hero-contenido li::before {
  content: "❧"; 
  margin-right: 1rem;
  color: var(--detalle);
  font-size: 1.2rem;
}

.boton-hero {
  display: inline-block;
  background: var(--accesible);
  color: white;
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.boton-hero:hover {
  background: var(--boton);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* =================================
   MÉTODO
   ================================= */
.metodo .destacado {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--acento);
  margin-bottom: 2rem;
  padding: 1rem;
  background: #EAF0EB;
  border-left: 4px solid var(--detalle);
}

.metodo h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem;
  color: var(--texto);
}

.metodo .nota-clases {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--acento);
  color: white;
  text-align: center;
  border-radius: 8px;
  font-weight: 600;
}

/* =================================
   AUTOR
   ================================= */
.autor-grid { 
  display: grid; 
  grid-template-columns: 2fr 1.5fr; 
  gap: 2rem; 
  align-items: start; /* Evita estirar imágenes */
  margin-bottom: 1rem;
}

.autor-biografia p { 
  font-size: 0.95rem; 
  color: var(--texto-suave); 
  margin-bottom: 1rem; 
}

.libro {
  font-style: italic;
  font-weight: 600;
  color: var(--acento);
}

/* =================================
   MOSAICO Y CARRUSEL
   ================================= */
.autor-mosaico {
  position: relative;
  background-color: var(--blanco);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: auto;
}

.carrusel-contenedor {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.carrusel-wrapper {
  position: relative;
  flex: 1;
}

.boton-carrusel {
  position: absolute;
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: var(--detalle);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
  font-size: 1.2rem;
}

.boton-carrusel:hover {
  background-color: var(--acento-hover);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.boton-carrusel:active {
  transform: translateY(-50%) scale(0.95);
}

.vista-mosaico {
  display: block;
  width: 100%;
}

.mosaico-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}

.mosaico-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background-color: var(--fondo-alt);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 4 / 3;
}

.mosaico-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.mosaico-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.45s ease;
  display: block;
}

.mosaico-item:hover img {
  transform: scale(1.05);
}

.indicador-mosaico {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.pie-foto {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem;
  font-size: 0.6rem;
  color: white;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s ease;
}

.mosaico-item:hover .pie-foto {
  white-space: normal;
  overflow: visible;
  background: rgba(0,0,0,0.92);
  font-size: 0.65rem;
  padding: 0.6rem;
  max-height: 60%;
  pointer-events: none;
}

/* =================================
   PREGUNTAS FRECUENTES
   ================================= */
.preguntas {
  text-align: center;
}

.preguntas-contenedor {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.preguntas-contenedor details {
  border: 1px solid var(--fondo-alt);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.preguntas-contenedor summary {
  padding: 1.1rem 1.5rem;
  background-color: var(--fondo-alt);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  color: var(--texto);
  transition: background-color 0.2s;
}

.preguntas-contenedor summary::after {
  content: "❧";
  padding-left: 1rem;
  color: var(--detalle);
  font-size: 1.2rem;
}

.preguntas-contenedor summary:hover {
  background-color: var(--acento);
  color: var(--blanco);
}

.preguntas-contenedor details[open] summary {
  background-color: var(--acento);
  color: var(--blanco);
}

.preguntas-contenedor details[open] summary::after {
  content: "❦";
  padding-left: 1rem;
  color: var(--detalle);
  font-size: 1.2rem;
}

.preguntas-contenedor details p {
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
  color: var(--texto-suave);
  background-color: var(--blanco);
  margin: 0;
}

.preguntas-contenedor details a {
  color: var(--detalle);
}

/* =================================
   CONTACTO (Formulario + Info)
   ================================= */
.contacto h2 {
  display: block;
  text-align: center;
  margin-bottom: 3rem;
}

.contacto-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  align-items: start;
}

.contacto-info {
  position: sticky;
  top: 100px;
}

.tarjeta-precio {
  background-color: var(--blanco);
  border: 1px solid var(--fondo-alt);
  border-top: 5px solid var(--detalle);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tarjeta-precio__texto {
  font-size: 0.85rem;
  color: var(--texto-suave);
  margin-bottom: 1.5rem;
  text-align: center;
}

.tarjeta-precio__contacto {
  font-size: 0.95rem;
  margin-bottom: 0;
  line-height: 1.8;
  text-align: center;
}

.tarjeta-precio__contacto a {
  color: var(--acento);
  text-decoration: none;
}

.tarjeta-precio__contacto a:hover {
  text-decoration: underline;
}

.aviso-legal {
  border-left: 4px solid var(--detalle);
  background: var(--fondo-alt);
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: var(--texto-suave);
  border-radius: 0 8px 8px 0;
}

.contacto-formulario {
  background-color: var(--blanco);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--fondo-alt);
}

.contacto-formulario h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 1.5rem;
  text-align: center;
}

.formulario {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texto);
}

.form-group input, .form-group textarea {
  padding: 0.8rem 1rem;
  border: 1px solid var(--fondo-alt);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: 'Open Sans', sans-serif;
  background-color: white;
  transition: border-color 0.2s;
  color: var(--texto-suave);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--acento);
  box-shadow: 0 0 0 3px rgba(46, 107, 62, 0.1);
}

.boton-formulario {
  background: var(--acento);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Open Sans', sans-serif;
  width: 100%;
}

.boton-formulario:hover {
  background: var(--acento-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.checkbox label {
  cursor: pointer;
  font-size: 0.8rem;
}

.checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--acento);
}

.checkbox a {
  color: var(--acento);
  text-decoration: none;
}

.checkbox a:hover {
  text-decoration: underline;
}

/* =================================
   FOOTER
   ================================= */
footer { 
  background-color: var(--texto); 
  color: var(--fondo-alt); 
  text-align: center; 
  padding: 2rem; 
  font-size: 0.8rem; 
  line-height: 2; 
}
footer a { 
  color: var(--accesible); 
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}
footer div {
  font-size: 0.7rem; 
  margin-top: 1rem;
}

/* =================================
   CONTENT MANAGEMENT SYSTEM
   ================================= */

.admin-header {
    background: var(--texto);
    color: var(--blanco);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.admin-header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-family: 'Merriweather', Georgia, serif;
}
.admin-header a {
    color: var(--detalle);
    text-decoration: none;
}
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}
.seccion-edicion {
    background: var(--blanco);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--fondo-alt);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.seccion-edicion h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--detalle);
    padding-left: 1rem;
}
.campo {
    margin-bottom: 1rem;
}
.campo label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.campo input[type="text"],
.campo input[type="email"],
.campo input[type="tel"],
.campo textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--fondo-alt);
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9rem;
}
.campo textarea {
    resize: vertical;
    min-height: 100px;
}
.campo textarea.texto-grande {
    min-height: 300px;
    font-family: monospace;
}
.ayuda-campo {
    font-size: 0.7rem;
    color: var(--texto-suave);
    margin-top: 0.25rem;
}
.faq-item {
    border: 1px solid var(--fondo-alt);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.faq-item .eliminar-faq {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}
.btn-guardar {
    background: var(--acento);
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}
.btn-guardar:hover {
    background: var(--acento-hover);
}
.btn-anadir {
    background: var(--detalle);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.5rem;
}
.mensaje-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    z-index: 1000;
    animation: fadeOut 3s ease forwards;
}
.mensaje-exito {
    background: #28a745;
}
.mensaje-error {
    background: #dc3545;
}
@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}
.botones-accion {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
hr {
    margin: 1rem 0;
    border-color: var(--fondo-alt);
}

/* Editor de contenido */
.unified-editor {
    margin-bottom: 0.5rem;
}

.editor-toolbar button:hover {
    background-color: var(--detalle) !important;
    color: white;
}

.editor-content p {
    margin: 0 0 0.75rem 0;
}

.editor-content p:last-child {
    margin-bottom: 0;
}

.editor-content strong {
    font-weight: bold;
}

.editor-content em {
    font-style: italic;
}

.editor-content u {
    text-decoration: underline;
}

.list-editor-textarea:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--detalle);
}

/* Animación para modales */
@keyframes fadeOutAlert {
    0% { opacity: 1; transform: translateY(0); }
    70% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); visibility: hidden; }
}

/* Estilo para el icono de vista previa */
label span {
    cursor: pointer;
}

label span:hover {
    opacity: 1 !important;
}

/* Animación para alertas */
@keyframes fadeOutAlert {
    0% { opacity: 1; transform: translateY(0); }
    70% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); visibility: hidden; }
}

/* =================================
   RESPONSIVE
   ================================= */

/* Pantallas medianas (tablets horizontales, diag. < 1024px) */
@media (max-width: 1024px) {
  .autor-grid { 
    grid-template-columns: 1fr; /* Una columna */
    gap: 2rem;
  }
  .autor-mosaico {
    max-width: 600px;
    margin: 0 auto; /* Centramos el mosaico */
    width: 100%;
  }
  .contacto-grid {
    gap: 2rem;
  }
}

/* Pantallas pequeñas (tablets verticales, móviles grandes, < 768px) */
@media (max-width: 768px) {
  /* html { font-size: 1rem; }*/
 
  body {
    /*padding-top: 120px;  Más espacio por nav en móvil */
  }
  
  nav .contenedor-nav {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem;
  }
  
  nav .enlaces { 
    justify-content: center;
    gap: 1rem; 
  }
  
  .hero {
    min-height: 100vh;
    /*min-height: calc(100vh - 120px);*/
  }
  
  .hero-contenido {
    max-width: 90%;
    padding: 1rem;
  }
  .hero-contenido ul {
    text-align: left;
    padding: 0.75rem 1.5rem;
  }
  section {
    padding: 3rem 1.5rem;
  }
  
  section h2 {
    /*font-size: 1.8rem;*/
  }
  
  /* Mosaico en móvil: 2 columnas pero cuadradas */
  .mosaico-grid {
    gap: 0.75rem;
  }
  .mosaico-item {
    aspect-ratio: 1 / 1; /* En móvil se ven más cuadradas */
  }
  
  .contacto-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .contacto-info {
    position: static;
  }
  
  .contacto-formulario {
    padding: 1.5rem;
  }
  
  .contacto-formulario h3 {
    /*font-size: 1.2rem;*/
  }
}

/* Pantallas muy pequeñas (móviles < 480px) */
@media (max-width: 480px) {
  html { font-size: 1rem; } /* Muy pequeño pero manejable, evita scroll horizontal */
  
  body {
    padding-top: 140px;
  }
  
  .hero {
    min-height: calc(100vh - 140px);
  }
  
  .hero-contenido h1 { 
    /*font-size: 1.8rem; */
  }
  
  .hero-contenido {
    padding: 1rem;
  }
  
  .hero-contenido ul {
    padding: 0.5rem 1rem;
  }
  
  .hero-contenido li {
    /*font-size: 0.8rem;*/
  }
  
  nav .contenedor-nav { 
    padding: 0.5rem; 
  }
  
  section {
    padding: 2rem 1rem;
  }
  
  section h2 {
    /*font-size: 1.5rem;*/
  }
  
  .mosaico-grid {
    gap: 0.5rem;
  }
  
  .autor-mosaico {
    padding: 1rem;
  }
  
  .contacto-formulario {
    padding: 1.25rem;
  }
  
  .form-group input, .form-group textarea {
    padding: 0.6rem 0.8rem;
  }
  
  .tarjeta-precio {
    padding: 1.5rem;
  }
  
  .boton-carrusel {
    right: -8px;
    width: 32px;
    height: 32px;
    /*font-size: 1rem;*/
  }
}

/* Pantallas grandes (escritorio > 1440px) */
@media (min-width: 1440px) {
  html { font-size: 1.35rem; } /* Aumentamos ligeramente la base para mejorar legibilidad */
  
  .contenedor-nav, .hero-contenido, .preguntas-contenedor, .contacto-grid {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }
  
  section {
    padding: 5rem 10%;
  }
  
  .hero-contenido h1 {
    font-size: 4rem;
  }
  
  .autor-grid {
    gap: 3rem;
  }
}