* { box-sizing: border-box; }
body { margin: 0; background: #000; color: #fff; font: 16px/1.5 var(--site-font); }
html, body { overflow: hidden; }
.gallery-header { position: absolute; z-index: 1; inset: 0 0 auto; padding: 12px max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px; pointer-events: none; }
.gallery-header a { pointer-events: auto; }
h1 { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); width: 80vw; margin: 0; font-family: var(--site-font); font-weight: 400; }
h1 svg { display: block; width: 100%; height: auto; overflow: visible; fill: currentColor; }
.gallery-header .open { grid-column: 3; grid-row: 1; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.gallery-header a, .close { min-height: 44px; min-width: 44px; display: inline-grid; place-items: center; border: 0; padding: 0; background: transparent; text-decoration: none; font-size: 2.4rem; line-height: 1; }
.gallery-header a, .close, h1 { color: var(--red); }
.gallery-header a { min-width: clamp(96px, 13.5vw, 132px); min-height: clamp(96px, 13.5vw, 132px); }
.gallery-header a svg { display: block; width: clamp(87px, 12vw, 114px); height: auto; }
.back-nav {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  pointer-events: auto;
}
.gallery-header:has(.open) .back-nav {
  top: 12px;
  right: calc(max(12px, env(safe-area-inset-right)) + clamp(96px, 13.5vw, 132px) + 16px);
  bottom: auto;
}
.back-menu {
  position: absolute;
  top: calc(50% + clamp(8.5px, 1.17vw, 11.1px));
  right: 74%;
  transform: translateY(-50%);
  min-width: 145px;
  padding: 4px 8px;
  pointer-events: auto;
}
.gallery-header .back-menu a { display: flex; justify-content: flex-end; min-width: 0; min-height: 26px; padding: 0 12px; font-size: 1rem; font-weight: 700; color: var(--red); }
.mosaic-viewport { touch-action: pinch-zoom; height: 100vh; height: 100dvh; overflow: clip; }
.mosaic { columns: 3; column-gap: 0; }
.mosaic a { display: block; break-inside: avoid; }
.mosaic img { display: block; width: 100%; height: auto; }
@media (min-width: 1400px) { .mosaic { columns: 4; } }
@media (max-width: 760px) { .mosaic { columns: 2; } }
.mosaic-short { columns: 1; }
.mosaic-short a[hidden] { display: none; }
.mosaic-short img { max-height: 100vh; max-height: 100dvh; object-fit: contain; }
dialog { position: fixed; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%; max-width: none; max-height: none; border: 0; background: #000; color: #fff; }
dialog[open] {
  touch-action: pinch-zoom;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  --frame: clamp(36px, 11vh, 92px);
  padding-top: max(var(--frame), env(safe-area-inset-top));
  padding-bottom: max(var(--frame), env(safe-area-inset-bottom));
}
dialog::backdrop { background: #000; }
.photo-stage { position: relative; min-height: 0; }
.photo-stage:focus { outline: none; }
.photo-stage img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.photo-zone { position: absolute; inset-block: 0; width: 50%; border: 0; padding: 0; background: transparent; }
.photo-zone.previous { left: 0; cursor: w-resize; }
.photo-zone.next { right: 0; cursor: e-resize; }
.close {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  width: clamp(72px, 10vw, 96px);
  height: clamp(72px, 10vw, 96px);
}
.close svg { display: block; width: 78%; height: auto; }

.misc-heading {
  position: fixed;
  top: 40%;
  left: 50%;
  width: 80vw;
  transform: translate(-50%, -50%);
}
.misc-heading h1 { position: static; width: 100%; transform: none; }
.misc-choices {
  position: fixed;
  inset: 78% 0 auto;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}
.gallery-header .misc-choices a {
  min-width: 0;
  min-height: 44px;
  padding-inline: 4px;
  font-size: clamp(.9rem, 3.3vw, 3.5rem);
  color: var(--red);
  text-align: center;
}
.misc-cover { height: 100vh; height: 100dvh; }
.misc-cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
