/**
 * Newswire & Community News — constrained hero + right “Latest” rail + sticky ad stub.
 * Complements stats-header.css; overrides full-bleed hero for these pages only.
 */

/* ── Shell: same horizontal rhythm as former .main-content (1fr + 16vw) ───── */
.news-page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16vw;
  grid-template-rows: auto 1fr;
  column-gap: 3vw;
  row-gap: clamp(1rem, 1.8vw, 1.75rem);
  padding: 2vw 4vw;
  box-sizing: border-box;
  max-width: 100%;
}

/* Страницы без правого рейла (модерация и т.п.) */
.news-page-shell.news-page-shell--full {
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
}

.news-page-shell.news-page-shell--full .news-page-top-row,
.news-page-shell.news-page-shell--full .news-page-body {
  grid-column: 1;
}

.news-page-top-row {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.news-page-body {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  position: relative;
  z-index: 5;
}

.news-page-rail {
  grid-column: 2;
  grid-row: 1 / -1;
  min-width: 0;
  position: sticky;
  top: max(0.75rem, 10vh);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.15vw, 1.1rem);
  max-height: calc(100vh - 11vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Floating hero: no band / gradient (content “in the air”) */
.stats-header-container.news-page-hero-floating {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
}

.stats-header-container.news-page-hero-floating::before,
.stats-header-container.news-page-hero-floating::after {
  display: none !important;
}

/* Title + stats only (wiki column removed) */
.stats-header-content.news-page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17.4rem, 19.1rem);
  grid-template-rows: auto;
  align-items: start;
  column-gap: clamp(0.95rem, 1.55vw, 1.45rem);
  row-gap: clamp(0.75rem, 1.2vw, 1rem);
  max-width: 100%;
}

.news-page-hero-grid .stats-header-main {
  grid-column: 1;
  grid-row: 1;
  padding-left: 0;
  padding-right: 0.35rem;
}

.news-page-hero-grid .stats-header-right {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  margin-right: 0;
  /* небольшой отступ слева у «окошка» статистики */
  margin-left: clamp(0.45rem, 1.1vw, 0.95rem);
}

/* Чуть крупнее заголовок страницы (Newswire / Community News) */
.news-container .news-page-top-row .stats-title,
.explore-container .news-page-top-row .stats-title,
.category-container .news-page-top-row .stats-title,
.trailers-container .news-page-top-row .stats-title,
.moderation-page .news-page-top-row .stats-title,
.vice-shop-container .news-container .news-page-top-row .stats-title {
  font-size: clamp(30px, 2.55vw, 50px);
}

/* Укороченная «воздушная» шапка — exploration, category, trailers, shop, coins */
.fan-page-hero-wrap {
  padding: 2vw 4vw 0;
  box-sizing: border-box;
  max-width: 100%;
}

.fan-page-hero-wrap .stats-title {
  font-size: clamp(30px, 2.55vw, 50px);
}

/* Правый сайдбар: без внутреннего скролла (community, newswire plain, fan pages) */
.news-page-rail.news-page-rail--community,
.news-page-rail.news-page-rail--fan-plain {
  max-height: none;
  overflow: visible;
}

/* Чёрный заголовок без полос (Latest News) */
.news-latest-head--plain {
  margin: 0 0 clamp(0.45rem, 0.85vw, 0.65rem);
  padding: 0;
  border: none;
}

.news-latest-head--plain::after {
  display: none !important;
}

/* Latest News — блок заголовка (без полосы снизу и без декоративной границы) */
.news-latest-head {
  margin: 0 0 clamp(0.55rem, 1vw, 0.85rem);
  padding: 0;
  border: none;
  position: relative;
}

.news-latest-head::after {
  display: none !important;
}

.news-latest-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  /* Как у заголовка статьи (.article-title-wiki): Inter 700; кегль прежний */
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(22px, 1.58vw, 34px);
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.25;
  text-transform: none;
}

.news-latest-heading::before {
  display: none !important;
  content: none !important;
}

/* Всегда чистый чёрный, без градиента */
.news-latest-heading__text {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: #0f172a;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: #0f172a !important;
}

.news-latest-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(0.65rem, 1vw, 0.95rem);
}

.news-latest-empty {
  margin: 0;
  font-size: clamp(12px, 0.78vw, 14px);
  color: #64748b;
  line-height: 1.45;
}

