/**
 * Certificates Page Styles (Сертифікати)
 * Gallery layout with 5 certificates from Figma design
 */

/* Certificates Page Container */
.certificates-page {
    position: relative;
    width: 100%;
    background: var(--color-bg); /* #F9F6F0 */
    padding: 0;
}

/* Let normal .site-main margins work */
.site-main.certificates-page {
    margin-bottom: 0 !important;
}

/* Remove footer spacing for Certificates page */
body.page-certificates-template .footer-section {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.page-certificates-template .site-main.certificates-page {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.certificates-page .container {
    position: relative;
    max-width: 1920px;
    width: 100%;
    margin: 0 auto;
    padding: 0 !important;
}

/* Certificates Article */
.certificates-page article {
    position: relative;
    width: 1660px;
    margin: 0 auto !important;
    padding: 0 !important;
}

.certificates-page .entry-header {
    width: 1660px;
    margin: 0 0 40px 0;
}

/* Certificates Page Title - Figma specs */
.certificates-page .certificates-title {
    width: 100%;
    font-family: 'Roboto Condensed', sans-serif;
    font-style: normal;
    font-weight: 700;
    font-size: 60px;
    line-height: 120%;
    color: var(--color-black);
    margin: 0;
}

/* Content wrapper */
.certificates-page .entry-content {
    width: 1660px;
}

/* Gallery layout - 5 images in a row */
.certificates-page .certificates-gallery {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 50px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    width: 1660px !important;
}

/* Individual certificate item */
.certificates-page .certificate-item {
    margin: 0 !important;
    width: 252px !important;
    min-width: 252px !important;
    max-width: 252px !important;
    height: 357px !important;
    flex: none !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    position: relative !important;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Certificate image wrapper */
.certificates-page .certificate-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

/* Certificate images - Figma specs */
.certificates-page .certificate-item img {
    width: 252px !important;
    height: 357px !important;
    object-fit: cover !important;
    border-radius: 25px !important;
    display: block !important;
    transition: transform 0.3s ease;
}

/* Hover overlay with zoom icon */
.certificates-page .certificate-overlay {
    position: absolute;
    inset: 0;
    background: rgba(128, 194, 66, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    border-radius: 25px;
}

.certificates-page .certificate-overlay .zoom-icon {
    width: 50px;
    height: 50px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hover effects */
.certificates-page .certificate-item:hover {
    transform: translateY(-8px);
}

.certificates-page .certificate-item:hover .certificate-image-wrapper {
    box-shadow: 0 12px 40px rgba(128, 194, 66, 0.25);
}

.certificates-page .certificate-item:hover img {
    transform: scale(1.05);
}

.certificates-page .certificate-item:hover .certificate-overlay {
    background: rgba(128, 194, 66, 0.15);
}

.certificates-page .certificate-item:hover .zoom-icon {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet - 3 certificates per row */
@media (max-width: 1024px) {
    body.page-certificates-template #page {
        padding: 0 15px !important;
    }

    .certificates-page {
        padding: 40px 0;
    }

    .certificates-page article {
        width: 100%;
        padding: 0;
    }

    .certificates-page .entry-header {
        width: 100%;
        margin-bottom: 30px;
    }

    .certificates-page .certificates-title {
        font-size: 40px;
    }

    .certificates-page .entry-content {
        width: 100%;
    }

    .certificates-page .certificates-gallery {
        width: 100% !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 30px !important;
    }

    .certificates-page .certificate-item {
        width: 30% !important;
        min-width: 200px !important;
        max-width: 250px !important;
        height: auto !important;
    }

    .certificates-page .certificate-item img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 252/357;
    }
}

/* Mobile - 2 certificates per row */
@media (max-width: 768px) {
    body.page-certificates-template #page {
        padding: 0 10px !important;
    }

    .certificates-page {
        padding: 20px 0;
    }

    .certificates-page .entry-header {
        margin-bottom: 20px;
    }

    .certificates-page .certificates-title {
        font-size: 28px;
        line-height: 130%;
    }

    .certificates-page .certificates-gallery {
        gap: 20px !important;
    }

    .certificates-page .certificate-item {
        width: 48% !important;
        min-width: 140px !important;
        max-width: 200px !important;
    }

    .certificates-page .certificate-item img {
        border-radius: 15px !important;
    }

    body.page-certificates-template .footer-section {
        margin-top: 0 !important;
    }
}

/* Small mobile - 1 certificate per row */
@media (max-width: 480px) {
    body.page-certificates-template #page {
        padding: 0 8px !important;
    }

    .certificates-page {
        padding: 15px 0;
    }

    .certificates-page .entry-header {
        margin-bottom: 15px;
    }

    .certificates-page .certificates-title {
        font-size: 24px;
        line-height: 130%;
    }

    .certificates-page .certificates-gallery {
        gap: 15px !important;
        flex-direction: column !important;
    }

    .certificates-page .certificate-item {
        width: 100% !important;
        max-width: 100% !important;
    }

    .certificates-page .certificate-item img {
        width: 100% !important;
        border-radius: 10px !important;
    }

    .certificates-page .certificate-image-wrapper {
        border-radius: 10px;
    }

    .certificates-page .certificate-overlay {
        border-radius: 10px;
    }
}

/* ===================================
   LIGHTBOX STYLES
   =================================== */

.cert-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cert-lightbox.active {
    opacity: 1;
    visibility: visible;
}

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

.cert-lightbox__image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cert-lightbox.active .cert-lightbox__image {
    transform: scale(1);
    opacity: 1;
}

.cert-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.cert-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.cert-lightbox__close svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

.cert-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.cert-lightbox__nav:hover {
    background: rgba(128, 194, 66, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.cert-lightbox__nav svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

.cert-lightbox__prev {
    left: 20px;
}

.cert-lightbox__next {
    right: 20px;
}

.cert-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 16px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
}

/* Lightbox responsive */
@media (max-width: 768px) {
    .cert-lightbox__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .cert-lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .cert-lightbox__prev {
        left: 10px;
    }

    .cert-lightbox__next {
        right: 10px;
    }

    .cert-lightbox__image {
        max-height: 80vh;
        border-radius: 10px;
    }

    .cert-lightbox__counter {
        bottom: 10px;
        font-size: 14px;
        padding: 6px 15px;
    }
}
