body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background: #f8f9fa;
}

/* HERO */
.convenios-hero {
    height: 65vh;
    background: url('/public/recursos/convenios/convenio.jpg') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.convenios-hero .overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,77,140,0.7);
   
}

.hero-content {
    position: relative;
    color: #fff;
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.95;
    letter-spacing: 0.5px;
}

/* SECTION */
.convenios-section {
    padding: 6rem 8%;
    /*background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);*/
     background: linear-gradient(to bottom, #e2c108 0%, #e2c108 50%, #ffffff 50%, #ffffff 100%);

}

.titulo {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 4rem;
    color: #f2f2f2;
    position: relative;
    display: inline-block;
    width: 100%;
    font-family: Montserrat, sans-serif;
}

.titulo::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: #0a4d8c;
    border-radius: 2px;
}

/* GRID */
.convenios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* CARD */
.convenio-card {
    position: relative;
    height: 280px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background: white;
    border: 8px solid #fde33d;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.convenio-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.03);
    z-index: 1;
    pointer-events: none;
}

.logo-box {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.logo-box img {
    max-width: 75%;
    max-height: 75%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
    border-radius: 10px;
}

.img-hover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
}

/* Overlay */
.overlay-card {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 77, 140, 0.95) 0%,
        rgba(10, 77, 140, 0.7) 50%,
        transparent 100%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 30px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 4;
}

.overlay-card span {
    background: white;
    color: #0a4d8c;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

/* Hover */
.convenio-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.convenio-card:hover .logo-box {
    opacity: 0;
}

.convenio-card:hover .img-hover {
    opacity: 1;
    transform: scale(1.05);
}

.convenio-card:hover .overlay-card {
    opacity: 1;
}

.convenio-card:hover .overlay-card span {
    transform: translateY(0);
}

/* MODAL */
.modal-preview {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-preview.show {
    display: flex;
}

.modal-preview img {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 2.8rem;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ANIMATIONS */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    .convenios-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 992px) {
    .convenios-hero {
        height: 50vh;
    }

    .hero-content h1 {
        font-size: 2.8rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .convenios-section {
        padding: 4rem 5%;
    }

    .titulo {
        font-size: 2rem;
        margin-bottom: 3rem;
    }

    .convenios-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.8rem;
        margin-right: 50px;
        margin-left: 50px;
    }

    .convenio-card {
        height: 250px;
        margin-right: 50px;
        margin-left: 50px;
    }
    .overlay-card{
        background: linear-gradient(to top, rgba(13, 69, 121, 0.342) 0%, rgba(10, 77, 140, 0) 50%, transparent 100%);
    }
}

@media (max-width: 768px) {
    .convenios-hero {
        height: 45vh;
    }

    .hero-content h1 {
        font-size: 2.2rem;
        margin-bottom: 0.8rem;
    }

    .hero-content p {
        font-size: 1rem;
    }
.convenio-card {
  
    border: 4px solid #fde33d;

}
    .convenios-section {
        padding: 3rem 4%;
        background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    }

   

  

    .convenios-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        margin-right: 0;
        margin-left: 0;
    }

    .convenio-card {
        height: 200px;
        margin-right: 0;
        margin-left: 0;
    }

    /* Mostrar overlay y botón siempre en móviles */
    .convenio-card .overlay-card {
        opacity: 1;
    }

    .convenio-card .overlay-card span {
        transform: translateY(0);
    }

    .overlay-card span {
        padding: 10px 20px;
        font-size: 0.8rem;
    }

    .modal-preview img {
        max-width: 95%;
        max-height: 80vh;
    }

    .close-modal {
        top: 20px;
        right: 20px;
        font-size: 2.2rem;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {
    .convenios-hero {
        height: 40vh;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .convenios-section {
        padding: 2.5rem 3%;
    }

    .titulo {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    .convenios-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        max-width: 100%;
        margin: 0;
    }

    .convenio-card {
        height: 180px;
    }

    /* Asegurar que overlay y botón estén visibles */
    .convenio-card .overlay-card {
        opacity: 1;
    }

    .convenio-card .overlay-card span {
        transform: translateY(0);
    }

    .overlay-card {
        padding-bottom: 20px;
    }

    .overlay-card span {
        padding: 8px 16px;
        font-size: 0.75rem;
    }

    .modal-preview img {
        max-width: 98%;
    }

    .close-modal {
        top: 15px;
        right: 15px;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 400px) {
    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 0.85rem;
    }

    .titulo {
        font-size: 1.3rem;
    }

    .convenios-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .convenio-card {
        height: 160px;
    }

    .logo-box img {
        max-width: 70%;
        max-height: 70%;
    }

    /* Mantener botón visible */
    .convenio-card .overlay-card {
        opacity: 1;
    }

    .convenio-card .overlay-card span {
        transform: translateY(0);
    }

    .overlay-card span {
        padding: 6px 12px;
        font-size: 0.7rem;
    }
}