/* Страница новостей: выход из ограничения main (max-width: 1400px) и прижатие сайдбара к левому краю экрана */
@media (min-width: 992px) {
  main:has(.news-page) {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 1.5rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .news-page.container-fluid {
    max-width: none;
  }
}

.news-page .news-sidebar {
  position: sticky;
  top: 6rem;
}

.news-sidebar__link {
  display: block;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 0.35rem;
  color: #212529;
  border: 1px solid transparent;
  text-decoration: none;
}

.news-sidebar__link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #212529;
  text-decoration: none;
}

.news-sidebar__link.is-active {
  background: #e9ecef;
  border-color: #dee2e6;
  font-weight: 600;
}

.news-card {
  overflow: hidden;
  border: 1px solid #dee2e6;
}

.news-card__media {
  background: #f8f9fa;
  aspect-ratio: 16 / 9;
  max-height: 320px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card__media > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.news-card__media img,
.news-card__media video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.news-card__media .embed-responsive {
  max-height: 320px;
}

.news-card__media .embed-responsive iframe {
  max-height: 320px;
}

.news-card__description {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.news-detail__hero {
  margin-bottom: 0.875rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f1f3f5;
}

.news-detail__media-button,
.news-gallery__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.news-detail__hero img,
.news-detail__hero video {
  width: 100%;
  max-height: min(70vh, 560px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #f1f3f5;
}

.news-detail__hero .embed-responsive {
  margin: 0;
}

.news-detail__gallery {
  margin-top: 0;
  margin-bottom: 1.25rem;
  height: 100%;
}

.news-detail__gallery .row {
  margin-bottom: 0;
}

.news-gallery__thumb {
  object-fit: cover;
  width: 100%;
  height: 140px;
  border-radius: 0.25rem;
}

.news-gallery-modal .modal-content {
  background: rgba(21, 24, 28, 0.98);
  color: #fff;
  border: 0;
  border-radius: 1rem;
}

.news-gallery-modal .modal-header {
  align-items: center;
  padding: 1rem 1.25rem 0;
}

.news-gallery-modal__toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.news-gallery-modal__counter {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
}

.news-gallery-modal .modal-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 1rem 4.5rem 1.5rem;
}

.news-gallery-modal__image {
  display: block;
  max-width: 100%;
  max-height: calc(70vh - 1rem);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 0.5rem;
  object-fit: contain;
}

.news-gallery-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  transition: background-color 0.2s ease;
}

.news-gallery-modal__nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.news-gallery-modal__nav--prev {
  left: 1rem;
}

.news-gallery-modal__nav--next {
  right: 1rem;
}

.news-gallery-modal__nav[hidden] {
  display: none;
}

@media (max-width: 767.98px) {
  .news-gallery-modal .modal-body {
    min-height: 60vh;
    padding: 1rem 1rem 4.5rem;
  }

  .news-gallery-modal__nav {
    top: auto;
    bottom: 1rem;
    transform: none;
  }

  .news-gallery-modal__nav--prev {
    left: calc(50% - 3.5rem);
  }

  .news-gallery-modal__nav--next {
    right: calc(50% - 3.5rem);
  }
}

.news-feed-pagination .news-load-more:disabled {
  opacity: 0.65;
}
