/* =========================================
   VARIABLES DE COLOR (TEMA DINÁMICO)
   ========================================= */

/* 🌙 TEMA OSCURO (Por defecto) */
:root {
  --bg-dark: #0F172A;
  --bg-card: #1E293B;
  /* Nota: la variable se sigue llamando "text-white" para no romper tu CSS, 
     pero su valor cambiará dependiendo del tema */
  --text-white: #F8FAFC; 
  --text-gray: #94A3B8;
  --accent-gold: #b08d38;
  --accent-blue: #0044cc;
  --border-color: #334155;
  
  /* Variables extra para degradados y transparencias */
  --nav-bg: rgba(15, 23, 42, 0.95);
  --hero-grad-center: #1E293B;
  --hero-grad-edge: #0F172A;
  --hero-text-grad: linear-gradient(to right, #F8FAFC, #94A3B8);
  --overlay-bg: rgba(15, 23, 42, 0.85);
}

/* ☀️ TEMA CLARO (Se activa automáticamente) */
@media (prefers-color-scheme: light) {
  :root {
    --bg-dark: #EEF2FF;
    --bg-card: #FFFFFF;
    --text-white: #1E293B; /* Texto oscuro para fondo claro */
    --text-gray: #475569;
    --border-color: #C7D2FE;
    
    --nav-bg: rgba(238, 242, 255, 0.95);
    --hero-grad-center: #FFFFFF;
    --hero-grad-edge: #EEF2FF;
    --hero-text-grad: linear-gradient(to right, #1E293B, #475569);
    --overlay-bg: rgba(255, 255, 255, 0.90);
  }
}

/* =========================================
   RESETEO Y TIPOGRAFÍA
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; scroll-behavior: smooth; }

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: 'Open Sans', sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease; /* Transición suave al cambiar tema */
}

h1, h2, h3, h4 { 
    font-family: 'Montserrat', sans-serif; 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: -0.5px; 
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section { padding: 80px 0; }
.text-center { text-align: center; }
.gold-text { color: var(--accent-gold); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 15px 30px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
}
.btn-primary { 
    background-color: var(--accent-blue); 
    color: #ffffff; /* Este siempre blanco para contrastar con el botón azul */
    box-shadow: 0 4px 15px rgba(0, 68, 204, 0.4); 
}
.btn-primary:hover { 
    background-color: #003399; 
    transform: translateY(-3px); 
}

/* Navbar */
.navbar { 
    position: fixed; top: 0; width: 100%; 
    background: var(--nav-bg); backdrop-filter: blur(10px); 
    padding: 15px 0; z-index: 1000; border-bottom: 1px solid var(--border-color); 
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 800; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { color: var(--text-gray); text-decoration: none; font-weight: 600; transition: color 0.3s; }
.nav-links a:hover { color: var(--accent-gold); }

/* Hero */
.hero { 
    min-height: 100vh; display: flex; align-items: center; justify-content: center; 
    background: radial-gradient(circle at center, var(--hero-grad-center) 0%, var(--hero-grad-edge) 100%); 
    padding-top: 60px; 
}
.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 1.1; margin-bottom: 20px;
    background: var(--hero-text-grad);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
}
.hero p { font-size: 1.2rem; color: var(--text-gray); max-width: 600px; margin: 0 auto 40px; }

/* Grids & Cards */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-top: 50px; }
.solution-card { 
  background: var(--bg-card); padding: 30px; border-radius: 15px; text-align: center; 
  border: 3px solid var(--border-color); transition: 0.3s; 
}
.solution-card:hover { border-color: var(--accent-gold); transform: translateY(-5px); }
.icon { font-size: 3rem; margin-bottom: 20px; color: var(--accent-gold); display: block; }

/* Team (Si lo usas en el futuro) */
.testi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 40px; }
.testi-card { 
  background: var(--bg-card); padding: 30px; border-radius: 15px; 
  border: 3px solid var(--border-color); display: flex; gap: 20px; transition: 0.3s;
}
.testi-card:hover { border-color: var(--accent-gold); transform: translateY(-5px); }
.testi-img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-gold); flex-shrink: 0; }
.role-text { font-size: 0.8rem; color: var(--text-gray); display: block; margin-bottom: 10px; }

/* =========================================
   SECCIÓN DE PORTAFOLIO
   ========================================= */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 50px;
}

.portfolio-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-card);
}

