﻿/* ==========================================================================
   Articles Page CSS — Единый файл стилей страницы «Статьи»
   Подключает общую базу (shared-base.css) и содержит все стили страницы
   ========================================================================== */
@import url("shared-base.css");

/* ==========================================================================
   1. Хиро-секция страницы Статьи
   ========================================================================== */
.top-bg-wrapper {
  background: transparent;
  position: relative;
}

.articles-section {
  position: relative;
  padding-top: 95px;
  padding-bottom: 60px;
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 400px); /* Чтобы футер не прилипал, если мало контента */
}

.articles__container {
  position: relative;
  z-index: 2;
  width: 100%;
}

/* Хлебные крошки */
.breadcrumbs--hero {
  margin: 0 0 15px 0;
  padding: 0;
  z-index: 10;
}

@media (max-width: 576px) {
  .breadcrumbs--hero {
    margin-bottom: 15px;
  }
}

.breadcrumbs__list {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.breadcrumbs__link {
  color: var(--text-muted);
  transition: color 0.3s ease;
  text-decoration: none;
}

.breadcrumbs__link:hover {
  color: var(--text-white);
}

.breadcrumbs__separator {
  color: var(--text-muted);
  user-select: none;
}

.breadcrumbs__current {
  color: var(--accent-green);
}

.articles-section__title {
  margin-bottom: 30px;
  text-transform: uppercase;
}

/* ==========================================================================
   2. Сетка карточек (Articles Grid)
   ========================================================================== */
/* Контейнер с ограниченной высотой и скроллом */
.articles__grid-wrapper {
  width: 100%;
  /* 
     ПК: видно 6 статей (3 ряда).
     При aspect-ratio 4/3 карточка высотой ~410px. 3 ряда + gap ~1285px.
  */
  max-height: 1285px; 
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 15px; /* Место для скроллбара, чтобы он не перекрывал карточки */
  margin-right: -15px; /* Компенсация отступа справа */
  
  /* Стилизация стандартного скроллбара (как в .projects__slider, но вертикального) */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-green) var(--bg-main);
}

/* Стилизация скроллбара для WebKit (Chrome, Safari) */
.articles__grid-wrapper::-webkit-scrollbar {
  width: 6px;
}

.articles__grid-wrapper::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}

.articles__grid-wrapper::-webkit-scrollbar-thumb {
  background: var(--accent-green);
  border-radius: 4px;
}

.articles__grid-wrapper::-webkit-scrollbar-thumb:hover {
  background: #b8cf25;
}

.articles__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  /* Добавим небольшой padding снизу для скролла */
  padding-bottom: 20px; 
}

/* Сама карточка */
.article-card {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: rgba(210, 236, 43, 0.4);
  box-shadow: 0 10px 30px rgba(210, 236, 43, 0.15);
}

.article-card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  background-color: #1a1a1a;
}

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

/* Контейнер для фото, чтобы скрыть вылезающий при ховере scale */
.article-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 12px;
  pointer-events: none;
  z-index: 2;
  /* Легкий градиент снизу, если нужно */
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 40%);
}

.article-card__btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  width: 100%;
  z-index: 3;
  white-space: normal;
  word-wrap: break-word;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--bg-card);
  border-radius: 0 0 12px 12px;
  padding: 12px 15px;
  text-align: center;
  line-height: 1.3;
  transition: none;
}

.article-card__btn:hover,
.article-card:hover .article-card__btn,
.article-card__btn:active {
  transform: none;
  filter: none;
  box-shadow: none;
}

/* ==========================================================================
   3. Модальное окно (Попап статьи)
   ========================================================================== */
.article-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.4s ease, opacity 0.4s ease;
}

.article-modal--active {
  visibility: visible;
  opacity: 1;
}

.article-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 4, 0.85); /* Цвет --bg-main с прозрачностью */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.article-modal__content {
  position: relative;
  z-index: 2;
  background-color: var(--bg-card);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Скроллбар для попапа */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-green) var(--bg-main);
}

.article-modal--active .article-modal__content {
  transform: scale(1) translateY(0);
}

.article-modal__content::-webkit-scrollbar {
  width: 6px;
}

.article-modal__content::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 0 16px 16px 0;
}

.article-modal__content::-webkit-scrollbar-thumb {
  background: var(--accent-green);
  border-radius: 4px;
}

.article-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.article-modal__close:hover {
  background: var(--bg-main);
  border-color: var(--accent-green);
  color: var(--accent-green);
  transform: scale(1.1);
}

.article-modal__body {
  display: flex;
  flex-direction: column;
}

.article-modal__img {
  width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  display: block;
}

.article-modal__title {
  padding: 32px 32px 16px 32px;
  margin: 0;
  font-size: 32px;
}

.article-modal__text {
  padding: 0 32px 40px 32px;
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
}

/* ==========================================================================
   4. Адаптив
   ========================================================================== */
@media (max-width: 992px) {
  .articles__grid-wrapper {
    /* Планшет (2 колонки): видно 4 статьи (2 ряда). */
    max-height: 570px; 
  }
}

@media (max-width: 768px) {
  .articles__grid {
    grid-template-columns: 1fr;
  }
  
  .articles__grid-wrapper {
    /* На мобильных 1 колонка. Видно 3 статьи (3 ряда). */
    max-height: 1000px;
    padding-right: 10px;
    margin-right: -10px;
  }

  div.top-bg-wrapper.top-bg-wrapper {
    background: url("../img/hero-bg.webp") no-repeat 10% top;
    background-size: 200% auto;
  }
  .article-modal__title {
    font-size: 24px;
    padding: 24px 20px 12px 20px;
  }
  
  .article-modal__text {
    font-size: 15px;
    padding: 0 20px 30px 20px;
  }
  
  .article-modal__img {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .articles__grid-wrapper {
    /* Для совсем узких экранов (1 колонка): 3 статьи (3 ряда). */
    max-height: 800px;
  }
  
  .articles-section {
    padding-top: 80px;
  }
}
