.certificate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Slightly smaller min-width */
    gap: 2rem;
    margin-top: 2rem;
}

#certificates {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 480px) {
    .certificate-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .certificate-info {
        padding: 1rem;
    }
    
    .certificate-image-container {
        height: 180px; /* Slightly shorter on mobile */
    }
    
    .modal-content {
        max-width: 95%; /* Use more screen space */
    }
    
    .close-modal {
        top: 10px;
        right: 20px;
    }
}

.certificate-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.certificate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--accent);
}

.certificate-image-container {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    overflow: hidden;
    position: relative;
    background-color: #2d3748; /* Placeholder background */
}

.certificate-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.certificate-card:hover .certificate-image-container img {
    transform: scale(1.05);
}

/* Overlay with zoom icon */
.certificate-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.certificate-overlay i {
    color: white;
    font-size: 2rem;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.certificate-card:hover .certificate-overlay i {
    transform: scale(1);
}

.certificate-info {
    padding: 1.5rem;
    text-align: center;
}

.certificate-info h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.certificate-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.certificate-date {
    display: block;
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Modal for Zoom Effect */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    position: absolute;
    bottom: 20px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}

@media only screen and (max-width: 700px){
    .modal-content {
        width: 100%;
    }
}
