/* General styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8; /* Light grey background for the page */
    overflow-x: hidden; /* Prevent horizontal scroll due to animations */
}

.container {
    width: 80%;
    max-width: 1200px; /* Limit max width for better readability */
    margin: 0 auto;
    padding: 20px 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* New: Carousel animation */
@keyframes scroll-logos {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); } /* Scrolls half the width of the track (one set of logos) */
}


/* Apply fade-in animation to most text and elements on load */
.fade-in-on-load .section h2,
.fade-in-on-load .section p,
.fade-in-on-load .section ul,
.fade-in-on-load .quote,
.fade-in-on-load .two-columns .column,
.fade-in-on-load .section img:not(.hero-section img, .logo, .client-logos-carousel .logo-item img) {
    animation: fadeIn 1s ease-out forwards;
    opacity: 0; /* Start invisible */
}

/* Delay animations for staggered effect */
.fade-in-on-load .section h2 { animation-delay: 0.2s; }
.fade-in-on-load .section p { animation-delay: 0.4s; }
.fade-in-on-load .section ul { animation-delay: 0.5s; }
.fade-in-on-load .quote { animation-delay: 0.6s; }
.fade-in-on-load .two-columns .column:nth-child(1) { animation-delay: 0.7s; }
.fade-in-on-load .two-columns .column:nth-child(2) { animation-delay: 0.8s; }
.fade-in-on-load .section img:not(.hero-section img, .logo, .client-logos-carousel .logo-item img) { animation-delay: 0.9s; }


/* Header styles */
header {
    background: #fff;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Make the container within the header a flex container to manage its children */
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    padding: 0 20px;
}

header .logo-link {
    display: flex;
    flex-shrink: 0;
}

header .logo {
    height: 70px;
    margin-left: 0;
}

/* Main Navigation */
.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
}

.main-nav ul li {
    margin: 0 15px;
    flex-shrink: 0;
}

.main-nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 0.9em;
    padding: 5px 8px;
    transition: color 0.3s ease, transform 0.2s ease;
    border-radius: 5px;
    white-space: nowrap;
}

.main-nav ul li a:hover {
    color: #a02020;
    transform: translateY(-2px);
    background-color: transparent;
}

/* Hamburger Menu Icon */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1001;
    flex-shrink: 0;
    margin-left: 20px;
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: all 0.3s ease-in-out;
}

/* Hamburger animation to 'X' */
.hamburger.is-active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.is-active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.is-active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* Section styles */
.section {
    padding: 40px 0;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.section:last-of-type {
    border-bottom: none;
}

/* Interiores Rojos en textos importantes */
.section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #a02020; /* Matepro red for section titles */
    font-size: 2.2em;
    position: relative;
    padding-bottom: 8px;
}

.section h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background-color: #a02020;
}

.section p strong, .section ul strong, .quote strong {
    color: #a02020; /* Make strong text red */
}

.quote {
    font-style: italic;
    text-align: center;
    margin-top: 20px;
    font-size: 1.1em;
    color: #a02020; /* Quote text now red */
}

.two-columns .column h3 {
    color: #a02020; /* Column titles red */
    margin-top: 0;
    font-size: 1.3em;
}

/* Hero Section */
.hero-section {
    text-align: center;
    background: #f4f4f4;
    padding: 60px 0;
    margin-bottom: 0;
    box-shadow: none;
}

.hero-section img {
    max-width: 70%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    animation: fadeIn 1.5s ease-out forwards;
    opacity: 0;
}

.hero-section h1 {
    color: #333;
    font-size: 2.5em;
    margin-top: 0;
    animation: slideInLeft 1s ease-out forwards;
    opacity: 0;
    animation-delay: 0.5s;
}

/* General text within sections */
.section p, .section ul {
    font-size: 1em;
    line-height: 1.7;
}

.section ul {
    list-style: disc inside;
    padding-left: 15px;
}

.section ul li {
    margin-bottom: 8px;
}

