/* Вёрстка страницы getnew (getnew-4qu.4) по мокапу getnew-4qu.2.
   Все цвета и шрифты — через токены src/styles/tokens.css. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--gn-bg);
  color: var(--gn-ink);
  font-family: var(--gn-font-text);
  font-size: 15px;
  line-height: 1.5;
}

.page {
  max-width: 1120px;
  margin-inline: auto;
  padding-block: clamp(16px, 4vw, 32px) 40px;
  padding-inline: clamp(16px, 4vw, 32px);
}

/* ---------- сетка ---------- */

.grid {
  display: grid;
  gap: var(--gn-space-grid);
  align-items: start;
}

@media (min-width: 520px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid .card:nth-child(3n + 2) {
    margin-top: var(--gn-offset-col);
  }
}

/* ---------- карточка ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--gn-surface);
  border: 1px solid var(--gn-line);
  border-radius: var(--gn-radius-card);
  padding: 10px 12px 13px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.18s ease, translate 0.18s ease, border-color 0.15s ease;
}

.thumb {
  display: block;
  aspect-ratio: 3 / 2;
  border-radius: var(--gn-radius-thumb);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: scale 0.35s ease;
}

/* генеративная заглушка вместо битой картинки: градиент от хэша id */
.thumb.fallback {
  --h: 220;
  background: linear-gradient(
    135deg,
    hsl(var(--h) 30% 54%),
    hsl(calc(var(--h) + 50) 34% 26%)
  );
}

.card .t {
  font-family: var(--gn-font-display);
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.35;
  text-wrap: balance;
}

.card .d {
  font-size: 13px;
  line-height: 1.45;
  color: var(--gn-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover {
  border-color: var(--gn-ink);
  translate: 0 -2px;
}

.card:hover .thumb img {
  scale: 1.045;
}

.card:focus-visible,
.more:focus-visible {
  outline: 2px solid var(--gn-accent);
  outline-offset: 3px;
}

/* ---------- кнопка «ещё» ---------- */

.more-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 32px;
  border-radius: 999px;
  border: 0;
  background: var(--gn-ink);
  color: var(--gn-bg);
  font-family: var(--gn-font-display);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, translate 0.1s ease;
}

.more:hover {
  background: var(--gn-accent);
  color: var(--gn-accent-contrast);
}

.more:active {
  translate: 0 1px;
}

/* ---------- заглушки, пока грузятся данные набора ---------- */

.card.skeleton .thumb,
.card.skeleton .t,
.card.skeleton .d {
  display: block;
  background: var(--gn-line);
  border-radius: var(--gn-radius-thumb);
  animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

/* высоты повторяют строку заголовка и две строки описания настоящей карточки */
.card.skeleton .t {
  height: 1.35em;
  width: 60%;
}

.card.skeleton .d {
  height: 2.9em;
}

@keyframes skeleton-pulse {
  to {
    opacity: 0.55;
  }
}

/* ---------- анимация смены набора ---------- */

.retuning .card {
  opacity: 0;
  translate: 0 8px;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
