/* Variables CSS para una gestión más fácil de colores y fuentes */
:root {
    --primary-color: #2c3e50; /* Azul oscuro muy corporativo */
    --secondary-color: #3498db; /* Azul corporativo un poco más claro */
    --accent-color: #27ae60; /* Un verde sutil para acentos o éxito */
    --text-color: #333;
    --light-text-color: #f4f4f4;
    --bg-light: #f9f9f9;
    --bg-dark: #2c3e50; /* Mantener el azul oscuro para fondos */
    --box-shadow-light: 0 4px 8px rgba(0, 0, 0, 0.05); /* Sombras más suaves */
    --box-shadow-dark: 0 8px 16px rgba(0, 0, 0, 0.1);
    --debug-lang-selector: transparent; /* rgba(0, 255, 0, 0.2); */
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-light);
    overflow-x: hidden; /* Evitar scroll horizontal */
}

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

ul {
    list-style: none;
}

/* --------------------
   Sección Hero
   -------------------- */
.hero {
    /* Fondo con imagen, adaptable y fija */
    background-image: url('fondo-hero.png'); /* Asegúrate de que 'fondo-hero.png' esté en la misma carpeta */
    background-size: cover; /* Cubre todo el área */
    background-position: center center; /* Centra la imagen */
    background-repeat: no-repeat;
    background-attachment: fixed; /* Imagen de fondo fija */
    height: 100vh; /* Altura de pantalla completa */
    color: var(--light-text-color);
    display: flex;
    justify-content: center;
    align-items: center; /* Centra verticalmente el contenido */
    position: relative;
    overflow: hidden; /* Asegura que el contenido no se salga */
    background-color: var(--debug-hero); /* Color de depuración */
}

/* Superposición oscura para el hero */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Oscurecimiento semi-transparente */
    z-index: 1; /* Asegura que la superposición esté detrás del contenido pero sobre el fondo */
}

.hero-container {
    position: relative; /* Para que el contenido esté sobre la superposición */
    z-index: 2;
    width: 100%;
    max-width: 1200px; /* Ancho máximo para el contenido */
    min-height: 100%; /* Permite que el contenedor ocupe al menos toda la altura, pero se adapta si el contenido es más pequeño */
    padding: 20px 40px; /* Espaciado interno */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Espacia el top y el body */
    align-items: center; /* Centra el contenido horizontalmente */
    background-color: var(--debug-hero-container); /* Color de depuración */
}

/* Bloque superior del hero: Nombre - Logo - Navbar */
.hero-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px; /* Un poco de padding arriba */
    background-color: var(--debug-hero-top); /* Color de depuración */
}

.hero-nombre {
    font-weight: bold;
    font-size: 1.8rem;
    background-color: var(--debug-hero-nombre); /* Color de depuración */
}

.hero-logo img {
    height: 40px; /* Tamaño del logo */
    vertical-align: middle; /* Alineación vertical */
    background-color: var(--debug-hero-logo); /* Color de depuración */
}

.hero-navbar .nav-links {
    display: flex;
    gap: 30px;
    background-color: var(--debug-hero-navbar); /* Color de depuración */
}

.hero-navbar .nav-links a {
    color: var(--light-text-color);
    font-weight: bold;
    transition: color 0.3s ease;
}

.hero-navbar .nav-links a:hover {
    color: var(--accent-color); /* Cambio de color al pasar el ratón */
}

/* Bloque central del hero: Título y subtítulo */
.hero-body {
    flex-grow: 1; /* Permite que este contenedor ocupe el espacio restante */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centra verticalmente el contenido dentro de hero-body */
    align-items: flex-start; /* Alinea el texto a la izquierda */
    width: 100%;
    max-width: 700px; /* Ancho máximo del texto */
    text-align: left;
    /* Se eliminó margin-top: -50px; para evitar la superposición al reducir la altura */
    background-color: var(--debug-hero-body); /* Color de depuración */
}

.hero-body h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 3.8rem);
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-body p {
    font-size: clamp(1rem, 2.5vw + 0.5rem, 1.3rem);
    margin-bottom: 40px;
    max-width: 600px; /* Limita el ancho del párrafo */
}

.btn-primary {
    display: inline-block;
    background: var(--accent-color);
    color: var(--light-text-color);
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: var(--box-shadow-dark);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* --------------------
   Secciones Generales
   -------------------- */
.section {
    padding: 80px 50px;
    text-align: center;
    background: var(--bg-light);
    transition: background 0.5s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.section h2 {
    font-size: 2.8rem;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

.section h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--secondary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    text-align: justify;
    font-size: 1.15rem;
    line-height: 1.8;
}

.content-wrapper p {
    margin-bottom: 1.5em;
}

/* Sección Servicios (Portafolio) */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.service-item {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.service-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.service-item .icon-large {
    font-size: 3.5rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
    display: block;
}

.service-item h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.service-item p {
    font-size: 1rem;
    color: var(--text-color);
}

/* Sección con gradiente de fondo (Portafolio) */
.section.bg-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--bg-dark));
    color: var(--light-text-color);
}

