/* =============================================
              PÁGINA: AGREGADOS
============================================= */
.main-agregados {
    background-color: #f4f6f9;
    font-family: sans-serif;
    overflow-x: hidden;
    border-top: 5px solid #2966C4; /* Línea superior con azul corporativo */
}

/* --- HERO DE AGREGADOS --- */
.agregados-hero {
    position: relative;
    display: flex;
    min-height: 570px;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
    color: #fff;
}

.agregados-hero-fondo,
.agregados-hero-foto,
.agregados-hero-overlay {
    position: absolute;
    inset: 0;
}

.agregados-hero-fondo {
    z-index: -2;
}

.agregados-hero-foto {
    background-position: center;
    background-size: cover;
    opacity: 1;
}

.agregados-hero-overlay {
    z-index: -1;
    background: linear-gradient(90deg, rgba(10, 25, 40, .9) 0%, rgba(10, 25, 40, .62) 48%, rgba(10, 25, 40, .18) 100%);
}

.agregados-hero-contenido {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 88px 5%;
}

.agregados-hero-contenido h1 {
    max-width: 760px;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(2.4rem, 5vw, 4.6rem);
    line-height: 1.08;
}

.agregados-hero-contenido h1 span {
    color: #ffcb11;
}

.agregados-hero-contenido p {
    max-width: 620px;
    margin: 24px 0 32px;
    color: #e4ebf2;
    font-size: 1.05rem;
    line-height: 1.75;
}

.agregados-hero-acciones {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.agregados-hero-principal,
.agregados-hero-secundario {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    text-decoration: none;
    font-weight: 700;
}

.agregados-hero-principal {
    background: #ffcb11;
    color: #15283d;
}

.agregados-hero-secundario {
    border: 1px solid rgba(255, 255, 255, .65);
    color: #fff;
}

.agregados-hero-principal:hover,
.agregados-hero-secundario:hover {
    background-color: #ffcb11;
}

.agregados-hero-secundario:hover {
    background: rgba(255, 255, 255, .14);
}

/* --- SECCIONES Y FONDOS --- */
.seccion-material {
    position: relative;
    width: 100%;
    min-height: 60vh; /* heigth rectangule */
    display: flex;
    align-items: center;
    isolation: isolate;
    background-size: cover;
    background-position: center;
    background-attachment: scroll;
}

.material-carrusel,
.material-carrusel-foto {
    position: absolute;
    inset: 0;
}

.material-carrusel {
    z-index: -2;
    overflow: hidden;
}

.material-carrusel-foto {
    background-position: center;
    background-size: cover;
    opacity: 0;
}

.material-carrusel-foto:first-child {
    opacity: 1;
}

@keyframes material-carrusel {
    0%, 38% { opacity: 1; }
    39%, 100% { opacity: 0; }
}

@media (min-width: 901px) {
    .material-carrusel-foto {
        animation: material-carrusel 24s steps(1, end) infinite;
        animation-delay: calc(var(--indice-material) * 8s);
    }

    .material-carrusel--dos .material-carrusel-foto {
        animation-duration: 16s;
    }
}

/* --- FILTROS DE IMAGEN --- */
.filtro-fondo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    z-index: 1;
    transform: translateZ(0); /* NUEVO: Fuerza aceleración por hardware */
    pointer-events: none; /* NUEVO: Evita que el filtro intercepte eventos de toque, mejorando el scroll */
}

.filtro-derecha {
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
}

/* --- CONTENEDOR PRINCIPAL --- */
.contenedor-material {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 5%;
    position: relative;
    z-index: 2;
}

.alinear-derecha {
    display: flex;
    justify-content: flex-end;
}

/* --- TARJETA DE INFORMACIÓN --- */
.tarjeta-info {
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 14px 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.tarjeta-info:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

/* --- TEXTOS DE LA TARJETA --- */
.etiqueta {
    display: inline-block;
    color: #2966C4;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
    border-bottom: 2px solid #61C4FA;
    padding-bottom: 5px;
}

.tarjeta-cabecera h2 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.1;
    color: #111;
}

