.nideo-gallery-page {
    padding: clamp(64px, 8vw, 104px) 0 clamp(80px, 10vw, 132px);
    background: var(--nideo-canvas);
}

.nideo-gallery-page__intro {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 42px;
}

.nideo-gallery-page__intro h2 {
    max-width: 680px;
    margin: 17px 0 15px;
    color: var(--nideo-ink);
    font-size: clamp(38px, 5vw, 66px);
    letter-spacing: -.05em;
    line-height: .98;
}

.nideo-gallery-page__intro p {
    max-width: 620px;
    margin: 0;
    color: var(--nideo-muted);
    font-size: 16px;
    line-height: 1.7;
}

.nideo-gallery-page__count {
    min-width: 150px;
    padding: 18px 20px;
    border-left: 2px solid var(--nideo-green);
    background: var(--nideo-white);
}

.nideo-gallery-page__count strong,
.nideo-gallery-page__count span { display: block; }
.nideo-gallery-page__count strong { color: var(--nideo-green-dark); font-size: 34px; letter-spacing: -.04em; line-height: 1; }
.nideo-gallery-page__count span { margin-top: 7px; color: var(--nideo-muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.nideo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.nideo-gallery-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--nideo-line);
    background: var(--nideo-white);
    color: var(--nideo-ink);
    box-shadow: 0 14px 30px rgba(23, 35, 29, .05);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.nideo-gallery-card:hover,
.nideo-gallery-card:focus-visible {
    border-color: rgba(67, 185, 77, .7);
    box-shadow: 0 22px 42px rgba(23, 35, 29, .12);
    color: var(--nideo-ink);
    outline: none;
    transform: translateY(-4px);
}

.nideo-gallery-card:focus-visible { outline: 3px solid rgba(67, 185, 77, .35); outline-offset: 3px; }

.nideo-gallery-card__image {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--nideo-dark);
}

.nideo-gallery-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}

.nideo-gallery-card:hover .nideo-gallery-card__image img,
.nideo-gallery-card:focus-visible .nideo-gallery-card__image img { transform: scale(1.045); }

.nideo-gallery-card__image::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 24, 14, 0) 52%, rgba(8, 24, 14, .45));
    content: '';
    pointer-events: none;
}

.nideo-gallery-empty {
    padding: 64px 32px;
    border: 1px dashed var(--nideo-line);
    background: var(--nideo-white);
    text-align: center;
}

.nideo-gallery-empty p { margin: 16px 0 0; color: var(--nideo-muted); }

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    padding: 34px 24px;
    background: rgba(8, 18, 12, .92);
}

.gallery-modal.is-open { display: grid; place-items: center; }
.gallery-modal__frame { position: relative; width: min(1040px, 100%); }
.gallery-modal__close { position: fixed; top: 18px; right: 24px; z-index: 2; width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(8,18,12,.4); color: #fff; font-size: 31px; line-height: 1; cursor: pointer; }
.gallery-modal__close:hover, .gallery-modal__close:focus-visible { border-color: var(--nideo-green); background: var(--nideo-green); color: var(--nideo-ink); outline: none; }
.gallery-modal__image { display: block; width: auto; max-width: 100%; max-height: 72vh; margin: 0 auto; object-fit: contain; box-shadow: 0 28px 70px rgba(0,0,0,.42); }
.gallery-modal__meta { padding: 28px 0 0; color: #fff; }
.gallery-modal__meta-inner { max-width: 820px; margin: 0 auto; text-align: left; }
.gallery-modal__meta h3 { margin: 14px 0 8px; color: #fff; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.03em; line-height: 1.12; }
.gallery-modal__meta p { max-width: 760px; margin: 0; color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.7; }

@media (max-width: 900px) {
    .nideo-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .nideo-gallery-page { padding: 58px 0 80px; }
    .nideo-gallery-page__intro { align-items: start; flex-direction: column; margin-bottom: 30px; }
    .nideo-gallery-page__intro h2 { font-size: 42px; }
    .nideo-gallery-page__count { min-width: 0; }
    .nideo-gallery-grid { gap: 14px; }
    .nideo-gallery-grid { grid-template-columns: 1fr; }
    .gallery-modal { padding: 66px 16px 24px; }
    .gallery-modal__close { top: 14px; right: 16px; }
}
