/* ==========================================================================
   CSS Variables & Typography Design System
   ========================================================================== */
:root {
    /* Colors - Premium, minimal, natural */
    --color-bg-main: #FFFFFF;
    --color-bg-alt: #F5F5F4; /* Blanco roto / Piedra muy claro */
    --color-text-main: #1C1C1C; /* Negro suave / Antracita */
    --color-text-muted: #5C5C5C; /* Gris medio */
    --color-accent: #DCD7C9; /* Tierra / Arena claro sutil (para detalles constructivos) */
    --color-accent-dark: #C4BCA8; /* Variante oscura del acento */
    --color-white: #FFFFFF;
    --color-border: #E5E5E5;

    /* Typography */
    --font-primary: 'Inter', sans-serif;
    
    /* Font Sizes - Modular Scale */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-md: 1.125rem;    /* 18px */
    --text-lg: 1.25rem;     /* 20px */
    --text-xl: 1.5rem;      /* 24px */
    --text-2xl: 2rem;       /* 32px */
    --text-3xl: 2.5rem;     /* 40px */
    --text-4xl: 3.5rem;     /* 56px */
    --text-5xl: 4.5rem;     /* 72px */

    /* Spacing */
    --space-sm: 1rem;       /* 16px */
    --space-md: 2rem;       /* 32px */
    --space-lg: 4rem;       /* 64px */
    --space-xl: 8rem;       /* 128px */
    --space-xxl: 12rem;     /* 192px */

    /* Layout */
    --container-width: 1200px;
    --header-height: 90px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth; /* Smooth scroll natively for anchor links */
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text-main);
    background-color: var(--color-bg-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em; /* Tighter letter spacing for contemporary feel */
    margin-bottom: var(--space-sm);
}

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

ul, ol {
    list-style: none;
}

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

/* ==========================================================================
   Utility Classes & Layout
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

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

.section-label {
    display: block;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    position: relative;
    padding-left: 2rem;
}

.section-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1.2rem;
    height: 1px;
    background-color: var(--color-text-muted);
}

.section-title {
    font-size: var(--text-3xl);
    max-width: 800px;
    margin-bottom: var(--space-md);
}

.section-desc {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 700px;
    font-weight: 300;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    transition: var(--transition-smooth);
    /* Square/very slightly rounded buttons for an architectural feel */
    border-radius: 2px;
}

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

.btn-primary:hover {
    background-color: var(--color-text-muted);
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid var(--color-text-main);
    color: var(--color-text-main);
}

.btn-outline:hover {
    background-color: var(--color-text-main);
    color: var(--color-white);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background-color: rgba(255, 255, 255, 0); /* Transparent by default */
    z-index: 100;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
}

.header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    height: 70px; /* Slight shrink on scroll */
}

/* Let's invert header text when at top if hero image is dark */
.header:not(.scrolled) {
    color: var(--color-white);
}

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

.logo {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: var(--text-base);
    font-weight: 600;
    letter-spacing: 0.15em;
    line-height: 1;
}

.logo-desc {
    font-size: var(--text-xs);
    font-weight: 300;
    letter-spacing: 0.05em;
    color: inherit;
    opacity: 0.7;
    margin-top: 4px;
}

.main-nav {
    display: flex;
}

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

.nav-link {
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: currentColor;
    transition: var(--transition-smooth);
}

.nav-link:hover::after {
    width: 100%;
}

.btn-contact-nav {
    border: 1px solid currentColor;
    padding: 0.5rem 1rem;
    border-radius: 2px;
}
.btn-contact-nav::after { display: none; }
.btn-contact-nav:hover {
    background-color: currentColor;
    color: var(--color-bg-main) !important;
}
.header:not(.scrolled) .btn-contact-nav:hover {
    background-color: var(--color-white);
    color: var(--color-text-main) !important;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 20px;
    position: relative;
    z-index: 101;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center; /* Center content vertically */
    position: relative;
    padding-top: var(--header-height); /* Offset for header */
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Subtle zoom effect for premium feel */
    animation: slowZoom 20s ease-out infinite alternate;
}

@keyframes slowZoom {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Gradient overlay for better text readability */
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.3) 0%,
        rgba(0,0,0,0.5) 100%
    );
}

.hero-content {
    color: var(--color-white);
    max-width: 800px;
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: 300;
    margin-bottom: var(--space-md);
}

.hero-subtitle {
    font-size: var(--text-xl);
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: var(--space-md);
    max-width: 600px;
}