.tarjeta-detalles-toggle {
    display: none;
}

.descripcion {
    font-size: 1.05rem;
    line-height: 1.7;
    color: black;
    margin-bottom: 12px;
}

.btn-cotizar-agregado {
    display: inline-block;
    margin-top: 0;
}

.tarjeta-pie {
    padding-top: 22px;
}

/* --- RESPONSIVE MÓVIL --- */
@media (max-width: 900px) {
    .agregados-hero {
        min-height: 640px;
    }

    .agregados-hero-overlay {
        background: linear-gradient(180deg, rgba(10, 25, 40, .45) 0%, rgba(10, 25, 40, .9) 100%);
    }

    .agregados-hero-contenido {
        align-self: flex-end;
        padding: 64px 5% 72px;
    }

    .agregados-hero-contenido h1 {
        font-size: clamp(2.2rem, 9vw, 3.5rem);
    }

    .seccion-material {
        min-height: 78vh;
        background-attachment: scroll;
    }

    .material-carrusel-foto {
        background-attachment: scroll;
        animation: none !important;
        animation-delay: 0s !important;
        opacity: 0 !important;
        display: none; /* NUEVO: Evita que el navegador renderice imágenes ocultas en el DOM */
    }

    .material-carrusel-foto:first-child {
        opacity: 1 !important;
        display: block; /* NUEVO: Muestra solo la primera imagen en móviles */
    }

    .agregados-hero-principal,
    .agregados-hero-secundario,
    .tarjeta-info,
    .tarjeta-detalles-toggle {
        transition: none !important;
        animation: none !important;
    }

    .filtro-fondo, .filtro-derecha {
        background: linear-gradient(to top, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .06) 48%, rgba(255, 255, 255, 0) 100%) !important;
    }

    .contenedor-material {
        display: flex;
        align-items: flex-end;
        padding-bottom: 24px;
    }

    .tarjeta-info {
        max-width: 100%;
        padding: 18px;
        background: rgba(255, 255, 255, .9); /* NUEVO: Mayor opacidad para menos esfuerzo de renderizado */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* NUEVO: Sombra más ligera */
        transform: translateZ(0); /* NUEVO: Fuerza aceleración por hardware */
        will-change: transform; /* NUEVO: Prepara el navegador para un mejor rendimiento */
    }

    .tarjeta-detalles-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        margin-top: 10px;
        padding: 0 16px;
        border: 1px solid rgba(0, 54, 152, .55);
        border-radius: 4px;
        background: rgba(255, 255, 255, .32);
        color: #003698;
        font: inherit;
        font-weight: 700;
        cursor: pointer;
    }

    .tarjeta-info:not(.detalles-abiertos) .tarjeta-cuerpo,
    .tarjeta-info:not(.detalles-abiertos) .tarjeta-pie {
        display: none;
    }

    .tarjeta-info.detalles-abiertos .tarjeta-detalles-toggle {
        background: rgba(0, 54, 152, .9);
        color: #fff;
    }

    .tarjeta-cabecera h2 {
        font-size: 2rem;
        margin-bottom: 6px;
    }

    .descripcion {
        font-size: .95rem;
        line-height: 1.55;
        margin-bottom: 8px;
    }

    .tarjeta-pie {
        padding-top: 14px;
    }

    .tarjeta-info .btn-cotizar-agregado {
        width: auto;
        max-width: none;
        margin-top: 0;
    }
}

/* Algunos móviles reportan un viewport ancho cuando usan modo escritorio. */
@media (hover: none) and (pointer: coarse) {
    .material-carrusel-foto {
        animation: none !important;
        animation-delay: 0s !important;
    }

    .material-carrusel-foto:not(:first-child) {
        display: none !important;
    }

    .material-carrusel-foto:first-child {
        display: block !important;
        opacity: 1 !important;
    }
}