/* Variables */
:root {
    --primary-color: #0F3B2E; /* Dark Green Montefino */
    --secondary-color: #6c757d; /* Grey */
    --text-color: #333333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Roboto', sans-serif;
    
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--white);
}

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

ul {
    list-style: none;
}

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

/* Utilities */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.section-padding {
    padding: 80px 0;
}

.bg-light {
    background-color: var(--light-bg);
}

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

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    margin-top: 10px;
}

.text-center .section-title::after {
    margin: 10px auto 0;
}

.section-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #555;
    text-align: justify;
    text-justify: inter-word; /* Mejora la distribución de espacios */
    hyphens: auto; /* Divide palabras con guiones si es necesario para evitar "ríos" */
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

/* Header - Floating Glassmorphism Pill Style */
.header {
    position: fixed;
    top: -150px; /* Fully hidden above viewport with extra buffer */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1100px;
    z-index: 1000;
    background: rgba(140, 140, 140, 0.45);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 40px;
    /* Symmetric smooth transition for entry and exit */
    transition: top 0.6s ease-in-out, 
                opacity 0.6s ease-in-out, 
                background 0.3s ease, 
                padding 0.3s ease,
                visibility 0s linear 0.6s; /* Delay visibility:hidden until after opacity transition */
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    opacity: 0;
    visibility: hidden;
}

/* Ensure header stays consistent on scroll, maybe slightly darker/smaller */
.header.scrolled {
    top: 25px; /* Slide down into view, slightly lower */
    opacity: 1;
    visibility: visible;
    background: rgba(120, 120, 120, 0.65); /* Darker grey on scroll */
    padding: 12px 35px; /* Slightly reduced padding on scroll but still substantial */
    width: 95%; /* Slightly wider on scroll if desired, or keep same */
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    /* Immediate visibility when showing */
    transition: top 0.6s ease-in-out, 
                opacity 0.6s ease-in-out, 
                background 0.3s ease, 
                padding 0.3s ease,
                visibility 0s linear 0s;
}

/* On mobile, full width might be better, or keep pill but smaller */
.header.menu-open {
    border-radius: 20px; /* Less rounded when menu opens */
    background: #121212; /* Solid dark */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo img {
    height: 45px; /* Increased size for bigger header */
    width: auto;
    filter: brightness(0) invert(1); /* Make logo white for dark header */
}

/* Specific styling for the Habitia-like nav */
.nav-menu ul {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav-menu a {
    font-family: var(--font-heading);
    font-weight: 700; /* Bold */
    font-size: 1.0rem; /* Increased size */
    color: #e0e0e0; /* Light grey text */
    text-transform: capitalize; /* Habitia uses sentence case/capitalize, not all caps */
    letter-spacing: 0.5px; /* Slightly increased spacing for readability */
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

/* Hover Effect - Montefino Green highlight */
.nav-menu a:hover {
    color: #4cd1a3; /* Bright Montefino Green (approximated from reference glow) */
    background: rgba(255, 255, 255, 0.05); /* Subtle hover background */
    text-shadow: 0 0 10px rgba(76, 209, 163, 0.4); /* Green glow */
}

/* Active State (optional) */
.nav-menu a.active {
    color: #4cd1a3;
}

/* Remove old scroll overrides */
.header.scrolled .nav-menu a {
    color: #e0e0e0;
}
.header.scrolled .nav-menu a:hover {
    color: #4cd1a3;
}

/* Mobile Menu */
.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--white);
    transition: var(--transition);
}
.header.scrolled .hamburger span {
    background-color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: transparent; /* Remove fallback to ensure image shows */
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0; /* Hidden initially */
    animation: fadeInBg 1.5s ease-out forwards; /* Slow fade in for background */
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Removed object-position to default center/cover or let the image dictate */
    display: block; /* Ensure it's not hidden */
}

.hero-content {
    z-index: 1;
    text-align: center;
    padding-top: 0; /* Centered vertically, no offset needed */
    width: 100%;
    display: flex;
    justify-content: center;
}

.main-logo {
    max-width: 950px; /* Significantly increased size */
    width: 90%; /* Occupy almost full width on smaller screens */
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1)); /* Subtle depth */
    opacity: 0; /* Hidden initially */
    transform: translateY(30px); /* Start slightly down */
    animation: fadeInUpLogo 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.5s; /* Smooth slide up with delay */
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scroll Animation Classes */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

/* Staggered delay for children if needed */
.fade-in-section .col-text {
    transition-delay: 0.1s;
}
.fade-in-section .col-img {
    transition-delay: 0.3s;
}

/* Keyframes for Hero Animations */
@keyframes fadeInBg {
    from { opacity: 0; transform: scale(1.05); }
    to { opacity: 1; transform: scale(1); }
}

/* Grid/Flex Layouts */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

/* Vision Section */
#vision {
    background-image: url('../img/vision-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#vision::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* 50% opacity white overlay */
    z-index: 0;
}

#vision .container {
    position: relative;
    z-index: 1;
}

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

/* Mision Section */
#mision {
    background-image: url('../img/mision-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Ensure text is readable on top of background image if needed */
/* Removing overlay to let background image show fully as requested */
#mision::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* 50% opacity white overlay */
    z-index: 0;
}

#mision .container {
    position: relative;
    z-index: 1;
}

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

.col-text, .col-img {
    flex: 1;
    min-width: 300px;
}

.img-wrapper {
    overflow: hidden;
    /* No border radius for strict corporate look, maybe slight shadow */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.img-wrapper img {
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
}

.img-wrapper:hover img {
    transform: scale(1.02);
}

/* Valores Section */
#valores {
    background-image: url('../img/valores-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#valores::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* 50% opacity white overlay */
    z-index: 0;
}

#valores .container {
    position: relative;
    z-index: 1;
}

.valores-bg-texture {
    /* Deprecated in favor of section background image */
    display: none;
}

.values-list-container {
    padding-right: 20px;
}

.values-list li {
    font-family: var(--font-heading);
    font-size: 1.8rem; /* Large text */
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    opacity: 0.6;
    transition: var(--transition);
    cursor: default;
}

.values-list li:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: translateX(10px);
}

/* Servicios Grid removed */

/* Contacto Section */
.contacto-section {
    background-image: url('../img/contacto-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    color: #fff; /* Ensure text is light on dark overlay */
}

.contacto-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* 50% opacity white overlay */
    z-index: 0;
}

.contacto-section .container {
    position: relative;
    z-index: 1;
}

/* Override text color if needed due to overlay */
.contacto-section .section-title, 
.contacto-section .contact-item,
.contacto-section .address-footer p {
    color: inherit; /* Inherit from body or specific styles */
}

.contact-info-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.contact-item {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-item a {
    color: var(--primary-color);
    font-weight: 600;
}

.map-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background: #f0f0f0; /* Placeholder color while loading */
    border-radius: 10px; /* Optional: Rounded corners */
}

.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.address-footer {
    font-size: 1rem;
    color: #666;
    margin-top: 20px;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 20px 0;
    text-align: center;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        background-color: var(--primary-color); /* Solid bg on mobile */
        padding: 15px 0;
    }
    
    .hamburger {
        display: block;
    }

    .nav-menu ul {
        position: fixed;
        top: 70px; /* Height of header */
        left: -100%;
        flex-direction: column;
        background-color: var(--primary-color);
        width: 100%;
        text-align: center;
        padding: 20px 0;
        transition: 0.3s;
    }

    .nav-menu ul.active {
        left: 0;
    }

    .reverse-mobile {
        flex-direction: column-reverse;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .values-list li {
        font-size: 1.4rem;
    }
}
