:root {
    /* Theme Variables - Dark (Default) */
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-header: rgba(15, 23, 42, 0.95);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --border-color: rgba(255, 255, 255, 0.05);
    --nav-hover: #38bdf8;
    --hero-gradient: linear-gradient(rgba(10, 38, 71, 0.7), rgba(10, 38, 71, 0.8));

    /* Functional Colors */
    --primary-btn: #add8ec;
    --primary-btn-hover: #a9d9f1;
    --primary-btn-text: #ffffff;
    --white: #ffffff;
    --logo-filter: brightness(0) invert(1);

    /* Spacing */
    --container-width: 1200px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #0284c7;
    --accent-glow: rgba(2, 132, 199, 0.1);
    --border-color: rgba(0, 0, 0, 0.1);
    --nav-hover: #0ea5e9;
    --hero-gradient: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.8));
    --primary-btn: #0284c7;
    --primary-btn-hover: #0369a1;
    --logo-filter: none;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Core Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

section {
    padding: var(--spacing-xl) 0;
}

/* Typography Helpers */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 700;
}

h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.section-title {
    text-align: center;
}

.section-subtitle {
    text-align: center;
    max-width: 600px;
    margin: 0 auto var(--spacing-lg);
    font-size: 1.1rem;
}

.highlight {
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-btn);
    color: var(--primary-btn-text);
    box-shadow: 0 4px 15px var(--accent-glow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background-color: var(--primary-btn-hover);
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    margin-left: 1rem;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s, border-color 0.3s;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100px;
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: 1px;
}

.header-logo {
    height: 270px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo .accent {
    color: var(--accent);
}

.logo-light {
    display: none;
}

.logo-dark {
    display: block;
}

[data-theme="light"] .logo-light {
    display: block;
}

[data-theme="light"] .logo-dark {
    display: none;
}

.main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.main-nav a:not(.btn) {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: var(--nav-hover);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.theme-toggle:hover {
    color: var(--accent);
    background: var(--border-color);
}

.theme-toggle .icon-light {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-dark {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-light {
    display: block;
}


/* Hero Section */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 100px;
    /* offset header */
    background: var(--hero-gradient), url('../assets/humedales_barrios-privados.jpeg');
    background-size: cover;
    background-position: center;
    animation: hero-bg-cycle 24s infinite;
}

@keyframes hero-bg-cycle {

    0%,
    33.32% {
        background: var(--hero-gradient), url('../assets/humedales_barrios-privados.jpeg');
        background-size: cover;
        background-position: center;
    }

    33.33%,
    66.65% {
        background: var(--hero-gradient), url('../assets/flood.jpeg');
        background-size: cover;
        background-position: center;
    }

    66.66%,
    100% {
        background: var(--hero-gradient), url('../assets/flood1.jpeg');
        background-size: cover;
        background-position: center;
    }
}

.hero-content {
    max-width: 800px;
    position: relative;
    z-index: 10;
}

.hero-lead {
    font-size: 1.25rem;
    max-width: 600px;
    margin-bottom: var(--spacing-md);
}

/* Value Props */
.value-prop {
    padding: var(--spacing-md) 0;
    margin-top: -50px;
    /* Overlap hero */
}

.value-prop .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.value-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, border-color 0.3s;
}

.value-card h3 {
    color: var(--accent);
    margin-bottom: 1rem;
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.service-card {
    background: var(--bg-card);
    padding: 0;
    padding-bottom: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, border-color 0.3s, background 0.3s;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    background: var(--bg-card);
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.service-card:hover .card-image img {
    transform: scale(1.1);
}

.service-card h3,
.service-card p {
    padding: 0 2rem;
}

.service-card h3 {
    margin-top: 1rem;
}

.service-list {
    margin-top: 1.5rem;
    padding: 0 2rem;
    list-style: none;
    color: var(--text-secondary);
}

.service-list li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.service-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

/* Methodology */
.timeline {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bg-card);
}

.step {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    position: relative;
}

.step-number {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-body);
    border: 2px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    z-index: 5;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.step-result {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--accent);
    font-style: italic;
    opacity: 0.9;
}

.step-result::before {
    content: "→ Resultado: ";
    font-weight: 600;
    font-style: normal;
}

/* Contact */
.contact-container {
    background: var(--bg-card);
    padding: 4rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.contact-links {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-btn {
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s;
}

.contact-btn.whatsapp {
    background-color: #25D366;
    color: white;
}

.contact-btn.email {
    background-color: var(--text-primary);
    color: var(--bg-body);
}

.contact-btn:hover {
    transform: scale(1.05);
}

/* Footer */
.site-footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Contact Page Styles */
.contact-page {
    padding-top: 151px;
    min-height: 80vh;
}

.contact-header {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.contact-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--spacing-lg);
    align-items: start;
}

.contact-form-container {
    background: var(--bg-card);
    padding: 3.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.contact-form-container:hover {
    transform: translateY(-5px);
}

.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 14px 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .contact-form input,
[data-theme="light"] .contact-form textarea {
    background: rgba(0, 0, 0, 0.02);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-response {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    display: none;
}

.form-response.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-response.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-block {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    padding: 14px;
}

.contact-info .info-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 120px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.info-card h4 {
    margin-bottom: 1rem;
}

.info-links {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: color 0.3s;
}

.info-link:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.info-links .contact-btn.whatsapp {
    margin-bottom: 0.5rem;
    justify-content: center;
}

/* Existing Mobile Responsive updates */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-form-container {
        padding: 2rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .hero {
        padding-top: 140px;
        /* Increased padding to account for taller header */
        text-align: center;
    }

    .hero-actions {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .btn-outline {
        margin-left: 0;
    }

    /* Header & Nav Adjustments for Mobile */
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }

    .main-nav {
        width: 100%;
        margin-top: 1rem;
    }

    .main-nav ul {
        display: flex;
        /* Force display flex to override simpler rules */
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        padding: 0;
    }

    .site-header {
        position: relative;
        /* Change from fixed to relative on mobile to avoid covering content if it gets too tall, or keep fixed but ensure hero padding is huge */
        /* Keeping fixed but increasing hero padding is better for UX, usually. 
           However, a stacked menu is tall. Let's start with relative position for mobile so it pushes content down naturally 
           instead of floating over it and obscuring the hero. */
        position: relative;
    }

    .hero {
        min-height: auto;
        /* Allow natural height */
        padding-top: 4rem;
        /* Standard padding since header is relative now */
    }

    .contact-container {
        padding: 2rem;
    }
}

/* Team Styles */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: 800px;
    margin: 0 auto 5rem;
}

.team-card {
    text-align: center;
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.team-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.team-image {
    width: 160px;
    height: 160px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.team-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.team-card:hover .team-image img {
    transform: scale(1.1);
}

.team-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.team-card p {
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .team-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    animation: pulse-whatsapp 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: #20ba5a;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    color: #FFF;
}

.whatsapp-icon {
    width: 35px;
    height: 35px;
    fill: currentColor;
}

@keyframes pulse-whatsapp {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .whatsapp-icon {
        width: 28px;
        height: 28px;
    }
}