/* CERTIFICATES GALLERY (homepages EN/RU/UA, below the contact form) */
.cert-section {
    --cert-gap: 20px;
    background: transparent;
    padding: 40px 40px 100px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.cert-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: min(420px, 60%);
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, rgba(204, 255, 0, 0.55), transparent);
    box-shadow: 0 0 12px rgba(204, 255, 0, 0.35);
}

.cert-section::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 700px 380px at 50% 60%, rgba(204, 255, 0, 0.035), transparent 70%);
    pointer-events: none;
}

.cert-header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin: 0 auto 36px;
    max-width: 680px;
}

.cert-label {
    font-size: 0.8rem;
    color: var(--neon-green, #CCFF00);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 12px;
    text-shadow: 0 0 10px rgba(204, 255, 0, 0.45);
}

.cert-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    margin: 0 0 14px;
    color: #fff;
}

.cert-intro {
    color: var(--text-dim, #8a9aa3);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
}

/* Track */
.cert-viewport {
    position: relative;
    z-index: 1;
}

.cert-track {
    display: flex;
    gap: var(--cert-gap);
    list-style: none;
    margin: 0;
    padding: 14px 4px 22px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(204, 255, 0, 0.35) transparent;
    -webkit-overflow-scrolling: touch;
}

.cert-track::-webkit-scrollbar { height: 6px; }
.cert-track::-webkit-scrollbar-thumb { background: rgba(204, 255, 0, 0.3); border-radius: 3px; }
.cert-track::-webkit-scrollbar-track { background: transparent; }

.cert-item {
    /* six cards fill the row on desktop; narrower screens scroll */
    flex: 0 0 clamp(160px, calc((100% - 5 * var(--cert-gap)) / 6), 210px);
    scroll-snap-align: start;
}

.cert-card {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 14px;
    outline: none;
    transition: transform 0.35s ease;
}

.cert-frame {
    display: block;
    position: relative;
    aspect-ratio: 941 / 1672;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(204, 255, 0, 0.16);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.cert-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* one soft sheen on hover */
.cert-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 35%, rgba(204, 255, 0, 0.12) 50%, transparent 65%);
    transform: translateX(-120%);
    pointer-events: none;
}

