/* ========================================
   OECSA WEBSITE - MAIN STYLES
   ======================================== */

/* ==========================================
   IMAGE SAFETY — Reglas universales para que
   NINGUNA imagen rompa el layout o se distorsione,
   sin importar el tamaño/proporción de archivo subido.

   Estrategia:
   1. Todas las <img> sin object-fit explícito → contain (NO se estiran)
   2. Todas las <img> dentro de aspect-ratio containers → cover
   3. Backgrounds con url() → cover + center + no-repeat
   4. Logos: contain (preservan proporción, no rellenan)
   5. Fotos en cards/grids: cover (recortan pero no deforman)
   ========================================== */

/* Base universal: ninguna imagen excede su contenedor ni se estira */
img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    display: block;
    object-fit: contain;            /* default seguro: NO deforma */
    object-position: center;
    vertical-align: middle;
    -webkit-user-drag: none;
}

/* Si la <img> tiene object-fit/style inline, respeta el del autor */
img[style*="object-fit"] { object-fit: revert; }
img[style*="object-fit: cover"]   { object-fit: cover !important; }
img[style*="object-fit: contain"] { object-fit: contain !important; }
img[style*="object-fit:cover"]    { object-fit: cover !important; }
img[style*="object-fit:contain"]  { object-fit: contain !important; }

/* Backgrounds con imagen → siempre cover, centrado y sin repetir */
[style*="background:"][style*="url("],
[style*="background-image:"],
[style*="background-image :"],
.hero-slideshow .slide {
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

/* Logos institucionales (navbar, footer, login, 404, admin)
   → contain absoluto, nunca se estiran */
.top-nav-logo img,
.a-side-logo img,
footer img,
.footer-section img {
    object-fit: contain !important;
    object-position: center;
    max-width: 100%;
    max-height: 100%;
    width: auto;
}

/* Cards: la imagen interna nunca se desborda */
.card img { max-width: 100%; max-height: 100%; }

/* Logos de servicios en home: tarjetas blancas — contain preserva forma */
.service-card img {
    object-fit: contain !important;
    max-height: 80px;
}

/* Slides del hero principal: el contenedor tiene tamaño, el bg cubre */
.hero-slideshow .slide { background-size: cover; background-position: center; }

/* Imágenes circulares (avatares, premios) → cover para llenar el círculo */
img[style*="border-radius: 50%"],
img[style*="border-radius:50%"] {
    object-fit: cover !important;
}

/* Galería de obra del detalle de proyecto: cada celda es un cuadrado/4:3
   que carga la imagen como background → cover ya está aplicado arriba */

/* Loader inicial (200k.png en footer) — preservar proporción */
#load-text { object-fit: contain; max-width: 90vw; }



:root {
    --oecsa-green: #BCD02E;
    --oecsa-gray: #A7ADA1;
    --oecsa-light-bg: #fbfcfb;
    --oecsa-border: #eaede6;
    --white: #ffffff;
    --text-main: #2b2b2b;
    --text-muted: #737c6f;
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 15px 40px rgba(0, 0, 0, 0.06);
    --nav-height: 88px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--white);
    color: var(--text-main);
    font-weight: 300;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ==========================================
   TOP FIXED NAVBAR
   ========================================== */
.top-nav {
    position: fixed;
    top: 15px;
    left: 20px;
    right: 20px;
    z-index: 5000;
    height: var(--nav-height);
    /* Fondo verde; el blanco lo aplica directamente .top-nav-logo */
    background: rgba(188, 208, 46, 0.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.2);
    border-top: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
}

.top-nav.scrolled {
    top: 8px;
    background: rgba(188, 208, 46, 0.45);
}

.top-nav.scrolled:hover {
    background: rgba(188, 208, 46, 0.85);
}

.top-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

.top-nav-logo {
    height: 100%;
    width: 180px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    transition: background 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.top-nav.scrolled .top-nav-logo {
    background: rgba(255, 255, 255, 0.98);
}

.top-nav-logo img {
    height: 75px; /* Logo más grande */
    display: block;
    object-fit: contain;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    padding: 0 20px;
}

.top-nav-links .nav-link {
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    height: auto;
    width: auto;
    border: none;
}

.top-nav.scrolled .top-nav-links .nav-link {
    color: white;
}

.top-nav-links .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white !important;
}

.btn-nav-admin {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--oecsa-green);
    background: white; /* Contraste total: Blanco sobre Verde */
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 40px;
    border: 1px solid white;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-nav-admin:hover {
    background: transparent;
    color: white;
}

.top-nav.scrolled .btn-nav-admin {
    background: white;
    color: var(--oecsa-green);
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: white;
    cursor: pointer;
    padding: 8px;
}

.top-nav.scrolled .nav-hamburger {
    color: var(--text-main);
}

.top-nav-mobile {
    display: none;
    flex-direction: column;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--oecsa-border);
    padding: 16px 32px 24px;
    gap: 4px;
}

.top-nav-mobile.open {
    display: flex;
}

.top-nav-mobile .nav-link {
    font-size: 1rem;
    color: var(--text-main);
    padding: 12px 8px;
    border-bottom: 1px solid var(--oecsa-border);
    display: block;
    height: auto;
    width: auto;
    border-radius: 0;
    text-decoration: none;
}

.top-nav-mobile .nav-link::after {
    display: none;
}

/* ==========================================
   SNAP SCROLL CONTAINER
   ========================================== */
.snap-container {
    height: 100vh;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;  
    scrollbar-width: none;
    padding-top: var(--nav-height); /* Compensar el navbar fijo */
}

