/* Gallery page — sidebar + editorial card grid */

@keyframes galleryPageHeroGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.82; transform: scale(1.05); }
}

body.page-gallery {
    background: #eef2f7;
    overflow-x: clip;
}

@media (max-width: 992px) {
    body.page-gallery {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
}

.page-header-gallery.gallery-page-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(72px, 10vw, 96px) 0 clamp(88px, 11vw, 108px);
    background-image:
        linear-gradient(135deg, rgba(5, 32, 64, 0.94) 0%, rgba(12, 61, 122, 0.9) 48%, rgba(26, 86, 168, 0.86) 100%),
        url('../images/company-factory.jpg');
    background-size: cover;
    background-position: center;
}

.gallery-page-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.gallery-page-hero-glow {
    position: absolute;
    top: -16%;
    left: -6%;
    width: min(480px, 58vw);
    height: min(480px, 58vw);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 163, 224, 0.28) 0%, transparent 68%);
    animation: galleryPageHeroGlow 8s ease-in-out infinite;
}

.gallery-page-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 88%);
}

.gallery-page-hero-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.page-header-gallery.gallery-page-hero .page-header-eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8ec5ff;
}

.page-header-gallery.gallery-page-hero h1,
.page-header-gallery.gallery-page-hero p {
    color: #fff;
}

.page-header-gallery.gallery-page-hero h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.page-header-gallery.gallery-page-hero p {
    max-width: 680px;
    margin: 0 auto 22px;
    opacity: 0.92;
    font-size: 1.02rem;
    line-height: 1.65;
}

.gallery-page-hero-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.gallery-page-hero-chip {
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
}

.gallery-page-hero-chip--gold {
    color: #ffe082;
    border-color: rgba(255, 224, 130, 0.35);
    background: rgba(255, 193, 7, 0.14);
}

.gallery-page-trust-wrap {
    position: relative;
    z-index: 3;
    margin-top: -36px;
    padding: 0 clamp(12px, 3vw, 24px);
}

.gallery-page-trust-wrap .trust-strip-wrap {
    margin: 0;
    padding: 0;
}

.gallery-page-trust-wrap .container {
    max-width: 1080px;
}

.gallery-page-trust-wrap .trust-strip-marquee {
    border-radius: 20px 64px 20px 48px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(12, 61, 122, 0.1);
    box-shadow: 0 16px 40px rgba(12, 61, 122, 0.12);
    padding: 14px 18px;
}

.gallery-page-trust-wrap .trust-strip-item {
    color: var(--brand-dark);
    font-weight: 700;
}

.section-gallery-page {
    position: relative;
    padding: clamp(36px, 5vw, 60px) 0 88px;
}

.gallery-page-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: clamp(20px, 3vw, 32px);
    align-items: start;
}

