/*
 * Статьи блога (CD-3380): карточка статьи и карусель «Статьи» / «Читай дальше».
 *
 * Тот же CSS лежит в next-app/app/globals.css (секция «Статьи»): главная —
 * Express, страницы /articles — Next, а общих стилей у двух приложений нет.
 * Меняете здесь — меняйте и там. Значения сняты с макета «Блог на сайте».
 */

.article-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  height: 300px;
  padding: 24px;
  border-radius: 40px;
  overflow: hidden;
  background: #2b2d42;
  color: #fff;
  text-decoration: none;
}

/* Затемнение снизу под текст и внутреннее свечение края — поверх обложки */
.article-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) -8%, rgba(0, 0, 0, 0.8) 67.5%);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.article-card__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.article-card:hover .article-card__img {
  transform: scale(1.03);
}

.article-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.article-card__rubric {
  padding: 6px 10px;
  border-radius: 20px;
  background: #4d65eb;
  color: #fff;
  font-family: "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
}

.article-card__date,
.article-card__stat {
  color: rgba(255, 255, 255, 0.8);
  font-family: "Roboto", "Inter", system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
}

.article-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  color: #fff;
  font-family: "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.article-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Секция с каруселью: «Статьи» на главной и «Читай дальше» под статьёй ── */

.articles-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 60px 0 80px;
}

.articles-section__title {
  margin: 0;
  padding: 0 16px;
  color: #000;
  font-family: "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-weight: 800;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.36px;
  text-align: center;
}

.articles-section__all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 328px;
  max-width: calc(100% - 32px);
  padding: 14px 24px;
  border-radius: 12px;
  background: #4d65eb;
  color: #fff;
  font-family: "Roboto", "Inter", system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 19px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.articles-section__all:hover {
  background: #3e50d8;
}

.articles-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.articles-carousel__viewport {
  position: relative;
  width: 100%;
}

/* Справа карусель уходит под фон: последняя видимая карточка обрезается */
.articles-carousel__viewport::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 76px;
  background: linear-gradient(90deg, rgba(243, 244, 250, 0), #f3f4fa);
  pointer-events: none;
}

.articles-carousel__track {
  /* Отступ слева как у контента страницы шириной 1360 px (на макете 1600 — 120 px) */
  --articles-carousel-inset: max(16px, calc((100% - 1360px) / 2));
  display: flex;
  gap: 16px;
  padding: 0 76px 0 var(--articles-carousel-inset);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--articles-carousel-inset);
  scrollbar-width: none;
}

.articles-carousel__track::-webkit-scrollbar {
  display: none;
}

.articles-carousel__track > .article-card {
  flex: 0 0 452px;
  scroll-snap-align: start;
}

.articles-carousel__next {
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #1b1b1e;
  backdrop-filter: blur(12px);
  transform: translateY(-50%);
  cursor: pointer;
}

.articles-carousel__next[hidden] {
  display: none;
}

.articles-carousel__dots {
  display: flex;
  gap: 5px;
}

.articles-carousel__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(77, 101, 235, 0.3);
  transition: background 0.2s ease;
}

.articles-carousel__dot.is-active {
  background: #4d65eb;
}

@media (max-width: 767px) {
  .article-card {
    padding: 16px;
    border-radius: 24px;
  }

  .articles-section {
    gap: 24px;
    padding: 20px 0 60px;
  }

  .articles-section__title {
    color: #111118;
    font-weight: 900;
    font-size: 30px;
    letter-spacing: 0;
  }

  .articles-carousel__viewport::after,
  .articles-carousel__next {
    display: none;
  }

  .articles-carousel__track {
    padding-right: 16px;
  }

  .articles-carousel__track > .article-card {
    flex-basis: calc(100vw - 32px);
    max-width: 452px;
  }
}
