/* ============================================================
   РАЗДЕЛ «НОВОСТИ» (#news) — карточки с фото, датой и текстом.
   Первая карточка широкая, остальные в сетке.

   УБРАТЬ РАЗДЕЛ: удалить <section id="news"> в index.html
   и подключение news.css / news.js.
   ============================================================ */

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 30px;
}

.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e6ebf2;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16, 38, 76, 0.07);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms ease, border-color 320ms ease;
}

.news-card:hover {
  transform: translateY(-6px);
  border-color: #bcd4f8;
  box-shadow: 0 26px 54px rgba(16, 38, 76, 0.16);
}

/* первая новость — во всю ширину, фото слева */
.news-card-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: stretch;
}

.news-card-wide .news-media {
  flex: 0 0 46%;
  height: auto;
}

.news-card-wide .news-body {
  justify-content: center;
  padding: 30px 32px;
}

.news-card-wide h3 {
  font-size: 26px;
}

.news-media {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: #eef2f8;
}

.news-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.news-card:hover .news-media img {
  transform: scale(1.06);
}

.news-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 24px;
}

.news-body time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.news-body time::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.6;
}

.news-body h3 {
  margin: 0;
  color: #10203b;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.news-body p {
  margin: 0;
  color: #5b6b80;
  font-size: 15px;
  line-height: 1.55;
}

/* ---------- слайдер фото внутри карточки новости ---------- */
.news-slider {
  position: relative;
}

.news-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

/* фото показываем целиком (contain), пустоту закрывает размытая копия —
   так вертикальные и горизонтальные снимки не обрезаются */
.news-slides img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 520ms ease, transform 720ms cubic-bezier(0.22, 1, 0.36, 1);
}

.news-blur {
  position: absolute;
  inset: -8%;
  z-index: 0;
  background-position: center;
  background-size: cover;
  filter: blur(22px) saturate(1.15) brightness(0.92);
  transform: scale(1.06);
  transition: background-image 420ms ease;
  pointer-events: none;
}

.news-slides img.is-active {
  opacity: 1;
  transform: scale(1);
}

/* стрелки — появляются при наведении, на тач-устройствах видны всегда */
.news-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0 0 3px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #10203b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 6px 18px rgba(10, 22, 40, 0.22);
  transform: translateY(-50%) scale(0.9);
  transition: opacity 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background 240ms ease;
}

.news-prev { left: 10px; }
.news-next { right: 10px; }

.news-slider:hover .news-nav,
.news-nav:focus-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.news-nav:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.1);
}

/* точки-индикаторы */
.news-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.news-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: width 260ms ease, background 260ms ease;
}

.news-dots button.is-active {
  width: 18px;
  border-radius: 4px;
  background: #fff;
}

@media (hover: none) {
  .news-nav {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* появление карточек волной */
.news-card {
  opacity: 0;
  transform: translateY(24px);
}

.news-grid.is-in .news-card {
  animation: news-in 640ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 110ms);
}

@keyframes news-in {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-card {
    opacity: 1;
    transform: none;
  }
  .news-grid.is-in .news-card {
    animation: none;
  }
}

@media (max-width: 980px) {
  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .news-card-wide {
    flex-direction: column;
  }
  .news-card-wide .news-media {
    flex: none;
    height: 210px;
  }
  .news-card-wide .news-body {
    padding: 20px 22px 24px;
  }
  .news-card-wide h3 {
    font-size: 21px;
  }
}

@media (max-width: 720px) {
  .news-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
  }
  .news-media {
    height: 200px;
  }
  .news-card-wide .news-media {
    height: 190px;
  }
  .news-body {
    padding: 16px 16px 18px;
  }
  .news-body h3,
  .news-card-wide h3 {
    font-size: 17px;
  }
  .news-body p {
    font-size: 14px;
  }
}
