/* --- HERO SECTION --- */
.hero-viva {
    position: relative;
    width: 100%;
    height: 85vh; /* Ocupa el 85% del alto de pantalla */
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Efecto Parallax simple */
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 46, 93, 0.5), rgba(0, 46, 93, 0.2));
    z-index: 1;
}

.hero-container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 1000px;
    text-align: center;
}

/* --- TEXTOS --- */
.hero-text h1 {
    color: #ffffff;
    font-size: 50px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.hero-text p {
    color: #ffffff;
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 50px;
    letter-spacing: 1px;
}

/* --- CAJA DE BUSQUEDA --- */
.main-search {
    background: #ffffff;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.main-search form {
    display: flex;
    gap: 25px;
    align-items: flex-end;
}

.filter-group {
    flex: 2;
    text-align: left;
}

.filter-group.btn-group {
    flex: 1;
}

.filter-group label {
    display: block;
    color: #002e5d;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.filter-group select {
    width: 100%;
    height: 55px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 15px;
    background-color: #f8f9fa;
    font-size: 15px;
    color: #333;
    font-weight: 600;
    outline: none;
    transition: border 0.3s;
}

.filter-group select:focus {
    border-color: #e65c00;
}

.hero-submit {
    width: 100%;
    height: 55px;
    background: #e65c00;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-submit:hover {
    background: #ff6600;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 92, 0, 0.4);
}

/* --- RESPONSIVO --- */
@media (max-width: 768px) {
    .hero-viva {
        height: auto;
        padding: 120px 0 80px 0;
    }
    .hero-text h1 {
        font-size: 32px;
    }
    .main-search form {
        flex-direction: column;
        gap: 20px;
    }
    .filter-group, .filter-group.btn-group {
        width: 100%;
    }
}
/* --- Estados Iniciales --- */

/* El texto viene desde la izquierda */
.hero-text {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

/* El buscador viene desde abajo */
.main-search {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease-out 0.3s, transform 1s ease-out 0.3s; /* Tiene un delay de 0.3s */
}

/* --- Clase Activadora --- */
.hero-viva.is-visible .hero-text,
.hero-viva.is-visible .main-search {
    opacity: 1;
    transform: translate(0);
}
.hero-viva {
    overflow: hidden; /* Evita que el zoom se salga del contenedor */
    background-size: 110%; /* Empieza un poco más grande */
    transition: background-size 1.5s ease-out;
}

.hero-viva.is-visible {
    background-size: 100%; /* Vuelve a su tamaño original suavemente */
}


/********************Sección 2 ***************************/

/* --- SECCIÓN CONFIANZA (CARDS) --- */
.section-confidence {
    padding: 80px 0;
    background-color: #fcfcfc;
    text-align: center;
}

.section-title {
    color: #333;
    font-size: 28px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 50px;
}

.confidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.confidence-card {
    background: #fff;
    padding: 40px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra todo horizontalmente */
}

.confidence-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* Contenedor de Iconos centrado */
.card-icon {
    height: 80px; /* Altura fija para que todos los títulos alineen */
    display: flex;
    align-items: center; /* Centrado vertical */
    justify-content: center; /* Centrado horizontal */
    margin-bottom: 20px;
    width: 100%;
}

.card-icon img {
    max-height: 100%;
    max-width: 160px;
    object-fit: contain;
}

/* Truco CSS para que el logo de AMPI se vea mejor si es blanquecino */
.card-icon img[alt*="AMPI"], 
.card-icon img[alt*="Certificados"] {
    filter: contrast(1.1) darken; /* Ajusta según necesites: puede ser brightness(0.9) */
    mix-blend-mode: multiply; /* Elimina restos de fondo blanco si la imagen no es PNG transparente */
}

.confidence-card h3 {
    color: #e65c00; 
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.confidence-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* --- SECCIÓN ESENCIA (NOSOTROS) --- */
.section-essence {
    padding: 100px 0;
}

.essence-flex {
    display: flex;
    align-items: center;
    gap: 60px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.essence-image {
    flex: 1;
    position: relative;
}

.image-wrapper {
    position: relative;
    z-index: 2;
}

/* El recuadro azul detrás de la foto */
.image-wrapper::before {
    content: '';
    position: absolute;
    bottom: -15px;
    right: -15px;
    width: 100%;
    height: 100%;
    background-color: #002e5d; 
    z-index: -1;
    border-radius: 10px;
}

.essence-image img {
    width: 100%;
    border-radius: 10px;
    display: block;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.essence-content {
    flex: 1.2;
    text-align: left;
}

.essence-content .subtitle {
    color: #e65c00;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
    display: block;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.essence-content h2 {
    color: #002e5d;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 25px;
    line-height: 1.2;
}

.essence-content p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 16px;
}

.btn-outline {
    display: inline-block;
    padding: 14px 35px;
    border: 2px solid #002e5d;
    color: #002e5d;
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    border-radius: 5px;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-outline:hover {
    background: #002e5d;
    color: #fff;
}

/* --- RESPONSIVO --- */
@media (max-width: 991px) {
    .essence-flex {
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .section-confidence {
        padding: 60px 0;
    }
    .essence-flex {
        flex-direction: column;
        text-align: center;
    }
    .essence-content {
        text-align: center;
    }
    .image-wrapper::before {
        right: 0;
        bottom: -10px;
        width: 100%;
    }
}

/* Estado inicial: oculto y ligeramente desplazado */
.confidence-card {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* El título también entra suave */
.section-confidence .section-title {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease-out;
}

/* Clase que activa todo el bloque cuando llegas con el scroll */
.section-confidence.is-visible .section-title,
.section-confidence.is-visible .confidence-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* El efecto cascada (stagger) para las 4 tarjetas */
.section-confidence.is-visible .confidence-card:nth-child(1) { transition-delay: 0.1s; }
.section-confidence.is-visible .confidence-card:nth-child(2) { transition-delay: 0.3s; }
.section-confidence.is-visible .confidence-card:nth-child(3) { transition-delay: 0.5s; }
.section-confidence.is-visible .confidence-card:nth-child(4) { transition-delay: 0.7s; }

/* --- Estados Iniciales --- */

/* La imagen viene desde la izquierda */
.essence-image {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

/* El contenido (texto) viene desde la derecha */
.essence-content {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

/* --- Clase Activadora --- */
.section-essence.is-visible .essence-image,
.section-essence.is-visible .essence-content {
    opacity: 1;
    transform: translateX(0);
}

.essence-content .btn-outline {
    opacity: 0;
    transition: opacity 0.5s ease-out 1.2s; /* Aparece después de 1.2s */
}

.section-essence.is-visible .btn-outline {
    opacity: 1;
}

/*************** sección 3 *************************/


/* --- SECCIÓN SERVICIOS --- */
.viva-services {
    padding: 100px 0;
    background-color: #fff;
    text-align: center;
}

.services-header {
    margin-bottom: 60px;
}

.services-header .pre-title {
    color: #e65c00;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 14px;
    display: block;
    margin-bottom: 10px;
}

.services-header .main-title {
    color: #002e5d;
    font-size: 36px;
    font-weight: 800;
    margin: 0;
}

.title-underline {
    width: 60px;
    height: 4px;
    background: #e65c00;
    margin: 15px auto 0;
}

/* Grid dinámico de 4 columnas */
.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Forzamos 4 en una fila */
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Card y Efecto Overlay */
.service-card {
    position: relative;
    height: 450px; /* Altura ideal para cards estrechas */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.service-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.service-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 46, 93, 0.9); /* Azul corporativo */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    opacity: 0;
    transition: all 0.4s ease;
    transform: translateY(20px);
}

.service-card:hover .service-overlay {
    opacity: 1;
    transform: translateY(0);
}

.service-card:hover img {
    transform: scale(1.1);
}

.service-overlay h3 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
}

.service-overlay p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.service-btn {
    padding: 12px 25px;
    background: #e65c00;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    transition: background 0.3s;
}

.service-btn:hover {
    background: #ff751a;
}

/* --- RESPONSIVIDAD --- */

/* Tablets (1024px o menos): 2 columnas */
@media (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móviles (600px o menos): 1 columna */
@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
    .service-card {
        height: 380px;
    }
    /* En móvil el overlay es mejor que sea siempre visible o más sutil */
    .service-overlay {
        opacity: 1;
        background: rgba(0, 46, 93, 0.7);
        transform: translateY(0);
        justify-content: flex-end;
    }
}

/* --- Estados Iniciales --- */

/* Título y Subrayado */
.services-header {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.title-underline {
    width: 0; /* Empieza sin ancho */
    transition: width 1s ease-in-out 0.5s; /* Se expande después del título */
    margin: 10px auto;
}

/* Tarjetas de Servicio */
.viva-services .service-card {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Clase Activadora --- */
.viva-services.is-visible .services-header {
    opacity: 1;
    transform: translateY(0);
}

.viva-services.is-visible .title-underline {
    width: 100px; /* O el ancho original que definiste */
}

.viva-services.is-visible .service-card {
    opacity: 1;
    transform: scale(1);
}

/* --- Cascada (Stagger) para los 4 servicios --- */
.viva-services.is-visible .service-card:nth-child(1) { transition-delay: 0.2s; }
.viva-services.is-visible .service-card:nth-child(2) { transition-delay: 0.4s; }
.viva-services.is-visible .service-card:nth-child(3) { transition-delay: 0.6s; }
.viva-services.is-visible .service-card:nth-child(4) { transition-delay: 0.8s; }

/*************** sección destino o no recuerdo su nobre ***********************/
/* --- SECCIÓN UBICACIONES --- */
.viva-locations {
    padding: 100px 0;
    background-color: #fcfcfc;
}

.locations-header {
    text-align: center;
    margin-bottom: 50px;
}

.locations-header p {
    color: #666;
    max-width: 600px;
    margin: 15px auto 0;
}

/* Grid asimétrico */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.location-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
}

/* El primer elemento ocupa 2 columnas y 2 filas */
.location-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.location-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.location-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px;
    background: linear-gradient(to top, rgba(0,46,93,0.9), transparent);
    color: #fff;
    text-align: left;
}

.loc-tag {
    background: #e65c00;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 10px;
    display: inline-block;
}

.location-content h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
	color: #fff;
}

.loc-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    margin-top: 15px;
}

.location-item.large .loc-link {
    display: block;
}

.location-item:hover img {
    transform: scale(1.1);
}

/* Responsivo */
@media (max-width: 991px) {
    .locations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .locations-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 300px;
    }
    .location-item.large {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* --- Estados Iniciales --- */

/* Cabecera de ubicaciones */
.locations-header {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Items del Grid */
.location-item {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

/* --- Clase Activadora --- */
.viva-locations.is-visible .locations-header {
    opacity: 1;
    transform: translateY(0);
}

.viva-locations.is-visible .location-item {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* --- Cascada para el Grid (5 elementos) --- */
.viva-locations.is-visible .location-item:nth-child(1) { transition-delay: 0.2s; } /* La grande */
.viva-locations.is-visible .location-item:nth-child(2) { transition-delay: 0.4s; }
.viva-locations.is-visible .location-item:nth-child(3) { transition-delay: 0.5s; }
.viva-locations.is-visible .location-item:nth-child(4) { transition-delay: 0.6s; }
.viva-locations.is-visible .location-item:nth-child(5) { transition-delay: 0.7s; }