/* Карточки в узкой колонке — как в сетке, без отдельного «featured»-масштаба */
.news-page-rail .home-news-card {
  width: 100%;
  max-width: 100%;
}

/* Community News: 3 горизонтальные мини-карточки под полной */
.news-rail-compact-list {
  list-style: none;
  margin: clamp(0.15rem, 0.45vw, 0.35rem) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 0.85vw, 0.72rem);
}

.news-rail-compact-row {
  display: flex;
  align-items: flex-start;
  gap: clamp(0.42rem, 0.7vw, 0.62rem);
  text-decoration: none;
  color: inherit;
  padding: 0.28rem 0;
  border-radius: 8px;
  transition: background 0.18s ease;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.news-rail-compact-row:hover {
  background: rgba(99, 102, 241, 0.06);
}

.news-rail-compact-row__thumb {
  flex: 0 0 auto;
  width: clamp(64px, 5.2vw, 92px);
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #eef1f6;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.news-rail-compact-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-rail-compact-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding-top: 0.06rem;
}

.news-rail-compact-row__title {
  margin: 0;
  font-size: clamp(11px, 0.68vw, 13px);
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-rail-compact-row__date {
  font-size: clamp(10px, 0.62vw, 12px);
  font-weight: 500;
  color: #64748b;
  line-height: 1.2;
}

.news-page-rail--community .news-latest-stack {
  gap: clamp(0.55rem, 0.9vw, 0.82rem);
}

/* Ad block under Latest (sidebar column is sticky so this stays in view while scrolling) */
.news-rail-ad-sticky {
  margin-top: clamp(0.35rem, 0.9vw, 0.75rem);
  flex-shrink: 0;
}

.news-ad-placeholder {
  min-height: clamp(180px, 22vw, 260px);
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(11px, 0.72vw, 13px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f8fafc;
  box-sizing: border-box;
}

.news-rail-ad .ad-slot {
  width: 100%;
  max-width: 16vw;
  min-height: clamp(160px, 20vw, 240px);
}

/* Match list cards to Inter (titles were inheriting Space Grotesk from page chrome) */
.news-container .home-news-card,
.news-container .home-news-card .home-news-card__title,
.news-container .home-news-card .home-news-card__desc,
.news-container .home-news-card .home-news-card__date,
.news-container .home-news-card .home-news-card__views,
.news-container .home-news-card .home-news-card__read-more {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Collapse to single column (same breakpoint family as inline news pages) */
@media (max-width: 82.8729vw) {
  .news-page-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    row-gap: 1.5rem;
    padding-left: 2vw;
    padding-right: 2vw;
  }

  .news-page-top-row {
    grid-column: 1;
    grid-row: 1;
  }

  /* Сначала основной контент, блок Latest News — ниже */
  .news-page-body {
    grid-column: 1;
    grid-row: 2;
  }

  .news-page-rail {
    grid-column: 1;
    grid-row: 3;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .stats-header-content.news-page-hero-grid {
    grid-template-columns: 1fr;
  }

  .news-page-hero-grid .stats-header-main {
    padding-left: 0;
  }

  .news-page-hero-grid .stats-header-right {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    margin-left: 0;
    width: 100%;
    max-width: none;
  }

  .news-rail-ad-sticky {
    position: static;
    margin-top: 0;
  }

  .news-rail-ad .ad-slot {
    max-width: 100%;
  }
}

/* Планшет/мобайл: отступы fan-шапки + trailers */
@media (max-width: 1024px) {
  .fan-page-hero-wrap {
    padding: 12px 10px 0;
  }

  .trailers-container .stats-header-container.news-page-hero-floating {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 clamp(6px, 1.2vw, 12px) !important;
  }

  .trailers-container .stats-header-container.news-page-hero-floating::before,
  .trailers-container .stats-header-container.news-page-hero-floating::after {
    display: none !important;
  }

  .trailers-container .stats-header-content.news-page-hero-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
  }

  .trailers-container .news-page-hero-grid .stats-header-right {
    margin-left: 0 !important;
    justify-self: stretch !important;
    width: 100%;
    max-width: none;
  }
}

/* Страница статьи: весь правый столбец ведёт себя как один блок (заголовок Latest News не «отлипает» из-за sticky у .news-page-rail) */
.news-recommendations-sidebar > .news-page-rail {
  position: static;
  top: auto;
  align-self: stretch;
  max-height: none;
  overflow: visible;
  -webkit-overflow-scrolling: auto;
}

/**
 * Mobile / tablet (≤1024px): Latest News всегда под основным контентом;
 * единая стилистика рейла (как на странице новости).
 */
@media (max-width: 1024px) {
  .news-page-shell {
    display: flex !important;
    flex-direction: column !important;
  }

  .news-page-shell > .news-page-top-row {
    order: 1 !important;
  }

  .news-page-shell > .news-page-body {
    order: 2 !important;
  }

  .news-page-shell > .news-page-rail {
    order: 3 !important;
    position: static !important;
    top: auto !important;
    align-self: stretch !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
    min-width: 0 !important;
    padding-top: clamp(12px, 2vw, 20px) !important;
    margin-top: clamp(4px, 1vw, 10px) !important;
    border-top: 1px solid var(--border-color, #e2e8f0);
    box-sizing: border-box;
  }

  /* В сайдбаре статьи полоса уже у колонки — не дублируем */
  .news-recommendations-sidebar > .news-page-rail {
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .news-page-rail.news-page-rail--article-sidebar .news-latest-head {
    margin-bottom: clamp(12px, 1.8vw, 16px) !important;
    padding-bottom: clamp(10px, 1.2vw, 14px) !important;
  }

  .news-page-rail .news-latest-heading {
    font-size: clamp(20px, 4.6vw, 28px) !important;
    line-height: 1.2 !important;
  }

  .news-page-rail .news-latest-stack {
    gap: clamp(14px, 2.4vw, 20px) !important;
  }

  .news-page-rail .home-news-card {
    border-radius: clamp(10px, 2vw, 14px);
    border: 1px solid #e7e8ec;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif !important;
  }

  .news-page-rail .home-news-card .home-news-card__title,
  .news-page-rail .home-news-card .home-news-card__date,
  .news-page-rail .home-news-card .home-news-card__desc,
  .news-page-rail .home-news-card .home-news-card__views,
  .news-page-rail .home-news-card .home-news-card__read-more {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif !important;
  }

  .news-page-rail .home-news-card__body {
    padding: 14px 16px 16px !important;
  }

  .news-page-rail .home-news-card__date {
    font-size: clamp(12px, 2.85vw, 14px) !important;
    font-weight: 500 !important;
    color: #64748b !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    margin: 0 0 6px !important;
  }

  .news-page-rail .home-news-card__title {
    font-size: clamp(14px, 3.6vw, 17px) !important;
    font-weight: 700 !important;
    margin: 0 0 6px !important;
    line-height: 1.35 !important;
    color: #0f172a !important;
  }

  .news-page-rail .home-news-card__desc {
    font-size: clamp(12px, 2.85vw, 14px) !important;
    font-weight: 500 !important;
    color: #64748b !important;
    margin: 0 0 8px !important;
    line-height: 1.35 !important;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .news-page-rail .home-news-card__footer {
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .news-page-rail .home-news-card__views,
  .news-page-rail .home-news-card__read-more {
    font-size: clamp(12px, 2.85vw, 14px) !important;
    font-weight: 600 !important;
    color: #1d4ed8 !important;
  }

  .news-page-rail .home-news-card__views {
    gap: 6px !important;
  }

  .news-page-rail .news-rail-compact-list {
    margin-top: 2px !important;
    gap: clamp(10px, 2vw, 14px) !important;
  }

  .news-page-rail .news-rail-compact-row {
    padding: 12px 14px !important;
    align-items: center !important;
    gap: 14px !important;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  }

  .news-page-rail .news-rail-compact-row:hover {
    background: #f8fafc;
  }

  .news-page-rail .news-rail-compact-row__thumb {
    width: clamp(92px, 24vw, 120px) !important;
    flex: 0 0 clamp(92px, 24vw, 120px) !important;
    border-radius: 8px;
  }

  .news-page-rail .news-rail-compact-row__main {
    gap: 6px !important;
    padding-top: 0 !important;
  }

  .news-page-rail .news-rail-compact-row__title {
    font-size: clamp(14px, 3.5vw, 16px) !important;
    line-height: 1.35 !important;
  }

  .news-page-rail .news-rail-compact-row__date {
    font-size: clamp(12px, 2.7vw, 14px) !important;
  }
}
