/* Страница кейса по макету (Figma, кадр 1920): колонка 960 px, Onest.
   Размеры плавные: 1920 px = как в макете, ниже сжимаются до читаемых на телефоне. */

.cs{--cs-body:clamp(17px, calc(15.5px + .34vw), 22px);--cs-h2:clamp(24px, calc(21px + .5vw), 32px);--cs-gap:clamp(48px, 5vw, 88px);
  max-width:calc(960px + var(--page-pad) * 2);margin-inline:auto;padding:clamp(96px, 13vw, 250px) var(--page-pad) 0;
  font-size:var(--cs-body);line-height:1.27}
/* до 900 px шапка липкая и сама занимает место в потоке, поэтому высоту шапки к отступу не прибавляем */
@media (max-width:899.98px){.cs{padding-top:24px}}
.cs p,.cs li{margin:0}
.cs b,.cs strong{font-weight:var(--fw-black)}

/* «Все кейсы» со стрелкой */
.cs__back{display:inline-flex;align-items:center;margin-left:-4px}
.cs__back .ico-arr{width:clamp(24px, 2.8vw, 30px);height:clamp(24px, 2.8vw, 30px);margin-right:-2px;transform:scaleX(-1)}
.ico-arr{display:inline-block;flex:none;width:44px;height:44px;background:currentColor;
  -webkit-mask:var(--arr) center/contain no-repeat;mask:var(--arr) center/contain no-repeat}
.ico-arr--next{--arr:url("../assets/case1/icon-next.svg")}
.cs__back .ico-arr{--arr:url("../assets/case1/icon-next.svg")}
.ico-arr--zoom{--arr:url("../assets/case1/icon-expand.svg")}

.cs__title{margin:clamp(28px, 3.5vw, 60px) 0 0;font-weight:var(--fw-black);font-size:clamp(30px, calc(24px + 1.66vw), 56px);line-height:1.27}

.cs__cover{display:block;margin:clamp(32px, 5vw, 97px) 0 0;height:360px;overflow:hidden}
.cs__cover img{display:block;width:100%;height:100%;object-fit:cover}
/* обложка на телефоне: не фиксированные 360 px (из широкой картинки остаётся центральный квадрат), а пропорция 2:1 для всех кейсов; кадр задаёт object-position у картинки */
@media (max-width:600px){.cs__cover{height:auto;aspect-ratio:2 / 1}}

/* заголовки и текст */
.cs h2{margin:var(--cs-gap) 0 .9em;font-weight:var(--fw-black);font-size:var(--cs-h2);line-height:1.27}
.cs__cover + h2{margin-top:clamp(28px, 3vw, 31px)}
.cs ol{margin:0;padding-left:1.5em}
.cs ol li{padding-left:.15em;margin-bottom:1.3em}
.cs ol li::marker{font-weight:var(--fw-black)}
.cs ol li:last-child{margin-bottom:0}

/* маркер: бирюзовая кисть под текстом */
.cs mark{color:inherit;background:url("../assets/case1/mark.svg") center 55% / 100% 1.12em no-repeat;
  padding-inline:.12em;margin-inline:-.12em;-webkit-box-decoration-break:clone;box-decoration-break:clone}

/* карточки стримов */
.cs-streams{display:grid;grid-template-columns:repeat(2,1fr);gap:clamp(16px, 1.9vw, 36px) clamp(16px, 1.8vw, 34px);margin:clamp(28px, 3.7vw, 72px) 0 0;padding:0 clamp(0px, 2.1vw, 40px);list-style:none}
@media (max-width:640px){.cs-streams{grid-template-columns:1fr}}
.cs-card{position:relative;min-height:calc(var(--cs-body) * 11.2);padding:clamp(22px, 2.6vw, 42px) clamp(22px, 2.5vw, 38px) clamp(52px, 4vw, 64px);
  background:var(--card) center / 100% 100% no-repeat}