/* Contacto */
.contact-email {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 30px;
}

.contact-email a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.contact-email a:hover {
    color: var(--secondary-color);
}

/* Pie de página */
footer {
    background: var(--bg-dark);
    color: var(--light-text-color);
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 10px;
}

.legal-links a {
    text-decoration: underline;
    color: var(--light-text-color);
}

/* --------------------
   Botón de "volver arriba"
   -------------------- */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    font-size: 1.5rem;
    background-color: var(--primary-color);
    color: whitesmoke;
    padding: 12px 14px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
}

/* --------------------
   Animaciones CSS
   -------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Clases para aplicar con JavaScript */
.fade-in.animate {
    animation: fadeIn 1.2s ease-out forwards;
}

.slide-up.animate {
    animation: slideInUp 1.2s ease-out forwards;
}

@keyframes slideDownMenu {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Language Selector Styles */
.language-selector {
    display: flex;
    align-items: center;
    margin-right: 20px; /* Adjust spacing as needed */
    background-color: var(--debug-lang-selector); /* Optional: for debugging positioning */
}

.lang-option {
    color: var(--light-text-color);
    font-weight: bold;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease, transform 0.2s ease;
    font-size: 0.9rem; /* Slightly smaller than nav links */
}

.lang-option:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.lang-option.active {
    color: var(--accent-color); /* Highlight active language */
    text-decoration: underline;
    pointer-events: none; /* Disable click on active language */
}

.lang-separator {
    color: var(--light-text-color);
    margin: 0 5px;
    font-size: 0.9rem;
}

/* Responsive adjustments for language selector if needed */
@media (max-width: 768px) {
    .hero-top {
        /* Ensure space for logo, lang selector, and menu toggle */
        /* Might need to adjust flex properties if layout breaks */
    }
    .language-selector {
        /* Example: order it differently or adjust margin for mobile if needed */
        /* For now, let's assume it fits. If not, adjustments are needed here. */
        /* Potentially reduce font size slightly more on very small screens if needed */
         font-size: 0.85rem;
    }
    .lang-option, .lang-separator {
        font-size: 0.85rem; /* Match parent or set explicitly */
    }
}

/* --------------------
   Diseño Responsivo (Mobile First)
   -------------------- */

/* Ocultar menú hamburguesa por defecto en escritorio */
.menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* Ajustes para pantallas más pequeñas (móviles y tablets) */

    .hero {
        background-attachment: scroll; /* Change from fixed to scroll for mobile */
    }

    .hero-container {
        padding: 15px 20px; /* Menos padding en móviles */
    }

    .hero-top {
        padding-top: 15px;
    }

    .hero-nombre {
        font-size: 1.5rem; /* Tamaño de fuente más pequeño para el nombre */
    }

    .hero-logo img {
        height: 30px; /* Logo más pequeño en móviles */
    }

    .hero-navbar .nav-links {
        display: none; /* Oculta el menú normal */
        flex-direction: column;
        width: 100%;
        background: rgba(44, 62, 80, 0.95); /* Fondo oscuro semitransparente para el menú */
        position: absolute;
        top: 70px; /* Debajo del encabezado */
        left: 0;
        padding: 20px 0;
        animation: slideDownMenu 0.4s ease-out forwards;
        text-align: center;
    }

    .nav-links.active {
        display: flex; /* Muestra el menú cuando está activo */
    }

    .nav-links li {
        margin: 5px 0; /* Reduced vertical margin */
    }

    .nav-links a {
        padding: 8px 0; /* Reduced vertical padding */
        display: block;
    }

    /* Mostrar menú hamburguesa */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        cursor: pointer;
        z-index: 3; /* Asegura que el botón esté sobre el menú */
    }

    .menu-toggle .bar {
        width: 100%;
        height: 3px;
        background-color: var(--light-text-color);
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero-body {
        align-items: center; /* Centra el texto en móviles */
        text-align: center;
        padding-top: 60px; /* Desplaza el texto más abajo en móviles */
        margin-top: 0; /* Elimina el ajuste negativo para móviles */
        padding-left: 20px;
        padding-right: 20px;
    }

    /* .hero-body h1 ahora es manejado por clamp() */
    /* .hero-body p ahora es manejado por clamp() */

    .section {
        padding: 50px 20px; /* Menos padding en secciones */
    }

    .section h2 {
        font-size: 2.2rem;
    }

    .content-wrapper {
        text-align: left; /* Mantener justificado o alinear a la izquierda para mejor lectura */
    }

    .services-grid {
        grid-template-columns: 1fr; /* Una columna en móviles */
    }
}

/* Media Queries para Tablets (Landscape) y Monitores Verticales (ej: 769px a 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-body h1 {
        font-size: 3.2rem;
    }

    .hero-body p {
        font-size: 1.2rem;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* 2 o 3 columnas */
    }
}
