/* ================= VARIABLES ================= */
:root {
    --primary: #f28c28; /* Naranja Marca */
    --primary-dark: #d97d24;
    --navy: #24214c; /* Azul oscuro marca */
    
    --white: #ffffff;
    --off-white: #f9f9f9;
    --border: #eaeaea;
    --text-main: #111111;
    --text-body: #555555;
    
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.08);
    
    --radius: 12px;
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* ================= RESET & BASE ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    font-family: 'Manrope', sans-serif;
    color: var(--text-main);
    background-color: var(--white);
    overflow-x: hidden;
}

body { width: 100%; overflow-x: hidden; line-height: 1.6; }
body.no-scroll { overflow: hidden; }

a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ================= HEADER PREMIUM ================= */
header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    padding: 20px 0; transition: var(--transition);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
}

header.scrolled {
    padding: 15px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.04);
}

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

.logo img { height: 50px; width: auto; }

.nav-links { display: flex; gap: 35px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--text-main); }
.nav-links a:hover { color: var(--primary); }

.btn-header {
    background: var(--navy); color: white !important;
    padding: 10px 25px; border-radius: 50px; font-weight: 600;
}
.btn-header:hover { background: var(--primary); transform: translateY(-2px); }

/* Hamburguesa */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; }
.hamburger-box { width: 30px; height: 24px; position: relative; }
.hamburger-inner {
    width: 30px; height: 2px; background: var(--text-main);
    position: absolute; top: 50%; transform: translateY(-50%);
    transition: var(--transition);
}
.hamburger-inner::before, .hamburger-inner::after {
    content: ''; position: absolute; width: 30px; height: 2px; background: var(--text-main);
    transition: var(--transition);
}
.hamburger-inner::before { top: -8px; }
.hamburger-inner::after { top: 8px; }

/* Menú Móvil */
#mobile-menu {
    position: fixed; inset: 0; background: var(--white); z-index: 999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: var(--transition);
}
#mobile-menu.active { opacity: 1; pointer-events: all; }
.mobile-content { display: flex; flex-direction: column; gap: 30px; text-align: center; z-index: 2; }
.mobile-content a { font-size: 2rem; font-weight: 700; color: var(--navy); }

/* ================= HERO IMPONENTE ================= */
#inicio {
    padding-top: 160px; padding-bottom: 100px;
    position: relative; overflow: hidden;
}

.hero-container { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }

.label-tech {
    display: inline-block; font-size: 0.85rem; font-weight: 700; 
    color: var(--primary); text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 20px;
}

h1 {
    font-size: 3.8rem; line-height: 1.1; margin-bottom: 25px;
    color: var(--navy); letter-spacing: -1px;
}
.text-highlight { color: var(--primary); }

.hero-content p { font-size: 1.15rem; color: var(--text-body); max-width: 500px; margin-bottom: 40px; }

.hero-buttons { display: flex; gap: 20px; align-items: center; }

/* Botones Animados */
.btn-primary {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 16px 36px; background: var(--primary); color: white;
    border-radius: 8px; font-weight: 600; 
    box-shadow: 0 10px 25px rgba(242, 140, 40, 0.3);
    position: relative; overflow: hidden;
    animation: pulse-orange 2s infinite;
}
.btn-primary svg { transition: transform 0.3s ease; }
.btn-primary:hover { 
    transform: translateY(-3px); 
    background: var(--primary-dark);
    animation: none; 
}
.btn-primary:hover svg { transform: translateX(5px); }

