/* Галерея «Выбор варианта сайта». Mobile-first.
   Пути только корневые абсолютные: файл отдаётся на / и на /prototypes/.
   Шкала отступов: 4 8 12 16 24 32 48 64 96. Шкала шрифтов: 12 14 16 18 20 24 30 36 48 60. */

:root {
  --bg: #f6f3ee;
  --surface: #fffdfa;
  --ink: #26262a;
  --muted: #5e5a55;
  --line: #e4ded5;
  --accent: #c2185b;
  --accent-ink: #ffffff;
  --radius: 8px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 10;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
}

.skip:focus-visible {
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---------- Шапка ---------- */

.head {
  padding-bottom: 32px;
}

.head__logo {
  display: block;
  width: 112px;
  height: 36px;
  margin-bottom: 32px;
}

.head h1 {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.head p {
  margin: 0;
  max-width: 56ch;
  font-size: 16px;
  color: var(--muted);
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* .item: li. Двигается и даёт тень. .card внутри обрезает превью по скруглению */
.item {
  position: relative;
  isolation: isolate;
  transition: transform 0.35s var(--ease);
  animation: rise 0.6s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

/* глубина через opacity: тень лежит на отдельном слое под карточкой */
.item::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(38, 38, 42, 0.08), 0 16px 32px rgba(38, 38, 42, 0.14);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- Превью ---------- */

.card__media {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: #ece4d8;
  border-bottom: 1px solid var(--line);
}

/* заглушка: линейка и номер варианта (видна, если картинки нет) */
.card__media::before {
  content: attr(data-n);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  font-weight: 200;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: repeating-linear-gradient(90deg, rgba(38, 38, 42, 0.14) 0 1px, transparent 1px 16px) 0 100% / 100% 12px no-repeat,
    linear-gradient(135deg, #f1eadf, #e3d8c8);
}

.card__media--dark {
  background: #17151a;
}

.card__media--dark::before {
  color: #f1e8da;
  background: repeating-linear-gradient(90deg, rgba(241, 232, 218, 0.22) 0 1px, transparent 1px 16px) 0 100% / 100% 12px no-repeat,
    linear-gradient(135deg, #1f1c23, #121014);
}

.card__media img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 0;
  transition: transform 0.9s var(--ease);
}

/* ---------- Тело карточки ---------- */

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card__num {
  font-size: 48px;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.03em;
}

.badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
}

/* ссылка растянута на всю карточку */
.card h2 a {
  text-decoration: none;
}

.card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
}

.card h2 a:focus-visible {
  outline: none;
}

.card h2 a:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card__text {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  padding: 0 24px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s var(--ease);
}

/* ---------- Архив ---------- */

.archive {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.archive h2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.archive ul {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.chip__letter {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Появление ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- Наведение и фокус (только устройства с hover) ---------- */

@media (hover: hover) {
  .item:hover {
    transform: translateY(-4px);
  }

  .item:hover::before {
    opacity: 1;
  }

  .item:hover .card__media img {
    transform: scale(1.03) translateY(-19%);
  }

  .item:hover .btn {
    background: var(--accent);
  }

  .item:hover .btn svg {
    transform: translateX(4px);
  }

  .chip:hover {
    border-color: var(--ink);
    background: #fff;
  }
}

/* клавиатура: то же, что при наведении */
.item:has(a:focus-visible) {
  transform: translateY(-4px);
}

.item:has(a:focus-visible)::before {
  opacity: 1;
}

.item:has(a:focus-visible) .card__media img {
  transform: scale(1.03) translateY(-19%);
}

.item:has(a:focus-visible) .btn {
  background: var(--accent);
}

/* ---------- Планшет и шире ---------- */

@media (min-width: 640px) {
  .page {
    padding: 32px 32px 96px;
  }
}

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

  .head {
    padding-bottom: 48px;
  }

  .head h1 {
    font-size: 48px;
  }

  .head p {
    font-size: 18px;
  }
}

@media (min-width: 1024px) {
  .page {
    padding: 48px 48px 96px;
  }

  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
  }
}

/* ---------- Без движения ---------- */

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

  .item:hover,
  .item:has(a:focus-visible) {
    transform: none;
  }

  .item:hover .card__media img,
  .item:has(a:focus-visible) .card__media img {
    transform: none;
  }
}
