/*-----------------------Certifications---------------------*/
#certifications {
    margin: 14px 0;
    background-color: var(--surface);
    color: var(--text);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.cert-lead {
    font-size: 16px;
    color: var(--muted);
    margin-top: 10px;
}

.cert-grid {
    display: grid;
    grid-template-columns: 1fr;
    --cert-gap: 18px;
    gap: var(--cert-gap);
    margin-top: 22px;
}

@media (min-width: 820px) and (max-width: 1279.98px) {
    .cert-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* If there's an odd number of cards, center the last one */
    .cert-grid > .cert-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        width: calc((100% - var(--cert-gap)) / 2);
        max-width: 520px;
    }
}

@media (min-width: 1280px) {
    .cert-grid {
        /* 3 cards per row using 6 sub-columns (each card spans 2) */
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .cert-grid > .cert-card {
        grid-column: span 2;
        width: auto;
        justify-self: stretch;
        max-width: none;
    }

    /* If last row has 1 card (count is 3n+1), center it */
    .cert-grid > .cert-card:last-child:nth-child(3n+1) {
        grid-column: 3 / span 2;
    }

    /* If last row has 2 cards (count is 3n+2), center the pair */
    .cert-grid > .cert-card:nth-last-child(2):nth-child(3n+1) {
        grid-column: 2 / span 2;
    }

    .cert-grid > .cert-card:last-child:nth-child(3n+2) {
        grid-column: 4 / span 2;
    }
}

.cert-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
    cursor: pointer;
}

.cert-card:focus-visible {
    outline: 2px solid var(--card-hover-border);
    outline-offset: 3px;
}

.cert-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-sm);
    background-color: var(--card-hover-bg);
    border-color: var(--card-hover-border);
}

.cert-card__media {
    position: relative;
    width: 100%;
    height: 160px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.cert-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 18px;
    position: absolute;
    inset: 0;
    transition: opacity 180ms ease;
}

.cert-card__image--badge {
    transition: none;
}

.cert-card__image--qr {
    opacity: 0;
}

.cert-card__qrLink {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    pointer-events: none;
}

.cert-card:hover .cert-card__image--badge {
    opacity: 0;
}

.cert-card:hover .cert-card__image--qr {
    opacity: 1;
}

.cert-card:hover .cert-card__qrLink {
    opacity: 1;
    pointer-events: auto;
}

.cert-card__earned {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

.cert-card__body {
    padding: 18px;
}

.cert-card__title {
    font-size: 18px;
    font-weight: 600;
    font-style: italic;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text);
    text-align: center;
}

.cert-card__desc {
    margin-top: 10px;
    color: var(--muted);
}
