.esg_blocks {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    font-family: "pkfGlobalSans", "OpenSans-Regular", Arial, sans-serif !important;
}
.esg_title {    
    width: 100%;
    max-width: 90%;
    margin-bottom: 35px;
    line-height: 32px;
    font-size: 30px;
    font-weight: 500;
}
.esg_intro { 
    font-size: 16px;
    font-weight: 400;
    line-height: 20.8px;
    color: #000;
    margin-bottom: 30px;
    text-align: center;
}
.esg_block {
    flex: 1 1 calc(33.333% - 20px);
    position: relative;
    min-height: 450px;
    border-radius: 8px;
    overflow: hidden;
}
.esg_back {
    transform-style: preserve-3d;
    transition: transform 1.2s ease; /* Duración del flip aumentada a 1.2s */
}

.esg_block a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.esg_block_content {  
    display: flex;  
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: white;
    font-size: 1.2rem;
    line-height: 1.5;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;    
    z-index: 2;
    opacity: 1;
    transition: opacity 0.6s ease 1.5s; /* Retraso ajustado para aparecer después del fondo */
}
.esg_block_content_text {
    max-height: 0; /* Comienza colapsado */
    overflow: hidden;
    padding-top: 0;
    width: 100%;        
    padding-left: 30px;
    padding-right: 30px;        
    transition: max-height 1s ease 0.5s, padding-top 0.6s ease 0.5s; /* Retraso de 5 segundos */
}
.esg_block_content_text, 
.esg_block_content_text p {
    font-size: 16px;
    text-align: left;
}
.esg_block::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--hover-bg-color);
    transform: rotateY(180deg);
    backface-visibility: hidden;
    z-index: 1;
    transition: background-color 0.3s ease-in-out;
}
.esg_back {
    position: absolute;
    top:0px;
    bottom:0px;
    left: 0px;
    right: 0px;
    z-index: 1;
}

.esg_back_content {
    position: absolute;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    z-index: 1;
    opacity: 0; /* Oculta inicialmente */
    background: rgba(0, 0, 0, 0.5); /* Fondo oscuro al mostrar */
    transition: opacity 0.3s ease 0.6s; /* Ajuste para sincronizar con el nuevo tiempo de flip */
}

.esg_block:hover .esg_back {
    transform: rotateY(180deg); /* Efecto de flip */
    transition: transform 1.2s ease; /* Duración del flip aumentada a 1.2s */
}

.esg_block:hover .esg_back_content {
    opacity: 1; /* Muestra con suavidad */
    transition: opacity 0.3s ease 1.2s; /* Aparece antes del texto */
}

.esg_block:hover .esg_block_content {
    opacity: 1; /* Asegura que el contenido aparezca solo después del fondo */
    transition: all 0.6s ease 1.5s;
}

.esg_block:hover .esg_block_content_text {
    max-height: 500px; /* Un valor suficientemente grande para tu contenido */
    padding-top: 30px;
}

/* Keyframe para autoHeight */
@keyframes autoHeight {
    0% {
        height: 0px;
    }
    100% {
        height: auto;
    }
}

.esg_block:hover::before {
    background-color: var(--hover-bg-color);
}

.esg_block_content .esg_block_title {
    margin: 0;
    color: white;
    z-index: 3;
    position: relative;
    font-size: 24px;
}

@media (max-width: 1024px) {
    .esg_main_block {
        padding-left: 15px;
        padding-right: 15px;
    }
    .esg_block_content .esg_block_title {
        font-size: 18px;                
        width: 100%;
    }
    .esg_block_content .esg_block_title, 
    .esg_block_content_text { 
        text-align: left;
        padding-left: 15px;
        padding-right: 15px;
    }
    .esg_block_content_text, 
    .esg_block_content_text p {
        font-size: 13px;
    }    
    .esg_back {
        transform: rotateY(180deg); /* Mantener el estado hover */
    }
    .esg_back_content {
        opacity: 1; /* Mostrar fondo oscuro */
    }
    .esg_block_content {
        opacity: 1; /* Mostrar contenido */
    }
    .esg_block_content_text {
        height: auto;
        max-height: 500px;
        overflow: visible;
        padding-top: 30px; /* Mostrar contenido expandido */
    }
}
@media (max-width: 768px) {
    .esg_block_content .esg_block_title {
        text-align: center;
    }
    .esg_block_content_text {
        max-width: 250px;
    }
    .esg_block {
        flex: 1 1 100%;
    }
}
.background-overlay {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Asegura que el vídeo llene el contenedor sin deformarse */
}
.background-overlay {
    z-index: 2;
}
