:root {
    /* Color Palette derived from logo */
    --primary-dark: #1b365d;
    --primary-medium: #2a5a9e;
    --primary-light: #5d9cec;
    --accent-blue: #9fc5e8;
    --dark-bg: #0f172a;
    
    /* Neutral colors */
    --white: #ffffff;
    --off-white: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #f1f5f9;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
    
    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    /* Scroll Animations */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sectors */
.bg-dark {
    background-color: var(--dark-bg);
}

.text-light {
    color: var(--white);
}

.sectors-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
    text-align: center;
}

.sector-item {
    flex: 1 1 200px;
    max-width: 250px;
}

.sector-item h4 {
    color: var(--white);
    margin-top: var(--space-sm);
}

.sector-client {
    font-size: 0.8rem;
    color: var(--accent-blue);
    margin-top: 0.5rem;
}

.sector-icon {
    font-size: 4rem;
    margin-bottom: var(--space-sm);
    color: var(--primary-light);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Staggered Delays */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

/* Scroll Animations (Entrance & Exit) */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Exit animation: slightly slide up or down when leaving */
.reveal.out-view {
    opacity: 0;
    transform: translateY(-20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--white);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary-dark);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section-padding {
    padding: var(--space-xl) 0;
}

.text-center { text-align: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-medium);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(27, 54, 93, 0.2);
}

.btn-outline {
    border: 2px solid var(--primary-medium);
    color: var(--primary-medium);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--primary-medium);
    color: var(--white);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo-img {
    height: 45px;
    width: auto;
    animation: logoEntrance 1s ease-out forwards;
}

@keyframes logoEntrance {
    from { opacity: 0; transform: scale(0.8) rotate(-5deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

.nav-links {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.nav-links a:not(.btn) {
    font-weight: 500;
    color: var(--primary-dark);
    position: relative;
}

.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-light);
    transition: var(--transition-smooth);
}

.nav-links a:not(.btn):hover::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    z-index: 1001;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    color: var(--white);
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(27, 54, 93, 0.9) 0%, rgba(27, 54, 93, 0.4) 100%);
    z-index: 1;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background-image: url('https://images.unsplash.com/photo-1581092160562-40aa08e78837?auto=format&fit=crop&q=80&w=2070');
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
}

.hero-title {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: var(--space-sm);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
    opacity: 0.9;
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.service-card {
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    text-align: center;
    transition: var(--transition-smooth);
    border-bottom: 4px solid transparent;
}

.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-light);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    color: var(--primary-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 800px;
    margin: var(--space-lg) auto 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    height: 100%;
    width: 2px;
    background: var(--accent-blue);
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: var(--space-lg);
}

.timeline-dot {
    position: absolute;
    left: 11px;
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--primary-medium);
    border: 4px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--accent-blue);
}

/* Contact */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.branch-info h3 {
    color: var(--primary-light);
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
}

.branch-info p {
    margin-bottom: 0.5rem;
    color: var(--text-main);
    line-height: 1.4;
}

.branch-info a {
    color: var(--primary-medium);
    font-weight: 500;
}

.branch-info a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.contact-form .form-group {
    margin-bottom: var(--space-sm);
}

.contact-form input, 
.contact-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    transition: var(--transition-smooth);
}

.contact-form input:focus, 
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-medium);
    box-shadow: 0 0 0 3px rgba(42, 90, 158, 0.1);
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: var(--space-lg) 0;
    text-align: center;
}

.footer-logo {
    height: 40px;
    filter: brightness(0) invert(1);
    margin-bottom: var(--space-sm);
}

/* Loader */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--accent-blue);
    border-top: 5px solid var(--primary-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-links { 
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--white);
        flex-direction: column;
        padding: var(--space-lg) 0;
        gap: var(--space-lg);
        transform: translateX(100%);
        transition: var(--transition-smooth);
        display: flex;
        z-index: 999;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 6px;
        cursor: pointer;
        padding: 5px;
    }

    .mobile-menu-btn span {
        width: 30px;
        height: 3px;
        background-color: var(--primary-dark);
        border-radius: 3px;
        transition: var(--transition-smooth);
    }

    /* Hamburger Animation */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .contact-wrapper { grid-template-columns: 1fr; }
    .hero-title { font-size: 2.5rem; }
    .section-padding { padding: var(--space-lg) 0; }
}

/* --- New Styles for Updated Sections --- */

/* Utility Classes */
.bg-light { background-color: var(--off-white); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* About & Value Prop Grids */
.about-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
}

.about-card {
    flex: 1 1 300px; /* Base width of 300px */
    max-width: 450px; /* Don't grow too wide */
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-top: 4px solid var(--primary-medium);
}

.highlight-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
    margin: var(--space-xs) 0;
}

.geo-list {
    margin-top: var(--space-sm);
}

.geo-list li {
    margin-bottom: var(--space-xs);
    position: relative;
    padding-left: 20px;
}

.geo-list li::before {
    content: '📍';
    position: absolute;
    left: 0;
    font-size: 0.9rem;
}

.value-prop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
}

.value-card {
    text-align: center;
    padding: var(--space-md);
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: var(--transition-smooth);
}

