@font-face {
    font-family: 'HelveticaNeueCyr Thin';
    src: url('/fonts/helveticaneuecyr_thin.otf') format('opentype');
    font-weight: 300; /* Тонкое начертание */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HelveticaNeueCyr Roman';
    src: url('/fonts/helveticaneuecyr_roman.otf') format('opentype');
    font-weight: normal; /* Обычное начертание */
    font-style: normal;
    font-display: swap;
}

.news-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  /* Добавлено для анимации */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.news-popup.visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.news-popup-content {
  background: white;
  max-width: 1000px;
  width: 90%;
  padding: 40px;
  border-radius: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 90vh;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  /* Улучшенная прокрутка */
  -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
  scrollbar-width: thin; /* Тонкий скроллбар для Firefox */
  scrollbar-color: #00A9CE #f0f0f0; /* Цвет скроллбара */
}

/* Стилизация скроллбара для WebKit браузеров (Chrome, Safari, Edge) */
.news-popup-content::-webkit-scrollbar {
  width: 8px;
}

.news-popup-content::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.news-popup-content::-webkit-scrollbar-thumb {
  background: #00A9CE;
  border-radius: 4px;
}

.news-popup-content::-webkit-scrollbar-thumb:hover {
  background: #0085a3;
}

.news-popup.visible .news-popup-content {
  transform: scale(1);
}

.news-popup-content img {
  width: 100%;
  margin: 10px 0;
  border-radius: 4px;
}

.popup-title {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 20px;
  font-family: 'Roboto', sans-serif;
  font-size: 30px;
}


.popup-text p {
  margin-top: 20px;
  font-size: 14px;
  font-family: 'HelveticaNeueCyr Roman', Arial, sans-serif;
  color: #333F48;
  letter-spacing: 0.8px;
}

.popup-text h3 {
  margin-top: 20px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  color: #333F48;
}

.close-popup {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
}

.popup-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.popup-images img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .popup-images {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .popup-images {
    grid-template-columns: 1fr;
  }
}

/* Адаптация для вертикальных планшетов */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  #newsPopup.news-popup {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 30px 20px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  #newsPopup.news-popup .news-popup-content {
    max-width: calc(100% - 40px) !important;
    width: calc(100% - 40px) !important;
    max-height: calc(100vh - 60px) !important;
    height: auto !important;
    min-height: 200px !important;
    padding: 30px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    transform: scale(1) !important;
    position: relative !important;
    box-sizing: border-box !important;
  }
  
  #newsPopup.news-popup .popup-title {
    font-size: 22px !important;
    margin-bottom: 15px !important;
    padding-right: 30px !important;
  }
  
  #newsPopup.news-popup .popup-text {
    overflow: visible !important;
  }
  
  #newsPopup.news-popup .popup-text p {
    font-size: 13px !important;
    margin-top: 15px !important;
  }
  
  #newsPopup.news-popup .popup-text h3 {
    font-size: 15px !important;
    margin-top: 15px !important;
  }
  
  #newsPopup.news-popup .popup-images {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
  }
  
  #newsPopup.news-popup .close-popup {
    top: 15px !important;
    right: 20px !important;
    font-size: 28px !important;
    z-index: 10 !important;
    position: absolute !important;
  }
}

/* Дополнительный медиа-запрос для вертикальных планшетов без ориентации */
@media (min-width: 768px) and (max-width: 1024px) {
  #newsPopup.news-popup {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 30px 20px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  #newsPopup.news-popup .news-popup-content {
    max-width: calc(100% - 40px) !important;
    width: calc(100% - 40px) !important;
    max-height: calc(100vh - 60px) !important;
    height: auto !important;
    min-height: 200px !important;
    padding: 30px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    transform: scale(1) !important;
    position: relative !important;
    box-sizing: border-box !important;
  }
  
  #newsPopup.news-popup .popup-title {
    font-size: 22px !important;
    margin-bottom: 15px !important;
    padding-right: 30px !important;
  }
  
  #newsPopup.news-popup .popup-text {
    overflow: visible !important;
  }
  
  #newsPopup.news-popup .popup-text p {
    font-size: 13px !important;
    margin-top: 15px !important;
  }
  
  #newsPopup.news-popup .popup-text h3 {
    font-size: 15px !important;
    margin-top: 15px !important;
  }
  
  #newsPopup.news-popup .popup-images {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
  }
  
  #newsPopup.news-popup .close-popup {
    top: 15px !important;
    right: 20px !important;
    font-size: 28px !important;
    z-index: 10 !important;
    position: absolute !important;
  }
}

.popup-share {
  margin-top: 30px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'HelveticaNeueCyr Roman', Arial, sans-serif;
  color: #00A9CE;
  letter-spacing: 0.8px;
}

.popup-share .share-label {
  margin-right: 20px;
  white-space: nowrap;
}

.popup-share .share-icons {
  display: flex;
  gap: 3px;
}

.share-icon img {
  width: 25px;
  height: 25px;
  transition: transform 0.2s ease;
}

.share-icon img:hover {
  transform: scale(1.15);
}

/* Модальное окно для изображений */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

#modalImage {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  z-index: 10001;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: #00A9CE;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 60px;
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10001;
  border-radius: 0;
}

.modal-nav:hover {
  color: #00A9CE;
  transform: translateY(-50%) scale(1.1);
}

.modal-nav:active {
  color: #0085a3;
  transform: translateY(-50%) scale(0.95);
}

.modal-prev {
  left: 30px;
}

.modal-next {
  right: 30px;
}

.modal-counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 18px;
  font-family: 'HelveticaNeueCyr Roman', Arial, sans-serif;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .modal-nav {
    width: 60px;
    height: 60px;
    font-size: 48px;
  }
  
  .modal-prev {
    left: 15px;
  }
  
  .modal-next {
    right: 15px;
  }
  
  .modal-close {
    top: 15px;
    right: 20px;
    font-size: 32px;
  }
  
  .modal-counter {
    bottom: 20px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .modal-nav {
    width: 50px;
    height: 50px;
    font-size: 36px;
  }
  
  .modal-prev {
    left: 10px;
  }
  
  .modal-next {
    right: 10px;
  }
}