/* Галерея в потоке статьи/страницы — hero-карусель */
.article-inline-gallery-wrap {
  margin: 0.75rem 0 2.25rem;
  max-width: 100%;
}

.article-sidebar-gallery {
  --sg-radius: 16px;
  --sg-accent: #2563eb;
  --sg-accent-soft: rgba(37, 99, 235, 0.12);
  --sg-surface: rgba(255, 255, 255, 0.92);
  --sg-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28),
    0 12px 24px -10px rgba(15, 23, 42, 0.18);
  --sg-border: rgba(148, 163, 184, 0.35);
  position: relative;
  border-radius: var(--sg-radius);
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 48%, #0f172a 100%);
  padding: 3px;
  box-shadow: var(--sg-shadow);
  overflow: hidden;
}

.article-sidebar-gallery::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(148, 163, 184, 0.15) 40%,
    rgba(15, 23, 42, 0.5) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.article-sidebar-gallery__viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #020617;
  border-radius: calc(var(--sg-radius) - 2px);
  overflow: hidden;
}

.article-sidebar-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: middle;
  transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.article-sidebar-gallery__scrim {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(
    to top,
    rgba(2, 6, 23, 0.75) 0%,
    rgba(2, 6, 23, 0.2) 45%,
    transparent 100%
  );
}

.article-sidebar-gallery__btn--edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.article-sidebar-gallery__btn--edge:hover {
  background: rgba(37, 99, 235, 0.85);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.45);
  transform: translateY(-50%) scale(1.05);
}

.article-sidebar-gallery__btn--edge:active {
  transform: translateY(-50%) scale(0.96);
}

.article-sidebar-gallery__btn--prev.article-sidebar-gallery__btn--edge {
  left: 12px;
}

.article-sidebar-gallery__btn--next.article-sidebar-gallery__btn--edge {
  right: 12px;
}

.article-sidebar-gallery__btn--hidden {
  display: none !important;
}

.article-sidebar-gallery__chev {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.article-sidebar-gallery__btn--prev .article-sidebar-gallery__chev::after,
.article-sidebar-gallery__btn--next .article-sidebar-gallery__chev::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform-origin: 50% 50%;
}

.article-sidebar-gallery__btn--prev .article-sidebar-gallery__chev::after {
  transform: translate(-35%, -50%) rotate(135deg);
}

.article-sidebar-gallery__btn--next .article-sidebar-gallery__chev::after {
  transform: translate(-65%, -50%) rotate(-45deg);
}

.article-sidebar-gallery__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, #0f172a 100%);
  border-radius: 0 0 calc(var(--sg-radius) - 3px) calc(var(--sg-radius) - 3px);
}

.article-sidebar-gallery__dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 12px;
}

.article-sidebar-gallery__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.45);
  transition: transform 0.25s ease, background 0.25s ease, width 0.3s ease,
    border-radius 0.3s ease;
}

.article-sidebar-gallery__dot:hover {
  background: rgba(248, 250, 252, 0.65);
  transform: scale(1.15);
}

.article-sidebar-gallery__dot.is-active {
  width: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sg-accent), #38bdf8);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

.article-sidebar-gallery__meta {
  margin-left: auto;
}

.article-sidebar-gallery__count {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.88);
}

.article-sidebar-gallery__cur {
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.article-sidebar-gallery__sep {
  opacity: 0.45;
  font-weight: 500;
  margin: 0 1px;
}

.article-sidebar-gallery__total {
  opacity: 0.65;
  font-weight: 600;
}

@media (max-width: 520px) {
  .article-sidebar-gallery__btn--edge {
    width: 38px;
    height: 38px;
  }

  .article-sidebar-gallery__btn--prev.article-sidebar-gallery__btn--edge {
    left: 8px;
  }

  .article-sidebar-gallery__btn--next.article-sidebar-gallery__btn--edge {
    right: 8px;
  }

  .article-sidebar-gallery__chrome {
    flex-direction: column;
    align-items: stretch;
  }

  .article-sidebar-gallery__meta {
    margin-left: 0;
    text-align: center;
    justify-content: center;
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-sidebar-gallery__img {
    transition: opacity 0.2s ease;
  }

  .article-sidebar-gallery__btn--edge:hover {
    transform: translateY(-50%);
  }

  .article-sidebar-gallery__dot {
    transition: none;
  }
}
