/* =========================================
   HOME.CSS - MEJORAS SIN ROMPER NADA
   Solo mejora el diseño móvil manteniendo todo lo demás intacto
   ========================================= */

/* =========================================
   ESTILOS DESKTOP (como estaban, con leves mejoras)
   ========================================= */
.chapter {
  padding: 3rem 2rem;
}

.chapter:not(:last-child) {
  margin-bottom: 4rem;
}

.chapter-grid {
  max-width: 1400px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4rem;
  align-items: center;
}

.chapter-grid.reverse {
  direction: rtl;
}

.chapter-grid.reverse > * {
  direction: ltr;
}

/* =========================================
   CHAPTER TITLE - CONTROL ESCRITORIO Y MÓVIL
   ========================================= */
.chapter-title {
  font-size: 2.5rem; /* tamaño fijo para escritorio */
  margin-bottom: 1rem;
  font-weight: 800;
  line-height: 1.1;
}

.chapter-lead {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.chapter-text p {
  line-height: 1.7;
}

.chapter-image img {
  width: 100%;
  max-width: 350px;
  border-radius: 2rem;
  box-shadow: 0 40px 80px rgba(0,0,0,.2);
  transition: transform 0.3s ease;
}

.chapter-image img:hover {
  transform: translateY(-5px) scale(1.02);
}

.chapter-light {
  background: #fff7f0;
}

.chapter-accent {
  background: #fff;
}

.chapter-dark {
  background: #1e1e1e;
  color: #fff;
}

/* =========================================
   MEJORAS PARA MÓVIL (< 900px)
   ========================================= */
@media (max-width: 900px) {
  .chapter {
    padding: 2rem 1rem;
  }
  
  .chapter:not(:last-child) {
    margin-bottom: 2.5rem;
  }
  
  /* Convertir a flexbox para reordenar visualmente */
  .chapter-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    grid-template-columns: 1fr; /* Reset grid */
    
    /* Efecto card */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  }
  
  /* Orden visual: imagen primero */
  .chapter-image {
    order: 1;
    margin-bottom: 1.5rem;
  }
  
  /* Imagen circular con anillo */
  .chapter-image img {
    max-width: 250px;
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 
      0 15px 40px rgba(0, 0, 0, 0.2),
      0 0 0 8px rgba(255, 255, 255, 0.9),
      0 0 0 12px rgba(192, 67, 6, 0.4);
  }
  
  /* Texto después de la imagen */
  .chapter-text {
    order: 2;
    width: 100%;
  }
  
  .chapter-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    text-align: center;
    margin-bottom: 1rem;
  }
  
  .chapter-lead {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1.2rem;
  }
  
  .chapter-text p {
    font-size: 1rem;
    text-align: left;
    margin-bottom: 1rem;
  }
  
  /* En reverse también mismo orden en móvil */
  .chapter-grid.reverse {
    direction: ltr;
  }
  
  .chapter-grid.reverse .chapter-image {
    order: 1;
  }
  
  .chapter-grid.reverse .chapter-text {
    order: 2;
  }
  
  /* Estilos específicos para temas en móvil */
  .chapter-dark .chapter-grid {
    background: rgba(255, 255, 255, 0.05);
  }
}

/* Móvil pequeño */
@media (max-width: 480px) {
  .chapter {
    padding: 1.5rem 0.75rem;
  }
  
  .chapter-grid {
    padding: 1.25rem;
  }
  
  .chapter-image img {
    max-width: 160px;
    width: 160px;
    height: 160px;
  }
  
  .chapter-title {
    font-size: 1.6rem;
  }
  
  .chapter-lead {
    font-size: 1.1rem;
  }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .chapter-image img {
    transition: none;
  }
  
  .chapter-image img:hover {
    transform: none;
  }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  .chapter-light {
    background: #1a1a1a;
  }
  
  .chapter-accent {
    background: #1e1e1e;
  }
  
  @media (max-width: 900px) {
    .chapter-grid {
      background: rgba(30, 30, 30, 0.8);
    }
    
    .chapter-image img {
      box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.5),
        0 0 0 8px rgba(50, 50, 50, 0.8),
        0 0 0 12px rgba(192, 67, 6, 0.4);
    }
  }
}
