.gallery-page {
    --gallery-primary: #06909d;
    --gallery-primary-light: #e1f7f9;
    --gallery-primary-border: #98e0e7;
    --gallery-accent: #d48e52;
    --gallery-text: #232c39;
    --gallery-muted: #6b7280;
    --gallery-background: #f9fafb;
    background: var(--gallery-background);
    color: var(--gallery-text);
}

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

.gallery-hero {
    position: relative;
    min-height: 530px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background-image: url("/assets/source/images/bg-gallery.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    isolation: isolate;
}

.gallery-hero__overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(13, 24, 26, .48) 0%, rgba(12, 26, 28, .32) 48%, rgba(9, 22, 24, .62) 100%),
        linear-gradient(90deg, rgba(3, 72, 78, .14), transparent 46%, rgba(85, 57, 33, .16));
}

.gallery-hero__content {
    width: min(760px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-top: 54px;
    color: #fff;
    text-align: center;
}

.gallery-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-bottom: 4px;
    color: #f2ddcb;
    font-size: 15px;
    font-weight: 500;
}

.gallery-breadcrumb a {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease;
}

.gallery-breadcrumb a:hover,
.gallery-breadcrumb a:focus-visible {
    color: #fff;
}

.gallery-breadcrumb img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.gallery-hero h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 800;
    line-height: 1.45;
    text-wrap: balance;
}

.gallery-hero p {
    max-width: 670px;
    margin: 0;
    color: rgba(255, 255, 255, .82);
    font-size: clamp(14px, 1.6vw, 18px);
    font-weight: 400;
    line-height: 2;
    text-wrap: balance;
}

.gallery-content {
    padding: 66px 0 78px;
}

.gallery-container {
    width: min(1260px, calc(100% - 48px));
    margin-inline: auto;
}

.gallery-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 38px;
}

.gallery-filters {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-bottom: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #c9eff3 transparent;
}

.gallery-filter {
    min-height: 44px;
    flex: 0 0 auto;
    padding: 9px 18px;
    border: 1px solid var(--gallery-primary-border);
    border-radius: 12px;
    background: transparent;
    color: var(--gallery-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.gallery-filter:hover {
    border-color: var(--gallery-primary);
    transform: translateY(-1px);
}

.gallery-filter:focus-visible,
.gallery-more:focus-visible,
.gallery-item:focus-visible {
    outline: 3px solid rgba(6, 144, 157, .24);
    outline-offset: 3px;
}

.gallery-filter.is-active {
    border-color: #07b4c4;
    background: #c9eff3;
    box-shadow: 0 6px 18px rgba(6, 144, 157, .08);
}

.gallery-count {
    min-height: 44px;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 8px 15px;
    border: 1.5px solid var(--gallery-accent);
    border-radius: 12px;
    background: rgba(255, 255, 255, .66);
    color: var(--gallery-muted);
    font-size: 14px;
    white-space: nowrap;
}

.gallery-count strong {
    color: var(--gallery-accent);
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px 24px;
}

.gallery-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.gallery-item[hidden] {
    display: none;
}

.gallery-item__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 17px;
    background: #e8ecee;
    box-shadow: 0 10px 28px rgba(25, 54, 57, .06);
}

.gallery-item__media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .45s cubic-bezier(.2, .72, .3, 1);
}

.gallery-item__overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(3, 72, 78, 0), rgba(3, 72, 78, .42));
    opacity: 0;
    transition: opacity .3s ease;
}

.gallery-item__zoom {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--gallery-primary);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
    transform: translateY(8px) scale(.9);
    transition: transform .3s ease;
}

.gallery-item__zoom svg {
    width: 23px;
    height: 23px;
}

.gallery-item:hover .gallery-item__media img,
.gallery-item:focus-visible .gallery-item__media img {
    transform: scale(1.045);
}

.gallery-item:hover .gallery-item__overlay,
.gallery-item:focus-visible .gallery-item__overlay {
    opacity: 1;
}

.gallery-item:hover .gallery-item__zoom,
.gallery-item:focus-visible .gallery-item__zoom {
    transform: translateY(0) scale(1);
}

.gallery-item__caption {
    display: block;
    color: var(--gallery-muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.8;
    transition: color .2s ease;
}

.gallery-item:hover .gallery-item__caption {
    color: var(--gallery-primary);
}

.gallery-empty {
    margin: 30px 0 0;
    padding: 26px;
    border: 1px dashed #cbd5d8;
    border-radius: 16px;
    color: var(--gallery-muted);
    text-align: center;
}

.gallery-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 38px;
}

.gallery-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: var(--gallery-accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s ease, transform .2s ease;
}

.gallery-more:hover {
    color: #aa7242;
    transform: translateY(2px);
}

.gallery-more svg {
    width: 21px;
    height: 21px;
}

.gallery-more[hidden],
.gallery-empty[hidden] {
    display: none;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* هماهنگ سازی نمای LightGallery با هویت بصری پروژه */
.lg-backdrop {
    background-color: rgba(4, 22, 24, .96);
}

.lg-outer {
    direction: ltr;
    font-family: "Vazirmatn", "Vazir", sans-serif;
}

.lg-outer .lg-sub-html {
    direction: rtl;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62));
    text-align: center;
}

.lg-outer .lg-sub-html h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.lg-outer .lg-thumb-item.active,
.lg-outer .lg-thumb-item:hover {
    border-color: #37c3d0;
}

.lg-outer .lg-toolbar .lg-icon:hover,
.lg-outer .lg-next:hover,
.lg-outer .lg-prev:hover {
    color: #98e0e7;
}

@media (max-width: 1024px) {
    .gallery-hero {
        min-height: 470px;
    }

    .gallery-container {
        width: min(100% - 36px, 960px);
    }

    .gallery-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-count {
        align-self: flex-start;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .gallery-hero {
        min-height: 390px;
        background-position: 48% center;
    }

    .gallery-hero__content {
        gap: 12px;
        padding-top: 36px;
    }

    .gallery-breadcrumb {
        font-size: 12px;
    }

    .gallery-hero h1 {
        font-size: 26px;
    }

    .gallery-hero p {
        max-width: 340px;
        font-size: 13px;
        line-height: 1.9;
    }

    .gallery-content {
        padding: 40px 0 56px;
    }

    .gallery-container {
        width: calc(100% - 28px);
    }

    .gallery-toolbar {
        gap: 15px;
        margin-bottom: 26px;
    }

    .gallery-filter {
        min-height: 40px;
        padding: 7px 14px;
        font-size: 13px;
    }

    .gallery-count {
        width: 100%;
        justify-content: space-between;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .gallery-item__media {
        border-radius: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page *,
    .gallery-page *::before,
    .gallery-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
