/* Archivo principal de estilos. Mueve aquí el contenido de styles.css y actualiza las rutas en index.html. *//* ===========================
   VARIABLES Y RESET
   =========================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #e74c3c;
    --accent-color: #3498db;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --bg-light: #ecf0f1;
    --bg-white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ===========================
   HERO SECTION
   =========================== */
.hero {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z" fill="rgba(255,255,255,0.1)"/></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    animation: fadeInUp 1s ease-out;
}

.author-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    transition: var(--transition);
}

.author-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.author-bio {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 2rem;
    text-align: left;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.author-bio p {
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    line-height: 1.8;
}

.author-bio p:last-child {
    margin-bottom: 0;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    font-size: 2rem;
    animation: bounce 2s infinite;
    opacity: 0.7;
    cursor: pointer;
}

/* ===========================
   LIBROS SECTION
   =========================== */
.libros-section {
    padding: 5rem 2rem;
    background: var(--bg-white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.libros-section h2 {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 1rem;
}

.libros-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    border-radius: 2px;
}

/* ===========================
   LIBROS GRID
   =========================== */
.libros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.libro-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.libro-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.libro-imagen {
    position: relative;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-light);
}

.libro-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.6s ease-in-out, transform 0.3s ease;
    backface-visibility: hidden;
}

.libro-imagen-trasera {
    opacity: 0;
    z-index: 2;
}

    /* Flip por clase .flipped (móviles y toque) */
    .libro-card.flipped .libro-imagen img:first-child {
        opacity: 0;
    }
    .libro-card.flipped .libro-imagen-trasera {
        opacity: 1;
    }

/* Efecto flip cuando hay imagen trasera */
.libro-card:hover .libro-imagen img:first-child {
    opacity: 0;
}

.libro-card:hover .libro-imagen-trasera {
    opacity: 1;
}

/* Efecto zoom cuando NO hay imagen trasera */
.libro-card:not(:has(.libro-imagen-trasera)):hover .libro-imagen img {
    transform: scale(1.05);
}

    @media (hover: none) {
        .libro-card:not(:has(.libro-imagen-trasera)).flipped .libro-imagen img {
            transform: scale(1.05);
        }
    }

.libro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
}

.libro-card:hover .libro-overlay {
    opacity: 1;
}

.btn-amazon {
    background: var(--accent-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    transform: translateY(20px);
}

.libro-card:hover .btn-amazon {
    transform: translateY(0);
}

.btn-amazon:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.libro-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.libro-info h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.libro-fecha {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.libro-descripcion {
    color: var(--text-dark);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.libro-footer {
    margin-top: auto;
}

.btn-comprar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
}

.btn-comprar:hover {
    background: #c0392b;
    transform: translateX(5px);
}

/* ===========================
   LOADING & STATES
   =========================== */
.loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.error-message {
    background: #fee;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 2rem 0;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 1.2rem;
}

/* ===========================
   FOOTER
   =========================== */
footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem;
}

footer p {
    margin: 0;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .author-photo {
        width: 150px;
        height: 150px;
    }
    
    .libros-section h2 {
        font-size: 2rem;
    }
    
    .libros-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .libros-section {
        padding: 3rem 1rem;
    }
}
