﻿.phone-gallery {
    min-height: 100vh;
    color: #f8fafc;
    background: radial-gradient(circle at 50% 0%, rgba(32, 67, 111, .35), transparent 38%), #0b1220;
}

.gallery-header {
    margin-bottom: 2rem;
}

.gallery-eyebrow {
    display: inline-block;
    margin-bottom: .6rem;
    color: #64d8ff;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.gallery-title {
    margin-bottom: .5rem;
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    font-weight: 800;
}

.gallery-subtitle {
    margin: 0;
    color: #aab6c8;
    font-size: .95rem;
}

/* شبکه تصاویر؛ شبیه گالری گوشی */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 0;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: #172235;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

    .gallery-item img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .3s ease, opacity .3s ease;
    }

    .gallery-item:hover img {
        transform: scale(1.04);
        opacity: .9;
    }

.gallery-item-number {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: rgba(5, 12, 24, .65);
    color: #fff;
    font-size: .75rem;
    backdrop-filter: blur(8px);
}

/* پنجره نمایش تصویر */
.gallery-viewer {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 55px 60px;
    background: rgba(2, 6, 14, .94);
    backdrop-filter: blur(8px);
}

    .gallery-viewer.is-open {
        display: flex;
    }

.viewer-content {
    display: flex;
    max-width: 100%;
    max-height: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

    .viewer-content img {
        display: block;
        max-width: min(100%, 1100px);
        max-height: calc(100vh - 120px);
        object-fit: contain;
        border-radius: 12px;
        box-shadow: 0 20px 70px rgba(0, 0, 0, .5);
    }

.viewer-counter {
    color: #d4deeb;
    font-size: .9rem;
}

.viewer-close,
.viewer-nav {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
    transition: background .2s ease;
}

    .viewer-close:hover,
    .viewer-nav:hover {
        background: rgba(255, 255, 255, .22);
    }

.viewer-close {
    top: 18px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
}

.viewer-nav {
    top: 50%;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 38px;
    line-height: 1;
    transform: translateY(-50%);
}

.viewer-prev {
    left: 18px;
}

.viewer-next {
    right: 18px;
}

body.gallery-viewer-open {
    overflow: hidden;
}

@media (min-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (min-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (max-width: 575.98px) {
    .phone-gallery {
        padding-top: 2rem !important;
    }

    .gallery-grid {
        gap: 7px;
    }

    .gallery-item {
        border-radius: 10px;
    }

    .gallery-viewer {
        padding: 55px 12px;
    }

    .viewer-nav {
        top: auto;
        bottom: 18px;
        transform: none;
    }

    .viewer-prev {
        left: calc(50% - 58px);
    }

    .viewer-next {
        right: calc(50% - 58px);
    }

    .viewer-content img {
        max-height: calc(100vh - 150px);
    }
}
