/* News/Blog Index Page Styles */
.news {
  padding: 120px 0 160px;
  --container-max: min(1400px, 96vw);
  position: relative;
  overflow: visible;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.news-inner {
  display: flex;
  flex-direction: column;
  gap: 80px;
  position: relative;
  z-index: 1;
}

.news-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  position: relative;
  text-align: center;
}

.news-title {
  margin: 0;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  line-height: 1.1;
  position: relative;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.news-title::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 60px;
  height: 5px;
  background: linear-gradient(90deg, 
    var(--primary) 0%, 
    #60a5fa 50%,
    transparent 100%);
  border-radius: 3px;
}

.news-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
  font-weight: 500;
  max-width: 680px;
  letter-spacing: 0.01em;
}

/* News List Wrapper */
.news-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 48px;
  position: relative;
}

/* News Item - Base Styles */
.news-item {
  position: relative;
  margin-bottom: 24px;
  overflow: visible;
}

.news-animate .news-item {
  opacity: 0;
  transform: translateX(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  transition-delay: var(--reveal-delay, 0ms);
}

/* На странице новостей первые три новости отображаются сразу без анимации */
.news-animate .template-blogindexpage .news-item:nth-child(-n+3) {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0ms;
}

/* Анимация для новостей слева - прилетают слева */
.news-animate .news-item--left {
  transform: translateX(-100px);
}

/* Анимация для новостей справа - прилетают справа */
.news-animate .news-item--right {
  transform: translateX(100px);
}

/* Класс для активации анимации при появлении в области видимости */
.news-animate .news-item.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.news-item__link {
  display: flex;
  align-items: stretch;
  gap: 0;
  text-decoration: none;
  color: inherit;
  min-height: 280px;
  position: relative;
  border-radius: 32px;
  overflow: hidden;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.12) 0%, 
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 32px 64px rgba(15, 23, 42, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-item__link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.06) 0%, 
    rgba(59, 130, 246, 0.04) 50%,
    rgba(147, 197, 253, 0.02) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  pointer-events: none;
}

.news-item:hover .news-item__link,
.news-item:focus-within .news-item__link {
  transform: translateY(-12px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 
    0 48px 96px rgba(15, 23, 42, 0.15),
    0 16px 32px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset,
    0 0 60px rgba(37, 99, 235, 0.1);
}

.news-item:hover .news-item__link::before,
.news-item:focus-within .news-item__link::before {
  opacity: 1;
}

/* Image Wrapper */
.news-item__image-wrapper {
  flex: 0 0 320px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.05) 0%, 
    rgba(59, 130, 246, 0.03) 100%);
}

.news-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  filter: brightness(0.95) contrast(1.05);
}

.news-item:hover .news-item__link .news-item__image,
.news-item:focus-within .news-item__link .news-item__image {
  transform: scale(1.08);
}

/* Content */
.news-item__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 48px 56px;
  position: relative;
  z-index: 2;
  min-height: 280px;
}

/* Для левых карточек - добавляем верхний отступ к контенту, чтобы он не перекрывался датой */
.news-item--left .news-item__content {
  padding-top: 64px;
}

