/* ===============================
   Общий контейнер страницы
   =============================== */

.certs-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    font-family: 'Roboto', sans-serif;
}

.certs-header {
    text-align: center;
    margin-bottom: 40px;
}

.certs-header h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 500;
    color: #1f2024;
}

.certs-header p {
    margin-top: 10px;
    font-size: 0.95em;
    color: #676769;
}


/* ===============================
   Сетки сертификатов
   =============================== */

.certs-grid {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 35px;
}


/* ===============================
   Карточка сертификата
   =============================== */

.cert-card {
    width: 260px;
    background: #ffffff;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 40px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
}

.cert-card img {
    width: 100%;
    height: auto;
    display: block;
}


/* ===============================
   3-й ряд — вертикальные
   =============================== */

.certs-grid.vertical .cert-card img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

/* ===============================
   Lightbox — корректное вписывание
   =============================== */

#cert-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(31, 32, 36, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#cert-lightbox .content {
    position: relative;
    padding: 20px;               /* отступы ТУТ */
    box-sizing: border-box;
}

#cert-lightbox img {
    max-width: calc(100vw - 80px);
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;         /* ключ */
    background: #ffffff;
    border-radius: 5px;
    box-shadow: 0 0 40px rgba(0,0,0,0.4);
}

/* ===============================
   Кнопка закрытия
   =============================== */

#cert-lightbox .close-btn {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 36px;
    height: 36px;
    background: #1f2024;
    color: #ffffff;
    border-radius: 50%;
    font-size: 22px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

#cert-lightbox .close-btn:hover {
    background: #000000;
}


/* ===============================
   Адаптив
   =============================== */

@media (max-width: 1024px) {
    .cert-card {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .certs-grid {
        flex-wrap: wrap;
    }

    .cert-card {
        width: 200px;
    }

    #cert-lightbox .content {
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 30px);
    }
}
