:root {
    /* MEJORA: Rojo más vibrante y blanco como color de acento */
    --primary-red: #E53935;
    --primary-white: #FFFFFF;
    --glow-color: rgba(229, 57, 53, 0.5);
    --dark-color: #0a0a0a;
    --text-color: #f0f0f0;
    --text-muted: #a0a0a0;
    /* Ligeramente más claro para mejor contraste */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow-color: rgba(229, 57, 53, 0.3);
}

/* --- NUEVAS ANIMACIONES --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px var(--glow-color);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px var(--glow-color);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 15px var(--glow-color);
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Exo 2', sans-serif;
    font-weight: 300;
    color: var(--text-color);
    /* Fondo gris oscuro con textura de grano fino estilo interior de auto */
    background-color: #1E1E1E;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23n)" opacity="0.07"/></svg>');
    overflow-x: hidden;
}

#fixed-background {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #2a0a0a 0%, #0a0a0a 100%);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#spotlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(229, 57, 53, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    opacity: 0;
    will-change: transform, opacity;
}

.fixed-logo-container {
    position: fixed;
    top: 30px;
    left: 40px;
    z-index: 1001;
    width: 130px;
    /* Reducido */
    transition: transform 0.4s ease, filter 0.4s ease, opacity 0.4s ease;
}

.fixed-logo-container:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px var(--glow-color));
}

.fixed-logo-container img {
    width: 100%;
}

/* --- NAVIGATION --- */
.top-nav {
    position: fixed;
    top: 30px;
    right: 40px;
    z-index: 1000;
    display: flex;
    transition: all 0.4s ease-out;
}

.nav-links-container {
    display: flex;
    gap: 0.5rem;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 50px;
    transition: all 0.4s ease-out;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* Evita que los items se encojan en el scroll horizontal */
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: var(--primary-red);
    transition: left 0.35s ease, color 0.35s ease;
    z-index: -1;
}

.nav-link:hover {
    color: var(--primary-white);
}

.nav-link:hover::before {
    left: 0;
}

/* Estilo para el enlace activo de la sección actual */
.nav-link.active {
    color: var(--primary-white);
}

.nav-link.active::before {
    left: 0;
}

.nav-link span span {
    display: inline-block;
    position: relative;
}

.nav-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.scroll-content {
    position: relative;
    z-index: 10;
}

.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10vh 20px 5vh 20px;
}

.hero-main-logo {
    width: 180px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 25px var(--glow-color));
}

video.hero-main-logo {
    filter: none;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.subtitle {
    font-size: 1.4rem;
    /* Reducido */
    color: var(--text-muted);
    max-width: 600px;
}

.content-section {
    padding: 60px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-box {
    width: 100%;
    max-width: 700px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.glass-effect {
    background-color: rgba(28, 28, 28, 0.75);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    height: 100%;
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.text-center {
    text-align: center;
}

.section-title {
    text-align: center;
    font-size: 2.6rem;
    /* Reducido */
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-white);
}

.section-title .char {
    opacity: 0;
    transform: translateY(-10px) scale(1.2);
    display: inline-block;
}

.section-title .highlight {
    color: var(--primary-red);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-subtitle-small {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    text-align: center;
}

.check-engine-container {
    margin: 2rem 0;
}

#check-engine-gif {
    display: block;
    width: 280px;
    /* Reducido */
    margin: auto;
    border-radius: 8px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s, transform 0.5s;
}

#check-engine-gif.visible {
    opacity: 1;
    transform: scale(1);
}

.purchase-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1100px;
    width: 100%;
    align-items: center;
}

.purchase-image-column {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-image-large-container {
    position: relative;
    line-height: 0;
    width: 100%;
    max-width: 420px;
    /* Reducido */
}

.product-image-large {
    width: 100%;
    border-radius: 16px;
    object-fit: cover;
}

#product-atropos .atropos-inner {
    border-radius: 16px;
    overflow: hidden;
}

.purchase-details-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    align-items: center;
    text-align: center;
    min-height: 540px;
}

.purchase-details-column .section-title {
    font-size: 2.0rem;
    line-height: 1.2;
}

.product-details {
    text-align: center;
}

#product-description-content {
    min-height: 180px;
    /* Añadido para estabilizar el tamaño */
}

.product-price {
    font-size: 2.5rem;
    /* Reducido */
    font-weight: 900;
    color: var(--primary-red);
    margin: 0 0 0.5rem 0;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background-color: var(--primary-red);
    color: var(--primary-white);
    text-decoration: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--glow-color);
    position: relative;
    z-index: 10;
    overflow: hidden;
}

#purchase-section .cta-button {
    animation: pulse 2.5s infinite 1s;
}

#cta-whatsapp-link {
    margin-top: 1.5rem;
    /* Espacio añadido */
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: var(--primary-white);
    transition: width 0.4s ease;
    z-index: -1;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px var(--glow-color);
    color: #000;
    animation-play-state: paused;
}

.cta-button:hover::before {
    width: 100%;
}

.cta-button svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.cta-button:hover svg {
    transform: rotate(15deg);
}

