/* =========================================================
   ФОТОГАЛЕРЕЯ БРАТСТВА ЗАБВО — Gallery 2.0
   Полный файл gallery.css
   ========================================================= */

.zg {
    width: 100%;
    padding: 10px 12px 30px;
    box-sizing: border-box;
    color: #34331f;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 20% 10%, rgba(255,255,255,.78), transparent 32%),
        radial-gradient(circle at 80% 30%, rgba(255,255,255,.55), transparent 30%),
        repeating-linear-gradient(0deg, rgba(128,100,42,.025) 0, rgba(128,100,42,.025) 1px, transparent 1px, transparent 4px),
        linear-gradient(to bottom, #fbf7ea 0%, #f1e8d2 100%);
}

.zg-hero {
    margin: 0 0 24px;
    padding: 8px 8px 16px;
    border-bottom: 1px solid #b68d35;
    text-align: center;
}

.zg h1 {
    margin: 3px 0 7px;
    padding: 0;
    border: 0;
    color: #8a6718;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 35px;
    line-height: 1.15;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    text-shadow:
        0 1px 0 #fff6ce,
        0 2px 0 #a77d25,
        0 3px 4px rgba(72,48,9,.35);
}

.zg-subtitle {
    color: #5e5037;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    line-height: 1.35;
    font-style: italic;
}

.zg-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto 5px;
    color: #a77a1f;
}

