/* Галерея – візуальний архів у журнальній розкладці. */
.gallery-page {
    --gallery-paper: #f2ede5;
    --gallery-muted: #aaa299;
    --gallery-red: #df263a;
    --gallery-gold: #dfb45e;
    --gallery-line: rgba(255, 255, 255, .13);
    background:
        radial-gradient(circle at 72% 8%, rgba(131, 10, 24, .18), transparent 32rem),
        linear-gradient(rgba(0,0,0,.82), rgba(0,0,0,.96)),
        url("images/characters-bg.png") center/cover fixed no-repeat !important;
}

.gallery-page .gallery-main-wrapper {
    width: 100% !important;
    margin: 0 !important;
}

.gallery-page .gallery-header {
    position: relative;
    width: min(1480px, calc(100% - clamp(32px, 7vw, 96px)));
    margin: 0 auto;
    padding: clamp(78px, 10vw, 138px) 0 48px;
    text-align: left;
}

.gallery-page .gallery-header::before {
    content: "01";
    position: absolute;
    top: clamp(36px, 5vw, 74px);
    left: -10px;
    z-index: 0;
    color: rgba(176, 17, 34, .34);
    font: 700 clamp(6rem, 11vw, 10rem)/1 'Cinzel', Georgia, serif;
}

.gallery-page .gallery-header::after {
    content: "ВІЗУАЛЬНИЙ АРХІВ";
    position: absolute;
    top: clamp(74px, 9.4vw, 132px);
    left: 0;
    color: var(--gallery-red);
    font: 700 .74rem 'Cinzel', Georgia, serif;
    letter-spacing: .2em;
}

.gallery-page .gallery-header h1 {
    position: relative;
    z-index: 1;
    max-width: 1040px;
    margin: 0 0 22px;
    color: var(--gallery-paper);
    font-size: clamp(4rem, 9vw, 9rem);
    line-height: .88;
    letter-spacing: -.02em;
    text-shadow: 0 14px 50px rgba(0, 0, 0, .75);
}

.gallery-page .gallery-header p {
    max-width: 680px;
    margin: 0;
    color: var(--gallery-muted);
    font-size: clamp(1rem, 1.3vw, 1.12rem);
    font-style: normal;
    line-height: 1.7;
}

.gallery-page .gallery-toolbar {
    position: sticky;
    top: 76px;
    z-index: 40;
    width: min(1480px, calc(100% - clamp(32px, 7vw, 96px)));
    max-width: none;
    margin: 0 auto 42px;
    padding: 13px 14px;
    border: 1px solid var(--gallery-line);
    border-radius: 16px;
    background: rgba(8, 8, 9, .9);
    box-shadow: 0 20px 54px rgba(0, 0, 0, .46);
    backdrop-filter: blur(16px);
}

.gallery-page .filter-group { gap: 7px; }

.gallery-page .filter-btn,
.gallery-page .sort-select,
.gallery-page .view-btn {
    min-height: 40px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px !important;
    color: #bdb5ac;
    background-color: rgba(255,255,255,.025);
    font: 700 .72rem 'Cinzel', Georgia, serif;
}

.gallery-page .filter-btn { padding: 8px 14px; }
.gallery-page .sort-select { min-width: 190px; padding: 8px 40px 8px 16px; border-radius: 12px !important; }
.gallery-page .view-btn { width: 40px; border-radius: 10px !important; }

.gallery-page .filter-btn:hover,
.gallery-page .filter-btn.active,
.gallery-page .view-btn:hover,
.gallery-page .view-btn.active {
    color: #fff;
    border-color: rgba(223, 38, 58, .84);
    background: rgba(162, 15, 31, .3);
    box-shadow: none;
}

.gallery-page .gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: clamp(16px, 2vw, 26px);
    width: min(1480px, calc(100% - clamp(32px, 7vw, 96px)));
    max-width: none;
    margin: 0 auto !important;
    padding: 0;
}

.gallery-page .shot-card {
    grid-column: span 4;
    position: relative;
    aspect-ratio: 4 / 3;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--gallery-line);
    border-radius: 18px;
    background: #090909;
    box-shadow: 0 22px 60px rgba(0,0,0,.43);
    isolation: isolate;
    transition: transform .34s ease, border-color .34s ease, box-shadow .34s ease;
}

