.hg-gallery {
  position: relative;
  margin-block: 1.75rem 2.25rem;
  padding: 0.5rem;
  border: 1px solid var(--hg-border-strong);
  border-radius: var(--hg-radius);
  background: linear-gradient(145deg, rgba(255, 61, 146, 0.08), rgba(155, 100, 255, 0.045) 45%, rgba(8, 8, 14, 0.96));
  box-shadow: var(--hg-shadow);
}

.hg-gallery__viewport {
  position: relative;
  display: grid;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--hg-radius) - 5px);
  background: #050509;
  isolation: isolate;
}

.hg-gallery__slide {
  grid-area: 1 / 1;
  display: grid;
  min-width: 0;
  height: 100%;
  margin: 0;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 240ms var(--hg-ease), transform 300ms var(--hg-ease);
}

.hg-gallery__slide.is-active {
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.entry-content .hg-gallery__slide > p,
.entry-content .hg-gallery__slide > figure {
  display: grid;
  width: 100%;
  height: 100%;
  margin: 0;
  place-items: center;
}

.entry-content .hg-gallery__slide img {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: calc(var(--hg-radius) - 5px);
  object-fit: contain;
}

.hg-gallery__button {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 7, 12, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  place-items: center;
  cursor: pointer;
  transform: translateY(-50%);
  transition: border-color 180ms var(--hg-ease), background-color 180ms var(--hg-ease), color 180ms var(--hg-ease);
}

.hg-gallery__button:hover {
  border-color: var(--hg-accent-bright);
  background: rgba(255, 61, 146, 0.92);
}

.hg-gallery__button:focus-visible,
.hg-gallery__dot:focus-visible {
  outline: 3px solid var(--hg-cyan);
  outline-offset: 3px;
}

.hg-gallery__button--previous { left: 1rem; }
.hg-gallery__button--next { right: 1rem; }
.hg-gallery__button svg { width: 22px; height: 22px; }

.hg-gallery__footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0.55rem 0.5rem 0.1rem;
}

.hg-gallery__dots {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.hg-gallery__dot {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.hg-gallery__dot::before {
  display: block;
  width: 8px;
  height: 8px;
  margin: auto;
  border-radius: 50%;
  background: #777381;
  content: "";
  transition: background-color 180ms var(--hg-ease), box-shadow 180ms var(--hg-ease), transform 180ms var(--hg-ease);
}

.hg-gallery__dot[aria-current="true"]::before {
  background: var(--hg-accent-bright);
  box-shadow: 0 0 0 4px rgba(255, 61, 146, 0.14), 0 0 14px rgba(255, 61, 146, 0.58);
  transform: scale(1.2);
}

.hg-gallery__counter {
  grid-column: 3;
  justify-self: end;
  padding-right: 0.25rem;
  color: var(--hg-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.hg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 580px) {
  .hg-gallery { margin-inline: -0.25rem; }
  .hg-gallery__viewport { aspect-ratio: 4 / 3; }
  .hg-gallery__button { width: 44px; height: 44px; }
  .hg-gallery__button--previous { left: 0.65rem; }
  .hg-gallery__button--next { right: 0.65rem; }
  .hg-gallery__footer { grid-template-columns: 1fr auto; }
  .hg-gallery__dots { grid-column: 1; justify-content: flex-start; }
  .hg-gallery__counter { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .hg-gallery__slide,
  .hg-gallery__button,
  .hg-gallery__dot::before {
    transition-duration: 0.01ms;
  }
}