@keyframes pulse-orange {
    0% { box-shadow: 0 0 0 0 rgba(242, 140, 40, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(242, 140, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(242, 140, 40, 0); }
}

.btn-secondary {
    padding: 16px 36px; border: 1px solid #ddd; border-radius: 8px;
    font-weight: 600; color: var(--navy); position: relative;
    z-index: 1; overflow: hidden; transition: color 0.4s ease;
}
.btn-secondary::before {
    content: ''; position: absolute; top: 0; left: 0; width: 0; height: 100%;
    background: var(--navy); z-index: -1; transition: width 0.4s ease;
}
.btn-secondary:hover { color: white; border-color: var(--navy); }
.btn-secondary:hover::before { width: 100%; }

/* Hero Visual */
.hero-visual { position: relative; }
.image-frame {
    position: relative; border-radius: 20px; overflow: hidden;
    box-shadow: var(--shadow-lg); transform: rotate(2deg); transition: var(--transition);
}
.image-frame:hover { transform: rotate(0); }
.glass-overlay {
    position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
}

.stat-card {
    position: absolute; bottom: 40px; left: -30px;
    background: white; padding: 15px 25px; border-radius: 12px;
    box-shadow: var(--shadow-lg); display: flex; gap: 15px; align-items: center;
}
.floating { animation: float 4s ease-in-out infinite; }
.stat-card strong { display: block; font-size: 0.9rem; color: var(--navy); }
.stat-card span { font-size: 0.8rem; color: #777; }

/* ================= SERVICIOS ================= */
#servicios { padding: 100px 0; background: var(--off-white); }

.section-header { text-align: center; max-width: 700px; margin: 0 auto 60px; }
.section-header h2 { font-size: 2.5rem; color: var(--navy); margin-bottom: 10px; }
.separator { width: 60px; height: 4px; background: var(--primary); margin: 0 auto 15px; border-radius: 2px; }

.grid-services { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }

.service-card {
    background: white; padding: 40px 30px; border-radius: 16px;
    box-shadow: var(--shadow-sm); border-top: 4px solid transparent;
    transition: var(--transition);
    position: relative; top: 0;
}
.service-card:hover {
    transform: translateY(-15px); box-shadow: 0 30px 60px rgba(0,0,0,0.12);
    border-top-color: var(--primary);
}

.icon-wrap {
    width: 60px; height: 60px; background: #fff3e0; color: var(--primary);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    margin-bottom: 25px; transition: transform 0.5s ease;
}
.icon-wrap svg { transition: transform 0.5s ease; }

.service-card:hover .icon-wrap { background: var(--primary); color: white; }
.service-card:hover .icon-wrap svg { transform: rotate(15deg) scale(1.1); }

.service-card h3 { font-size: 1.3rem; margin-bottom: 15px; color: var(--navy); }
.service-card p { color: var(--text-body); }

/* ================= NOSOTROS & CARRUSEL (CORREGIDO) ================= */
#nosotros { padding: 120px 0; background: white; overflow: hidden; }

/* GRID ESTRICTO */
.nosotros-layout { 
    display: grid; 
    grid-template-columns: 45% 55%; 
    gap: 50px; 
    align-items: center; 
}

.nosotros-info { z-index: 5; position: relative; }

.nosotros-info h2 { font-size: 2.8rem; line-height: 1.1; margin: 10px 0 25px; color: var(--navy); }
.subtitle { color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

.features-grid { display: flex; gap: 40px; margin-top: 40px; }
.feat-item strong { display: block; font-size: 1.8rem; color: var(--primary); line-height: 1; }
.feat-item span { font-size: 0.9rem; color: var(--navy); font-weight: 600; }

/* --- CARRUSEL AJUSTADO --- */
.carousel-3d-container {
    perspective: 1200px; 
    position: relative;
    height: 400px;
    display: flex; align-items: center; justify-content: center;
    margin-left: 50px; 
}

.carousel-stage {
    width: 200px; 
    height: 300px;
    transform-style: preserve-3d;
    animation: autoRun 25s linear infinite;
    position: relative;
}

.carousel-stage:hover { animation-play-state: paused; }

.spinner {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    transform-style: preserve-3d;
}

.item {
    position: absolute; inset: 0;
    /* RADIO REDUCIDO A 250PX PARA NO CHOCAR */
    transform: 
        rotateY(calc( (var(--i) - 1) * (360deg / 7) )) 
        translateZ(250px); 
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 3px solid white;
}

.item img { width: 100%; height: 100%; object-fit: cover; }

@keyframes autoRun {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(-360deg); }
}

.carousel-base {
    position: absolute; bottom: -60px; width: 500px; height: 500px;
    background: radial-gradient(closest-side, rgba(36, 33, 76, 0.05), transparent);
    transform: rotateX(90deg);
    pointer-events: none;
}

/* ================= CONTACTO & MAPA (CORREGIDO) ================= */
#contacto { padding: 100px 0; background: var(--off-white); }

.contact-box {
    background: var(--navy); color: white; border-radius: 24px;
    padding: 0; /* Padding cero para que el mapa ocupe todo el ancho abajo */
    overflow: hidden; position: relative;
    box-shadow: var(--shadow-lg);
}

.contact-inner { padding: 60px 60px 40px 60px; } 

.contact-content {
    display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 40px;
}

.c-item {
    display: flex; align-items: center; gap: 20px;
    padding: 20px; background: rgba(255,255,255,0.05); border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1); margin-bottom: 20px;
    transition: var(--transition);
}
.c-item:hover { background: white; color: var(--navy); border-color: white; }
.c-item:hover .c-icon { color: var(--navy); }

.c-icon { color: var(--primary); }

.form-placeholder {
    background: white; color: var(--text-main); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 20px;
}

/* --- MAPA --- */
.map-frame {
    width: 100%;
    height: 350px; /* Altura generosa */
    border-top: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
    background: #ccc; /* Fondo por si tarda en cargar */
}

.map-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    filter: grayscale(100%) contrast(1.1);
    transition: filter 0.5s ease;
    display: block; /* Evita espacios extraños */
}

.map-frame:hover iframe {
    filter: grayscale(0%);
}

/* ================= FOOTER ================= */
footer { padding: 40px 0; border-top: 1px solid #eee; background: white; }
.footer-flex { display: flex; justify-content: space-between; align-items: center; }
.f-logo { height: 35px; }
.f-social a { color: var(--text-body); font-weight: 600; }
.f-social a:hover { color: var(--primary); }

/* ================= WHATSAPP ================= */
.wa-float {
    position: fixed; bottom: 30px; right: 30px; z-index: 100;
    width: 65px; height: 65px; background: #25D366; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    animation: bounce 3s infinite;
}
.wa-ripple {
    position: absolute; inset: 0; border-radius: 50%; border: 2px solid #25D366;
    animation: ripple 2s infinite; opacity: 0;
}
@keyframes bounce { 
    0%, 100% { transform: translateY(0); } 
    10% { transform: translateY(-8px); } 
}
@keyframes ripple {

    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ANIMACIONES */
.fade-up { opacity: 0; transform: translateY(40px); transition: 0.8s ease-out; }
.fade-up.visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }

/* ================= RESPONSIVE ================= */
@media (max-width: 992px) {
    .hero-container, .nosotros-layout, .contact-content { grid-template-columns: 1fr; text-align: center; }
    .hero-buttons { justify-content: center; }
    .nav-links, .btn-header { display: none; }
    .menu-toggle { display: block; }
    
    .carousel-3d-container { 
        height: 350px; 
        transform: scale(0.8);
        margin: 50px auto 0; /* CORRECCIÓN CLAVE: Margen superior positivo */
    }
    .item { transform: rotateY(calc( (var(--i) - 1) * (360deg / 8) )) translateZ(280px); }
    
    .nosotros-layout { gap: 40px; }
    .contact-inner { padding: 40px 24px; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    
    /* CORRECCIÓN FINAL MÓVIL */
    .carousel-3d-container { 
        transform: scale(0.6); 
        margin: 20px auto 0; /* Margen positivo para separar */
    }
    
    .footer-flex { flex-direction: column; gap: 20px; }
    .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
    .hero-buttons { flex-direction: column; width: 100%; }
}