body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Секция .blog чёрная, но она не тянется на всю высоту. Отфильтруй список
     до пары карточек — и снизу светилась белая полоса фона body. */
  background-color: #000;
}

main {
  flex-grow: 1;
}

footer::before {
  border-top: 1px solid #6e6e84;
}

.blog {
  padding-top: 98px;
  padding-bottom: 160px;
  background-color: #000;
}

.blog .container {
  max-width: 1232px;
  padding: 0 16px;
}

.blog .blog__inner {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
}

.blog .blog__last-article {
  grid-column: span 5;
}

:is(.blog .blog__last-article) .blog__article-card {
  background-color: #15151f;
  margin-bottom: 24px;
  min-height: auto;
  max-height: 65vh;
}

:is(.blog .blog__last-article) .blog__card-image {
  height: auto;
}

:is(.blog .blog__last-article) .blog__card-title {
  flex-shrink: 0;
}

.blog .blog__last-inner {
  position: sticky;
  top: 98px;
}

.blog .blog__content {
  grid-column: span 7;
}

/* Фильтр стоит над крупной карточкой: под ней он подпрыгивал вверх, как только
   выбранный тег прятал карточку. */
.blog .blog__filter {
  margin-bottom: 24px;
}

/* Выбран конкретный тег — крупной карточки нет (её статья уходит в общую сетку
   обычной карточкой), поэтому колонка на 5 из 12 осталась бы пустой дырой
   слева. Раскладываем фильтр и список на всю ширину. */
.blog .blog__inner[data-filtered='true'] .blog__last-article,
.blog .blog__inner[data-filtered='true'] .blog__content {
  grid-column: span 12;
}

.blog .blog__inner[data-filtered='true'] .blog__last-article {
  margin-bottom: 8px;
}

/* липкость нужна была только рядом с длинным списком справа */
.blog .blog__inner[data-filtered='true'] .blog__last-inner {
  position: static;
}

@media (min-width: 993px) {
  /* На всю ширину те же span 6 дали бы карточки вдвое шире обычных —
     на широком экране в ряд встают три. */
  .blog .blog__inner[data-filtered='true'] .blog__articles-item {
    grid-column: span 4;
  }
}

.blog .blog__articles {
  margin-bottom: 24px;
}

.blog .blog__articles-list {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin-bottom: 24px;
  align-items: stretch;
}

.blog .blog__articles-item {
  grid-column: span 6;
  display: flex;
}

/* Фильтр по тегу прячет карточки атрибутом hidden, но штатное
   [hidden] { display: none } проигрывает display: flex выше — гасим явно. */
.blog .blog__articles-item[hidden],
.blog .blog__article-card[hidden] {
  display: none;
}

.blog .blog__article-card {
  border: 1px solid #6e6e84;
  border-radius: 32px;
  background-color: #000;
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  row-gap: 24px;
  cursor: pointer;
}

.blog .blog__card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blog .blog__card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 32px;
  font-family: var(--second-family);
  font-weight: 600;
  font-size: 14px;
  line-height: 143%;
  letter-spacing: -0.02em;
}

.blog .blog__card-tag--blue {
  background: rgba(164, 195, 255, 0.25);
  color: #568fff;
}

.blog .blog__card-tag--yellow {
  background: rgba(230, 243, 85, 0.25);
  color: #e6f355;
}

.blog .blog__card-tag--red {
  background: rgba(255, 106, 42, 0.25);
  color: #ff6a2a;
}

.blog .blog__card-tag--green {
  background: rgba(34, 205, 72, 0.25);
  color: #22cd48;
}

.blog .blog__card-date {
  font-family: var(--second-family);
  font-weight: 600;
  font-size: 12px;
  line-height: 133%;
  letter-spacing: -0.02em;
  color: #6e6e84;
}