.snap-container::-webkit-scrollbar {
    display: none;
}

.snap-section {
    min-height: calc(100vh - var(--nav-height));
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    position: relative;
    padding: 60px 8%;
}

/* First snap section (hero/video) should still be full height */
.snap-section.hero-full {
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    margin-top: calc(-1 * var(--nav-height)); /* Pull up to fill screen */
}

/* ==========================================
   TYPOGRAPHY & LAYOUT
   ========================================== */
h1, h2, h3, h4 {
    font-weight: 300;
    color: var(--text-main);
    line-height: 1.1;
    text-align: center;
}

h1 {
    font-size: clamp(3.5rem, 6vw, 5rem);
    letter-spacing: -2px;
    margin-bottom: 40px;
}

h2 {
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
    letter-spacing: -1px;
    margin-bottom: 35px;
    line-height: 1.2;
}

h3 {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 12px;
}

p {
    color: var(--text-muted);
}

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

/* ==========================================
   CARDS & UI ELEMENTS
   ========================================== */
.card {
    background: var(--white);
    border: 1px solid var(--oecsa-border);
    border-radius: 8px;
    padding: 50px 40px;
    box-shadow: var(--shadow-sm);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
    border-color: var(--oecsa-green);
}

/* Entrance animations */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Light beam effect — overflow:hidden está en el wrapper div (inyectado por JS)
   El h1/h2 interior NO tiene overflow:hidden, así los acentos (á,é,ó,ú,ñ) nunca se cortan */
.beam-text {
    position: relative;
    display: block;
    overflow: hidden;
}

.beam-text::after {
    content: "";
    position: absolute;
    top: 0; 
    left: -150%;
    width: 100%; 
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent 0%, 
        rgba(188, 208, 46, 0.2) 30%, 
        rgba(188, 208, 46, 0.8) 50%, 
        rgba(188, 208, 46, 0.2) 70%, 
        transparent 100%
    );
    transform: skewX(-25deg);
    pointer-events: none;
    z-index: 10;
}

.beam-text.visible::after {
    animation: beamSweep 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.5s;
}

@keyframes beamSweep {
    0% { left: -150%; }
    100% { left: 150%; }
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--oecsa-green);
    color: var(--white);
    padding: 16px 36px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 40px;
    border: 1px solid var(--oecsa-green);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--white);
    color: var(--oecsa-green);
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
    border: 1px solid var(--oecsa-border);
    border-radius: 50%;
    margin-bottom: 24px;
    color: var(--oecsa-green);
    font-size: 1.5rem;
    transition: 0.4s ease;
}

.card:hover .icon-wrapper {
    background-color: var(--oecsa-green);
    color: var(--white);
    border-color: var(--oecsa-green);
}

/* ==========================================
   NAMED RESPONSIVE GRID CLASSES
   These classes define grid layouts and collapse
   cleanly on mobile without needing !important wars
   on inline styles.
   ========================================== */

/* History section: image left + text right */
.rg-history {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 80px;
    align-items: center;
    width: 100%;
}

/* Contact page: form + info side-by-side */
.rg-contact {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 80px;
    width: 100%;
}

/* Footer 3-column grid */
.rg-footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    margin-bottom: 80px;
}

/* Two-column input pairs inside forms */
.rg-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Project detail: carousel + sidebar */
.rg-project-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 60px;
    align-items: start;
    width: 100%;
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
    .top-nav-links {
        display: none;
    }

    .btn-nav-admin {
        display: none;
    }

    .nav-hamburger {
        display: block;
    }

    .snap-container {
        scroll-snap-type: none;
        overflow-y: auto;
    }

    .snap-section {
        padding: 60px 20px 80px 20px !important;
        height: auto !important;
        min-height: auto !important;
        display: block !important;
    }

    .snap-section.hero-full {
        height: 100vh !important;
        min-height: 100vh !important;
        margin-top: 0;
    }

    .floating-call-btn {
        bottom: 20px;
        right: 20px;
        left: auto;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    h1 { font-size: 2.5rem !important; letter-spacing: -1px; margin-bottom: 25px; }
    h2 { font-size: 1.8rem !important; margin-bottom: 25px; }
    p { font-size: 1rem !important; line-height: 1.6; }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    .metrics-grid div {
        border-right: none !important;
        border-bottom: 1px solid var(--oecsa-border);
        padding-bottom: 15px;
    }
    .metrics-grid div span:first-child {
        font-size: 3rem !important;
    }

    /* Footer section: override the inline flex so it doesn't push content down */
    .footer-section {
        display: block !important;
        padding: 60px 20px 40px 20px !important;
    }

    /* Footer bottom bar: stack on very small screens */
    .rg-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Named grid responsive overrides */
    .rg-history {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .rg-history > div:first-child {
        min-height: 260px !important;
        height: 260px !important;
    }

    .rg-contact {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .rg-footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 50px;
    }

    .rg-form-fields {
        grid-template-columns: 1fr;
    }

    .rg-project-body {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Prevent horizontal overflow on all pages */
    .snap-container,
    .snap-section {
        overflow-x: hidden;
    }

    /* Cards inside grids should be full width */
    .card {
        padding: 30px !important;
    }

    /* Footer section: on mobile become block so content flows naturally */
    section.snap-section.bg-light:last-of-type {
        justify-content: flex-start;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.5rem !important; }

    .metrics-grid {
        grid-template-columns: 1fr !important;
    }

    .top-nav {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .btn-primary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Footer bottom bar stacks vertically */
    .rg-footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}