/**
 * style.css — стили компонента certificate (шаблон rost2026)
 * Сетка сертификатов + модальное окно на чистом JS.
 * Тёмная тема через :where(.dark, .dark *) — нулевая специфичность,
 * чтобы не перекрывать Tailwind dark-классы.
 */

/* === Сетка сертификатов === */
.cert-grid {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
    justify-content: flex-start;
}

.cert-column {
    flex: 0 0 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .cert-column {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 1200px) {
    .cert-column {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* === Карточка сертификата === */
.cert-card {
    /* Фиксированный размер превью: 297px */
    width: 297px;
    height: 297px;
    /* Центрирование изображения любого формата внутри */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    border: 1px solid #dee2e6;
}

.cert-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-color: #adb5bd;
    transform: translateY(-5px);
}

.cert-card:focus-visible {
    outline: 2px solid #e21a22;
    outline-offset: 2px;
}

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

/* === Модальное окно === */
.cert-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-modal.hidden {
    display: none;
}

.cert-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.cert-modal__content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-modal__image {
    max-width: 90vw;
    max-height: 90vh;
    border: 6px solid #ffffff;
    border-radius: 4px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}

.cert-modal__close {
    position: absolute;
    top: -50px;
    right: 0;
    color: #ffffff;
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.cert-modal__close:hover {
    opacity: 1;
}

.cert-modal__close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* === Тёмная тема (через :where для нулевой специфичности) === */
:where(.dark, .dark *) .cert-card {
    border-color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

:where(.dark, .dark *) .cert-card:hover {
    border-color: #4b5563;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

:where(.dark, .dark *) .cert-modal__image {
    border-color: #1e293b;
}
