/* Лента новостей — макет Figma, узел 138:529 «Лента новостей», 1920 × 2276.
   Типографика (.d-160), контейнер и токены — из styles.css, здесь только
   то, чего в общих стилях нет: панель фильтров, сетка карточек, индикатор. */

/* ---------- Каркас страницы ---------- */
/* 110px = 225.7px от верха макета до заголовка минус высота шапки (28+60+28). */
.news-page > main{padding-top:106px}
/* В макете между лентой и футером 120px, а общий футер по умолчанию отступает на --section-gap-lg. */
.news-page .footer{padding-top:120px}

.news-skip{
  position:fixed;z-index:100;top:12px;left:16px;padding:12px 18px;border-radius:8px;
  background:var(--gold);color:var(--bg);transform:translateY(-160%);
}
.news-skip:focus{transform:translateY(0)}
.news-page main button:focus-visible,
.news-page main input:focus-visible,
.news-skip:focus-visible{outline:2px solid var(--gold);outline-offset:4px;border-radius:3px}

.news-feed{display:flex;flex-direction:column;align-items:stretch}
.news-title{overflow-wrap:break-word}

/* ---------- Фильтры, сортировка, поиск ---------- */
.news-toolbar{
  display:flex;align-items:center;justify-content:space-between;gap:24px;
  margin-top:96px;
}
.news-filters{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;min-width:0;flex:1 1 auto}

.news-chip{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;padding:12px 16px;border-radius:12px;
  background:rgba(255,255,255,.08);color:var(--text-footer);
  font-family:var(--font-text);font-weight:500;font-size:16px;line-height:1.3;
  white-space:nowrap;transition:background-color .2s ease,color .2s ease;
}
.news-chip:hover{background:rgba(255,255,255,.16)}
.news-chip.is-active{background:var(--white);color:#000}
.news-chip.is-active:hover{background:var(--white)}

.news-tools{display:flex;align-items:center;gap:12px;flex:none}

.news-sort{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:44px;padding:6px;border-radius:12px;color:var(--white);
  font-family:var(--font-text);font-weight:500;font-size:16px;line-height:1.3;
  white-space:nowrap;transition:background-color .2s ease;
}
.news-sort:hover{background:rgba(255,255,255,.08)}
.news-sort__icon{width:28px;height:28px;flex:none}

/* В макете поиск свёрнут до иконки. Поле раскрывается кликом по иконке
   (это <label for>) и при фокусе с клавиатуры — без JavaScript. */
.news-search{display:flex;align-items:center;border-radius:12px;transition:background-color .2s ease}
.news-search:focus-within{background:rgba(255,255,255,.08)}
.news-search__label{
  position:absolute;width:1px;height:1px;margin:-1px;padding:0;
  overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
.news-search__input{
  width:0;min-width:0;padding:0;border:0;background:none;color:var(--white);
  font:inherit;font-size:16px;line-height:1.3;
  transition:width .25s ease,padding .25s ease;
}
.news-search__input::placeholder{color:var(--text-muted)}
.news-search__input::-webkit-search-cancel-button{filter:invert(1);opacity:.5}
.news-search:focus-within .news-search__input{width:200px;padding:0 4px 0 12px}
.news-search__toggle{
  display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;padding:6px;border-radius:12px;flex:none;
  cursor:pointer;transition:background-color .2s ease;
}
.news-search:not(:focus-within) .news-search__toggle:hover{background:rgba(255,255,255,.08)}
.news-search__toggle img{width:28px;height:28px}

/* ---------- Сетка карточек ---------- */
.news-grid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
  gap:52px;align-items:start;margin-top:52px;
}
.news-card{display:flex;flex-direction:column;align-items:flex-start;gap:24px;min-width:0}
.news-card__media{
  position:relative;width:100%;aspect-ratio:445.667/280;
  border-radius:24px;background:#181819;overflow:hidden;
}
.news-card__img{
  width:100%;height:100%;object-fit:cover;
  object-position:center var(--news-focus,50%);
}
.news-card__body{display:flex;flex-direction:column;gap:12px;width:100%}
.news-card__title{
  font-family:var(--font-text);font-weight:700;font-size:18px;line-height:1.15;
  color:rgba(255,255,255,.85);text-wrap:pretty;overflow-wrap:break-word;
}
.news-card__tags{
  display:flex;flex-wrap:wrap;gap:8px;
  font-size:14px;line-height:1.3;color:#7d7d7d;
}
.news-card__tags li{opacity:.7;white-space:nowrap}

/* Фильтр, поиск и сортировка (news.js) прячут карточки атрибутом hidden;
   display:flex у карточки иначе перебивает его. */
.news-card[hidden]{display:none}
.news-empty{margin-top:52px;color:var(--text-muted);font-size:18px;line-height:1.3;text-align:center}

/* ---------- Индикатор подгрузки ---------- */
.news-more{
  display:flex;align-items:center;justify-content:center;
  width:40px;height:40px;margin:52px auto 0;
}
.news-more__spinner{width:20px;height:20px;animation:news-spin 1s linear infinite}
@keyframes news-spin{to{transform:rotate(360deg)}}

/* ---------- Адаптив ---------- */
@media (max-width:1520px){
  .news-page > main{padding-top:88px}
  .news-toolbar{margin-top:72px}
  .news-grid{gap:40px;margin-top:40px}
}

@media (max-width:1180px){
  .news-page > main{padding-top:64px}
  .news-page .footer{padding-top:96px}
  .news-toolbar{align-items:flex-start;flex-direction:column;gap:20px;margin-top:56px}
  .news-filters{width:100%}
  .news-tools{align-self:flex-start;margin-left:-6px}
  .news-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:36px;margin-top:36px}
}

@media (max-width:760px){
  .news-page > main{padding-top:40px}
  .news-page .footer{padding-top:72px}
  .news-toolbar{margin-top:36px;gap:16px}
  /* На телефоне чипсы не переносятся, а прокручиваются горизонтально. */
  .news-filters{
    flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;
    margin-inline:-16px;padding-inline:16px;scroll-snap-type:x proximity;
  }
  .news-filters::-webkit-scrollbar{display:none}
  .news-chip{scroll-snap-align:start}
  .news-tools{justify-content:space-between;width:100%;margin-left:-6px}
  .news-search{flex:0 1 auto;min-width:0}
  .news-search:focus-within .news-search__input{width:min(160px,38vw)}
  .news-grid{grid-template-columns:minmax(0,1fr);gap:32px;margin-top:28px}
  .news-card{gap:16px}
  .news-card__media{border-radius:20px}
  .news-more{margin-top:36px}
}

@media (prefers-reduced-motion:reduce){
  .news-more__spinner{animation:none}
  .news-search__input{transition:none}
}