.portfolio-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.portfolio-overlay h4 {
    color: var(--accent-gold);
    margin-bottom: 10px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.portfolio-overlay p {
    font-size: 0.9rem;
    color: var(--text-white);
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

/* Efectos al pasar el mouse (Hover) */
.portfolio-item:hover img {
    transform: scale(1.1);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover .portfolio-overlay h4,
.portfolio-item:hover .portfolio-overlay p {
    transform: translateY(0);
}

/* =========================================
   FAQ ACCORDION
   ========================================= */
.faq-container { max-width: 800px; margin: 0 auto; }
.accordion-title {
    width: 100%; background: none; border: none; padding: 20px 0;
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-white); font-size: 1.1rem; font-weight: 600;
    cursor: pointer; border-bottom: 1px solid var(--border-color);
    transition: color 0.3s;
}
.accordion-title:hover, .accordion-title.active { color: var(--accent-gold); }
.accordion-content {
    max-height: 0px; 
    overflow: hidden; 
    transition: max-height 0.3s ease-out;
}
.accordion-content p { 
    padding: 20px 0; 
    color: var(--text-gray); 
}
.accordion-title i { transition: transform 0.3s; }
.accordion-title.active i { transform: rotate(180deg); }

/* =========================================
   FOOTER Y CONTACTO
   ========================================= */
.footer {
    background: var(--bg-dark); 
    padding: 70px 0 20px;
    border-top: 1px solid var(--border-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 50px;
}

.footer-col h4 {
    color: var(--text-white);
    margin-bottom: 20px;
    font-size: 1.2rem;
    position: relative;
    padding-bottom: 10px;
}

/* Pequeña línea dorada debajo de los títulos del footer */
.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-gold);
}

.footer-col p {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.footer-col ul li i {
    color: var(--accent-gold);
    width: 25px; /* Mantiene los iconos alineados verticalmente */
}

.footer-col ul li a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-col ul li a:hover {
    color: var(--accent-gold);
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* =========================================
   ANIMACIONES DE SCROLL (REVEAL)
   ========================================= */
.reveal {
    opacity: 0;
    transition: all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1);
}

/* Direcciones iniciales */
.reveal.fade-up { transform: translateY(50px); }
.reveal.fade-down { transform: translateY(-50px); }
.reveal.fade-left { transform: translateX(-50px); }
.reveal.fade-right { transform: translateX(50px); }

/* Estado activo (cuando entran a la pantalla) */
.reveal.active {
    opacity: 1;
    transform: translate(0);
}

/* Retrasos escalonados para las tarjetas */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }


/* =========================================
   DISEÑO RESPONSIVO (@media queries)
   ========================================= */
@media (max-width: 768px) {
    /* 1. Ajustes del Hero (Cabecera) */
    .hero {
        padding-top: 100px;
        text-align: center;
    }
    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
    }
    .hero p {
        font-size: 1rem;
        padding: 0 15px;
    }

    /* 2. Reducir el espacio en blanco de las secciones */
    .section {
        padding: 50px 0;
    }

    /* 3. Forzar 1 sola columna en todas las cuadrículas */
    .grid-4, 
    .testi-grid, 
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* 4. Ajustes del Acordeón (FAQ) */
    .accordion-title {
        font-size: 1rem;
        padding: 15px 0;
    }

    /* 5. Ajustes de la barra de navegación */
    .nav-content {
        justify-content: center; /* Centramos el logo */
    }
    .logo {
        font-size: 1.3rem;
    }
    .nav-links {
        display: none; /* Ocultamos los links en móvil para que no estorben */
    }

    /* 6. CORRECCIÓN DEL PORTAFOLIO EN CELULAR */
    .portfolio-item {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important; /* Deja que la tarjeta crezca según el texto */
        background: var(--bg-card) !important;
    }

    .portfolio-item img {
        height: 200px !important; /* Altura ideal para la foto */
        width: 100% !important;
        object-fit: cover !important;
    }

    .portfolio-overlay {
        position: relative !important; /* Ya no flota sobre la imagen */
        opacity: 1 !important; /* Siempre visible */
        height: auto !important; /* Matamos el 100% que empujaba todo abajo */
        background: transparent !important; /* Toma el color de la tarjeta padre */
        padding: 25px 20px !important;
        display: block !important;
    }

    .portfolio-overlay h4, 
    .portfolio-overlay p {
        transform: translateY(0) !important; /* Matamos la animación de caída */
        margin: 0 !important;
    }

    .portfolio-overlay h4 {
        margin-bottom: 10px !important;
    }
}

/* Ajuste extra para pantallas medianas (Tablets) */
@media (max-width: 1024px) and (min-width: 769px) {
    .grid-4, 
    .testi-grid, 
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas en tablets */
    }
}