.cert-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(10, 10, 10, 0.75);
    border: 1px solid rgba(204, 255, 0, 0.45);
    color: var(--neon-green, #CCFF00);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cert-zoom svg { width: 16px; height: 16px; }

.cert-caption {
    display: block;
    padding: 12px 2px 0;
}

.cert-name {
    display: block;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 4px;
}

.cert-meta {
    display: block;
    color: var(--text-dim, #8a9aa3);
    font-size: 0.72rem;
    line-height: 1.45;
}

@media (hover: hover) {
    .cert-card:hover { transform: translateY(-6px); }
    .cert-card:hover .cert-frame {
        border-color: rgba(204, 255, 0, 0.6);
        box-shadow: 0 0 0 1px rgba(204, 255, 0, 0.25), 0 12px 32px rgba(204, 255, 0, 0.14);
    }
    .cert-card:hover .cert-frame::after {
        transform: translateX(120%);
        transition: transform 0.9s ease;
    }
    .cert-card:hover .cert-zoom { opacity: 1; transform: scale(1); }
}

.cert-card:focus-visible { transform: translateY(-6px); }
.cert-card:focus-visible .cert-frame {
    border-color: var(--neon-green, #CCFF00);
    box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.35), 0 12px 32px rgba(204, 255, 0, 0.16);
}
.cert-card:focus-visible .cert-zoom { opacity: 1; transform: scale(1); }
.cert-card:focus-visible .cert-name { color: var(--neon-green, #CCFF00); }

/* Scroll arrows: only shown when the track overflows */
.cert-nav {
    position: absolute;
    top: calc(50% - 30px);
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(204, 255, 0, 0.45);
    background: rgba(10, 10, 10, 0.85);
    color: var(--neon-green, #CCFF00);
    display: none;
    place-items: center;
    cursor: pointer;
    transition: opacity 0.25s ease, box-shadow 0.25s ease;
}
.cert-nav svg { width: 18px; height: 18px; }
.cert-nav.prev { left: -8px; }
.cert-nav.next { right: -8px; }
.cert-viewport.is-scrollable .cert-nav { display: grid; }
.cert-nav:disabled { opacity: 0; pointer-events: none; }
.cert-nav:hover { box-shadow: 0 0 14px rgba(204, 255, 0, 0.35); }
.cert-nav:focus-visible { outline: 2px solid var(--neon-green, #CCFF00); outline-offset: 3px; }

/* Entrance: only when JS is running and the section hasn't come into view yet */
.cert-section.cert-anim .cert-item {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: calc(var(--i, 0) * 90ms);
}
.cert-section.cert-anim.is-visible .cert-item {
    opacity: 1;
    transform: none;
}

/* Lightbox */
.cert-lightbox {
    border: none;
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    background: transparent;
    color: #fff;
    overflow: hidden;
}
.cert-lightbox::backdrop {
    background: rgba(2, 4, 8, 0.88);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.cert-lightbox[open] { display: flex; }

.cert-lb-stage {
    position: relative;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 16px;
    max-width: 100%;
    max-height: 100%;
    animation: certLbIn 0.28s ease-out;
}

.cert-lb-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    touch-action: pan-y pinch-zoom;
}

.cert-lb-img {
    display: block;
    height: calc(100vh - 150px);
    height: calc(100dvh - 150px);
    max-height: 1672px;
    width: auto;
    max-width: 100%;
    aspect-ratio: 941 / 1672;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid rgba(204, 255, 0, 0.3);
    box-shadow: 0 0 40px rgba(204, 255, 0, 0.1);
    background: #000;
}

.cert-lb-caption {
    text-align: center;
    padding-top: 12px;
    max-width: 520px;
}
.cert-lb-title { display: block; font-weight: 700; font-size: 0.9rem; line-height: 1.4; }
.cert-lb-meta { display: block; color: var(--text-dim, #8a9aa3); font-size: 0.78rem; margin-top: 3px; }
.cert-lb-meta a { color: var(--neon-green, #CCFF00); }
.cert-lb-count { color: var(--neon-green, #CCFF00); margin-right: 6px; }

.cert-lb-btn {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(204, 255, 0, 0.5);
    background: rgba(10, 10, 10, 0.85);
    color: var(--neon-green, #CCFF00);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: box-shadow 0.25s ease;
}
.cert-lb-btn svg { width: 20px; height: 20px; }
.cert-lb-btn:hover { box-shadow: 0 0 16px rgba(204, 255, 0, 0.35); }
.cert-lb-btn:focus-visible { outline: 2px solid var(--neon-green, #CCFF00); outline-offset: 3px; }

.cert-lb-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1;
}

@keyframes certLbIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 968px) {
    .cert-section { padding: 30px 20px 70px; }
    .cert-title { font-size: 1.5rem; }
    .cert-item { flex-basis: clamp(150px, 42vw, 200px); }
    .cert-nav { display: none !important; }
}

@media (max-width: 640px) {
    /* image fills the width; prev/next move under the caption */
    .cert-lb-stage {
        flex-wrap: wrap;
        padding: 68px 12px 12px;
        gap: 10px 24px;
    }
    .cert-lb-figure { order: 0; flex: 1 1 100%; }
    .cert-lb-img {
        height: auto;
        width: auto;
        max-height: calc(100vh - 235px);
        max-height: calc(100dvh - 235px);
    }
    .cert-lb-caption { padding-top: 8px; }
    .cert-lb-btn { width: 42px; height: 42px; }
    .cert-lb-btn.prev, .cert-lb-btn.next { order: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cert-card, .cert-frame, .cert-zoom, .cert-nav, .cert-lb-btn { transition: none; }
    .cert-card:hover, .cert-card:focus-visible { transform: none; }
    .cert-frame::after { display: none; }
    .cert-section.cert-anim .cert-item { opacity: 1; transform: none; transition: none; }
    .cert-lb-stage { animation: none; }
}