.value-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.value-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    color: var(--primary-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

/* Tabs Component */
.tabs-container {
    display: flex;
    flex-direction: column;
    margin-top: var(--space-md);
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
}

@media (min-width: 768px) {
    .tabs-container {
        flex-direction: row;
        min-height: 400px;
    }
}

.tabs-sidebar {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    background: var(--dark-bg);
}

@media (min-width: 768px) {
    .tabs-sidebar {
        flex-direction: column;
        width: 300px;
        flex-shrink: 0;
    }
}

.tab-btn {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .tab-btn {
        border-bottom: none;
        border-left: 4px solid transparent;
        padding: var(--space-md);
        white-space: normal;
    }
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.tab-btn.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 767px) {
    .tab-btn.active { border-bottom-color: var(--primary-light); }
}

@media (min-width: 768px) {
    .tab-btn.active { border-left-color: var(--primary-light); }
}

.tabs-content {
    padding: var(--space-md);
    flex-grow: 1;
    background: var(--off-white);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.tab-pane.active {
    display: block;
}

.service-list {
    margin-top: var(--space-sm);
    padding-left: var(--space-md);
}

.service-list li {
    margin-bottom: var(--space-xs);
    position: relative;
    list-style-type: disc;
    color: var(--text-main);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Marquee Carousel */
.overflow-hidden {
    overflow: hidden;
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
}

.marquee-container::before,
.marquee-container::after {
    content: '';
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 2;
}

.marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--white) 0%, transparent 100%);
}

.marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--white) 0%, transparent 100%);
}

.marquee-content {
    display: inline-flex;
    animation: marquee 30s linear infinite;
}

.marquee-content:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } 
}

.client-logo {
    display: inline-block;
    height: 80px; /* Fixed height for consistency */
    width: auto;
    object-fit: contain;
    margin: 0 var(--space-md);
    background: var(--white);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
    filter: grayscale(100%) opacity(0.7); /* Professional blend-in */
    transition: var(--transition-smooth);
}

.client-logo:hover {
    filter: grayscale(0%) opacity(1); /* Color on hover */
    transform: scale(1.05);
}

/* Proyectos Recientes Section */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.project-card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.project-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 66.66%; /* 3:2 aspect ratio */
    overflow: hidden;
    background-color: var(--off-white);
}

.project-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.project-card:hover .project-img {
    transform: scale(1.05);
}

.project-content {
    padding: var(--space-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-date {
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-title {
    font-size: 1.25rem;
    color: var(--primary-dark);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}

.project-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.project-tag {
    font-size: 0.75rem;
    background-color: var(--off-white);
    color: var(--primary-medium);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* --- Modal Styles --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 10000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto; 
    padding: var(--space-md);
    border: 1px solid #888;
    width: 90%; 
    max-width: 800px;
    border-radius: var(--radius-md);
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.close-btn {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-btn:hover,
.close-btn:focus {
    color: var(--primary-dark);
    text-decoration: none;
}

.modal-header {
    border-bottom: 1px solid var(--off-white);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-client-logo {
    height: 40px;
    max-width: calc(100% - 48px); /* leave room for the close button */
    object-fit: contain;
    object-position: left center;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.carousel-container {
    position: relative;
    width: 100%;
    height: min(440px, 60vh);
    background-color: var(--dark-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* contain: vertical and horizontal photos show complete, without cropping */
.carousel-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.7);
    color: var(--white);
    font-size: 0.8rem;
    padding: 2px 10px;
    border-radius: 999px;
}

.carousel-container.single .carousel-btn,
.carousel-container.single .carousel-counter {
    display: none;
}

/* Clients without a logo file show their name as the logo */
.logo-text {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
}

.client-logo-large.logo-text {
    font-size: 2rem;
    line-height: 1.15;
    width: 80%;
}

.modal-client-logo.logo-text {
    font-size: 1.4rem;
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.7);
    color: var(--white);
    padding: var(--space-sm);
    text-align: center;
}

.carousel-caption h4 {
    color: var(--primary-light);
    margin-bottom: 0.2rem;
    font-size: 1rem;
}

.carousel-caption p {
    font-size: 0.85rem;
    margin: 0;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
}

.carousel-btn:hover {
    background: var(--white);
    color: var(--primary-dark);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.project-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-sm);
}

.project-list-table th, .project-list-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9rem;
}

.project-list-table th {
    background-color: var(--primary-dark);
    color: var(--white);
    font-weight: 600;
}

.project-list-table tr:nth-child(even) {
    background-color: var(--off-white);
}

/* Client Card additions */
.client-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg) var(--space-md);
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: var(--transition-smooth);
}

.client-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.client-card .client-logo-large {
    height: 80px;
    max-width: 80%;
    object-fit: contain;
    margin-bottom: var(--space-sm);
    filter: grayscale(100%) opacity(0.8);
    transition: var(--transition-smooth);
}

.client-card:hover .client-logo-large {
    filter: grayscale(0%) opacity(1);
}

.client-card h3 {
    text-align: center;
    margin-top: var(--space-sm);
    font-size: 1.1rem;
    color: var(--primary-dark);
}
