/* ===== HEADER (страница новостей) ===== */
.header__top-services {
  margin-top: 20px;
}

.logo img {
  width: 50px;
  height: auto;
}

.header__hero-services {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 70vh;
  padding: 40px 0;
}

.header__title-services {
  font-size: 80px;
  font-weight: 500;
  line-height: 96px;
  text-align: center;
  margin-bottom: 50px;
  animation: hero-rise 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.header__subtitle {
  position: relative;
  padding-bottom: 32px;
  line-height: 26px;
  opacity: 0.82;
  font-weight: 400;
  font-size: inherit;
  text-align: center;
  max-width: 800px;
}

.header__subtitle::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1280px, calc(100% - 40px));
  height: 1px;
  background-color: var(--color-black);
  opacity: 0.5;
}

/* ===== СЕКЦИЯ НОВОСТЕЙ ===== */
.news {
  margin: 150px 0;
}

.news-page__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Пустое состояние (если новостей нет) */
.news-page__list:empty::after {
  content: "Новости скоро появятся";
  display: block;
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  font-size: 18px;
  opacity: 0.6;
}

/* ===== КАРТОЧКА НОВОСТИ ===== */
.news__card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(27, 25, 23, 0.15);
  transition: border-color 0.3s ease;
}

.news__card-link:hover {
  border-color: #c2551e;
}

.news__card-link:focus-visible {
  outline: 2px solid #c2551e;
  outline-offset: 2px;
  border-color: #c2551e;
}

.news__card-img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background-color: rgba(27, 25, 23, 0.05);
}

.news__card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.news__card-link:hover img {
  transform: scale(1.05);
}

.news__card-date {
  position: absolute;
  top: 15px;
  left: 15px;
  background-color: #c2551e;
  color: #fff;
  padding: 4px 10px;
  font-size: 13px;
  z-index: 1;
}

.news__card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 25px;
  flex: 1;
}

.news__card-tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.news__card-body h3 {
  font-size: 22px;
  line-height: 1.3;
  margin: 0;
}

.news__card-body p {
  line-height: 24px;
  opacity: 0.8;
  margin: 0;
}

.news__card-more {
  margin-top: auto;
  color: #c2551e;
  font-weight: 500;
}

.news__card-link:hover .news__card-more {
  text-decoration: underline;
}

/* ===== АНИМАЦИИ ===== */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll-driven animations для карточек ниже первого экрана */
@supports (animation-timeline: view()) {
  .news__card:nth-child(4) {
    animation: rise 1s both;
    animation-timeline: view();
    animation-range: entry 0% cover 35%;
  }

  .news__card:nth-child(5) {
    animation: rise 1s both;
    animation-timeline: view();
    animation-range: entry 10% cover 40%;
  }

  .news__card:nth-child(6) {
    animation: rise 1s both;
    animation-timeline: view();
    animation-range: entry 20% cover 45%;
  }

  .news__card:nth-child(n + 7) {
    animation: rise 1s both;
    animation-timeline: view();
    animation-range: entry 20% cover 50%;
  }
}

/* ===== АДАПТИВ ===== */

/* Планшеты */
@media (max-width: 1024px) {
  .header__title-services {
    font-size: 56px;
    line-height: 68px;
    margin-bottom: 40px;
  }

  .news {
    margin: 100px 0;
  }

  .news-page__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Мобильные */
@media (max-width: 768px) {
  .header__title-services {
    font-size: 40px;
    line-height: 48px;
    margin-bottom: 30px;
    padding: 0 20px;
  }

  .header__subtitle {
    padding: 0 20px 32px;
    font-size: 16px;
  }

  .header__subtitle::after {
    bottom: -60px;
  }

  .news {
    margin: 60px 0;
  }

  .news-page__list {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .news__card-body {
    padding: 20px;
  }

  .news__card-body h3 {
    font-size: 20px;
  }

  .news__card-body p {
    font-size: 15px;
    line-height: 22px;
  }

  .news__card-date {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
  .header__title-services {
    font-size: 32px;
    line-height: 40px;
  }

  .news {
    margin: 40px 0;
  }

  .news__card-body {
    padding: 16px;
  }

  .news__card-body h3 {
    font-size: 18px;
  }
}

/* Отключение hover на тач-устройствах */
@media (hover: none) {
  .news__card-link:hover {
    border-color: rgba(27, 25, 23, 0.15);
  }

  .news__card-link:hover img {
    transform: none;
  }

  .news__card-link:hover .news__card-more {
    text-decoration: none;
  }
}

/* Поддержка пользователей с вестибулярными расстройствами */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .news__card-link:hover img {
    transform: none;
  }
}
