/* --- Reset Básico y Variables --- */
:root {
    --primary-color: #eb86a8;   /* Pink */
    --secondary-color: #d4b3e0; /* Purple */
    --accent-color: #fbcd78;    /* Yellow */
    --hover-color: #8dd2d7;     /* Celeste */
    --font-heading: 'Pacifico', cursive;
    --font-body: 'Roboto', sans-serif;

    /* 1. Consistencia con Variables de Espaciado */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 15px;
    --spacing-lg: 25px;
    --spacing-xl: 40px;

    /* Light Mode */
    --bg-color: #ffffff;
    --bg-secondary-color: #fef9fb;
    --card-bg-color: #ffffff;
    --text-color: #333333;
    --text-color-light: #666666;
    --border-color: #e0d7e4;
    --shadow-color: rgba(0,0,0,0.1);
}

body.dark-mode {
    --bg-color: #212529;
    --bg-secondary-color: #2c3034;
    --card-bg-color: #343a40;
    --text-color: #f8f9fa;
    --text-color-light: #adb5bd;
    --border-color: #495057;
    --shadow-color: rgba(0,0,0,0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-body);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding-inline: 20px; /* 2. Uso de Propiedades Lógicas */
}

/* --- Header y Navegación --- */
.navbar {
    background-color: var(--bg-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-family: var(--font-heading);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.brand-logo img {
    height: 90px; /* Aumentado para mejor visibilidad */
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin-inline-start: var(--spacing-lg); /* Usando variable y propiedad lógica */
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--hover-color);
}

/* --- Menú Hamburguesa --- */
.hamburger-menu {
    display: none; /* Oculto en desktop */
    font-size: 1.8rem;
    color: var(--text-color);
    cursor: pointer;
}

/* --- Theme Switcher --- */
.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.theme-switcher {
    cursor: pointer;
    font-size: 1.5rem;
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--text-color);
}

.theme-switcher i {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-switcher .fa-sun {
    transform: scale(1);
    opacity: 1;
}

.theme-switcher .fa-moon {
    transform: scale(0);
    opacity: 0;
}

body.dark-mode .theme-switcher .fa-sun { transform: scale(0); opacity: 0; }
body.dark-mode .theme-switcher .fa-moon { transform: scale(1); opacity: 1; }

/* --- Sección Hero --- */
#hero {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('#aquivalaimagenturbina');
    background-size: cover;
    background-position: center;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding-inline: 20px;
}

body.dark-mode #hero {
    /* Aumentamos la opacidad del overlay en modo oscuro para mejorar el contraste del texto */
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('#aquivalaimagenturbina');
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.hero-content p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.cta-button {
    background-color: var(--primary-color);
    color: #fff;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;
    will-change: transform; /* 3. Optimización de Rendimiento */
}

.cta-button:hover {
    transform: translateY(-3px);
}

/* --- Efecto de énfasis para el botón del catálogo --- */
.cta-highlight {
    /* Animación para llamar la atención */
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}
/* --- Secciones Generales --- */
section {
    padding: 80px 0;
}

/* Añade una línea sutil de separación entre secciones */
section + section {
    border-top: 1px solid var(--border-color);
}

section h2 {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 2.8rem;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.bg-light {
    background-color: var(--bg-secondary-color);
}

/* --- Sección Ventajas --- */
#ventajas {
    padding: 60px 0;
}

.ventajas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xl);
    text-align: center;
}

.ventaja-item i {
    font-size: 3rem;
    color: var(--secondary-color); /* Using purple for icons */
    margin-bottom: 15px;
}

.ventaja-item h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-weight: 700;
}

.ventaja-item p {
    font-size: 1rem;
    color: var(--text-color-light);
    padding-inline: 10px;
}

/* Staggered animation delays */
.ventaja-item:nth-child(2) { transition-delay: 0.1s; }
.ventaja-item:nth-child(3) { transition-delay: 0.2s; }


/* --- Grid de Productos --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px; /* Podrías usar calc(var(--spacing-lg) + var(--spacing-xs)) si quieres ser estricto */
}

.product-card {
    background: var(--card-bg-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    position: relative;
    will-change: transform, box-shadow;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px var(--shadow-color);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-icon-container {
    width: 100%;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-secondary-color);
}

.product-icon-container i {
    font-size: 6rem;
    color: var(--secondary-color);
}

.product-card h3 {
    margin: 15px 0 10px;
    font-size: 1.4rem;
}

.product-card p {
    padding-inline: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-color-light);
    min-height: 3em; /* Ayuda a alinear tarjetas con descripciones de distinta longitud */
}

.product-card .price-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.product-card .original-price {
    text-decoration: line-through;
    color: var(--text-color-light);
    font-size: 1.1rem;
}

.product-card .offer-price {
    background-color: var(--accent-color);
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.4rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.4;
}

