:root {
    --gallery-green: #315b4f;
    --gallery-green-soft: #e5ebe7;
}

html,
body {
    min-height: 100%;
}

body {
    overflow-y: auto;
}

.gallery-app {
    min-height: 100dvh;
    background:
        linear-gradient(rgba(111, 101, 83, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(111, 101, 83, 0.055) 1px, transparent 1px),
        #f4f1ea;
    background-size: 40px 40px;
}

.gallery-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(170px, 0.7fr) minmax(240px, 1fr) minmax(170px, 0.7fr);
    align-items: center;
    gap: 24px;
    padding: 16px clamp(18px, 3vw, 40px);
    border-bottom: 1px solid var(--line);
    background: rgba(251, 250, 246, 0.95);
    backdrop-filter: blur(14px);
}

.gallery-brand {
    display: grid;
    width: fit-content;
    color: inherit;
    text-decoration: none;
}

.gallery-brand .eyebrow {
    margin-bottom: 2px;
}

.gallery-brand strong,
.gallery-title-block h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.gallery-brand strong {
    font-size: 1.25rem;
}

.gallery-title-block {
    text-align: center;
}

.gallery-title-block h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2.5vw, 2.15rem);
}

.gallery-back {
    justify-self: end;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.gallery-back:hover,
.gallery-back:focus-visible {
    border-color: var(--ink);
    outline: none;
}

.gallery-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(150px, auto);
    gap: 18px;
    align-items: end;
    max-width: 1500px;
    margin: 0 auto;
    padding: 22px clamp(18px, 3vw, 40px) 16px;
}

.gallery-search-wrap {
    display: grid;
    gap: 6px;
}

.gallery-search-wrap label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.gallery-search-wrap input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: #fff;
    outline: none;
}

.gallery-search-wrap input:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px rgba(41, 40, 36, 0.08);
}

.gallery-filters {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(251, 250, 246, 0.9);
}

.gallery-filters button,
.gallery-version-switch button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.gallery-filters button {
    padding: 8px 10px;
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.gallery-filters button.is-active {
    background: var(--ink);
    color: #fff;
}

.gallery-summary {
    display: grid;
    justify-items: end;
    gap: 2px;
    color: var(--muted);
    font-size: 0.72rem;
}

.gallery-summary strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 18px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 10px clamp(18px, 3vw, 40px) 48px;
}

.gallery-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d8d1c4;
    border-radius: 9px;
    background: #fffdf8;
    box-shadow: 0 7px 20px rgba(53, 45, 35, 0.06);
}

.gallery-card-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid #e4ded3;
    background: #e9e5dc;
    cursor: zoom-in;
}

.gallery-card-visual::after {
    content: "Nagyítás";
    position: absolute;
    right: 9px;
    bottom: 9px;
    padding: 5px 7px;
    border-radius: 4px;
    background: rgba(36, 32, 28, 0.72);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.gallery-card-visual:hover::after,
.gallery-card-visual:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.gallery-card-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.gallery-card-body {
    display: grid;
    gap: 9px;
    padding: 11px 12px 12px;
}

.gallery-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.gallery-card-heading strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
}

.gallery-card-heading span {
    color: var(--muted);
    font-size: 0.64rem;
    text-align: right;
}

.gallery-person-list,
.gallery-lightbox-person-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.gallery-person-list a,
.gallery-lightbox-person-list a {
    display: inline-flex;
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--gallery-green-soft);
    color: var(--gallery-green);
    font-size: 0.68rem;
    font-weight: 700;
    text-decoration: none;
}

.gallery-person-list a:hover,
.gallery-lightbox-person-list a:hover {
    text-decoration: underline;
}

.gallery-no-people {
    color: var(--muted);
    font-size: 0.7rem;
    font-style: italic;
}

.gallery-version-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gallery-version-switch.compact {
    padding-top: 2px;
}

.gallery-version-switch button {
    padding: 6px 8px;
    border: 1px solid #d8d1c4;
    border-radius: 5px;
    background: #f7f4ee;
    color: #665f55;
    font-size: 0.66rem;
    font-weight: 700;
}

.gallery-version-switch button:hover,
.gallery-version-switch button:focus-visible {
    border-color: var(--gallery-green);
    outline: none;
}

.gallery-version-switch button.is-active {
    border-color: var(--gallery-green);
    background: var(--gallery-green);
    color: #fff;
}

.gallery-empty {
    max-width: 1500px;
    margin: 0 auto;
    padding: 60px 40px;
    color: var(--muted);
    text-align: center;
}

.gallery-error {
    max-width: 1000px;
    margin: 24px auto;
}

.gallery-lightbox {
    width: min(96vw, 1500px);
    height: min(94dvh, 1050px);
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 1px solid #6f675b;
    border-radius: 10px;
    background: #1e1d1a;
    color: #f7f4ed;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.gallery-lightbox::backdrop {
    background: rgba(27, 24, 21, 0.78);
    backdrop-filter: blur(5px);
}

.gallery-lightbox-shell {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.gallery-lightbox-header,
.gallery-lightbox-footer {
    background: #25231f;
}

.gallery-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.gallery-lightbox-header .eyebrow {
    color: #aaa396;
}

.gallery-lightbox-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.2rem, 2vw, 1.65rem);
    font-weight: 500;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: #fff;
    cursor: pointer;
}

.gallery-lightbox-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.5rem;
}

.gallery-lightbox-stage {
    position: relative;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #141311;
}

.gallery-lightbox-visual {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 18px 64px;
}

.gallery-lightbox-visual img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}

.gallery-lightbox-placeholder {
    color: #aaa396;
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 64px;
    transform: translateY(-50%);
    border-radius: 7px;
    font-size: 2rem;
}

.gallery-lightbox-nav.prev {
    left: 10px;
}

.gallery-lightbox-nav.next {
    right: 10px;
}

.gallery-lightbox-nav:disabled {
    opacity: 0.25;
    cursor: default;
}

.gallery-lightbox-footer {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.gallery-lightbox-footer .gallery-version-switch button {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: #d8d2c7;
}

.gallery-lightbox-footer .gallery-version-switch button.is-active {
    border-color: #c6d4ce;
    background: #dbe6e1;
    color: #24483e;
}

.gallery-lightbox-people {
    justify-self: end;
}

.gallery-lightbox-person-list {
    justify-content: flex-end;
}

@media (max-width: 820px) {
    .gallery-topbar {
        grid-template-columns: 1fr auto;
        gap: 12px;
    }

    .gallery-title-block {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: left;
    }

    .gallery-back {
        grid-column: 2;
        grid-row: 1;
    }

    .gallery-controls {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .gallery-summary {
        justify-items: start;
    }

    .gallery-filters {
        width: fit-content;
        max-width: 100%;
        overflow-x: auto;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .gallery-lightbox {
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .gallery-lightbox-visual {
        padding: 12px 48px;
    }

    .gallery-lightbox-footer {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gallery-lightbox-people,
    .gallery-lightbox-person-list {
        justify-self: start;
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-card-visual {
        aspect-ratio: 16 / 11;
    }

    .gallery-filters button {
        padding-inline: 8px;
        font-size: 0.7rem;
    }

    .gallery-lightbox-header {
        padding: 10px 12px;
    }

    .gallery-lightbox-visual {
        padding: 8px 38px;
    }

    .gallery-lightbox-nav {
        width: 34px;
        height: 54px;
    }

    .gallery-lightbox-footer {
        padding: 10px 12px;
    }
}
