.gallery-heading,
.gallery-collections,
.gallery-albums-nav,
.gallery-album {
    width: min(90%, 1280px);
    margin-inline: auto;
}

.gallery-heading { padding-block: clamp(16px, 4vw, 54px) 24px; }
.gallery-heading-index { padding-top: clamp(42px, 7vw, 100px); text-align: center; }
.gallery-heading h1 {
    margin: 0;
    font-size: clamp(2.5rem, 7vw, 6.1rem);
    line-height: 1.04;
    overflow-wrap: anywhere;
}
.gallery-heading-index h1 { margin-inline: auto; }
.gallery-heading .lead { max-width: 56ch; margin: 16px 0 0; }
.gallery-heading-index .lead { margin-inline: auto; }
.gallery-total { margin: 12px 0 0; color: #5e5051; }

.gallery-collections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 24px);
    margin-block: 18px clamp(38px, 7vw, 90px);
}
.gallery-collection {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fcfbf8;
}
.gallery-collection h2 a { text-decoration: none; }
.gallery-collection h2 a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}
.gallery-collection:hover h2 a { text-decoration: underline; text-underline-offset: .14em; }
.gallery-collection-photo {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border-radius: 17px 17px 0 0;
    background: #e8ded4;
}
.gallery-collection-photo img,
.gallery-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 32%;
}
.gallery-collection-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: start;
    padding: clamp(22px, 4vw, 48px);
    overflow-wrap: anywhere;
}
.gallery-collection-copy h2 { margin: 0; font-size: clamp(1.55rem, 3.1vw, 3rem); line-height: 1.12; }
.gallery-collection-copy p { margin: 12px 0 18px; color: #534747; }
.gallery-collection-meta { display: inline-flex; gap: 12px; margin-top: auto; color: #89152e; font-weight: 600; }

.gallery-featured { grid-column: 1 / -1; background: #251b20; color: #fcfbf8; }
.gallery-featured.gallery-collection-with-photo { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.gallery-featured .gallery-collection-photo { aspect-ratio: 16 / 9; border-radius: 17px 0 0 17px; }
.gallery-featured .gallery-collection-copy { align-self: center; }
.gallery-featured h2 { font-size: clamp(2rem, 4vw, 4.3rem); }
.gallery-featured p { color: #f2e8e9; }
.gallery-featured .gallery-collection-meta { color: #ffb8c8; }

.gallery-albums-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 6px 24px; }
.gallery-albums-nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 7px 14px;
    border: 1px solid #bba9a8;
    border-radius: 999px;
    background: #fcfbf8;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.gallery-albums-nav a[aria-current] { color: #fff; background: #89152e; border-color: #89152e; }
.gallery-albums-nav a:hover { text-decoration: underline; }
.gallery-album { margin-bottom: clamp(38px, 7vw, 90px); }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(8px, 1.5vw, 18px);
    padding: 0;
    margin: 0;
    list-style: none;
}
.gallery-thumbnail {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    background: #e8ded4;
}
.gallery-thumbnail picture { display: block; width: 100%; height: 100%; }
.gallery-expand {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #251b20e8;
}
.gallery-thumbnail:hover .gallery-expand, .gallery-thumbnail:focus-visible .gallery-expand { background: #89152e; }
.gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 24px;
    margin-top: 24px;
}
.gallery-pagination a { display: inline-flex; align-items: center; min-height: 44px; }

.gallery-dialog {
    width: min(94vw, 1100px);
    max-width: none;
    max-height: 94dvh;
    margin: auto;
    padding: clamp(12px, 2vw, 22px);
    border: 1px solid #7b666c;
    border-radius: 18px;
    background: #21191c;
    color: #fff;
    overscroll-behavior: contain;
}
.gallery-dialog::backdrop { background: #110c10e8; }
html:has(.gallery-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.gallery-dialog figure { margin: 0; }
.gallery-dialog-top, .gallery-dialog-controls {
    position: sticky;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #21191c;
}
.gallery-dialog-top { top: -12px; padding-bottom: 10px; }
.gallery-dialog-controls { bottom: -12px; padding-top: 10px; }
.gallery-position { margin: 0; font-size: .85rem; }
.gallery-dialog button {
    min-height: 44px;
    padding: 7px 12px;
    border: 1px solid #ac969d;
    border-radius: 8px;
    background: #34272c;
    color: inherit;
    font: inherit;
    font-size: .83rem;
}
.gallery-dialog button:hover { background: #653144; }
.gallery-dialog :focus-visible { outline-color: #ffb8c8; }
.gallery-dialog-image {
    display: grid;
    height: min(55dvh, 660px);
    place-items: center;
    overflow: hidden;
    background: #141014;
}
.gallery-dialog-image img { width: 100%; height: 100%; min-height: 0; object-fit: contain; touch-action: pan-y pinch-zoom; }
.gallery-dialog figcaption { padding-top: 10px; overflow-wrap: anywhere; }
.gallery-dialog figcaption h2 { margin: 0; font-size: clamp(1rem, 2.3vw, 1.55rem); line-height: 1.25; }
.gallery-dialog figcaption p { margin: 6px 0 0; color: #eee4e7; font-size: .84rem; line-height: 1.6; }

@media (max-width: 760px) {
    .gallery-featured.gallery-collection-with-photo { grid-template-columns: minmax(0, 1fr); }
    .gallery-featured .gallery-collection-photo { border-radius: 17px 17px 0 0; }
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .gallery-collections { grid-template-columns: minmax(0, 1fr); }
}
@media (forced-colors: active) {
    .gallery-featured, .gallery-dialog, .gallery-dialog-top, .gallery-dialog-controls { background: Canvas; color: CanvasText; }
    .gallery-featured p, .gallery-featured .gallery-collection-meta, .gallery-dialog figcaption p { color: CanvasText; }
    .gallery-albums-nav a[aria-current] { outline: 2px solid Highlight; }
}