.blog .blog__card-image {
  border-radius: 16px;
  background-color: #000;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

:is(.blog .blog__card-image) img {
  display: block;
  width: 100%;
  height: auto;
}

.blog .blog__card-title {
  font-family: var(--third-family);
  font-weight: 700;
  font-size: 24px;
  line-height: 133%;
  letter-spacing: -0.04em;
  color: #fff;
  margin-top: auto;
  margin-bottom: auto;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog .blog__articles-btn {
  width: 100%;
  cursor: pointer;
}

.blog .blog__banner {
  border: 1px solid #6e6e84;
  border-radius: 32px;
  background: #15151f;
  overflow: hidden;
  padding-top: 98px;
  padding-right: 32px;
  padding-bottom: 99px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.blog .blog__banner-image {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 453px;
  height: 596px;
  display: flex;
  align-items: center;
  justify-content: center;
}

:is(.blog .blog__banner-image) img {
  width: 100%;
  /* контейнер — флекс, и по умолчанию он растягивает картинку на всю свою
     высоту. Раньше растягиваться было нечему: высоту задавал атрибут height.
     Держим пропорции и центрируем по вертикали. */
  align-self: center;
  height: auto;
}

.blog .blog__banner-info {
  text-align: center;
  position: relative;
  z-index: 2;
}

.blog .blog__banner-title {
  font-family: var(--third-family);
  font-weight: 600;
  font-size: 32px;
  line-height: 125%;
  text-align: center;
  color: #fff;
  margin-bottom: 8px;
}

.blog .blog__banner-sutitle {
  font-family: var(--second-family);
  line-height: 150%;
  letter-spacing: -0.04em;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
}

.blog .blog__banner-link {
  padding: 12px 34px;
}

.custom-select__trigger {
  display: none;
}

.custom-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-option {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  /* Ширина по содержимому: жёсткие 90px обрезали длинные теги — русские
     «Инструменты» вылезали за границу плашки. 90px остаются минимумом,
     чтобы короткие теги выглядели как раньше. */
  min-width: 90px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  border: 1px solid #e6f355;
  border-radius: 32px;
  padding: 8px 16px;
  background-color: #000;
  font-family: var(--second-family);
  font-weight: 600;
  font-size: 14px;
  line-height: 143%;
  letter-spacing: -0.02em;
  color: #fff;
  transition: background-color 0.3s ease-in, color 0.3s ease-in, opacity 0.3s ease-in;
}

.custom-option:hover {
  opacity: 0.7;
}

.custom-option.active {
  background-color: #e6f355;
  color: #232332;
}

@media (max-width: 992px) {
  .blog .blog__inner {
    row-gap: 40px;
  }

  .blog .blog__last-article {
    grid-column: span 12;
  }

  .blog .blog__last-inner {
    position: static;
  }

  .blog .blog__content {
    grid-column: span 12;
  }
}

@media (max-width: 650px) {

  .blog .blog__articles {
    margin-bottom: 40px;
  }

  .blog .blog__articles-item {
    grid-column: span 12;
  }
}

@media (max-width: 500px) {
  :is(.blog .blog__last-article) .blog__card-image {
    height: auto;
  }

  .blog .blog__card-title {
    font-weight: 400;
  }

  .blog .blog__banner {
    flex-direction: column;
    padding-right: 0;
    padding-bottom: 24px;
  }

  .blog .blog__banner-image {
    transform: none;
    position: static;
    width: 100%;
    height: auto;
    margin-top: -110px;
  }

  .custom-select {
    position: relative;
  }

  .custom-select__trigger {
    display: none;
  }

  .custom-select__trigger .custom-select__trigger-decor {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease-in, background-color 0.3s ease-in;
  }

  .custom-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: static;
    width: auto;
    visibility: visible;
    opacity: 1;
    transform: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
  }

  .custom-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: none;
    width: auto;
    min-width: 0;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 143%;
    border-radius: 32px;
    border: 1px solid #e6f355;
    background-color: #000;
  }

  .custom-option.active {
    background-color: #e6f355;
    color: #232332;
  }

  .custom-option.active::after {
    display: none;
  }
}
/* Заголовок страницы блога. Появился вместе с <h1>: раньше список начинался
   сразу с карточек, и у страницы не было заголовка первого уровня. */
.blog .blog__title {
  font-family: var(--third-family);
  font-weight: 600;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #fff;
  margin: 0 0 40px;
}

@media (max-width: 992px) {
  .blog .blog__title {
    margin-bottom: 24px;
  }
}
