html:is(.gallery-open, .info-open) { overflow: hidden; scrollbar-gutter: stable; }

.gallery-dialog, .info-dialog {
  width: min(59rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: clamp(.8rem, 2vw, 1.4rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--glass-edge);
  border-radius: clamp(1.1rem, 3vw, 1.85rem);
  background: radial-gradient(ellipse at 14% 0, #532420, transparent 65%), #211719;
  box-shadow: inset 0 1px 0 #fff2, 0 30px 90px #0009, 0 0 32px #ff695a1f;
  color: var(--ink);
}
.gallery-dialog[open] { display: grid; gap: clamp(.9rem, 1.8vw, 1.2rem); }
:is(.gallery-dialog, .info-dialog)::backdrop { background: #0c090ac9; backdrop-filter: blur(7px); }
.gallery-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: var(--control-gap);
  align-items: center;
  text-align: center;
}
.gallery-heading h2 { grid-column: 2; font-size: clamp(1.5rem, 4vw, 2.45rem); line-height: 1.15; }
.gallery-heading .gallery-close { grid-column: 3; width: 44px; min-height: 44px; }
.gallery-close span { font-size: 1.5rem; }
.gallery-figure { display: grid; gap: .85rem; margin: 0; }
.gallery-stage {
  display: grid;
  position: relative;
  place-items: center;
  height: min(55dvh, 34rem);
  min-height: 9rem;
  overflow: hidden;
  border: 1px solid var(--glass-edge);
  border-radius: .85rem;
  background: radial-gradient(ellipse at 50% 66%, #341c23, #120e10 80%);
  touch-action: pan-y;
}
.gallery-stage .gallery-image { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; object-fit: contain; user-select: none; }
.gallery-status {
  position: absolute;
  inset-inline: 1rem;
  inset-block-end: .7rem;
  z-index: 1;
  justify-self: center;
  max-width: calc(100% - 2rem);
  padding: .32rem .72rem;
  border: 1px solid var(--glass-edge);
  border-radius: .65rem;
  background: #171012e8;
  color: var(--ink);
  font-size: .86rem;
  text-align: center;
}
.gallery-status[hidden] { display: none; }
.gallery-meta { display: grid; gap: .25rem; min-height: 3rem; padding-inline: .65rem; text-align: center; overflow-wrap: anywhere; }
.gallery-category { color: var(--contrast); text-transform: none; }
.gallery-category[hidden], .gallery-playback[hidden] { display: none; }
.gallery-caption { color: var(--ink); font-size: 1rem; font-weight: 650; }
.gallery-controls { display: flex; align-items: center; justify-content: center; gap: max(.75rem, var(--control-gap)); }
.gallery-counter { min-width: 4.5rem; text-align: center; color: var(--contrast); font-variant-numeric: tabular-nums; }
.gallery-dialog:dir(rtl) .gallery-step > span { display: block; transform: scaleX(-1); }

@media (max-width: 600px) {
  .gallery-dialog, .info-dialog { width: calc(100% - 1.2rem); max-height: calc(100dvh - 1.2rem); }
  .gallery-stage { height: min(53dvh, 92vw); }
}

@media (prefers-reduced-motion: no-preference) {
  :is(.gallery-dialog, .info-dialog)[open] { animation: glass-enter .32s var(--glide) both; }
  @keyframes glass-enter { from { opacity: 0; transform: translateY(8px); } }
}
.gallery-intro { max-width: 54ch; margin-top: .8rem; color: var(--muted); }
.gallery-launch { margin-top: clamp(1.35rem, 3vw, 2.8rem); }
.gallery-launch-button { cursor: pointer; }
.gallery-launch-button[hidden], .gallery-launch:has(.gallery-launch-button[hidden]) { display: none; }

