/* 02 · Кейсы — «РАБОТЫ» и сетка карточек */

/* индекс «04» у «РАБОТЫ» стоит вне масок букв — прячем его вместе с ними и проявляем после последней буквы */
[data-roll][data-pending] .w-sup {
  opacity: 0;
}

[data-roll][data-in] .w-sup {
  transition: opacity .5s var(--e3) .45s;
}

.works-h {
  font-size: clamp(110px,17.4vw,250px);
  font-weight: 900;
  line-height: .86;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.w-sup {
  display: inline-block;
  vertical-align: top;
  margin: .1em 0 0 .1em;
  font-size: max(.19em,19px);
  line-height: 1;
  color: var(--acc-t);
  letter-spacing: 0;
}

.works-top {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,400px);
  column-gap: 48px;
  row-gap: 24px;
  align-items: end;
  margin-top: 34px;
}

.cases {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 24px;
  margin-top: 64px;
}

.cw {
  min-width: 0;
}

/* сдвигаем саму карточку, а не обёртку: наблюдатель видит обёртку на её месте и запускает выезд вовремя.
   fill-mode backwards — после выезда снова работает :hover-наклон карточки */
.cw[data-pending]>.case {
  opacity: 0;
  transform: translate3d(0,170px,0) rotate(5deg);
}

.cw.cw-b[data-pending]>.case {
  transform: translate3d(0,170px,0) rotate(-5deg);
}

.cw[data-in]>.case {
  animation: caseIn 1.15s var(--e2) backwards;
}

.cw.cw-b[data-in]>.case {
  animation-name: caseInB;
}

.cw[data-in][data-d="1"]>.case {
  animation-delay: .1s;
}

.cw[data-in][data-d="2"]>.case {
  animation-delay: .2s;
}

.cw[data-in][data-d="3"]>.case {
  animation-delay: .3s;
}

@keyframes caseIn {
  from {
    opacity: 0;
    transform: translate3d(0,170px,0) rotate(5deg);
  }
  40% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes caseInB {
  from {
    opacity: 0;
    transform: translate3d(0,170px,0) rotate(-5deg);
  }
  40% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes caseInS {
  from {
    opacity: 0;
    transform: translate3d(0,80px,0) rotate(2deg);
  }
  40% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes caseInSB {
  from {
    opacity: 0;
    transform: translate3d(0,80px,0) rotate(-2deg);
  }
  40% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.case {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 26px;
  border-radius: 30px;
  color: var(--ink);
  transition: transform .7s var(--e3);
}

@media (hover:hover) and (pointer:fine) {
  /* наклон и подъём карточки — только мышью: после тапа на телефоне карточка оставалась перекошенной */
  .case:hover {
    transform: translateY(-10px) rotate(-.7deg);
  }
  .cw-b .case:hover {
    transform: translateY(-10px) rotate(.7deg);
  }
}

.case--w {
  background: var(--card);
}

.case--l {
  background: var(--acc);
}

.case-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 6px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.35;
}

.case-top>span:last-child {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.cv {
  position: relative;
  margin-top: 16px;
  aspect-ratio: 612/380;
  border-radius: 20px;
  overflow: hidden;
  container-type: inline-size;
  isolation: isolate;
}

.stage {
  position: absolute;
  inset: 0;
  font-size: 1.634cqw;
  line-height: 1.25;
  transition: transform 1s var(--e3);
}

@media (hover:hover) and (pointer:fine) {
  .case:hover .stage {
    transform: scale(1.035);
  }
}

.case-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 6px 0;
}

.case-title {
  font-weight: 800;
  font-size: clamp(34px,3.2vw,46px);
  line-height: .95;
  text-transform: uppercase;
  letter-spacing: .003em;
}

.case-text {
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.5;
  max-width: 580px;
}

.case-did {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 580px;
  color: var(--ink2);
}

.case-did b {
  color: var(--ink);
}

/* на томатной карточке приглушённый графит не дотягивает по контрасту — текст полного тона */
.case--l .case-did {
  color: var(--ink);
}

/* теги — своей группой, ссылка на сайт — отдельно справа внизу: когда теги не помещаются в строку, переносятся они,
   а ссылка не уезжает одна на новую строку */
.case-foot {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.case-tag {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

/* мелкий томатный текст на графите рябит — текст светлый, томатной остаётся только галочка */
.case-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px 8px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
}

.case-badge .ico {
  color: var(--acc);
}

/* ссылка на сайт — той же высоты (36px) и кегля, что бейдж и теги рядом */
.case-go {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  height: 36px;
  padding: 0 5px 0 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
}

.case-go i {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: transform .55s var(--e1);
}

@media (hover:hover) and (pointer:fine) {
  .case-go:hover i {
    transform: rotate(-45deg);
  }
}

@media (max-width:1180px) {
  .cases {
    grid-template-columns: minmax(0,1fr);
  }
  .cw[data-in][data-d]>.case {
    animation-delay: 0s;
  }
}

@media (max-width:1040px) {
  /* гигантское «РАБОТЫ» не помещается рядом с текстом — ставим колонки друг под другом */
  .works-top {
    grid-template-columns: minmax(0,1fr);
  }
}

@media (max-width:900px) {
  .works-top {
    grid-template-columns: minmax(0,1fr);
  }
}

@media (max-width:640px) {
  .works-h {
    font-size: 25vw;
  }
  .case {
    padding: 14px 14px 20px;
    border-radius: 24px;
  }
  .cw[data-pending]>.case {
    transform: translate3d(0,80px,0) rotate(2deg);
  }
  .cw.cw-b[data-pending]>.case {
    transform: translate3d(0,80px,0) rotate(-2deg);
  }
  .cw[data-in]>.case {
    animation-name: caseInS;
  }
  .cw.cw-b[data-in]>.case {
    animation-name: caseInSB;
  }
  .cv {
    aspect-ratio: 4/3.3;
  }
  .case-top {
    font-size: 11px;
  }
  /* на телефоне ссылка всегда отдельной строкой под тегами, одинаково во всех кейсах */
  .case-foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

.works-intro {
  padding-bottom: 18px;
}

.works-lead {
  font-size: clamp(22px,7vw,28px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.works-note {
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg88);
}

.cv {
  background: var(--ink);
}

.case-badge .ico {
  width: 16px;
  height: 16px;
  stroke-width: 2.8;
}

.case-go .ico {
  width: 14px;
  height: 14px;
}