.cs-card--c{--card:url("../assets/case1/card-cyan.png");--chip:#91ffe7}
.cs-card--y{--card:url("../assets/case1/card-yellow.png");--chip:#fff98d}
.cs-card h3{margin:0 0 clamp(14px, 2vw, 34px);font-weight:var(--fw-black);font-size:clamp(18px, calc(14px + .52vw), 24px);line-height:1.3;text-transform:uppercase}
.cs-card p{font-size:clamp(15px, calc(12px + .42vw), 20px);line-height:1.3;padding-left:.2em}
.cs-card__chip{position:absolute;right:clamp(18px, 2vw, 30px);bottom:clamp(14px, 1.6vw, 24px);padding:.18em .6em;font-weight:var(--fw-black);font-size:clamp(13px, calc(10px + .38vw), 17px);line-height:1.2;isolation:isolate}
.cs-card__chip::before{content:"";position:absolute;inset:-16% -4% -25% -3%;z-index:-1;background:var(--chip);
  -webkit-mask:url("../assets/case1/mark.svg") center / 100% 100% no-repeat;mask:url("../assets/case1/mark.svg") center / 100% 100% no-repeat}

/* схемы-картинки и «увеличить» */
.cs-fig{margin:clamp(28px, 4vw, 72px) 0 0}
.cs-fig__btn{display:block;width:100%;padding:0;border:0;background:none}
.cs-fig img{display:block;width:100%;height:auto}
/* подпись под схемой и кнопка «увеличить» — один компонент: размер задан здесь, дочерние элементы его наследуют */
.cs-note{font-size:clamp(14px, calc(12px + .32vw), 18px);line-height:1.3;display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-top:clamp(14px, 1.2vw, 20px)}
.cs-note p{max-width:557px}
.cs-zoom{margin-left:auto;display:inline-flex;align-items:center;gap:.4em;flex:none;padding:0;border:0;background:none;cursor:pointer;
  font:inherit;color:var(--ink);transition:color var(--dur) var(--ease);-webkit-tap-highlight-color:transparent}
.cs-zoom .ico-arr{width:1.6em;height:1.6em}
.cs-zoom:hover,.cs-zoom:active{color:var(--purple)}

/* результат: знак вместо цифр */
.cs-res{list-style:none;margin:0;padding:0}
.cs-res li{position:relative;padding-left:clamp(26px, 2.2vw, 31px);margin-bottom:1.6em}
.cs-res li:last-child{margin-bottom:0}
.cs-res li::before{content:"";position:absolute;left:0;top:.62em;width:19px;height:17px;transform:translateY(-50%);background:var(--purple);
  -webkit-mask:url("../assets/case1/icon-sharingan.svg") center / contain no-repeat;mask:url("../assets/case1/icon-sharingan.svg") center / contain no-repeat}

/* статьи Medium */
.cs-articles li{margin-bottom:1.6em}

/* следующий кейс */
/* воздух вокруг разделителя: список статей → линия → «Следующий кейс» */
.cs-articles{margin-bottom:clamp(40px, 4vw, 80px)}
.cs-divider{display:block;width:min(262px, 40%);height:auto;margin:clamp(72px, 8vw, 160px) auto clamp(64px, 7vw, 140px)}
.cs-next{display:flex;align-items:center;justify-content:space-between;gap:26px;padding-bottom:clamp(48px, 6vw, 120px)}
.cs-next__arr{flex:none;color:var(--ink);transition:color var(--dur) var(--ease)}
.cs-next__arr:hover{color:var(--purple)}

/* окно «увеличить» */
/* окно «увеличить». Размер берём от видимой области экрана (fixed + inset:0), а не от 100vh:
   на планшетах и телефонах vh не совпадает с реальной высотой под панелями браузера. */
.lb{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;border:0;padding:0;
  background:rgb(0 0 0 / .94);overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.lb::backdrop{background:rgb(0 0 0 / .94)}
.lb__in{min-height:100%;display:grid;place-items:center;padding:clamp(12px, 2vw, 32px);padding-top:max(clamp(12px, 2vw, 32px), env(safe-area-inset-top));cursor:zoom-out}
.lb img{display:block;max-width:100%;height:auto;max-height:calc(100vh - 2 * clamp(12px, 2vw, 32px));background:#fff;object-fit:contain}
@supports (height:100dvh){.lb img{max-height:calc(100dvh - 2 * clamp(12px, 2vw, 32px))}}
.lb.is-zoomed img{max-height:none;max-width:none;width:max(100%, 1500px)}
.lb__x{position:fixed;top:max(12px, env(safe-area-inset-top));right:max(16px, env(safe-area-inset-right));z-index:2;width:48px;height:48px;border:0;border-radius:50%;background:#fff;color:var(--ink);font-size:28px;line-height:1;cursor:pointer;box-shadow:0 0 0 2px rgb(0 0 0 / .25)}
.lb__x:hover{color:var(--purple)}
body:has(.lb[open]){overflow:hidden}
/* окно с картинкой: страничный зум и выделение текста за ним отключены (зум двумя пальцами делает скрипт, долгий тап по картинке сохраняет её как обычно) */
.lb{touch-action:pan-x pan-y;-webkit-tap-highlight-color:transparent}
.lb,.lb *{-webkit-user-select:none;user-select:none}
.lb img{-webkit-touch-callout:default}
body:has(.lb[open]){-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
body:has(.lb[open]) .lb img{-webkit-touch-callout:default}

/* заголовок раздела, который в макете нарисован внутри картинки: для скринридера и структуры страницы */
.vh{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* список после схемы: отступ сверху, как между блоками */
.cs-fig + .cs-after{margin-top:clamp(36px, 4.5vw, 86px)}
.cs-fig + .cs-after{margin-top:clamp(32px, 4vw, 72px)}

/* ---- схемы с овалами (кейс про мобильное приложение) ----
   Овалы и цифры из Figma лежат поверх картинки без нарисованных овалов. Овал — кисть из макета (svg как маска),
   поэтому цвет меняется, а выбранный овал заново «обводится» сам по тому же контуру. */
.cs-stage{position:relative;container-type:inline-size;-webkit-tap-highlight-color:transparent}
.ovl{position:absolute;inset:0;pointer-events:none}
.ov{display:contents}
.ov__r{position:absolute;display:block;background:#f3595b;transform:scaleY(-1);will-change:transform,opacity;
  -webkit-mask:var(--svg) center / 100% 100% no-repeat;mask:var(--svg) center / 100% 100% no-repeat;transition:opacity .35s var(--ease)}
.ov__n{--nd:2.3cqw;position:absolute;isolation:isolate;text-align:center;font-weight:var(--fw-black);font-size:1.4583cqw;line-height:var(--nd);height:var(--nd);color:#fff;transition:opacity .35s var(--ease)}
/* цифра в красном круге */
.ov__n::before{content:"";position:absolute;z-index:-1;left:50%;top:0;width:var(--nd);height:var(--nd);margin-left:calc(var(--nd) / -2);border-radius:50%;background:#f3595b;transition:background-color .35s var(--ease)}
/* выбран один овал: остальные притихают */
.cs-stage[data-active] .ov:not(.is-on):not(.is-sel) .ov__r,.cs-stage[data-active] .ov:not(.is-on):not(.is-sel) .ov__n{opacity:.3}
.ov__r,.ov__n{transition:opacity .6s var(--ease)}

/* выбранный овал на месте становится ярче и один раз «подпрыгивает»; остальные притихают.
   Ничего не стирается и не перерисовывается с нуля: на планшете это выглядело как мерцание */
/* цвет выбранного овала ставится сразу при выборе (пока страница едет и овал ещё не виден), а не в момент прибытия: смена цвета у кольца-маски на iOS давала мигание */
.ov.is-sel .ov__r,.ov.is-on .ov__r{background:#e5252b}
.ov.is-sel .ov__n::before,.ov.is-on .ov__n::before{background:#e5252b}
.ov.is-on .ov__r{animation:ovl-ring .8s cubic-bezier(.45,.05,.2,1) both}
.ov.is-on .ov__n{animation:ovl-pop .9s cubic-bezier(.45,.05,.2,1) both}
/* овал, который уже был нарисован на экране (пока страница ехала к схеме), не перезапускаем: на iOS кольцо на миг пропадало и рисовалось заново; меняется только цвет */
.ov.is-on.is-still .ov__r{animation:none}
@keyframes ovl-ring{0%{transform:scaleY(-1) scale(.965)}100%{transform:scaleY(-1) scale(1)}}
@keyframes ovl-pop{0%{transform:scale(1)}45%{transform:scale(1.14)}100%{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){.ov.is-on .ov__r,.ov.is-on .ov__n{animation:none}}

/* зона клика по кольцу овала и цифре: невидимая, толщиной около пальца; остальная схема открывает «увеличить» */
.ov__hit{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.ov__hit [data-hit]{outline:none;-webkit-tap-highlight-color:transparent;fill:transparent;stroke:transparent;stroke-width:26px;vector-effect:non-scaling-stroke;pointer-events:all;cursor:pointer}
.ov__hit circle[data-hit]{fill:transparent;pointer-events:all}

.cs-after li[data-g]{cursor:pointer;border-radius:4px;transition:background-color var(--dur) var(--ease);-webkit-tap-highlight-color:transparent}
.cs-after li[data-g].is-active{background:rgb(174 0 232 / .06)}
@media (hover:hover){.cs-after li[data-g]:hover{background:rgb(174 0 232 / .06)}}   /* на телефоне :hover залипает на последнем пункте, поэтому только для мыши */
.cs-after li[data-g] b{transition:color var(--dur) var(--ease)}
.cs-after li[data-g].is-active b,.cs-after li[data-g].is-active::marker{color:var(--purple)}
@media (hover:hover){.cs-after li[data-g]:hover b,.cs-after li[data-g]:hover::marker{color:var(--purple)}}
.cs-after li[data-g]:focus-visible{outline:3px solid var(--purple);outline-offset:4px}

/* пункт, к которому спустил клик по овалу: короткая вспышка */
.cs-after li.is-flash{animation:li-flash 1.4s var(--ease)}
@keyframes li-flash{0%{background:rgb(174 0 232 / .28)}100%{background:rgb(174 0 232 / .06)}}
@media (prefers-reduced-motion:reduce){.cs-after li.is-flash{animation:none}}

/* подсказка «нажми на любой круг» со стрелкой на схеме «Было / Стало» (по макету: текст 12 px Onest SemiBold, стрелка повёрнута на 150°) */
.ov-hint{position:absolute;inset:0;pointer-events:none}
.ov-hint__t{position:absolute;left:5.3125%;top:3.667%;font-weight:var(--fw-semibold);font-size:1.25cqw;letter-spacing:.0125cqw;line-height:1.26;white-space:nowrap}
.ov-hint__a{position:absolute;left:12.396%;top:3.667%;width:4.407%;height:6.177%;display:flex;align-items:center;justify-content:center}
.ov-hint__a > span{flex:none;display:block;width:53.77%;height:89.48%;transform:rotate(var(--rot,150deg))}
.ov-hint__a img{display:block;width:100%;height:100%;overflow:visible}
@container (max-width:560px){.ov-hint{display:none}}
@container (min-width:561px) and (max-width:700px){.ov-hint__t{font-size:max(8px,1.25cqw)}}

/* жирный заголовок кликабельного пункта подчёркнут, как ссылка */
.cs-after li[data-g] b{text-decoration:underline;text-decoration-color:currentColor;text-decoration-thickness:var(--ul-thick);text-underline-offset:var(--ul-offset)}

/* узкий экран: схема режется на части и части идут друг под другом (части делает js/diagram.js) */
.cs-split{display:none}
@media (max-width:600px){
  .cs-fig > .cs-stage[data-split]{display:none}
  .cs-split{display:block}
  .cs-crop{position:relative;overflow:hidden;margin-inline:-7.5vw}   /* на всю ширину экрана, чтобы овалы не обрезались по полям */
    .cs-crop .cs-stage{max-width:none}
  .cs-crop .ov__n{--nd:2.84cqw;font-size:1.8cqw}
}
.cs-mask{position:absolute;background:#fff}
.cs-p2{margin-top:1.1em!important}   /* второй абзац подряд: пустая строка между абзацами, как в макете */

.cs ol.cs-rules ol{margin-top:.5em;padding-left:1.6em;list-style:lower-alpha}
.cs ol.cs-rules ol li{margin-bottom:.2em}
.cs ol.cs-rules ol li::marker{font-weight:var(--fw-regular)}
.cs p + ol.cs-rules{margin-top:1.1em}