.gallery-page .shot-card:nth-child(8n + 1),
.gallery-page .shot-card:nth-child(8n + 6) {
    grid-column: span 8;
    aspect-ratio: 16 / 8.3;
}

.gallery-page .shot-card:nth-child(8n + 2),
.gallery-page .shot-card:nth-child(8n + 5) { aspect-ratio: 4 / 4.4; }

.gallery-page .shot-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 42%, rgba(0,0,0,.18) 58%, rgba(0,0,0,.92) 100%);
}

.gallery-page .shot-card:hover,
.gallery-page .shot-card:focus-visible {
    transform: translateY(-7px);
    border-color: rgba(223, 38, 58, .68);
    box-shadow: 0 32px 78px rgba(0,0,0,.6), 0 0 0 1px rgba(223,38,58,.1);
}

.gallery-page .shot-card:focus-visible {
    outline: 2px solid var(--gallery-gold);
    outline-offset: 4px;
}

.gallery-page .shot-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.68) contrast(1.08) brightness(.78);
    transition: transform .7s ease, filter .4s ease;
}

.gallery-page .shot-card:hover img,
.gallery-page .shot-card:focus-visible img {
    transform: scale(1.045);
    filter: saturate(.94) contrast(1.08) brightness(.92);
}

.gallery-page .shot-info {
    z-index: 3;
    padding: 72px 20px 18px;
    background: none;
}

.gallery-page .shot-tag {
    color: var(--gallery-paper);
    font: 700 .82rem 'Cinzel', Georgia, serif;
    letter-spacing: .06em;
}

.gallery-page .shot-stats { color: #d0c7bc; font-size: .82rem; }
.gallery-page .gallery-meta { display: none; }

.gallery-page .gallery-save,
.gallery-page .gallery-download {
    z-index: 6;
    top: 15px;
    min-height: 38px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px !important;
    color: #f5e5c1;
    background: rgba(6,6,6,.72);
    backdrop-filter: blur(10px);
}

.gallery-page .gallery-save { right: 15px; width: 38px; height: 38px; }
.gallery-page .gallery-download { right: auto; left: 15px; }

.gallery-page .gallery-grid.list-view {
    grid-template-columns: 1fr;
    width: min(1100px, calc(100% - clamp(32px, 7vw, 96px)));
}

.gallery-page .gallery-grid.list-view .shot-card {
    grid-column: 1 / -1;
    width: 100%;
    height: clamp(320px, 48vw, 580px);
    aspect-ratio: auto;
}

.gallery-page .load-more-container { margin: 54px 0 100px; }

.gallery-page .load-more-btn {
    min-height: 50px;
    padding: 12px 24px;
    border: 1px solid rgba(223,38,58,.66);
    border-radius: 999px !important;
    color: var(--gallery-paper);
    background: rgba(137,10,24,.23);
    font: 700 .78rem 'Cinzel', Georgia, serif;
    letter-spacing: .08em;
}

.gallery-page .lightbox { background: rgba(0,0,0,.96); }
.gallery-page .lightbox-img { max-width: min(90vw, 1500px); border-radius: 10px; }
.gallery-page .atlas-context-menu { display: none !important; }

@media (max-width: 1080px) {
    .gallery-page .shot-card,
    .gallery-page .shot-card:nth-child(n) { grid-column: span 6; aspect-ratio: 4 / 3; }
}

@media (max-width: 720px) {
    .gallery-page .gallery-header { width: min(100% - 28px, 680px); padding-top: 76px; }
    .gallery-page .gallery-header h1 { font-size: clamp(2rem, 14vw, 6rem); overflow-wrap: anywhere; }
    .gallery-page .gallery-toolbar,
    .gallery-page .gallery-grid { width: min(100% - 24px, 680px); }
    .gallery-page .gallery-toolbar { position: relative; top: auto; align-items: stretch; }
    .gallery-page .filter-group { width: 100%; min-width: 0; max-width: 100%; flex-wrap: wrap; }
    .gallery-page .sort-group { width: 100%; min-width: 0; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
    .gallery-page .sort-select { min-width: 0; max-width: 100%; flex: 1 1 150px; }
    .gallery-page .view-toggles { flex: 0 0 auto; }
    .gallery-page .shot-card,
    .gallery-page .shot-card:nth-child(n) { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page .shot-card,
    .gallery-page .shot-card img { transition: none; }
}
