/* variables y reseteo */
:root {
    --primary-color: #DA251D;
    --primary-dark: #b31d17;
    --text-color: #333333;
    --text-light: #777777;
    --bg-light: #f9f9f9;
    --bg-white: #ffffff;
    --bg-dark: #111111;
    --font-main: 'Inter', sans-serif;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-white);
    overflow-x: hidden;
}

p {
    text-align: justify;
    text-justify: inter-word;
}

/* Utilidades */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.bg-light { background-color: var(--bg-light); }

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--bg-dark);
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 4px;
    background-color: var(--primary-color);
    bottom: -10px;
    left: 0;
}

.text-center.section-title::after {
    left: 50%;
    transform: translateX(-50%);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 50px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.main-logo {
    height: 45px;
    width: auto;
    display: block;
    mix-blend-mode: multiply;
}

.main-logo-small {
    height: 45px;
    width: auto;
    display: block;
    mix-blend-mode: multiply;
}

.fademol-logo {
    height: 55px;
    width: auto;
    display: block;
    mix-blend-mode: multiply;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--bg-dark);
    text-decoration: none;
    letter-spacing: -1px;
}

.logo-dot {
    color: var(--primary-color);
}

.logo a {
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    bottom: -5px;
    left: 0;
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 10px;
}
.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}
.lang-icon {
    height: 50px; 
    width: 50px;
    object-fit: contain;
    border-radius: 50%;
    transform: scale(1.4); 
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.lang-btn:hover .lang-icon {
    opacity: 0.8;
    transform: scale(1.45);
}
.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-white);
    min-width: 120px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 5px;
    padding: 10px 0;
    margin-top: 15px; /* Espacio bajo el navbar */
}
/* Puente invisible para mantener el hover activo al mover el cursor hacia abajo */
.lang-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}
.lang-dropdown:hover .lang-menu {
    display: block;
}
.lang-menu li {
    margin: 0;
    list-style: none;
}
.flag-emoji {
    margin-right: 8px;
    font-size: 1.2em;
}
.nav-links .lang-menu a {
    color: var(--bg-dark);
    padding: 8px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
}
.nav-links .lang-menu a:hover {
    background-color: #f5f5f5;
    color: var(--primary-color);
}
.nav-links .lang-menu a::after {
    display: none; /* Eliminar la animación de subrayado del navbar */
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--bg-dark);
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(17, 17, 17, 0.9), rgba(17, 17, 17, 0.5));
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 10;
    color: var(--bg-white);
    max-width: 800px;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: #e0e0e0;
}

/* Animaciones */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}



/* About Section */
.about-section {
    padding: 100px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-light);
}

.about-list {
    list-style: none;
    margin-top: 30px;
}

