.ilyinsky-gallery-open {
  overflow: hidden;
}

button.doc-btn[data-ilyinsky-gallery] {
  font-family: inherit;
  cursor: pointer;
}

.ilyinsky-gallery {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 16, 16, .88);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.ilyinsky-gallery.is-open {
  opacity: 1;
  visibility: visible;
}

.ilyinsky-gallery__dialog {
  position: relative;
  width: min(1000px, calc(100vw - 40px));
  overflow: hidden;
  border-radius: 14px;
  background: #171313;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
  transform: translateY(8px) scale(.99);
  transition: transform .2s ease;
}

.ilyinsky-gallery.is-open .ilyinsky-gallery__dialog {
  transform: translateY(0) scale(1);
}

.ilyinsky-gallery__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  background: #171313;
}

.ilyinsky-gallery__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.ilyinsky-gallery__close,
.ilyinsky-gallery__nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 14, 14, .68);
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: background .15s ease, transform .15s ease;
}

.ilyinsky-gallery__close:hover,
.ilyinsky-gallery__nav:hover {
  background: #7a1515;
  transform: scale(1.05);
}

.ilyinsky-gallery__close:focus-visible,
.ilyinsky-gallery__nav:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.ilyinsky-gallery__close {
  top: 14px;
  right: 14px;
  font-size: 24px;
}

.ilyinsky-gallery__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 27px;
}

.ilyinsky-gallery__nav:hover {
  transform: translateY(-50%) scale(1.05);
}

.ilyinsky-gallery__prev { left: 14px; }
.ilyinsky-gallery__next { right: 14px; }

.ilyinsky-gallery__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 12px 18px;
  color: #fff;
}

.ilyinsky-gallery__title {
  font-size: 16px;
  font-weight: 700;
}

.ilyinsky-gallery__counter {
  flex: none;
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .ilyinsky-gallery { padding: 0; }
  .ilyinsky-gallery__dialog {
    width: 100vw;
    border-radius: 0;
  }
  .ilyinsky-gallery__close,
  .ilyinsky-gallery__nav {
    width: 40px;
    height: 40px;
  }
  .ilyinsky-gallery__close { top: 10px; right: 10px; }
  .ilyinsky-gallery__prev { left: 10px; }
  .ilyinsky-gallery__next { right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ilyinsky-gallery,
  .ilyinsky-gallery__dialog {
    transition: none;
  }
}