.two-columns {
    display: flex;
    gap: 30px;
    margin-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.two-columns .column {
    flex: 1;
    min-width: 280px;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Client Logos Carousel */
.client-logos-carousel {
    overflow: hidden; /* Hide overflowing logos */
    position: relative;
    white-space: nowrap; /* Keep all logos in one line */
    padding: 15px 0; /* Ajustar padding para altura adecuada de la imagen de 330px */
    height: 360px; /* **NUEVA ALTURA**: Fija la altura para 330px imágenes + padding */
    display: flex;
    align-items: center; /* Vertically centers the track */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    margin-top: 30px;
}

.carousel-track {
    display: flex;
    align-items: center;
    animation: scroll-logos 40s linear infinite; /* Tiempo de animación se mantiene en 40s */
    width: fit-content;
    height: 100%; /* Ensure track takes full height of its parent */
}

/* Wrapper for each logo to create the uniform white square */
.client-logos-carousel .logo-item {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 350px; /* **NUEVO TAMAÑO**: Fixed width for the square (330px image + 10px padding each side) */
    height: 350px; /* **NUEVO TAMAÑO**: Fixed height for the square (330px image + 10px padding each side) */
    background-color: #ffffff;
    margin: 0 15px; /* Espacio entre cuadros de logos */
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.client-logos-carousel .logo-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.25);
    cursor: pointer;
}

.client-logos-carousel .logo-item img {
    max-width: 330px; /* **NUEVO TAMAÑO**: Set max width to fit 330x330 */
    max-height: 330px; /* **NUEVO TAMAÑO**: Set max height to fit 330x330 */
    object-fit: contain; /* Ensure logo fits without cropping */
    filter: grayscale(80%);
    transition: filter 0.3s ease;
}

.client-logos-carousel .logo-item:hover img {
    filter: grayscale(0%);
}


/* Specific image styling within sections (other than hero, logo, client logos) */
.section img:not(.hero-section img, .logo, .client-logos-carousel .logo-item img) {
    display: block;
    max-width: 40%;
    height: auto;
    margin: 15px auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease-in-out;
}

.section img:not(.hero-section img, .logo, .client-logos-carousel .logo-item img):hover {
    transform: scale(1.03);
}

/* Footer styles */
footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    font-size: 0.85em;
}

footer .container {
    border-top: 1px solid #555;
    padding-top: 15px;
}

footer .matepro-footer-text {
    color: #a02020;
    font-weight: bold;
}

/* Responsive Adjustments (Desktop to Tablet/Small Desktop) */
@media (max-width: 1024px) {
    .main-nav ul li {
        margin: 0 10px;
    }
    .main-nav ul li a {
        font-size: 0.8em;
        padding: 4px 6px;
    }

    /* Adjust carousel for larger logos on tablets */
    .client-logos-carousel {
        height: 280px; /* Altura ajustada para tablet */
        padding: 10px 0;
    }
    .client-logos-carousel .logo-item {
        width: 260px; /* Ajustar item size */
        height: 260px;
        margin: 0 10px;
    }
    .client-logos-carousel .logo-item img {
        max-width: 240px; /* Ajustar logo size within item */
        max-height: 240px;
    }
}

@media (max-width: 850px) {
    .main-nav ul li {
        margin: 0 8px;
    }
    .main-nav ul li a {
        font-size: 0.75em;
        padding: 3px 5px;
    }
    header .logo {
        height: 60px;
    }

    /* Further adjust carousel for smaller tablets */
    .client-logos-carousel {
        height: 180px; /* Altura reducida */
        padding: 8px 0;
    }
    .client-logos-carousel .logo-item {
        width: 160px; /* Tamaño de item ajustado */
        height: 160px;
        margin: 0 8px;
    }
    .client-logos-carousel .logo-item img {
        max-width: 140px; /* Tamaño de logo ajustado */
        max-height: 140px;
    }
}


/* Responsive Adjustments (Mobile Menu) */
@media (max-width: 768px) {
    header .container {
        width: 95%;
        padding: 0 15px;
    }

    header .logo {
        height: 50px;
    }

    .hamburger {
        display: block;
        margin-left: 0;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100%;
        background-color: #fff;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2);
        transition: right 0.3s ease-in-out;
        z-index: 999;
        padding-top: 80px;
        flex-grow: unset;
        display: block;
    }

    .main-nav.is-open {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        flex-wrap: nowrap;
        overflow-x: hidden;
    }

    .main-nav ul li {
        margin: 15px 0;
        width: 100%;
        text-align: center;
    }

    .main-nav ul li a {
        display: block;
        padding: 10px 0;
        font-size: 1.1em;
        color: #a02020;
        white-space: nowrap;
    }

    .main-nav ul li a:hover {
        background-color: #f0f0f0;
    }

    /* General mobile adjustments */
    .section h2 {
        font-size: 1.8em;
    }

    .hero-section h1 {
        font-size: 2em;
    }

    .two-columns {
        flex-direction: column;
    }

    .client-logos-carousel {
        height: 130px; /* Altura ajustada para móvil */
        padding: 5px 0;
    }

    .client-logos-carousel .logo-item {
        width: 120px; /* Tamaño de item ajustado para móvil */
        height: 120px;
        margin: 0 5px;
    }

    .client-logos-carousel .logo-item img {
        max-width: 110px; /* Tamaño de logo ajustado para móvil */
        max-height: 110px;
    }

    .section p, .section ul {
        font-size: 0.95em;
    }

    .section img:not(.hero-section img, .logo, .client-logos-carousel .logo-item img) {
        max-width: 50%;
    }
}

/* Hide desktop menu when hamburger is shown (important for transition) */
@media (max-width: 768px) {
    .main-nav:not(.is-open) {
        display: none;
    }
}

/* Ensure the main-nav is visible on desktop */
@media (min-width: 769px) {
    .main-nav {
        display: flex !important;
    }
    .hamburger {
        display: none !important;
    }
}