﻿/* =====================================================
   OrderNow Gallery
   Responsive aligned cards + Fancybox v2 mobile support
   ===================================================== */

.gallery-page,
.gallery-page * {
    box-sizing: border-box;
}

    /* ---------- Gallery grid ---------- */

    .gallery-page .gallery-row {
        display: flex;
        flex-wrap: wrap;
    }

    .gallery-page .gallery-col {
        display: flex;
        margin-bottom: 24px;
    }

    .gallery-page .gallery-work-item {
        width: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

        .gallery-page .gallery-work-item > em {
            display: block;
            position: relative;
            width: 100%;
            aspect-ratio: 4 / 3;
            overflow: hidden;
            background: #f3f4f6;
        }

            .gallery-page .gallery-work-item > em > img {
                display: block;
                width: 100%;
                height: 100%;
                object-fit: cover;
                object-position: center;
            }

    /* Keep descriptions aligned when captions have different lengths. */
    .gallery-page .recent-work-description {
        flex: 1;
        min-height: 72px;
    }

/* ---------- Tablet / mobile ---------- */

@media (max-width: 767px) {
    .gallery-page {
        padding-left: 12px;
        padding-right: 12px;
    }

        .gallery-page .gallery-title-wrap {
            text-align: center;
        }

        .gallery-page .gallery-col {
            padding-left: 6px;
            padding-right: 6px;
            margin-bottom: 16px;
        }

        .gallery-page .gallery-work-item {
            max-width: 300px;
            margin-left: auto;
            margin-right: auto;
        }

            /*
       Square thumbnails give mobile cards a consistent visual size.
       Do not set a separate fixed image height here; aspect-ratio controls it.
    */
            .gallery-page .gallery-work-item > em {
                aspect-ratio: 1 / 1;
            }

        .gallery-page .recent-work-description {
            min-height: 64px;
            text-align: center;
        }

    /* Fancybox v2 mobile sizing */
    .fancybox-wrap {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        left: 12px !important;
        right: 12px !important;
    }

    .fancybox-skin {
        padding: 8px !important;
        box-sizing: border-box;
    }

    .fancybox-outer,
    .fancybox-inner {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 78vh !important;
        overflow: hidden !important;
    }

        .fancybox-image,
        .fancybox-inner img {
            display: block !important;
            width: auto !important;
            max-width: 100% !important;
            height: auto !important;
            max-height: 78vh !important;
            object-fit: contain !important;
            margin-left: auto !important;
            margin-right: auto !important;
        }

    .fancybox-close {
        top: -12px !important;
        right: -12px !important;
        z-index: 99999 !important;
    }

    .fancybox-title {
        font-size: 13px !important;
        line-height: 1.35 !important;
        text-align: center !important;
    }
}

/* ---------- Small phones ---------- */

@media (max-width: 480px) {
    .gallery-page .gallery-col {
        width: 100%;
        float: none;
    }

    .gallery-page .gallery-work-item {
        max-width: 320px;
    }

    .fancybox-wrap {
        width: calc(100vw - 18px) !important;
        max-width: calc(100vw - 18px) !important;
        left: 9px !important;
        right: 9px !important;
    }

    .fancybox-outer,
    .fancybox-inner,
    .fancybox-image,
    .fancybox-inner img {
        max-height: 74vh !important;
    }
}
