a[data-gallery-photo] { cursor: zoom-in; }
html.ep-gallery-open,
html.ep-gallery-open body { overflow: hidden; overscroll-behavior: none; }

.ep-photo-dialog {
  --gallery-pad: clamp(16px, 2.6vw, 42px);
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: max(12px, env(safe-area-inset-top)) var(--gallery-pad) max(12px, env(safe-area-inset-bottom));
  border: 0;
  background: #101319;
  color: #f8f9fb;
  box-sizing: border-box;
  overflow: hidden;
}
.ep-photo-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.4vh, 18px);
}
.ep-photo-dialog::backdrop { background: #101319; }
.ep-photo-toolbar,
.ep-photo-nav { display: flex; align-items: center; gap: .65rem; }
.ep-photo-toolbar { justify-content: space-between; }
.ep-photo-count { font-variant-numeric: tabular-nums; font-size: 1rem; letter-spacing: .09em; }
.ep-photo-stage { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); min-height: 0; min-width: 0; place-items: center; }
.ep-photo-large {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y pinch-zoom;
}
.ep-photo-nav { justify-content: center; }
.ep-photo-nav[hidden] { display: none; }
.ep-photo-control {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #707680;
  border-radius: 50%;
  color: #f8f9fb;
  background: transparent;
  cursor: pointer;
}
.ep-photo-control:hover { background: #2b303a; }
.ep-photo-control:focus-visible { outline: 3px solid #a5bffe; outline-offset: 3px; }
.ep-photo-control::before,
.ep-photo-close::after { content: ''; position: absolute; top: 50%; left: 50%; }
.ep-photo-prev::before,
.ep-photo-next::before {
  width: 11px;
  height: 11px;
  border-top: 2px solid;
  border-right: 2px solid;
}
.ep-photo-prev::before { transform: translate(-34%, -50%) rotate(-135deg); }
.ep-photo-next::before { transform: translate(-66%, -50%) rotate(45deg); }
.ep-photo-close::before,
.ep-photo-close::after { width: 18px; border-top: 2px solid; transform: translate(-50%, -50%) rotate(45deg); }
.ep-photo-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

@media (prefers-reduced-motion: no-preference) {
  [data-reveal] { transition: opacity .48s ease, translate .48s ease; }
  [data-reveal].ep-reveal-wait:not(:focus-within):not(:target) { opacity: 0; translate: 0 12px; }
}
@media (max-height: 470px) and (min-width: 640px) {
  .ep-photo-dialog[open] { grid-template-rows: minmax(0, 1fr); padding-inline: 72px; }
  .ep-photo-toolbar { position: absolute; inset: 8px 12px auto; pointer-events: none; }
  .ep-photo-toolbar > button { pointer-events: auto; }
  .ep-photo-nav { position: absolute; inset: 50% 12px auto; justify-content: space-between; pointer-events: none; }
  .ep-photo-nav > button { pointer-events: auto; }
}
