/* Кейсы: список /keisy и страница кейса /keisy/<slug>. Размеры — Figma «страница с кейсами» (1920, контейнер 1344). */

main { padding-top: clamp(32px, 4.2vw, 80px); overflow-x: clip; }

/* ---------- список ---------- */
.cases__title {
  font-size: var(--h2); font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink-strong);
  margin-bottom: clamp(28px, 2.5vw, 48px);
}
.cases__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 12px; }
.case-card a { display: grid; gap: 24px; border-radius: var(--radius-l); }
.case-card a:focus-visible { outline: 3px solid var(--purple); outline-offset: 6px; }
.case-card__media {
  aspect-ratio: 666 / 500; border-radius: var(--radius-l); overflow: hidden; background: var(--surface);
}
.case-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-out); }
.case-card__media--contain img { object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .case-card a:hover .case-card__media img { transform: scale(1.03); } }
.case-card a:active .case-card__media img { transform: scale(1.01); }
.case-card__title {
  font-size: clamp(20px, 1.46vw, 28px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--ink-case);
  text-wrap: balance;
}
.case-card__meta { margin-top: -14px; font-size: clamp(15px, 0.94vw, 18px); font-weight: 500; letter-spacing: -0.03em; color: var(--grey-case); }
.cases__empty { font-size: var(--lead); color: var(--grey); }

.case-cta {
  margin-top: var(--section-gap);
  padding: clamp(40px, 5vw, 96px) clamp(24px, 3vw, 48px);
  border-radius: var(--radius-xl); background: var(--grad-warm);
  display: grid; justify-items: center; gap: 24px; text-align: center;
}
.case-cta h2 { max-width: 1004px; font-size: var(--h2); font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink-strong); text-wrap: balance; }
.case-cta p { max-width: 40ch; font-size: var(--lead); line-height: 1.25; letter-spacing: -0.03em; color: var(--grey-soft); }
.case-cta .btn { margin-top: 8px; }

/* ---------- страница кейса ---------- */
.case-hero {
  border-radius: var(--radius-xl); background: var(--surface); overflow: hidden;
}
.case-hero img { width: 100%; height: auto; border-radius: var(--radius-m); }

.case-head { display: grid; gap: clamp(20px, 1.67vw, 32px); margin-top: clamp(40px, 4.2vw, 80px); }
.case-crumbs { display: flex; flex-wrap: wrap; gap: 0.35em; font-size: clamp(16px, 1.25vw, 24px); font-weight: 500; letter-spacing: -0.03em; color: var(--grey-light); }
.case-crumbs a { transition: color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .case-crumbs a:hover { color: var(--purple); } }
.case-crumbs a:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 4px; }
.case-head h1 {
  max-width: 1116px; font-size: var(--h2); font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink-strong); text-wrap: balance;
}
.case-tags { display: flex; flex-wrap: wrap; gap: 12px; }
.case-tags li {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 100px;
  background: var(--purple-8); color: var(--purple); font-size: 16px; font-weight: 800; letter-spacing: -0.03em;
}
.case-link {
  justify-self: start; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; color: var(--purple);
  text-decoration: underline; text-decoration-color: var(--purple-18); text-underline-offset: 5px; text-decoration-thickness: 2px;
  transition: text-decoration-color 160ms ease;
}
@media (hover: hover) and (pointer: fine) { .case-link:hover { text-decoration-color: var(--purple); } }
.case-link:focus-visible { outline: 2px solid var(--purple); outline-offset: 4px; border-radius: 4px; }

.case-body { display: grid; gap: 64px; margin-top: clamp(56px, 4.2vw, 80px); }
.case-text { max-width: 892px; display: grid; gap: clamp(16px, 1.67vw, 32px); }
.case-text h2 { font-size: var(--h2); font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink-strong); }
.case-text p { font-size: var(--lead); font-weight: 500; line-height: 1.2; letter-spacing: -0.03em; color: var(--ink-strong); text-wrap: pretty; }
.case-text__body p + p { margin-top: 1.2em; }
/* «Задача» и «Решение» идут подряд — между ними обычный шаг, перед картинками — побольше */
.case-photo, .case-showcase { margin-block: clamp(0px, 0.83vw, 16px); }
.case-photo img { width: 100%; height: auto; border-radius: var(--radius-xl); background: var(--surface); }
/* на всю ширину экрана — выходим из контейнера */
.case-photo--wide { width: 100vw; margin-inline: calc(50% - 50vw); }
.case-photo--wide img { border-radius: 0; }
/* длинный скриншот: показываем целиком, но в окне с прокруткой */
.case-scroll {
  max-height: min(80vh, 900px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--radius-xl); background: var(--surface); scrollbar-width: thin;
}
.case-scroll img { border-radius: 0; }
.case-photo--wide .case-scroll { border-radius: 0; }
.case-scroll:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }

.case-video video { display: block; width: 100%; height: auto; border-radius: var(--radius-xl); background: var(--surface); }
.case-video figcaption, .case-photo figcaption { margin-top: 12px; font-size: 16px; color: var(--grey); }

.case-showcase {
  display: grid; gap: 32px; justify-content: center;
  padding: clamp(24px, 3.33vw, 64px); border-radius: var(--radius-xl); background: var(--surface);
}
.case-showcase--1 .case-showcase__item { max-width: 892px; }
.case-showcase--2, .case-showcase--3 { grid-template-columns: repeat(var(--cols), minmax(0, 340px)); }
.case-showcase--2 { --cols: 2; }
.case-showcase--2, .case-showcase--3 { grid-template-columns: repeat(var(--cols), minmax(0, 440px)); }
.case-showcase--plain { padding: 0; background: none; gap: 12px; }
.case-showcase--plain.case-showcase--2, .case-showcase--plain.case-showcase--3 { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); justify-content: stretch; }
.case-showcase--plain .case-showcase__item img { border-radius: var(--radius-l); }
.case-showcase--3 { --cols: 3; }
.case-showcase__item img { width: 100%; height: auto; border-radius: var(--radius-m); }

.case-preview-bar {
  position: sticky; top: 0; z-index: 30; margin: -16px 0 24px; padding: 10px 16px; text-align: center;
  background: var(--purple); color: #fff; font-weight: 700; font-size: 15px;
}

.case-next {
  margin-top: var(--section-gap); padding: clamp(48px, 3.33vw, 64px) 0 clamp(56px, 4vw, 72px);
  background:
    radial-gradient(40% 60% at 8% 70%, rgba(208, 186, 255, 0.45), transparent 70%),
    radial-gradient(40% 60% at 95% 15%, rgba(255, 214, 240, 0.5), transparent 70%),
    #f9f6ff;
}
.case-next + .footer { margin-top: 0; }
.case-next__inner { display: grid; justify-items: center; gap: 24px; text-align: center; }
.case-next__label { font-size: clamp(16px, 1.25vw, 24px); font-weight: 500; letter-spacing: -0.03em; color: #a699bf; }
.case-next h2 { margin-top: -8px; font-size: clamp(34px, 3.75vw, 72px); font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink-strong); text-wrap: balance; }
.case-tags--center { justify-content: center; }
.case-tags--center li { min-height: 60px; padding: 0 32px; font-size: clamp(16px, 1.25vw, 24px); }
.case-next__media { display: block; width: min(100%, 720px); border-radius: var(--radius-l); overflow: hidden; }
.case-next__media img { width: 100%; height: auto; transition: transform 600ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .case-next__media:hover img { transform: scale(1.02); } }
.case-next .btn { min-height: 72px; padding: 24px 32px; font-size: clamp(18px, 1.25vw, 24px); }
.case-next .btn:focus-visible, .case-cta .btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }

@media (max-width: 760px) {
  .cases__grid { grid-template-columns: 1fr; gap: 36px; }
  .case-card a { gap: 16px; }
  .case-card__meta { margin-top: -8px; }
  .case-body { gap: 40px; }
  .case-tags li { min-height: 40px; padding: 0 18px; font-size: 14px; }
  .case-tags--center li { min-height: 44px; padding: 0 20px; font-size: 15px; }
  .case-showcase--2, .case-showcase--3 { grid-template-columns: minmax(0, 440px); }
  .case-showcase--plain.case-showcase--2, .case-showcase--plain.case-showcase--3 { grid-template-columns: 1fr; }
  .case-next .btn { min-height: 56px; padding: 18px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .case-card__media img, .case-next__media img { transition: none; }
}

/* ---------- компьютер / телефон: блоки и картинки, загруженные отдельно для телефона ---------- */
.case picture, .case-card picture { display: block; }
@media (max-width: 760px) { .only-desktop { display: none !important; } }
@media (min-width: 761px) { .only-mobile { display: none !important; } }
.case-video__m video { max-height: 86svh; width: auto; max-width: 100%; margin-inline: auto; }

/* ---------- появление при прокрутке: блоки кейса и карточки списка (cases.js ставит .is-in) ---------- */
.js-reveal .reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js-reveal .reveal.is-in { opacity: 1; transform: none; }
/* главная картинка кейса: мягкое приближение при загрузке страницы */
.case-hero { overflow: hidden; }
.js-reveal .case-hero img { animation: case-hero-in 1100ms var(--ease-out) both; }
@keyframes case-hero-in { from { opacity: 0; transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal { transform: none; transition: opacity 300ms ease; }
  .js-reveal .case-hero img { animation: none; }
}