.about-list li {
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-list i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.about-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.about-img:hover {
    transform: scale(1.02);
}

/* Products */
.products-section {
    padding: 100px 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: var(--bg-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-bottom-color: var(--primary-color);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 3px solid var(--primary-color);
}

.product-info {
    padding: 30px;
}

.product-info h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: var(--bg-dark);
}

.product-info p {
    color: var(--text-light);
    font-size: 0.95rem;
    text-align: justify;
    text-justify: inter-word;
}

/* Innovation & Quality */
.innovation-section {
    padding: 100px 0;
    background-color: var(--bg-dark);
    color: var(--bg-white);
}

.innovation-section .section-title {
    color: var(--bg-white);
}

.lab-emphasis {
    text-align: center;
    background: linear-gradient(rgba(17,17,17,0.8), rgba(17,17,17,0.8)), url('../IMAGEN GOMEX/fotos pagina web/20160406_56.jpg') center/cover;
    padding: 60px 40px;
    border-radius: 15px;
    border-top: 5px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lab-description {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 30px auto;
    color: #e0e0e0;
}

.test-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.tag {
    padding: 8px 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 30px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.tag:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.lab-gallery {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.lab-photo {
    width: 250px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.lab-photo:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.mt-60 {
    margin-top: 60px;
}

.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.cert-item {
    background: linear-gradient(145deg, rgba(40, 40, 40, 0.6), rgba(15, 15, 15, 0.8));
    padding: 40px 25px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.cert-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.cert-logo {
    max-width: 120px;
    height: 80px;
    object-fit: contain;
    transition: transform 0.4s ease;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3));
}

.cert-text {
    text-align: center;
}

.cert-text h4 {
    font-size: 1.3rem;
    color: #ffffff;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.cert-text p {
    font-size: 0.95rem;
    color: #bbbbbb;
    margin: 0;
    line-height: 1.6;
}

.cert-item:hover {
    transform: translateY(-10px);
    background: linear-gradient(145deg, rgba(50, 50, 50, 0.8), rgba(20, 20, 20, 0.9));
    box-shadow: 0 20px 40px rgba(229, 0, 0, 0.15);
    border-color: rgba(229, 0, 0, 0.3);
}

.cert-item:hover::before {
    transform: scaleX(1);
}

.cert-item:hover .cert-logo {
    transform: scale(1.1);
}

/* Expansión */
.expansion-section {
    position: relative;
    padding: 100px 0;
    overflow: hidden;
    color: #fff;
}

.expansion-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
}

.expansion-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expansion-overlay {
    display: none;
}

.expansion-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: flex-start;
}

.expansion-text-box {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 50px;
    border-radius: 15px;
    max-width: 600px;
}

.expansion-badge {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.expansion-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #e0e0e0;
}

.expansion-stats {
    margin-bottom: 30px;
}

.exp-stat-item {
    margin-bottom: 20px;
}

.exp-stat-num {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 5px;
}

.final-stat-num {
    font-size: 2.2rem;
}

.exp-stat-num span {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.exp-stat-label {
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.exp-stat-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.exp-bar-fill {
    height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.expansion-total {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    font-size: 1.05rem;
}

.expansion-total i {
    color: var(--primary-color);
    margin-right: 10px;
}


/* Alianzas Estratégicas */
.alianzas-section {
    padding: 100px 0;
    background-color: var(--bg-white);
}

.alianza-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    margin-top: 15px;
}

.alianza-image-wrapper {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.alianza-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.alianza-image-wrapper:hover .alianza-image {
    transform: scale(1.05);
}

.alianza-badge {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(229,0,0,0.3);
}

/* Footer */
.footer {
    background-color: #0a0a0a;
    color: #ffffff;
    padding: 80px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-brand .logo-text {
    color: #ffffff;
}

.footer-brand p {
    color: #999999;
    margin-top: 20px;
    max-width: 300px;
}

.footer-logo {
    height: 40px;
    margin-bottom: 15px;
    filter: grayscale(1) invert(1) brightness(2);
    mix-blend-mode: screen;
}

.footer p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #ffffff;
}

.footer h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #ffffff;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #999999;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-brand p {
    color: #bbb;
    margin-bottom: 10px;
    text-align: left;
}

.footer-contact p {
    color: #999999;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-contact i {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    color: #777777;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .about-grid, .innovation-grid {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none; /* simple mobile hide for now */
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: var(--bg-white);
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    
    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid, .alianza-grid {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    

}

/* Fortalezas Section (Rediseño Premium) */
.fortalezas-section {
    padding: 100px 0;
    position: relative;
    overflow: hidden;
    background-color: #0a0a0a;
}

.fortalezas-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
}

.fortalezas-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}

.fortalezas-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, #0a0a0a 0%, transparent 50%, #0a0a0a 100%);
}

.premium-card {
    background: #181818;
    border: 1px solid rgba(229, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(229, 0, 0, 0.15);
    border-radius: 8px;
    padding: 30px;
    transition: all 0.3s ease;
    text-align: left;
}

.premium-card:hover {
    background: #1a1a1a;
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(229, 0, 0, 0.4);
}

.fortalezas-section .timeline-year {
    position: static;
    transform: none;
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.timeline-divider {
    width: 100%;
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    margin-bottom: 25px;
}

.fortalezas-section .timeline-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.glass-panel {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(229, 0, 0, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(229, 0, 0, 0.1);
    border-left: none !important;
    padding: 40px;
    border-radius: 10px;
}

.capacity-stat {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.capacity-stat .counter {
    color: var(--primary-color);
}

.timeline-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 60px;
}

.capacity-item {
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.capacity-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.capacity-item h4 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.capacity-item p {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
}

@media (max-width: 900px) {
    .timeline-grid, .capacity-grid {
        grid-template-columns: 1fr;
    }
}

/* Sustainability Section */
.sustainability-section {
    padding: 80px 0;
    background-color: var(--bg-white);
}

.circular-system {
    position: relative;
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 550px;
    margin: 60px auto;
    display: block;
}
.circle-node {
    width: 170px;
    height: 170px;
    border: 4px solid #2ecc71;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fff;
    z-index: 2;
    text-align: center;
    padding: 15px;
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.1);
    position: absolute;
}
.node-1 {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}
.node-2 {
    bottom: 0;
    right: 0;
}
.node-3 {
    bottom: 0;
    left: 0;
}
.circle-node.eco-node {
    border-color: #27ae60;
    background: #f0fff4;
}
.node-icon { font-size: 2.5rem; color: #2ecc71; margin-bottom: 8px; }
.eco-node .node-icon { color: #27ae60; }
.node-text { font-weight: bold; color: #333; font-size: 0.8rem; text-transform: uppercase; }

.connecting-line {
    position: absolute;
    height: 3px;
    background-color: #2ecc71;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.line-arrow {
    color: #2ecc71;
    font-size: 1.5rem;
    background: #fdfdfd;
    padding: 0 5px;
}
.line-1 {
    width: 465px;
    top: 85px;
    left: 350px;
    transform-origin: 0 50%;
    transform: rotate(55.1deg);
}
.line-2 {
    width: 530px;
    bottom: 85px;
    left: 85px;
}
.line-3 {
    width: 465px;
    bottom: 85px;
    left: 85px;
    transform-origin: 0 50%;
    transform: rotate(-55.1deg);
}

.center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    z-index: 0;
    text-align: center;
}

@media (max-width: 768px) {
    .circular-system {
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    .circle-node {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
    }
    .connecting-line {
        position: relative;
        width: 3px !important;
        height: 40px !important;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none !important;
        margin: 10px 0;
    }
    .line-arrow {
        transform: rotate(90deg);
    }
    .line-2 .line-arrow {
        transform: rotate(-90deg);
    }
    .center-label {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        order: -1;
        margin-bottom: 20px;
    }
}

/* Animación de TR circulando */
.particle {
    position: absolute;
    background-color: #27ae60;
    box-shadow: 0 0 8px #2ecc71, 0 0 15px #fff;
    border-radius: 50%;
    z-index: 2;
    width: 12px;
    height: 12px;
}

@media (min-width: 769px) {
    .particle {
        top: -4.5px;
    }
    .line-1 .particle { animation: move-right 3s linear infinite; animation-delay: 0s; }
    .line-2 .particle { animation: move-left 3s linear infinite; animation-delay: 1s; }
    .line-3 .particle { animation: move-right 3s linear infinite; animation-delay: 2s; }

    @keyframes move-right {
        0% { left: 0; opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { left: 100%; opacity: 0; }
    }
    @keyframes move-left {
        0% { right: 0; left: auto; opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { right: 100%; left: auto; opacity: 0; }
    }
}

@media (max-width: 768px) {
    .particle {
        left: -4.5px;
    }
    .line-1 .particle { animation: move-down 3s linear infinite; animation-delay: 0s; }
    .line-2 .particle { animation: move-up 3s linear infinite; animation-delay: 1s; }
    .line-3 .particle { animation: move-down 3s linear infinite; animation-delay: 2s; }

    @keyframes move-down {
        0% { top: 0; opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { top: 100%; opacity: 0; }
    }
    @keyframes move-up {
        0% { bottom: 0; top: auto; opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { bottom: 100%; top: auto; opacity: 0; }
    }
}


/* =========================================
   HISTORIA / TIMELINE INTERACTIVA
   ========================================= */

.timeline-wrapper {
    --arc-radius: clamp(280px, min(35vw, 40vh), 420px);
    display: flex;
    width: 100%;
    min-height: 850px;
    height: 90vh;
    position: relative;
    overflow: hidden;
    background: #f4f4f9;
}

.timeline-wrapper .arch-section {
    position: relative;
    width: 50%;
    height: 100%;
    overflow: visible;
    z-index: 2;
}

.timeline-wrapper .arch-line {
    position: absolute;
    top: 50%;
    left: calc(-1 * var(--arc-radius));
    transform: translateY(-50%);
    width: calc(2 * var(--arc-radius));
    height: calc(2 * var(--arc-radius));
    border: 3px dashed rgba(218, 37, 29, 0.3);
    border-radius: 50%;
    z-index: 0;
}

.timeline-wrapper .arch-center {
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 1px;
    --radius: var(--arc-radius);
    z-index: 10;
}

.timeline-wrapper .item {
    position: absolute;
    transform: rotate(var(--angle)) translateY(calc(-1 * var(--radius))) rotate(calc(-1 * var(--angle)));
    z-index: 10;
    display: flex;
    align-items: center;
}

.timeline-wrapper .node-container {
    position: absolute;
    top: 0; 
    left: 0;
    transform: translate(-50%, -50%);
}

.timeline-wrapper .node {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border: 3px solid var(--primary-color);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.timeline-wrapper .item:hover {
    z-index: 100;
}

.timeline-wrapper .item:hover .node {
    transform: scale(1.3);
    box-shadow: 0 15px 30px rgba(218, 37, 29, 0.3);
    border-width: 4px;
}

.timeline-wrapper .node img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s;
}

.timeline-wrapper .content {
    position: absolute;
    left: 55px;
    top: -35px;
    width: max-content;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    /* pointer-events: none; removed to allow hover on text balloon */
}

.timeline-wrapper .item:hover .content {
    transform: translateX(15px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    background: #ffffff;
}

.timeline-wrapper .year {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    flex-shrink: 0;
}

.timeline-wrapper .desc {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
    margin: 0;
    white-space: normal;
}

/* LADO DERECHO: DISPLAY */
.timeline-wrapper .preview-section {
    position: relative;
    width: 50%;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    background: transparent;
}

.timeline-wrapper .default-message {
    font-size: 2.4rem;
    color: #cbd5e1;
    font-weight: 300;
    text-align: center;
    transition: all 0.4s ease;
    max-width: 600px;
}

.timeline-wrapper .preview-card {
    position: absolute;
    width: 85%;
    max-width: 750px;
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.08);
    border-top: 8px solid var(--primary-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(40px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.timeline-wrapper .preview-card img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.timeline-wrapper .preview-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-wrapper .preview-info h2 {
    font-size: 3.8rem;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.timeline-wrapper .preview-info p {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
}

.timeline-wrapper:has(.item-1:hover) .preview-1,
.timeline-wrapper:has(.item-2:hover) .preview-2,
.timeline-wrapper:has(.item-3:hover) .preview-3,
.timeline-wrapper:has(.item-4:hover) .preview-4,
.timeline-wrapper:has(.item-5:hover) .preview-5,
.timeline-wrapper:has(.item-6:hover) .preview-6 {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    z-index: 100;
}

.timeline-wrapper:has(.item:hover) .default-message {
    opacity: 0;
    transform: scale(0.9);
    visibility: hidden;
}

.timeline-wrapper .item { animation: slideIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; opacity: 0; }
.timeline-wrapper .item-1 { animation-delay: 0.1s; }
.timeline-wrapper .item-2 { animation-delay: 0.2s; }
.timeline-wrapper .item-3 { animation-delay: 0.3s; }
.timeline-wrapper .item-4 { animation-delay: 0.4s; }
.timeline-wrapper .item-5 { animation-delay: 0.5s; }
.timeline-wrapper .item-6 { animation-delay: 0.6s; }

@keyframes slideIn {
    0% { opacity: 0; transform: rotate(var(--angle)) translateY(0) rotate(calc(-1 * var(--angle))) scale(0.2); }
    100% { opacity: 1; transform: rotate(var(--angle)) translateY(calc(-1 * var(--radius))) rotate(calc(-1 * var(--angle))) scale(1); }
}

@media (max-width: 992px) {
    .timeline-wrapper {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }
    .timeline-wrapper .arch-section {
        width: 100%;
        height: 500px;
    }
    .timeline-wrapper .arch-line {
        left: 50%;
        top: 100%;
        transform: translate(-50%, -50%);
        width: 120vw;
        height: 120vw;
    }
    .timeline-wrapper .arch-center {
        left: 50%;
        top: 100%;
        --radius: 60vw;
    }
    .timeline-wrapper .preview-section {
        width: 100%;
        height: 500px;
        padding: 20px;
    }
}