.zg-ornament:before,
.zg-ornament:after {
    content: "";
    display: block;
    width: 170px;
    height: 1px;
    background: linear-gradient(to right, transparent, #b58b32);
}

.zg-ornament:after {
    background: linear-gradient(to left, transparent, #b58b32);
}

.zg-ornament span {
    margin: 0 12px;
    font-size: 20px;
    line-height: 1;
    text-shadow: 0 1px 1px #fff4c7;
}

.zg-ornament-bottom {
    margin-top: 9px;
    margin-bottom: 0;
}

.zg h2 {
    margin: 8px 0 20px;
    padding: 0 0 8px;
    border-bottom: 2px solid #86851b;
    color: #515519;
    font-size: 23px;
    line-height: 1.25;
}

.zg p {
    margin: -10px 0 16px;
    color: #68654f;
    font-size: 14px;
}

.zg-top {
    margin: 0 0 15px;
}

.zg-btn {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid #777523;
    border-radius: 3px;
    background: linear-gradient(to bottom, #9d9a36 0%, #6c6b18 100%);
    color: #fff !important;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.18);
}

.zg-btn:hover {
    background: linear-gradient(to bottom, #aaa640 0%, #79771d 100%);
}

.zg-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

/* Одинаковые музейные рамы альбомов */
.zg-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 300px;
    min-width: 0;
    padding: 13px;
    box-sizing: border-box;
    overflow: hidden;
    text-decoration: none !important;
    border: 7px ridge #b98a31;
    border-radius: 2px;
    background:
        linear-gradient(135deg,
            #fff7d9 0%,
            #d8b56b 12%,
            #fff1b7 25%,
            #a97926 43%,
            #f0cf84 58%,
            #8f641c 76%,
            #dfb760 100%);
    box-shadow:
        0 4px 7px rgba(0,0,0,.35),
        inset 0 0 0 2px #fff2ba,
        inset 0 0 0 5px #8d621e;
    transition: transform .18s ease, box-shadow .18s ease;
}

.zg-card:before {
    content: "";
    position: absolute;
    top: 7px;
    right: 7px;
    bottom: 7px;
    left: 7px;
    z-index: 0;
    pointer-events: none;
    border: 2px solid #7b561c;
    box-shadow:
        inset 0 0 0 2px #fff8df,
        inset 0 0 10px rgba(66,40,7,.35);
}

.zg-card:hover {
    z-index: 2;
    transform: translateY(-4px);
    box-shadow:
        0 10px 16px rgba(0,0,0,.42),
        inset 0 0 0 2px #fff2ba,
        inset 0 0 0 5px #8d621e;
}

.zg-card img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 180px;
    flex: 0 0 180px;
    box-sizing: border-box;
    object-fit: cover;
    object-position: center;
    border: 5px solid #f7f0dc;
    outline: 1px solid #74501a;
    background: #eee;
    box-shadow:
        0 1px 3px rgba(0,0,0,.45),
        inset 0 0 7px rgba(0,0,0,.18);
}

.zg-info {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 78px;
    flex: 0 0 78px;
    margin-top: 10px;
    padding: 7px 4px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #c7b878;
    background: linear-gradient(to bottom, #5e6028 0%, #404419 100%);
    color: #fff;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.zg-title {
    display: block;
    max-height: 38px;
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    word-break: break-word;
}

.zg-meta {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    box-sizing: border-box;
    color: #fff7cf;
    font-size: 13px;
    font-weight: bold;
    line-height: 16px;
    text-align: center;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* Одинаковые музейные рамы фотографий */
.zg-photo {
    position: relative;
    width: 100%;
    height: 205px;
    min-width: 0;
    padding: 11px;
    box-sizing: border-box;
    border: 6px ridge #b98a31;
    border-radius: 2px;
    background:
        linear-gradient(135deg,
            #f8e3a4 0%,
            #a87322 18%,
            #f1cf80 36%,
            #8b601b 54%,
            #e7c06d 72%,
            #9b6a20 100%);
    box-shadow:
        0 4px 7px rgba(0,0,0,.34),
        inset 0 0 0 2px #fff0b5,
        inset 0 0 0 4px #805719;
    transition: transform .18s ease, box-shadow .18s ease;
}

.zg-photo:before {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: 6px;
    left: 6px;
    z-index: 0;
    pointer-events: none;
    border: 1px solid #74501a;
    box-shadow:
        inset 0 0 0 2px #fff7dc,
        inset 0 0 8px rgba(65,39,7,.35);
}

.zg-photo:hover {
    z-index: 3;
    transform: translateY(-4px) scale(1.015);
    box-shadow:
        0 10px 16px rgba(0,0,0,.43),
        inset 0 0 0 2px #fff0b5,
        inset 0 0 0 4px #805719;
}

.zg-photo a {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    padding: 5px;
    box-sizing: border-box;
    border: 1px solid #7d571e;
    background: #f8f3e6;
    text-decoration: none !important;
}

.zg-photo img {
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    object-fit: cover;
    object-position: center;
    border: 2px solid #fff;
    background: #eee;
    box-shadow:
        0 0 0 1px #a69776,
        inset 0 0 6px rgba(0,0,0,.15);
}

.zg-empty {
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px solid #c7c5aa;
    background: #f7f7ed;
    color: #666;
    text-align: center;
}

/* Полноэкранный просмотр */
.zg-light {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 50px 70px 70px;
    box-sizing: border-box;
    background: rgba(0,0,0,.9);
}

.zg-light.open {
    display: flex;
}

.zg-light img {
    display: block;
    max-width: 92vw;
    max-height: 82vh;
    padding: 10px;
    box-sizing: border-box;
    border: 8px ridge #c09238;
    background: #f8f1df;
    box-shadow:
        0 0 0 3px #6f4a14,
        0 12px 35px rgba(0,0,0,.65);
}

.zg-close,
.zg-prev,
.zg-next {
    position: fixed;
    z-index: 1000000;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 4px;
    background: rgba(62,63,20,.9);
    color: #fff;
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 3px 9px rgba(0,0,0,.45);
}

.zg-close {
    top: 15px;
    right: 20px;
    width: 42px;
    height: 42px;
    font-size: 22px;
    font-weight: bold;
}

.zg-prev,
.zg-next {
    top: 50%;
    width: 48px;
    height: 70px;
    margin-top: -35px;
    font-size: 42px;
    line-height: 60px;
}

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

.zg-close:hover,
.zg-prev:hover,
.zg-next:hover {
    background: rgba(115,111,31,.98);
}

.zg-cap {
    position: fixed;
    right: 20px;
    bottom: 15px;
    left: 20px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    text-shadow: 0 1px 3px #000;
}

@media screen and (max-width: 1180px) {
    .zg-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .zg-card { height: 315px; }
    .zg-card img { height: 195px; flex-basis: 195px; }
}

@media screen and (max-width: 850px) {
    .zg-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 17px;
    }

    .zg h1 { font-size: 28px; }
    .zg-subtitle { font-size: 15px; }
    .zg-card { height: 310px; }
    .zg-card img { height: 190px; flex-basis: 190px; }
    .zg-photo { height: 215px; }
}

@media screen and (max-width: 540px) {
    .zg { padding: 7px 5px 18px; }
    .zg h1 { font-size: 23px; letter-spacing: 0; }
    .zg-subtitle { font-size: 14px; }
    .zg h2 { font-size: 19px; }

    .zg-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .zg-card { height: auto; min-height: 350px; }
    .zg-card img { height: 240px; flex-basis: 240px; }
    .zg-photo { height: 260px; }

    .zg-light { padding: 55px 14px 65px; }
    .zg-light img {
        max-width: 96vw;
        max-height: 79vh;
        padding: 5px;
        border-width: 5px;
    }

    .zg-prev,
    .zg-next {
        width: 40px;
        height: 58px;
        margin-top: -29px;
        font-size: 34px;
    }

    .zg-prev { left: 5px; }
    .zg-next { right: 5px; }
}


/* Gallery 2.1 — естественные пропорции без вытягивания вверх */
.zg-card img,
.zg-photo img {
    object-fit: cover;
    object-position: center center;
}

@supports (aspect-ratio: 4 / 3) {
    .zg-card {
        height: auto;
    }

    .zg-card img {
        height: auto;
        flex-basis: auto;
        aspect-ratio: 4 / 3;
    }

    .zg-photo {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}