.news-item__header {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Date Styling - НА угол карточки (частично за пределами) */
.news-item__date {
  position: absolute;
  top: -12px;
  right: -27px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px 18px;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.95) 0%, 
    rgba(59, 130, 246, 0.9) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 
    0 8px 24px rgba(37, 99, 235, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  z-index: 20;
  transition: transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  min-width: 64px;
  transform: rotate(5deg);
}

/* Для левых карточек - дата на левом верхнем углу */
.news-item--left .news-item__date {
  right: auto;
  left: -27px;
  transform: rotate(-5deg);
}

.news-item:hover .news-item__date,
.news-item:focus-within .news-item__date {
  transform: rotate(0deg) translateY(-4px) scale(1.08);
  box-shadow: 
    0 12px 32px rgba(37, 99, 235, 0.4),
    0 6px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

.news-item__date-day {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.news-item__date-month {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Title */
.news-item__title {
  margin: 0 0 16px 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Excerpt */
.news-item__excerpt {
  margin: 0;
  font-size: 25px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Arrow - в правом нижнем углу КАРТОЧКИ (link) - ВСЕГДА справа, НА углу карточки */
/* Позиционируется относительно article, но вычисляет позицию относительно link */
.news-item__arrow {
  position: absolute;
  bottom: -12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.25) 0%, 
    rgba(255, 255, 255, 0.15) 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: var(--primary);
  backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 8px 24px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  z-index: 20;
  overflow: hidden;
  transform: rotate(5deg);
  pointer-events: none;
}

/* Для правых карточек - стрелка в правом нижнем углу link (link занимает 85% и выровнен справа) */
.news-item--right .news-item__arrow {
  right: -12px;
}

/* Для левых карточек - стрелка в правом нижнем углу link (link занимает 85% и выровнен слева, значит правый край на 15% от правого края article) */
.news-item--left .news-item__arrow {
  right: calc(15% - 12px);
}

.news-item__arrow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.15) 0%, 
    rgba(59, 130, 246, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.news-item:hover .news-item__arrow,
.news-item:focus-within .news-item__arrow {
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.95) 0%, 
    rgba(59, 130, 246, 0.95) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: rotate(0deg) translateY(4px) scale(1.08);
  box-shadow: 
    0 12px 32px rgba(37, 99, 235, 0.4),
    0 6px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.news-item:hover .news-item__arrow::before,
.news-item:focus-within .news-item__arrow::before {
  opacity: 1;
}

.news-item__arrow .news-item__arrow-icon {
  display: block;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.news-item:hover .news-item__arrow .news-item__arrow-icon,
.news-item:focus-within .news-item__arrow .news-item__arrow-icon {
  transform: translateX(3px);
}

/* Alternating Layout - Right Aligned */
.news-item--right .news-item__link {
  margin-left: auto;
  max-width: 85%;
  flex-direction: row;
}

/* Для правых карточек: изображение слева, контент справа */
.news-item--right .news-item__image-wrapper {
  order: 1;
}

.news-item--right .news-item__content {
  order: 2;
}

/* Alternating Layout - Left Aligned */
.news-item--left .news-item__link {
  margin-right: auto;
  max-width: 85%;
  flex-direction: row;
}

/* Для левых карточек: контент слева, изображение справа */
.news-item--left .news-item__content {
  order: 1;
}

.news-item--left .news-item__image-wrapper {
  order: 2;
}

/* Empty State */
.news-empty {
  text-align: center;
  padding: 120px 20px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 32px;
  box-shadow: 
    0 24px 48px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.news-empty p {
  font-size: 20px;
  color: var(--muted);
  margin: 0;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .news-item__link {
    flex-direction: column !important;
    min-height: auto;
  }
  
  .news-item--right .news-item__link,
  .news-item--left .news-item__link {
    max-width: 100%;
  }
  
  .news-item__image-wrapper {
    flex: 0 0 240px;
    width: 100%;
  }
  
  .news-item__content {
    padding: 36px 40px;
    min-height: auto;
  }
  
  /* На мобильных: контент всегда сверху, изображение снизу */
  .news-item--right .news-item__image-wrapper {
    order: 1;
  }
  
  .news-item--right .news-item__content,
  .news-item--left .news-item__content {
    order: 2;
  }
  
  .news-item--left .news-item__image-wrapper {
    order: 3;
  }
}

@media (max-width: 768px) {
  .news {
    padding: 80px 0 100px;
  }

  .news-animate .news-item--left {
    transform: translateX(-36px);
  }

  .news-animate .news-item--right {
    transform: translateX(36px);
  }
  
  .news-item__content {
    padding: 32px 24px;
  }
  
  .news-item__date {
    top: -10px;
    right: -10px;
    padding: 12px 16px;
    min-width: 58px;
    transform: rotate(3deg);
  }
  
  .news-item--left .news-item__date {
    right: auto;
    left: -10px;
    transform: rotate(-3deg);
  }
  
  .news-item:hover .news-item__date,
  .news-item:focus-within .news-item__date {
    transform: rotate(0deg) translateY(-2px) scale(1.05);
  }
  
  .news-item__date-day {
    font-size: 26px;
  }
  
  .news-item__date-month {
    font-size: 10px;
  }
  
  .news-item__excerpt {
    font-size: 17px;
    -webkit-line-clamp: 2;
  }
  
  .news-item__title {
    font-size: 22px;
  }
  
  /* На мобильных уменьшаем верхний отступ для левых карточек */
  .news-item--left .news-item__content {
    padding-top: 56px;
  }
  
  .news-item__arrow {
    width: 56px;
    height: 56px;
    bottom: -10px;
    right: -10px;
    border-radius: 16px;
    transform: rotate(3deg);
  }
  
  /* На мобильных link занимает 100% ширины, поэтому стрелка всегда справа */
  .news-item--left .news-item__arrow {
    right: -10px;
  }
  
  .news-item:hover .news-item__arrow,
  .news-item:focus-within .news-item__arrow {
    transform: rotate(0deg) translateY(2px) scale(1.05);
  }

  .news-item__link,
  .news-item__date,
  .news-item__arrow,
  .news-empty,
  .pagination-container,
  .pagination-arrow {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .news-item__link {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  }

  .news-item__date,
  .news-item__arrow,
  .pagination-arrow {
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
  }

  .news-empty {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  }
}

/* Пагинация - Современный минимализм */
.news-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0;
  padding: 40px 20px;
}

.pagination-container {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 18px 36px;
}

.pagination-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--primary);
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.25) 0%, 
    rgba(255, 255, 255, 0.15) 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 8px 24px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.pagination-arrow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.15) 0%, 
    rgba(59, 130, 246, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pagination-arrow:hover {
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.95) 0%, 
    rgba(59, 130, 246, 0.95) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
  box-shadow: 
    0 12px 32px rgba(37, 99, 235, 0.4),
    0 6px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.pagination-arrow:hover::before {
  opacity: 1;
}

.pagination-arrow .pagination-arrow__icon {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.pagination-arrow--prev:hover .pagination-arrow__icon {
  transform: translateX(-2px);
}

.pagination-arrow--next:hover .pagination-arrow__icon {
  transform: translateX(2px);
}

.pagination-counter {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  font-size: 20px;
  color: var(--fg);
  padding: 10px 24px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.pagination-current {
  color: #2563eb;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
}

.pagination-separator {
  color: var(--muted);
  font-weight: 400;
  font-size: 18px;
  opacity: 0.5;
}

.pagination-total {
  color: var(--muted);
  font-weight: 500;
  font-size: 18px;
  opacity: 0.7;
}

/* Адаптивность для пагинации */
@media (max-width: 768px) {
  .news-pagination {
    margin-top: 0;
    padding: 30px 15px;
  }
  
  .pagination-container {
    gap: 32px;
    padding: 14px 28px;
    border-radius: 18px;
  }
  
  .pagination-arrow {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }
  
  .pagination-arrow .pagination-arrow__icon {
    width: 22px;
    height: 22px;
  }
  
  .pagination-counter {
    font-size: 18px;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 12px;
  }
  
  .pagination-current {
    font-size: 22px;
  }
  
  .pagination-separator,
  .pagination-total {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .news-pagination {
    margin-top: 0;
    padding: 20px 10px;
  }
  
  .pagination-container {
    gap: 24px;
    padding: 12px 24px;
    border-radius: 16px;
  }
  
  .pagination-arrow {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }
  
  .pagination-arrow .pagination-arrow__icon {
    width: 20px;
    height: 20px;
  }
  
  .pagination-counter {
    font-size: 16px;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 10px;
  }
  
  .pagination-current {
    font-size: 20px;
  }
  
  .pagination-separator,
  .pagination-total {
    font-size: 14px;
  }
}

/* Dark theme styles - чтобы background был виден */
/* В темной теме делаем фон секции новостей прозрачным, чтобы было видно фоновое изображение */
body.theme-dark .news {
  background: transparent;
  position: relative;
}

/* Убеждаемся, что контент находится поверх фона */
body.theme-dark .news-inner {
  position: relative;
  z-index: 1;
}

/* Для страницы новостей делаем фон body прозрачным в темной теме на десктопе */
@media (min-width: 769px) {
  body.theme-dark.template-blogindexpage {
    background: transparent !important;
  }
}


