.gallery { border-top: 1px solid #cdd0c4; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: clamp(180px, 18vw, 270px); gap: 12px; }
.gallery-item { position: relative; display: block; overflow: hidden; background: #222d25; }
.gallery-item:first-child, .gallery-item:last-child { grid-column: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:focus-visible { outline-offset: 3px; }
.gallery-item::after { content: ''; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, #101b18a6); pointer-events: none; }
.gallery-item-number, .gallery-item-expand { position: absolute; z-index: 1; bottom: 16px; color: #fff; }
.gallery-item-number { left: 18px; font-size: 11px; letter-spacing: .1em; }
.gallery-item-expand { right: 16px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #ffffff80; font-size: 20px; }
.gallery-hint { margin: 20px 0 0; font-size: 11px!important; }
dialog.gallery-lightbox { width: calc(100% - 28px); max-width: 1140px; padding: 22px; }
.gallery-lightbox::backdrop { background: #080f0de8; }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; }
.gallery-toolbar h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.gallery-close { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #b6c0aa; background: transparent; color: inherit; font-size: 27px; line-height: 1; }
.gallery-stage { position: relative; min-height: 200px; height: min(65vh, 720px); display: flex; align-items: center; justify-content: center; background: #0e1512; touch-action: pan-y; }
.gallery-stage img { width: 100%; height: 100%; object-fit: contain; }
.gallery-stage[data-loading="true"] img, .gallery-stage[data-error="true"] img { visibility: hidden; }
.gallery-stage-message { position: absolute; left: 20px; right: 20px; margin: 0; text-align: center; color: #edf1e7; font-size: 14px; }
.gallery-controls { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-top: 16px; }
.gallery-controls button { display: grid; place-items: center; width: 46px; height: 42px; border: 1px solid #b6c0aa; background: transparent; color: inherit; font-size: 23px; }
.gallery-controls button:hover, .gallery-close:hover { border-color: #d3b13d; background: #f8d44d; color: #20251f; }
.gallery-counter { font-size: 12px; font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .gallery { border-color: var(--dark-border); }
html[data-theme="dark"] .gallery-controls button, html[data-theme="dark"] .gallery-close { border-color: #68795e; }
@media(max-width:700px) {
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 155px; gap: 8px; }
    .gallery-item-number { left: 12px; bottom: 12px; }
    .gallery-item-expand { right: 12px; bottom: 12px; }
    dialog.gallery-lightbox { padding: 12px; }
    .gallery-stage { height: 58vh; }
}
@media(min-width:921px) and (max-width:1100px) {
    .header { flex-wrap: wrap; }
    .header .menu-toggle { display: flex; gap: 12px; margin-left: auto; border: 0; background: transparent; font-size: 11px; color: inherit; }
    .header nav { display: none; order: 4; width: 100%; padding: 15px 0; border-top: 1px solid #cdd0c4; flex-wrap: wrap; }
    .header nav.open { display: flex; }
    .header-actions .small { display: none; }
}
@media(prefers-reduced-motion:reduce) { .gallery-item img { transition: none; } }
