:root {
    --trmg-surface: #f6f6f6;
    --trmg-surface-strong: #ffffff;
    --trmg-border: rgba(15, 23, 42, 0.1);
    --trmg-text: #1f2937;
    --trmg-muted: #6b7280;
    --trmg-accent: #111827;
    --trmg-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.trmg-gallery {
    --trmg-gap: 14px;
    color: var(--trmg-text);
}

.trmg-gallery__header {
    margin: 0 0 1.5rem;
}

.trmg-gallery__name {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    line-height: 1.1;
}

.trmg-gallery__description {
    margin-top: 0.9rem;
    color: var(--trmg-muted);
}

.trmg-gallery__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 1rem;
    flex-wrap: wrap;
}

.trmg-gallery__toolbar-label {
    white-space: nowrap;
    color: inherit;
}

.trmg-gallery__select {
    min-width: 230px;
    max-width: 100%;
    font: inherit;
    color: inherit;
    appearance: auto;
}

.trmg-gallery__category-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.trmg-gallery__category-title.is-hidden {
    display: none;
}

.trmg-gallery__grid {
    display: grid;
    grid-template-columns: repeat(var(--trmg-columns), minmax(0, 1fr));
    grid-auto-rows: 10px;
    gap: var(--trmg-gap);
}

.trmg-gallery__item[hidden] {
    display: none !important;
}

.trmg-gallery__card {
    margin: 0;
    overflow: hidden;
    border-radius: 0;
    background: var(--trmg-surface-strong);
    box-shadow: var(--trmg-shadow);
}

.trmg-gallery__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.trmg-gallery__image {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 220ms ease, filter 220ms ease;
}

.trmg-gallery__card:hover .trmg-gallery__image,
.trmg-gallery__link:focus-visible .trmg-gallery__image {
    transform: scale(1.015);
    filter: saturate(1.02);
}

.trmg-gallery__content {
    padding: 0.8rem 0 0;
}

.trmg-gallery__eyebrow {
    margin: 0 0 0.35rem;
    color: var(--trmg-muted);
    font-size: 0.82rem;
    line-height: 1.3;
    text-transform: uppercase;
}

.trmg-gallery__title {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.3;
}

.trmg-gallery__caption {
    margin: 0.35rem 0 0;
    color: var(--trmg-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.trmg-gallery__empty {
    padding: 1rem 1.15rem;
    border: 1px solid var(--trmg-border);
    background: var(--trmg-surface);
    color: var(--trmg-muted);
}

.trmg-lightbox-open {
    overflow: hidden;
}

.trmg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.trmg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
}

.trmg-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: min(1180px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    padding: 1rem;
    border-radius: 20px;
    background: rgba(10, 15, 27, 0.92);
    color: #f8fafc;
}

.trmg-lightbox__stage {
    display: grid;
    gap: 1rem;
    justify-items: center;
    max-height: calc(100vh - 6rem);
}

.trmg-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: min(74vh, 880px);
    border-radius: 16px;
    object-fit: contain;
}

.trmg-lightbox__meta {
    width: min(760px, 100%);
}

.trmg-lightbox__title,
.trmg-lightbox__caption,
.trmg-lightbox__description {
    margin: 0;
}

.trmg-lightbox__title + .trmg-lightbox__caption,
.trmg-lightbox__caption + .trmg-lightbox__description,
.trmg-lightbox__title + .trmg-lightbox__description {
    margin-top: 0.65rem;
}

.trmg-lightbox__caption,
.trmg-lightbox__description {
    color: rgba(241, 245, 249, 0.82);
}

.trmg-lightbox__close,
.trmg-lightbox__nav {
    border: 0;
    border-radius: 999px;
    width: 3rem;
    height: 3rem;
    cursor: pointer;
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.12);
    transition: transform 180ms ease, background-color 180ms ease;
}

.trmg-lightbox__close:hover,
.trmg-lightbox__close:focus-visible,
.trmg-lightbox__nav:hover,
.trmg-lightbox__nav:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
    outline: none;
}

.trmg-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

@media (max-width: 1024px) {
    .trmg-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .trmg-gallery__toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .trmg-gallery__grid {
        grid-template-columns: 1fr;
    }

    .trmg-lightbox__dialog {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 4rem 1rem 1rem;
    }

    .trmg-lightbox__stage {
        order: 2;
    }

    .trmg-lightbox__nav {
        position: absolute;
        top: 1.25rem;
    }

    .trmg-lightbox__nav--prev {
        left: 1rem;
    }

    .trmg-lightbox__nav--next {
        right: 4.5rem;
    }
}