#gallery .text-box {
    max-width: 650px;
    /* Reducido */
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.gallery-item {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: contain;
    /* Modificado */
    background-position: center;
    background-repeat: no-repeat;
    /* Añadido */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.atropos {
    width: 100%;
    position: relative;
    overflow: visible;
}

#interactive-webgl-container-main,
#interactive-webgl-container-secondary {
    width: 100%;
    height: 500px;
    border-radius: 16px;
    background-color: transparent;
    cursor: grab;
    margin-top: 2rem, 0, 0, 0;
}

#interactive-webgl-container-main:active,
#interactive-webgl-container-secondary:active {
    cursor: grabbing;
}

.footer {
    padding: 3rem 0;
    background: #000;
    text-align: center;
}

.footer-text {
    max-width: 500px;
    margin: 1.2rem auto 1.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.purchase-info-container {
    display: flex;
    justify-content: center;
    gap: 3rem;
    /* Espacio añadido */
    flex-wrap: wrap;
    margin: 2rem auto;
    max-width: 800px;
}

.footer-contact-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.footer-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.footer-button svg {
    width: 20px;
    height: 20px;
}

.footer-button:hover {
    color: #fff;
    transform: translateY(-3px);
}

.footer-button.whatsapp:hover {
    background-color: #25D366;
    border-color: #25D366;
    animation: none;
}

.footer-button.facebook:hover {
    background-color: #1877F2;
    border-color: #1877F2;
}

#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 0.8rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.product-selector {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.product-selector-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Exo 2', sans-serif;
    font-weight: 500;
    position: relative;
    z-index: 10;
}

.product-selector-btn:hover {
    background-color: rgba(229, 57, 53, 0.2);
    border-color: var(--primary-red);
    color: var(--primary-white);
}

.product-selector-btn.active {
    background-color: var(--primary-red);
    color: var(--primary-white);
    border-color: var(--primary-red);
    box-shadow: 0 0 15px var(--glow-color);
}

.autoplay-progress {
    width: 90%;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 0 auto 1.2rem;
    overflow: hidden;
}

.autoplay-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-red);
    border-radius: 3px;
}

.product-spec-list {
    list-style: none;
    padding: 0;
    margin: 1.2rem 0;
    text-align: left;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.product-spec-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.product-spec-list li::before {
    content: '✓';
    font-weight: 900;
    color: var(--primary-red);
    flex-shrink: 0;
    margin-top: 2px;
}

.product-spec-list li span strong {
    color: var(--text-color);
    font-weight: 500;
}

/* --- Improved Installation Diagram --- */
.installation-diagram-container {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.diagram-step-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    min-height: 40px;
    text-align: center;
}

.diagram-visual-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 1.5rem auto;
    overflow: visible;
}

#installation-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

#diag-sensor,
#diag-spacer,
#diag-wrench,
#diag-exhaust-group,
#diag-cat-group {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.diagram-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.diagram-btn {
    background-color: var(--primary-red);
    color: var(--primary-white);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
}

.diagram-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--glow-color);
}

.diagram-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- FAQ Section --- */
.faq-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.faq-item[open] {
    background-color: rgba(40, 40, 40, 0.5);
}

.faq-item[open] summary {
    color: var(--primary-white);
}

.faq-question {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 1rem 1.5rem;
    cursor: pointer;
    list-style: none;
    position: relative;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.faq-item[open] .faq-question::after {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.faq-answer p,
.faq-answer ul {
    margin-bottom: 1rem;
}

.faq-answer ul {
    list-style-position: inside;
    padding-left: 0.5rem;
}

.faq-answer ul li {
    margin-bottom: 0.5rem;
}

/* --- SHIPPING LOGOS --- */
.shipping-companies {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.shipping-company {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.shipping-company img {
    height: 40px;
    width: auto;
    transition: filter 0.3s ease;
}

.shipping-company:hover img {
    filter: none;
}

.shipping-company span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
    .top-nav {
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        padding: 1rem;
        border-radius: 0;
        justify-content: center;
    }

    .nav-links-container {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===== ESTILOS PARA CELULAR ===== */
@media (max-width: 768px) {
    html {
        /* Desactiva el scroll suave en móvil para una experiencia nativa */
        scroll-behavior: auto;
    }

    .fixed-logo-container {
        left: 1rem;
        top: 1rem;
        width: 100px;
    }

    .top-nav {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        width: auto;
    }

    .nav-links-container {
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 25px;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.9rem;
        gap: 0.5rem;
    }

    main.scroll-content {
        padding-bottom: 150px;
    }

    .content-section {
        padding-top: 20px;
        padding-bottom: 20px;
    }
}


@media (max-width: 900px) {
    .purchase-layout {
        grid-template-columns: 1fr;
    }

    #interactive-webgl-container-main,
    #interactive-webgl-container-secondary {
        height: 320px;
    }
}

@media (max-width: 600px) {
    .content-section {
        padding: 40px 20px;
    }

    /* Padding ajustado para ser consistente */
    .text-box {
        padding: 1.8rem 1.5rem;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .footer-contact-buttons {
        flex-direction: column;
        align-items: center;
    }

    .footer-button {
        width: 90%;
        justify-content: center;
    }
}