/* Sidebar filters */
.gallery-sidebar {
    position: sticky;
    top: 96px;
    padding: 24px 20px;
    border-radius: 24px;
    background: linear-gradient(165deg, #0a2540 0%, #0c3d7a 55%, #1456a8 100%);
    box-shadow: 0 20px 48px rgba(10, 37, 64, 0.28);
    color: #fff;
}

.gallery-sidebar-head {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.gallery-sidebar-brand {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8ec5ff;
    margin-bottom: 8px;
}

.gallery-sidebar-count {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88);
}

.gallery-sidebar-count strong {
    display: block;
    font-size: 2rem;
    line-height: 1.1;
    color: #fff;
    margin-bottom: 2px;
}

.gallery-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gallery-filter-btn {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.86rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.gallery-filter-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.gallery-filter-icon::after {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 3px;
    background: currentColor;
    opacity: 0.9;
}

.gallery-filter-icon--all { color: #8ec5ff; }
.gallery-filter-icon--field { color: #81c784; }
.gallery-filter-icon--factory { color: #ffb74d; }
.gallery-filter-icon--products { color: #64b5f6; }

.gallery-filter-icon--all::after {
    inset: 8px;
    border-radius: 50%;
}

.gallery-filter-icon--field::after {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    inset: 9px 8px 8px;
}

.gallery-filter-icon--factory::after {
    inset: 10px 8px 8px;
    border-radius: 2px 2px 0 0;
}

.gallery-filter-icon--products::after {
    inset: 9px;
    border-radius: 4px;
    transform: rotate(45deg);
}

.gallery-filter-count {
    min-width: 28px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
}

.gallery-filter-btn:hover,
.gallery-filter-btn.is-active {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.gallery-filter-btn.is-active {
    background: #fff;
    color: var(--brand-dark);
}

.gallery-filter-btn.is-active .gallery-filter-count {
    background: rgba(12, 61, 122, 0.1);
    color: var(--brand);
}

/* Card grid */
.gallery-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.gallery-cards.is-filtered {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.gallery-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: none;
    padding: 0;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 8px 24px rgba(12, 61, 122, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-card__frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f0f4fa;
}

.gallery-card--field .gallery-card__frame {
    background: linear-gradient(160deg, #e8f5e9 0%, #f1f8f2 100%);
}

.gallery-card--factory .gallery-card__frame {
    background: linear-gradient(160deg, #fff3e0 0%, #fffaf3 100%);
}

.gallery-card--products .gallery-card__frame {
    background: linear-gradient(160deg, #e3f2fd 0%, #f3f8ff 100%);
}

.gallery-card__media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.gallery-card.is-cutout .gallery-card__media {
    padding: 18px 16px;
    background: transparent;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.gallery-card.is-cutout img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(12, 61, 122, 0.18));
}

.gallery-card__zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 32, 62, 0.45);
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-card__zoom svg {
    width: 42px;
    height: 42px;
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(6px);
}

.gallery-card__info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px 18px;
    border-top: 3px solid transparent;
}

.gallery-card--field .gallery-card__info { border-top-color: #43a047; }
.gallery-card--factory .gallery-card__info { border-top-color: #fb8c00; }
.gallery-card--products .gallery-card__info { border-top-color: #1e88e5; }

.gallery-card__cat {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-light);
}

.gallery-card--field .gallery-card__cat { color: #2e7d32; }
.gallery-card--factory .gallery-card__cat { color: #ef6c00; }
.gallery-card--products .gallery-card__cat { color: #1565c0; }

.gallery-card__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--brand-dark);
}

.gallery-card__cta {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--brand);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 44px rgba(12, 61, 122, 0.16);
}

.gallery-card:hover img {
    transform: scale(1.06);
}

.gallery-card.is-cutout:hover img {
    transform: scale(1.04);
}

.gallery-card:hover .gallery-card__zoom {
    opacity: 1;
}

.gallery-card:hover .gallery-card__cta {
    opacity: 1;
    transform: translateY(0);
}

.gallery-card:focus-visible {
    outline: 3px solid rgba(26, 86, 168, 0.45);
    outline-offset: 3px;
}

/* Featured spotlight card */
.gallery-card--featured {
    grid-column: 1 / -1;
}

@media (min-width: 1101px) {
    .gallery-card--featured {
        flex-direction: row;
        min-height: 280px;
    }

    .gallery-card--featured .gallery-card__frame {
        flex: 1.15;
        aspect-ratio: auto;
        min-height: 280px;
    }

    .gallery-card--featured .gallery-card__info {
        flex: 0.85;
        justify-content: center;
        padding: 28px 32px;
        border-top: none;
        border-left: 4px solid var(--brand);
        background: linear-gradient(180deg, #fafcff 0%, #fff 100%);
    }

    .gallery-card--featured.gallery-card--field .gallery-card__info { border-left-color: #43a047; }
    .gallery-card--featured.gallery-card--factory .gallery-card__info { border-left-color: #fb8c00; }
    .gallery-card--featured.gallery-card--products .gallery-card__info { border-left-color: #1e88e5; }
}

.gallery-card--featured .gallery-card__title {
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}

.gallery-card--featured .gallery-card__cta {
    opacity: 1;
    transform: none;
    margin-top: 8px;
    font-size: 0.88rem;
}

.gallery-cards.is-filtered .gallery-card--featured,
.gallery-card--featured.is-hidden {
    display: none;
}

.gallery-card.is-hidden {
    display: none;
}

.gallery-filter-btn:focus-visible {
    outline: 3px solid rgba(142, 197, 255, 0.55);
    outline-offset: 2px;
}

.gallery-empty-msg {
    text-align: center;
    color: var(--text-light);
    padding: 56px 0 12px;
    font-size: 1.02rem;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(4, 18, 36, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px;
    backdrop-filter: blur(8px);
}

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

.gallery-lightbox-inner {
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

.gallery-lightbox-inner img {
    display: block;
    margin: 0 auto;
    max-width: min(100%, 720px);
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox-inner p {
    color: #fff;
    margin-top: 18px;
    font-size: 1.05rem;
    font-weight: 600;
}

.gallery-lightbox-close {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-close svg {
    width: 20px;
    height: 20px;
}

.gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: scale(1.04);
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.24);
}

.gallery-lightbox-prev { left: 16px; }
.gallery-lightbox-next { right: 16px; }

@media (max-width: 1100px) {
    .gallery-cards:not(.is-filtered) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .gallery-page-layout,
    .gallery-main,
    .gallery-cards,
    .gallery-card,
    .gallery-card__frame,
    .gallery-card__info,
    .gallery-sidebar {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .gallery-page-layout {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        gap: 16px;
    }

    .gallery-sidebar {
        width: 100%;
        overflow: hidden;
    }

    .gallery-main {
        width: 100%;
        overflow: hidden;
    }

    .gallery-cards,
    .gallery-cards.is-filtered {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        width: 100%;
    }

    .gallery-card--featured,
    .gallery-card--featured .gallery-card__frame,
    .gallery-card--featured .gallery-card__info {
        flex: none;
        min-height: 0;
        width: 100%;
    }

    .gallery-card--featured .gallery-card__frame {
        aspect-ratio: 4 / 3;
    }

    .gallery-card--featured .gallery-card__media {
        padding: 0;
    }

    .gallery-card--featured:not(.is-cutout) img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        object-fit: cover;
    }

    .gallery-card--featured .gallery-card__info {
        padding: 16px;
        border-left: none;
        border-top: 4px solid var(--brand);
        background: #fff;
    }

    .gallery-card--featured.gallery-card--field .gallery-card__info { border-top-color: #43a047; }
    .gallery-card--featured.gallery-card--factory .gallery-card__info { border-top-color: #fb8c00; }
    .gallery-card--featured.gallery-card--products .gallery-card__info { border-top-color: #1e88e5; }
}

@media (max-width: 768px) {
    .gallery-page-trust-wrap {
        margin-top: -24px;
        padding: 0 12px;
    }

    .gallery-page-trust-wrap .trust-strip-wrap {
        background: transparent;
        border-bottom: none;
    }

    .gallery-page-trust-wrap .trust-strip-marquee {
        border-radius: 999px;
        padding: 12px 14px;
    }

    .page-header-gallery.gallery-page-hero {
        padding: 56px 0 72px;
    }

    .page-header-gallery.gallery-page-hero p {
        font-size: 0.94rem;
        padding: 0 8px;
    }

    .gallery-page-hero-chips {
        gap: 8px;
        padding: 0 8px;
    }

    .gallery-page-hero-chip {
        font-size: 0.76rem;
        padding: 7px 12px;
    }

    .section-gallery-page {
        padding: 24px 0 calc(104px + env(safe-area-inset-bottom, 0px));
        overflow-x: clip;
    }

    .gallery-cards {
        padding-bottom: 8px;
    }

    .gallery-cards .gallery-card:last-child {
        scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .section-gallery-page .container {
        padding-left: 12px;
        padding-right: 12px;
        max-width: 100%;
        width: 100%;
        overflow: hidden;
    }

    .gallery-page-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .gallery-main {
        min-width: 0;
        width: 100%;
    }

    .gallery-sidebar {
        position: static;
        padding: 14px 12px;
        border-radius: 18px;
    }

    .gallery-sidebar-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .gallery-sidebar-count {
        font-size: 0.82rem;
        text-align: right;
    }

    .gallery-sidebar-count strong {
        display: inline;
        font-size: 1.25rem;
        margin-right: 4px;
    }

    .gallery-filters {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
        mask-image: linear-gradient(90deg, #000 92%, transparent);
        -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
    }

    .gallery-filters::-webkit-scrollbar {
        display: none;
    }

    .gallery-filter-btn {
        grid-template-columns: 24px auto auto;
        min-width: 0;
        width: auto;
        flex-shrink: 0;
        padding: 10px 12px;
        font-size: 0.78rem;
        gap: 8px;
        border-radius: 999px;
    }

    .gallery-filter-icon {
        width: 24px;
        height: 24px;
        border-radius: 8px;
    }

    .gallery-filter-icon::after {
        inset: 7px;
    }

    .gallery-filter-icon--field::after {
        inset: 6px 5px 5px;
    }

    .gallery-filter-count {
        min-width: 22px;
        padding: 2px 6px;
        font-size: 0.68rem;
    }

    .gallery-filter-btn:hover,
    .gallery-filter-btn.is-active {
        transform: none;
    }

    .gallery-cards:not(.is-filtered),
    .gallery-cards.is-filtered {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .gallery-card {
        border-radius: 16px;
        width: 100%;
        max-width: 100%;
    }

    .gallery-card__frame {
        width: 100%;
        max-width: 100%;
    }

    .gallery-card__media {
        padding: 0;
        inset: 0;
        width: 100%;
    }

    .gallery-card:not(.is-cutout) img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        object-fit: cover;
    }

    .gallery-card.is-cutout .gallery-card__media {
        padding: 14px;
    }

    .gallery-card.is-cutout img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
    }

    .gallery-card__info {
        padding: 12px 14px 14px;
        width: 100%;
        box-sizing: border-box;
    }

    .gallery-card__title {
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .gallery-card__cat {
        font-size: 0.68rem;
    }

    .gallery-card__cta {
        opacity: 1;
        transform: none;
        font-size: 0.72rem;
    }

    .gallery-card--featured .gallery-card__title {
        font-size: 1.05rem;
    }

    .gallery-lightbox {
        padding: 52px 10px 16px;
    }

    .gallery-lightbox-inner img {
        max-height: 68vh;
        border-radius: 12px;
    }

    .gallery-lightbox-inner p {
        font-size: 0.92rem;
        padding: 0 8px;
    }

    .gallery-lightbox-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
    }

    .gallery-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .gallery-lightbox-prev {
        left: 8px;
    }

    .gallery-lightbox-next {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .gallery-filter-btn {
        padding: 9px 11px;
    }

    .gallery-card__frame {
        aspect-ratio: 4 / 3;
    }

    .gallery-card--featured .gallery-card__frame {
        aspect-ratio: 4 / 3;
    }
}

@media (hover: none) and (pointer: coarse) {
    .gallery-card:hover {
        transform: none;
        box-shadow: 0 8px 24px rgba(12, 61, 122, 0.08);
    }

    .gallery-card:hover img,
    .gallery-card.is-cutout:hover img {
        transform: none;
    }

    .gallery-card:hover .gallery-card__zoom {
        opacity: 0;
    }

    .gallery-card:active {
        transform: scale(0.985);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page-hero-glow {
        animation: none;
    }
}