.hero-ctas {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* Hero primary button override to match dark background */
.hero-ctas .btn-primary {
    background-color: var(--color-white);
    color: var(--color-text-main);
}
.hero-ctas .btn-primary:hover {
    background-color: rgba(255,255,255,0.8);
}
.hero-ctas .btn-outline {
    border-color: var(--color-white);
    color: var(--color-white);
}
.hero-ctas .btn-outline:hover {
    background-color: var(--color-white);
    color: var(--color-text-main);
}

/* ==========================================================================
   Animations & Reveal Classes
   ========================================================================== */
.reveal-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-text {
    opacity: 0;
    transform: translateY(20px);
    animation: revealText 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes revealText {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

/* ==========================================================================
   Responsive Styles
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --text-4xl: 2.5rem;
        --text-5xl: 3.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --text-3xl: 2rem;
        --text-5xl: 2.5rem;
        --space-xl: 4rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .menu-icon,
    .menu-icon::before,
    .menu-icon::after {
        content: '';
        display: block;
        width: 100%;
        height: 2px;
        background-color: currentColor;
        position: absolute;
        transition: var(--transition-fast);
    }
    .menu-icon { top: 9px; }
    .menu-icon::before { top: -8px; }
    .menu-icon::after { top: 8px; }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background-color: var(--color-bg-main);
        color: var(--color-text-main);
        padding: var(--space-xl) var(--space-md);
        transition: var(--transition-smooth);
        box-shadow: -5px 0 30px rgba(0,0,0,0.1);
    }
    
    .main-nav.is-open {
        right: 0;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .hero-ctas {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}

/* ==========================================================================
   Helper Classes
   ========================================================================== */
.bg-alt { background-color: var(--color-bg-alt); }
.text-center { text-align: center; }
.center-label { padding-left: 0; display: inline-block; }
.center-label::before { display: none; }
.mt-s { margin-top: var(--space-sm); }
.mt-m { margin-top: var(--space-md); }
.mt-l { margin-top: var(--space-lg); }
.mx-auto { margin-left: auto; margin-right: auto; }
.d-flex { display: flex; flex-wrap: wrap; gap: var(--space-xl); align-items: center; }

/* ==========================================================================
   Sección: Estudio
   ========================================================================== */
.section-estudio {
    padding-top: var(--space-xxl);
}

.estudio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .estudio-grid {
        grid-template-columns: 7fr 5fr;
        align-items: center;
    }
}

/* ==========================================================================
   Sección: Visión
   ========================================================================== */
.vision-img-col {
    flex: 1 1 400px;
}
.vision-text-col {
    flex: 1 1 400px;
}

.vision-img {
    aspect-ratio: 4/5;
    object-fit: cover;
}

/* ==========================================================================
   Sección: Servicios
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl) var(--space-md);
    margin-top: var(--space-xl);
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.service-card {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-md);
    transition: var(--transition-smooth);
}

.service-card:hover {
    border-color: var(--color-text-main);
}

.service-icon {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.service-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-s);
}

.service-desc {
    color: var(--color-text-muted);
}

/* ==========================================================================
   Sección: Proyectos
   ========================================================================== */
.proyectos-header {
    margin-bottom: var(--space-xl);
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        /* Offset layout for editorial feel */
        gap: var(--space-lg);
    }
    .projects-grid .project-card:nth-child(even) {
        transform: translateY(var(--space-xl));
    }
    .section-proyectos {
        padding-bottom: calc(var(--space-xl) * 2); /* Extra space for offset grid */
    }
}

.project-card {
    display: block;
}

.project-img-wrapper {
    overflow: hidden;
    aspect-ratio: 4/3;
    margin-bottom: var(--space-sm);
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

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

.project-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid transparent;
    transition: var(--transition-fast);
    padding-bottom: 4px;
}

.project-card:hover .project-info {
    border-color: var(--color-text-main);
}

.project-name {
    font-size: var(--text-lg);
    margin: 0;
}

.project-category {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   Sección: Valores
   ========================================================================== */
.valores-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl) var(--space-md);
}

@media (min-width: 768px) {
    .valores-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.valor-num {
    font-size: var(--text-3xl);
    font-weight: 300;
    color: var(--color-accent-dark);
    margin-bottom: var(--space-sm);
    line-height: 1;
}

.valor-title {
    font-size: var(--text-lg);
}

.valor-desc {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* ==========================================================================
   Sección: Proceso
   ========================================================================== */
.process-flex {
    align-items: flex-start;
}

.process-text {
    flex: 1 1 300px;
}

@media (min-width: 768px) {
    .process-text {
        position: sticky;
        top: calc(var(--header-height) + var(--space-md));
    }
}

.process-steps {
    flex: 2 1 500px;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.process-step {
    border-left: 1px solid var(--color-border);
    padding-left: var(--space-md);
    position: relative;
}

.process-step::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 8px;
    width: 7px;
    height: 7px;
    background-color: var(--color-text-main);
    border-radius: 50%; /* Tiny circle for timeline, exception to the square rule */
}

.step-title {
    font-size: var(--text-xl);
}

.step-desc {
    color: var(--color-text-muted);
}

/* ==========================================================================
   Sección: Contacto
   ========================================================================== */
.contact-flex {
    align-items: flex-start;
}

.contacto-text {
    flex: 1 1 400px;
}

.contacto-info {
    flex: 1 1 300px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.contact-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.contact-link {
    font-size: var(--text-xl);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.contact-link:hover {
    color: var(--color-text-muted);
}

.contact-text {
    font-size: var(--text-lg);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background-color: var(--color-text-main);
    color: var(--color-white);
    padding: var(--space-md) 0;
    font-size: var(--text-xs);
    text-align: center;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   Lightbox (Image Popup)
   ========================================================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: var(--color-accent);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.lightbox-nav:hover {
    background: rgba(0,0,0,0.6);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}
