/* =========================================================================
   GYDRA.info — доработка главной страницы (home-polish)
   Подключается только на главной, после gydra.css и site-refresh.css.
   Только переменные из tokens.css, литеральных цветов нет.
   Движение — только при prefers-reduced-motion: no-preference; без
   JavaScript всё содержимое видно сразу.
   ========================================================================= */

/* --- Раздел с одним материалом: карточка в строку, без пустой половины --- */
@media (min-width: 48rem) {
  .home__main section.block .grid-3 > .card:only-child:has(> .card__media),
  .home__main .block.grid-3 > .card:nth-child(3):last-child:has(> .card__media) {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    column-gap: 1.5rem;
    align-items: center;
  }
  .home__main section.block .grid-3 > .card:only-child .card__title { font-size: 1.45rem; line-height: 1.18; }
  .home__main section.block .grid-3 > .card:only-child .card__dek,
  .home__main .block.grid-3 > .card:nth-child(3):last-child .card__dek { font-size: .88rem; line-height: 1.6; }
}

/* --- Ритм ---------------------------------------------------------------- */
.home__main > .block:last-child { margin-bottom: 0; }
.home__rail > :last-child { margin-bottom: 0; }

/* Дата в ленте вместо бессмысленного «00:00» */
.wire__time--date { white-space: nowrap; letter-spacing: 0; }

/* --- Отклик на наведение -------------------------------------------------- */
@media (hover: hover) {
  .home .card__title a { transition: color .18s ease; }
  .home .wire__time { transition: color .18s ease; }
  .home .wire__item:hover .wire__time { color: var(--signal); }
  .home .rail-links a svg { transition: transform .2s cubic-bezier(.2,.7,.3,1); }
  .home .rail-links a:hover svg { transform: translate3d(3px, 0, 0); }
}

/* --- Движение -------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  /* Первый экран: появляется сразу при загрузке, без JavaScript */
  .home .card--lead .card__media img { animation: hp-settle 1.1s cubic-bezier(.2,.7,.2,1) backwards; }
  .home .card--lead .kicker,
  .home .card--lead .card__title,
  .home .card--lead .card__dek,
  .home .card--lead .meta { animation: hp-rise .6s cubic-bezier(.2,.7,.2,1) backwards; }
  .home .card--lead .kicker      { animation-delay: .06s; }
  .home .card--lead .card__title { animation-delay: .12s; }
  .home .card--lead .card__dek   { animation-delay: .2s; }
  .home .card--lead .meta        { animation-delay: .28s; }

  .home .wire__item { animation: hp-slide .5s cubic-bezier(.2,.7,.2,1) backwards; }
  .home .wire__item:nth-child(1) { animation-delay: .10s; }
  .home .wire__item:nth-child(2) { animation-delay: .16s; }
  .home .wire__item:nth-child(3) { animation-delay: .22s; }
  .home .wire__item:nth-child(4) { animation-delay: .28s; }
  .home .wire__item:nth-child(5) { animation-delay: .34s; }
  .home .wire__item:nth-child(6) { animation-delay: .40s; }
  .home .wire__item:nth-child(7) { animation-delay: .46s; }
  .home .wire__item:nth-child(n+8) { animation-delay: .52s; }

  /* Ниже первого экрана: home-polish.js ставит hp-wait только тем блокам,
     которые ещё не видны, и снимает его, когда блок входит в экран. */
  .hp-wait { opacity: 0; transform: translate3d(0, 18px, 0); }
  .hp-wait.hp-in {
    opacity: 1; transform: none;
    transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1);
    transition-delay: var(--hp-delay, 0ms);
  }
}

@keyframes hp-rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes hp-slide {
  from { opacity: 0; transform: translate3d(-10px, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes hp-settle {
  from { transform: scale(1.045); }
  to   { transform: none; }
}

/* Печать и «уменьшить движение»: ничего не прячем */
@media print { .hp-wait { opacity: 1 !important; transform: none !important; } }
@media (prefers-reduced-motion: reduce) { .hp-wait { opacity: 1; transform: none; } }