.product-card .offer-condition {
    font-size: 0.85rem;
    color: var(--text-color-light);
}

body.dark-mode .product-card .offer-price {
    color: #333;
}

/* Staggered animation delays */
.product-card:nth-child(2) { transition-delay: 0.1s; }
.product-card:nth-child(3) { transition-delay: 0.2s; }

/* --- Insignia de Oferta --- */
.offer-badge {
    position: absolute;
    top: var(--spacing-md);
    inset-inline-start: var(--spacing-md);
    background-color: var(--primary-color);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 5px var(--shadow-color);
}

/* --- Sección FAQ --- */
#faq .container {
    max-width: 800px;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
}

.faq-question h4 {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text-color);
}

.faq-question i {
    transition: transform 0.3s ease;
    color: var(--secondary-color);
}

.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    transition: grid-template-rows 0.4s ease-out;
}

.faq-answer p {
    /* Se usa min-height: 0 para que el contenido interno se colapse correctamente */
    min-height: 0;
    color: var(--text-color-light);
    line-height: 1.7;
    padding-top: 15px; /* Añadimos el padding aquí */
}

.faq-item.active .faq-answer {
    grid-template-rows: 1fr;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.3s ease;
}

.faq-answer a:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

/* --- Sobre Nosotros y Contacto --- */
#sobre-nosotros .container,
#contacto .container {
    max-width: 800px;
    text-align: center;
}

#contacto p a {
    color: var(--primary-color);
    font-weight: bold;
}

#contacto .cta-button {
    margin: 20px 0;
}

.contact-methods {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 12px 24px;
    border: 2px solid var(--secondary-color);
    border-radius: 50px;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    will-change: transform, box-shadow;
}

.contact-link:hover {
    background-color: var(--hover-color);
    border-color: var(--hover-color);
    color: #333; /* Forzar texto oscuro para contraste */
    transform: translateY(-3px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.contact-link i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* --- Página de Error 404 --- */
.error-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100vh;
    padding: var(--spacing-lg);
}

.error-container {
    max-width: 600px;
}

.error-container h1 {
    font-family: var(--font-heading);
    font-size: 8rem; /* Larger for emphasis */
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.error-container p {
    font-size: 1.5rem;
    margin-block: var(--spacing-md) var(--spacing-xl);
}

/* --- Footer --- */
footer {
    background-color: var(--bg-secondary-color);
    color: var(--text-color);
    text-align: center;
    padding: 20px 0;
}

/* --- Back to Top Button --- */
.back-to-top-btn {
    position: fixed;
    inset-block-end: 30px;   /* Reemplaza a 'bottom' */
    inset-inline-end: 30px;  /* Reemplaza a 'right' */
    background-color: var(--primary-color);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    text-decoration: none;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    will-change: transform, opacity;
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 4. Agrupación de Selectores (DRY) */
.cta-button:hover,
.back-to-top-btn:hover {
    background-color: var(--hover-color);
    color: #333; /* Forzar texto oscuro para contraste */
}

.back-to-top-btn:hover {
    transform: translateY(-5px);
}

/* --- Animaciones de Scroll --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(var(--spacing-xl));
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Efecto Typewriter --- */
.hero-content h1.typing::after {
    content: '';
    display: inline-block;
    /* Usamos 'em' para que el cursor se adapte al tamaño de la fuente */
    width: 0.1em; 
    height: 1em;
    background-color: #fff; /* Color del cursor */
    margin-left: 8px;
    animation: blink-caret 0.75s infinite;
    vertical-align: baseline; /* Alinea el cursor con la base del texto */
}

@keyframes blink-caret {
    50% { background-color: transparent; }
}


/* --- Responsividad --- */
@media (max-width: 768px) {
    .nav-controls {
        gap: 15px;
    }
    .hamburger-menu { display: block; }
    
    .nav-links {
        position: fixed;
        top: 122px; /* Ajustado a la nueva altura del navbar (90px logo + 2rem padding) */
        inset-inline-end: -100%; /* Reemplaza 'right' */
        width: 100%;
        height: calc(100vh - 122px);
        background-color: var(--bg-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: inset-inline-end 0.4s ease-in-out;
    }

    .nav-links.active {
        right: 0; /* Se desliza a la vista */
    }

    .nav-links li {
        margin: 20px 0;
        margin-inline-start: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    /* Evita el scroll del body cuando el menú está abierto */
    body.no-scroll {
        overflow: hidden;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .hero-content p {
        font-size: 1.2rem;
    }

    section h2 {
        font-size: 2.2rem;
    }

    .error-container h1 {
        font-size: 6rem;
    }

    .error-container p {
        font-size: 1.2rem;
    }

    .ventajas-grid {
        grid-template-columns: 1fr;
    }

    .contact-link {
        font-size: 1rem;
        padding: 10px 20px;
    }
}