/* ===== news.css — стили для страницы новостей ===== */

/* ===== КОНТЕЙНЕР ===== */
.news-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 2rem;
  width: 100%;
  box-sizing: border-box;
}

.news-container h1 {
  border-bottom: none;
  text-align: center;
  margin-bottom: 2rem;
  width: 100%;
}

#news-list {
  width: 100%;
  display: block;
}

/* ===== КАРТОЧКА ===== */
.news-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  animation: cardFadeIn 0.4s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

.news-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* ===== ЗАДЕРЖКИ АНИМАЦИИ ===== */
.news-card:nth-child(1) { animation-delay: 0.05s; }
.news-card:nth-child(2) { animation-delay: 0.10s; }
.news-card:nth-child(3) { animation-delay: 0.15s; }
.news-card:nth-child(4) { animation-delay: 0.20s; }
.news-card:nth-child(5) { animation-delay: 0.25s; }
.news-card:nth-child(6) { animation-delay: 0.30s; }
.news-card:nth-child(7) { animation-delay: 0.35s; }
.news-card:nth-child(8) { animation-delay: 0.40s; }
.news-card:nth-child(9) { animation-delay: 0.45s; }
.news-card:nth-child(10) { animation-delay: 0.50s; }

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== ЭЛЕМЕНТЫ КАРТОЧКИ ===== */
.news-card__date {
  font-size: 0.7rem;
  color: var(--color-text-dim, #888);
  margin-bottom: 0.4rem;
  display: block;
  width: 100%;
  flex-shrink: 0;
}

.news-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.3;
  display: block;
  width: 100%;
  flex-shrink: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.news-card__image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  display: block;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.news-card:hover .news-card__image {
  transform: scale(1.01);
}

/* ===== ПРЕВЬЮ СТАТЬИ (УМЕНЬШЕННЫЙ ТЕКСТ) ===== */
.news-card__preview {
  color: var(--color-text, #222);
  line-height: 1.5;
  font-size: 0.85rem; /* БЫЛО 0.95rem, СТАЛО 0.85rem */
  display: block;
  width: 100%;
  flex: 1;
  max-height: none;
  overflow: hidden;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  min-height: 100px;
}

.news-card__preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, transparent, var(--color-surface, #ffffff));
  pointer-events: none;
}

/* ===== ФУТЕР ===== */
.news-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border, #e0e0e0);
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  flex-shrink: 0;
  margin-top: auto;
}

.news-card__meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-dim, #888);
  flex-wrap: wrap;
  align-items: center;
}

.news-card__views {
  font-size: 0.75rem;
  color: var(--color-text-dim, #888);
}

.tag-pill {
  background: var(--color-bg, #f5f0e8);
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--color-text-dim, #888);
  transition: all 0.2s ease;
  cursor: default;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 150px;
}

.tag-pill:hover {
  background: var(--color-accent, #2C2C2C);
  color: var(--color-bg, #F5F0E8);
  transform: scale(1.05);
}

/* ===== КНОПКИ ===== */
.news-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.9rem;
  font-family: var(--font-body, 'Georgia', serif);
  font-size: 0.8rem;
  border: 2px solid var(--color-accent, #2C2C2C);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
  border-radius: var(--radius-sm, 4px);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

.news-card__btn--read {
  background: var(--color-accent, #2C2C2C);
  color: var(--color-bg, #F5F0E8);
  border-color: var(--color-accent, #2C2C2C);
}

.news-card__btn--read:hover {
  background: var(--color-bg, #F5F0E8);
  color: var(--color-accent, #2C2C2C);
  border-color: var(--color-accent, #2C2C2C);
}

.news-empty {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-dim, #888);
}

/* ===== ПАГИНАЦИЯ ===== */
.pagination {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
  width: 100%;
}

.pagination button {
  padding: 0.25rem 0.6rem;
  border: 2px solid var(--color-border, #e0e0e0);
  border-radius: var(--radius-sm, 4px);
  background: var(--color-surface, #ffffff);
  color: var(--color-text, #222);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body, 'Georgia', serif);
  font-size: 0.8rem;
  line-height: 1.3;
  min-width: 30px;
}

.pagination button:hover {
  background: var(--color-bg, #f5f0e8);
  transform: scale(1.05);
}

.pagination button.active {
  background: var(--color-accent, #2C2C2C);
  border-color: var(--color-accent, #2C2C2C);
  color: var(--color-bg, #F5F0E8);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none !important;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--color-surface, #ffffff);
  border-radius: 16px;
  max-width: 1170px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 2px solid var(--color-border, #e0e0e0);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 34px;
  height: 34px;
  border: 2px solid var(--color-border, #e0e0e0);
  background: var(--color-surface, #ffffff);
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text, #222);
  line-height: 1;
}

.modal-close:hover {
  background: var(--color-accent, #2C2C2C);
  color: var(--color-bg, #F5F0E8);
  border-color: var(--color-accent, #2C2C2C);
  transform: rotate(90deg);
}

.modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--color-border, #e0e0e0);
  flex-shrink: 0;
}

.modal-date {
  font-size: 0.75rem;
  color: var(--color-text-dim, #888);
  margin-bottom: 0.2rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  color: var(--color-highlight, #000000);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.modal-body {
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
  flex: 1;
  line-height: 1.7;
  font-size: 1rem;
  color: var(--color-text, #222);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.modal-body img {
  max-width: 100%;
  max-height: 500px;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  object-fit: contain;
}

.modal-body blockquote {
  border-left: 4px solid var(--color-accent, #2C2C2C);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--color-text-dim, #888);
}

.modal-body code {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
}

.modal-loading,
.modal-error {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-dim, #888);
}

.modal-error {
  color: #e74c3c;
}

/* ===== СКРОЛЛ В МОДАЛКЕ ===== */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--color-bg, #f5f0e8);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--color-accent, #2C2C2C);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--color-highlight, #000000);
}

/* ===== АДАПТИВ ===== */
@media (max-width: 1200px) {
  .modal-content {
    max-width: 95vw;
  }
}

@media (max-width: 1024px) {
  .modal-content {
    max-width: 96vw;
  }
  
  .modal-header {
    padding: 1.25rem 1.5rem 0.75rem;
  }
  
  .modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
  }
}

@media (max-width: 767px) {
  .news-container {
    padding: 1rem 0.75rem;
    max-width: 100%;
  }

  .news-card {
    padding: 1rem 1.25rem;
  }

  .news-card__title {
    font-size: 1rem;
  }

  .news-card__image {
    max-height: 140px;
  }

  .news-card__preview {
    font-size: 0.8rem; /* Уменьшено на мобильных */
    min-height: 80px;
  }

  .news-card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .news-card__btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }

  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 0.75rem 1rem 0.5rem;
  }

  .modal-title {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 0.75rem 1rem 1rem;
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .modal-body img {
    max-height: 300px;
    margin: 0.75rem 0;
  }

  .modal-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    max-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .modal-overlay {
    padding: 0;
  }

  .modal-body img {
    max-height: 220px;
  }

  .news-card__preview {
    font-size: 0.75rem;
    min-height: 60px;
  }
}

/* ===== ПРЕДОТВРАЩАЕМ ГОРИЗОНТАЛЬНЫЙ СКРОЛЛ ===== */
.news-container,
#news-list,
.news-card,
.news-card__preview,
.news-card__title,
.news-card__text,
.modal-body {
  max-width: 100%;
  overflow-x: hidden;
}

.news-card__preview a,
.modal-body a,
.news-card__preview code,
.modal-body code {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
}