/* 1. CONFIGURACIÓN Y VARIABLES */
:root {
    --primary-color: #140e7e;
    --secondary-color: #ffC600; 
    --primary-container: #2d2d93;
    --on-primary: #ffffff;
    --surface: #fcf8ff;
    --on-surface: #1b1b21;
    --on-surface-variant: #fdfdfd;
    --transition-soft: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --primary:#8a84d6;
    --primary-light:#eef2ff;
    --secondary:#ffc600;
    --azul:#2d2d93;
    --bg:#f8f5f0;
    --bg2:#f1f5f9;
    --danger:#ef142b
}

/* REGLA CRÍTICA: Adiós al scroll horizontal */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface);
    color: var(--on-surface);
    line-height: 1.6;
}

/* 2. NAVEGACIÓN (REPARADA) */
.navbar {
    background-color: var(--primary-container) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%; /* Cambiado de 100vw a 100% */
    padding: 0.8rem 0;
}

.header-logo {
    max-height: 40px;
    width: auto;
    transition: var(--transition-soft);
}

/* 3. COMPONENTES Y FILAS */
/* Reparación de filas: Bootstrap necesita sus márgenes negativos, 
   si los quitas, rompes el alineamiento. Se usa un contenedor padre con overflow hidden en su lugar. */
.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
}

.service-card {
    background: #ffffff;
    border-radius: 2rem;
    padding: 2.5rem;
    height: 100%;
    transition: var(--transition-soft);
    scroll-margin-top: 120px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(20, 14, 126, 0.12);
}

/* 4. CARRUSEL (REPARADO) */
.carousel-item img {
    width: 100%;
    height: 500px; /* Altura por defecto Desktop */
    object-fit: cover;
    border-radius: 2rem;
}

/* 5. NAVEGACIÓN PILLS */
.nav-pills-container {
    margin-top: 40px;
    padding: 6px;
    background: #fff;
    border-radius: 40px;
    display: inline-flex;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.nav-pills .nav-link:hover{
    background:var(--primary);
    color:var(--primary-light)
}
.nav-pills .nav-link {
    font-weight: 600;
    font-size: .85rem;
    border-radius: 40px;
    padding: 8px 18px;
    color: var(--on-primary);
    transition: var(--transition-soft);
}

.nav-pills .nav-link.active {
    background: var(--secondary-color);
    color: #000 !important;
}

/* 6. MEDIA QUERIES (OPTIMIZADAS) */

/* Tablets y Laptops pequeñas */
@media (max-width: 991px) {
    .carousel-item img {
        height: 400px;
    }
    
    .navbar-collapse {
            /* 1. Fondo semi-transparente (ajusta el 0.8 para más o menos transparencia) */
            background-color: rgba(24, 24, 99, 0.8) !important; 
            
            /* 2. El efecto de desenfoque (Glassmorphism core) */
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            
            /* 3. Estética de la tarjeta */
            border-radius: 1.5rem;
            margin: 10px; /* Separación de los bordes de la pantalla */
            padding: 1.5rem;
            
            /* 4. Borde sutil para dar relieve de cristal */
            border: 1px solid rgba(255, 255, 255, 0.15);
            
            /* 5. Sombra profunda pero suave */
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
            
            /* 6. Asegurar que el contenido no se pegue arriba */
            margin: 1rem;
        }
    }

/* Móviles */
/* Móviles (Ajustes de precisión) */
@media (max-width: 768px) {
    .hero-title { font-size: 2.2rem; }
    .header-logo { max-height: 32px; }
    
    .carousel-item img {
        height: 350px; /* Un poco más de aire para que la foto luzca */
    }

    /* Forzamos que el caption sea visible y legible en móvil */
    .carousel-caption {
        display: block !important; /* Bootstrap a veces usa d-none d-md-block, esto lo activa */
        padding: 20px !important;
    }

    .carousel-caption h5 {
        font-size: 1.1rem !important;
        margin-bottom: 5px;
    }

    .carousel-caption p {
        font-size: 0.85rem !important;
        opacity: 0.9;
        display: -webkit-box;
        -webkit-line-clamp: 2; /* Limita a 2 líneas para no tapar toda la foto */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Ajuste de flechas para que no estorben en pantallas pequeñas */
    .carousel-control-prev i, .carousel-control-next i {
        font-size: 1.8rem !important;
    }
}
/* Desktop: Logo Absoluto */
@media (min-width: 992px) {
    .navbar-brand.d-lg-absolute {
        position: absolute;
        left: 2rem;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* UTILIDADES */
.footer-institucional { font-size: 13px; opacity: 0.8; }

.carousel-fade .carousel-item {
    transition-duration: 1.2s;
}