#gabinet { background:#f8f6f3; scroll-margin-top:70px; }
#gabinet .gallery-intro { max-width:42rem; margin:0 auto 2rem; text-align:center; }
#gabinet .gallery-intro h2 { margin:.65rem 0 .75rem; font-weight:500; }
#gabinet .gallery-intro p:last-child { color:#706456; line-height:1.65; }

#gabinet .gallery-stage { position:relative; display:block; width:100%; max-width:56rem; margin:0 auto; padding:0; border:0; overflow:hidden; border-radius:1.25rem; background:#eae6dd; aspect-ratio:4/3; cursor:zoom-in; box-shadow:0 18px 40px -24px #4a3f2e66; }
#gabinet .gallery-slide { position:absolute; inset:0; margin:0; opacity:0; transition:opacity 1.2s ease-in-out; will-change:opacity; }
#gabinet .gallery-slide:first-child { opacity:1; }
#gabinet .gallery-stage.is-ready .gallery-slide { opacity:0; transition:opacity .01s linear 1.25s; }
#gabinet .gallery-stage.is-ready .gallery-slide.is-active { opacity:1; z-index:2; transition:opacity 1.2s ease-in-out; }
#gabinet .gallery-slide img { display:block; width:100%; height:100%; object-fit:cover; transform:translateZ(0) scale(1); transform-origin:50% 50%; will-change:transform; backface-visibility:hidden; transition:transform 0s linear 1.25s; }
#gabinet .gallery-stage.is-ready .gallery-slide.is-active img { transform:translateZ(0) scale(1.06); transition:transform 8s linear; }
#gabinet .gallery-hint { position:absolute; z-index:3; right:1rem; bottom:1rem; padding:.4rem .85rem; border-radius:999px; background:#faf9f6e6; color:#504b3f; font-size:.8125rem; letter-spacing:.02em; backdrop-filter:blur(4px); transition:background .2s; }
#gabinet .gallery-stage:hover .gallery-hint { background:#fff; }
#gabinet .gallery-stage:focus-visible { outline:3px solid #6b6b4e; outline-offset:4px; }

.gallery-viewer { position:fixed; inset:0; margin:auto; width:min(1100px,100vw); max-width:100vw; height:100dvh; max-height:100dvh; padding:0; border:0; background:transparent; color:#faf9f6; overflow:hidden; }
.gallery-viewer::backdrop { background:#1c1a16; }
.gallery-viewer[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; animation:gallery-in .25s ease-out; }
.gallery-viewer-top { display:flex; align-items:center; justify-content:space-between; padding:.75rem 1rem; font-size:.875rem; color:#d9d3c6; }
.gallery-viewer-stage { position:relative; display:grid; place-items:center; min-height:0; padding:0 3.5rem; touch-action:pan-y; }
.gallery-viewer-stage img { max-width:100%; max-height:100%; object-fit:contain; border-radius:.75rem; transition:opacity .2s ease; }
.gallery-viewer-stage img.is-loading { opacity:.35; }
.gallery-viewer button { display:grid; place-items:center; width:44px; height:44px; padding:0; border:0; border-radius:50%; background:#faf9f61f; color:#faf9f6; font-size:1.4rem; line-height:1; cursor:pointer; transition:background .2s; }
.gallery-viewer button:hover { background:#faf9f640; }
.gallery-viewer button:focus-visible { outline:3px solid #fff; outline-offset:2px; }
.gallery-viewer [data-step] { position:absolute; top:50%; translate:0 -50%; }
.gallery-viewer [data-step="-1"] { left:.5rem; }
.gallery-viewer [data-step="1"] { right:.5rem; }
@keyframes gallery-in { from { opacity:0; } }

@media(min-width:768px) {
  #gabinet .gallery-stage { aspect-ratio:3/2; }
}
@media(max-width:640px) {
  #gabinet .gallery-stage { border-radius:1rem; }
  #gabinet .gallery-hint { right:.625rem; bottom:.625rem; font-size:.75rem; }
  .gallery-viewer-stage { padding:0 .5rem; }
  .gallery-viewer [data-step] { top:auto; bottom:.25rem; translate:none; }
  .gallery-viewer [data-step="-1"] { left:1rem; }
  .gallery-viewer [data-step="1"] { right:1rem; }
  .gallery-viewer-stage { padding-bottom:3.5rem; }
}
@media(prefers-reduced-motion:reduce) {
  #gabinet .gallery-slide { transition:none; }
  #gabinet .gallery-slide img, #gabinet .gallery-stage.is-ready .gallery-slide.is-active img { transition:none; transform:none; }
  .gallery-viewer[open] { animation:none; }
  .gallery-viewer-stage img { transition:none; }
}
