/* =========================================================
   MIRIDEA · блок «Кейсы» v1.0
   Полная ширина экрана, раскладка «плиткой» (Pinterest),
   карточка = окно браузера, сайт прокручивается при наведении.
   ========================================================= */
.m-cases {
  --c-red: #f93c3c;
  --c-pink: #cd0973;
  --c-violet: #a068f8;
  --c-blue: #3f55c3;
  --c-ink: #1d1f33;
  --c-text: #39404b;
  --c-muted: #8090aa;
  --c-line: #e4e7f0;
  --c-bg: #f3f4f9;
  --c-card: #ffffff;
  --c-ease: cubic-bezier(.22, 1, .36, 1);
  --c-gap: clamp(14px, 1.8vw, 28px);
  position: relative;
  padding-block: clamp(56px, 6vw, 96px);
  /* ширина — как у всего сайта: контент внутри .container */
}

/* ---------- Шапка блока ---------- */
.m-cases__head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: 20px 40px; margin-bottom: clamp(24px, 3vw, 40px);
}
.m-cases__eyebrow {
  margin: 0 0 12px; font-size: 13px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--c-muted);
}
.m-cases__title {
  margin: 0; font-size: clamp(32px, 3.6vw, 52px); line-height: 1; font-weight: 700; letter-spacing: -.02em;
  color: var(--c-ink); text-wrap: balance;
}
.m-cases__title span {
  background: linear-gradient(169deg, #f93c3c 0%, #cd0973 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.m-cases__lead { margin: 16px 0 0; max-width: 56ch; font-size: 16px; line-height: 1.5; color: var(--c-muted); }
.m-cases__lead b { color: var(--c-text); font-weight: 500; }
.m-cases__stats { display: flex; gap: clamp(20px, 3vw, 48px); }
.m-cases__stat b { display: block; font-size: clamp(30px, 3vw, 46px); line-height: 1; font-weight: 700; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.m-cases__stat span { display: block; margin-top: 6px; font-size: 13px; line-height: 1.3; color: var(--c-muted); }

/* ---------- Фильтры ---------- */
.m-cases__filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(20px, 2.4vw, 34px);
}
.m-cases__filter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 1px solid var(--c-line); border-radius: 8px 22px 7px 22px;
  background: #fff; color: var(--c-text); font: inherit; font-size: 14px; line-height: 1.2; cursor: pointer;
  transition: border-color .3s, color .3s, background-position .6s var(--c-ease), transform .3s var(--c-ease), box-shadow .3s;
  background-size: 220% 100%;
}
.m-cases__filter sup { font-size: 11px; color: var(--c-muted); transition: color .3s; }
.m-cases__filter:hover { border-color: var(--c-violet); transform: translateY(-1px); }
.m-cases__filter.is-active {
  color: #fff; border-color: transparent;
  background-image: linear-gradient(120deg, #a068f8 0%, #3f55c3 45%, #184eae 100%);
  box-shadow: 0 10px 22px -12px rgba(63, 85, 195, .8);
}
.m-cases__filter.is-active sup { color: rgba(255, 255, 255, .75); }
.m-cases__filter:focus-visible { outline: 2px solid var(--c-violet); outline-offset: 2px; }

/* ---------- Плитка ---------- */
.m-cases__grid { column-count: 3; column-gap: var(--c-gap); }
@media (max-width: 1000px) { .m-cases__grid { column-count: 2; } }
@media (max-width: 600px)  { .m-cases__grid { column-count: 1; } }
/* С JS — точная раскладка по колонкам (js/cases.js); без JS остаются CSS-колонки выше */
.m-cases__grid.is-js { column-count: auto; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: var(--c-gap); align-items: start; }
.m-cases__col { display: flex; flex-direction: column; gap: var(--c-gap); min-width: 0; }
.m-cases__grid.is-js .m-case { margin-bottom: 0; }

.m-case {
  position: relative; display: block; break-inside: avoid; margin-bottom: var(--c-gap);
  border-radius: 10px 26px 10px 26px; background: var(--c-card);
  box-shadow: 0 2px 4px rgba(29, 31, 51, .04), 0 18px 40px -24px rgba(29, 31, 51, .35);
  color: inherit; text-decoration: none; overflow: hidden; isolation: isolate;
  transition: transform .6s var(--c-ease), box-shadow .6s var(--c-ease), opacity .4s;
}
.m-case[hidden] { display: none; }
.m-case.is-pre { opacity: 0; }
.m-case.is-entering { animation: m-case-in .6s var(--c-ease) both; }
@keyframes m-case-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
.m-case:hover { transform: translateY(-6px); box-shadow: 0 2px 4px rgba(29, 31, 51, .04), 0 34px 60px -28px rgba(63, 85, 195, .45); }
.m-case:focus-visible { outline: 3px solid var(--c-violet); outline-offset: 3px; }

/* Окно браузера */
.m-case__bar {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  background: #f6f7fb; border-bottom: 1px solid var(--c-line);
}
.m-case__bar i { width: 9px; height: 9px; border-radius: 50%; background: #dfe2ec; flex: none; }
.m-case__bar i:nth-child(1) { background: #ff6b6b; }
.m-case__bar i:nth-child(2) { background: #ffc94d; }
.m-case__bar i:nth-child(3) { background: #3ccf8e; }
.m-case__bar span {
  flex: 1; min-width: 0; margin-left: 8px; padding: 4px 10px; border-radius: 6px; background: #fff;
  font-size: 11px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-case__screen { position: relative; overflow: hidden; aspect-ratio: 4 / 4.2; background: #eef0f6; }
.m-case--tall .m-case__screen { aspect-ratio: 4 / 5.2; }
.m-case--short .m-case__screen { aspect-ratio: 4 / 3.2; }
.m-case__screen img {
  position: absolute; left: 0; top: 0; display: block; width: 100%; height: auto; max-width: none;
  transform: translateY(0); will-change: transform;
  transition: transform var(--dur, 6s) cubic-bezier(.45, .05, .35, 1);
}
.m-case.is-back .m-case__screen img { transition-duration: .9s; transition-timing-function: var(--c-ease); }
/* Подсказка «наведите» и затемнение снизу */
.m-case__screen::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 30%;
  background: linear-gradient(to top, rgba(29, 31, 51, .28), transparent);
  pointer-events: none; transition: opacity .5s;
}
.m-case:hover .m-case__screen::after { opacity: 0; }
.m-case__badge {
  position: absolute; z-index: 2; top: 48px; left: 14px;
  padding: 6px 12px; border-radius: 999px; background: rgba(29, 31, 51, .78); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 500; letter-spacing: .02em;
}
.m-case__badge--hot { background: linear-gradient(135deg, #f93c3c, #cd0973); }

/* Подпись */
.m-case__info { position: relative; padding: 18px 20px 20px; }
.m-case__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.m-case__tags span { padding: 4px 10px; border-radius: 999px; background: #f2f3f8; font-size: 12px; color: var(--c-muted); }
.m-case__tags span:first-child { background: rgba(249, 60, 60, .09); color: #d6263c; }
.m-case__name { margin: 0 0 6px; font-size: 20px; line-height: 1.2; font-weight: 700; color: var(--c-ink); }
.m-case__text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--c-muted); }
.m-case__more {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink);
}
.m-case__more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--c-ease); }
.m-case:hover .m-case__more { color: var(--c-red); }
.m-case:hover .m-case__more svg { transform: translateX(6px); }

/* ---------- Курсор «Смотреть» ---------- */
.m-cases__cursor {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  width: 108px; height: 108px; margin: -54px 0 0 -54px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: linear-gradient(135deg, #f93c3c, #cd0973); color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.15; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 16px 34px -12px rgba(205, 9, 115, .7);
  transform: translate3d(var(--x, -200px), var(--y, -200px), 0) scale(0);
  transition: transform .35s var(--c-ease);
}
.m-cases__cursor.is-on { transform: translate3d(var(--x), var(--y), 0) scale(1); }
@media (hover: none), (pointer: coarse) { .m-cases__cursor { display: none; } }
@media (hover: hover) and (pointer: fine) { .m-cases.has-cursor .m-case { cursor: none; } }

/* ---------- Низ блока ---------- */
.m-cases__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 30px;
  margin-top: clamp(12px, 2vw, 24px); padding: clamp(22px, 3vw, 36px);
  border-radius: 10px 26px 10px 26px; background: #fff;
  box-shadow: 0 18px 40px -28px rgba(29, 31, 51, .35);
}
.m-cases__foot p { margin: 0; font-size: clamp(20px, 2vw, 28px); line-height: 1.2; font-weight: 700; color: var(--c-ink); }
.m-cases__foot p span { display: block; margin-top: 6px; font-size: 15px; font-weight: 400; color: var(--c-muted); }
.m-cases__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.m-cases__actions .btn--primary { min-height: 52px; padding: 5px 32px; }
.m-cases__all { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--c-ink); text-decoration: none; }
.m-cases__all:hover { color: var(--c-red); }
/* ---------- «Посмотреть ещё» ---------- */
.m-cases__more {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; margin-top: clamp(4px, 1vw, 12px); padding: 22px 24px;
  border: 1.5px dashed #cdd2e2; border-radius: 10px 26px 10px 26px; background: rgba(255, 255, 255, .6);
  color: var(--c-ink); font: inherit; font-size: 15px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; transition: border-color .3s, background-color .3s, color .3s, transform .4s var(--c-ease);
}
.m-cases__more[hidden] { display: none; }
.m-cases__more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s var(--c-ease); }
.m-cases__more-count {
  min-width: 28px; padding: 4px 8px; border-radius: 999px; background: linear-gradient(135deg, #f93c3c, #cd0973);
  color: #fff; font-size: 12px; line-height: 1.2; letter-spacing: 0; text-align: center;
}
.m-cases__more:hover { border-color: var(--c-red); border-style: solid; background: #fff; color: var(--c-red); transform: translateY(-2px); }
.m-cases__more:hover svg { transform: translateY(4px); }
.m-cases__more:focus-visible { outline: 2px solid var(--c-violet); outline-offset: 3px; }
.m-cases__empty { padding: 40px; text-align: center; color: var(--c-muted); }

@media (max-width: 800px) {
  .m-cases__head { grid-template-columns: 1fr; }
  .m-cases__stats { gap: 28px; }
  .m-cases__filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -15px; padding-inline: 15px; scrollbar-width: none; }
  .m-cases__filters::-webkit-scrollbar { display: none; }
  .m-cases__filter { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .m-case, .m-case__screen img, .m-cases__cursor { transition: none !important; animation: none !important; }
}
