/* ============================================================
   СТРАНИЦА КЕЙСА (case-*.html)
   Как на danielkurilenko.com: сверху — название и описание, ниже экраны, каждый в своём фрейме.
   Фон фрейма — Nature-фото кейса или чёрный (чередуются), ширина: на всю / ~83% слева / ~83% справа.
   Кнопки Visit site (белая) и Next (красная) — в доке снизу экрана.
   ============================================================ */
.case-page {
  padding-top: 128px;
  /* скругления — пропорционально ширине блока, как у карточек кейсов на главной (16px на карточку 417px);
     между блоками 32, по краям var(--pad) */
  --ratio: calc(16 / 417);
  --gap: 32px;
  --frame-p: 56px;
}

.case-info, .shots { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); container-type: inline-size; }

/* ---------- Экраны: каждый в своём фрейме (как на danielkurilenko.com) ---------- */
.shots { display: flex; flex-direction: column; gap: var(--gap); padding-bottom: 140px; }
.shot { position: relative; margin: 0; isolation: isolate; }
.shot--full  { width: 100%; --k: 1; }
.shot--left  { width: 83.3%; --k: .833; align-self: flex-start; }
.shot--right { width: 83.3%; --k: .833; align-self: flex-end; }
/* фрейм с Nature-фото */
/* радиус блока = его ширина × 16/417; радиус экрана внутри фрейма = ширина экрана × 16/417 */
.shot { --w: calc(var(--k, 1) * 100cqw); }
.shot--nature, .shot--black { overflow: hidden; padding: var(--frame-p); border-radius: calc(var(--w) * var(--ratio)); background: var(--card); }
.shot--black { background: #000; border: 1px solid rgba(229, 229, 229, .1); } /* на чёрной странице край фрейма виден только по бордеру */
.shot__bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: var(--crop, 50% 50%); }
/* чёрный фон — экран прямо на странице */
.shot--plain { background: transparent; }
.shot__screen, .shot--plain > img, .shot--plain > video, .player > video { display: block; width: 100%; height: auto; border: 1px solid rgba(229, 229, 229, .1); border-radius: calc(var(--w) * var(--ratio)); }
.shot--nature .shot__screen, .shot--black .shot__screen { border-radius: calc((var(--w) - 2 * var(--frame-p)) * var(--ratio)); }
/* вертикальное видео — по высоте экрана и по центру. Размер элемента = размер видео (без чёрных полей внутри), иначе скругление режет кадр не по его углам */
.shot--portrait > video, .shot--portrait .player > video { width: auto; max-width: 100%; max-height: 86vh; margin: 0 auto; }

/* ---------- Плеер моушен-кейса: панель — та же подложка, что у пилюли с кнопками внизу экрана ---------- */
.player { position: relative; overflow: hidden; border-radius: calc(var(--w) * var(--ratio)); background: #000; }
.shot--portrait .player { width: fit-content; max-width: 100%; margin: 0 auto; }
.player > video { cursor: pointer; }
.player.is-idle, .player.is-idle > video { cursor: none; }

.player__big { position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; display: grid; place-items: center; border-radius: 50%; background: rgba(18, 18, 18, .72); color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.player__big svg { width: 32px; height: 32px; }
.player.is-paused .player__big { opacity: 1; transition-delay: .5s; } /* с задержкой: пока ролик стартует сам, кнопка не мигает */
.player.is-waiting:not(.is-paused) .player__big { opacity: 1; transition-delay: .5s; }
.player.is-waiting:not(.is-paused) .player__big svg { display: none; }
.player.is-waiting:not(.is-paused) .player__big::after { content: ""; width: 28px; height: 28px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: playerSpin .8s linear infinite; }
@keyframes playerSpin { to { transform: rotate(360deg); } }

.player__bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; color: #fff;
  background: linear-gradient(180deg, rgba(42, 42, 42, .88) 0%, rgba(18, 18, 18, .92) 100%);
  box-shadow: 0 0 0 1px #262626, inset 0 1px 0 rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.player.is-idle .player__bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player__btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; transition: background-color .2s var(--ease); }
.player__btn:hover { background: rgba(255, 255, 255, .1); }
.player__btn:focus-visible, .player__seek:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.player__time { flex: none; padding: 0 8px; font-family: var(--mono); font-size: 13px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text-80); white-space: nowrap; }

.player__seek { flex: 1; min-width: 0; height: 40px; margin: 0 8px; padding: 0; border-radius: 8px; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; --track: linear-gradient(to right, var(--red-2) var(--p, 0%), rgba(255, 255, 255, .24) var(--p, 0%)); }
.player__seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--track); }
.player__seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.player__seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; }
.player__seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

/* на весь экран: кадр вписан целиком, без скруглений */
.player.is-fs { display: flex; width: 100%; height: 100%; max-width: none; margin: 0; border-radius: 0; }
.player.is-fs > video { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; object-fit: contain; }

/* ---------- Текст (сверху) ---------- */
.case-info { padding-bottom: var(--gap); }
.case-card { display: flex; flex-direction: column; gap: 40px; padding: var(--frame-p); border-radius: calc(100cqw * var(--ratio)); background: var(--card); }
.case-card__top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px 40px; }
.case-card h1 { font-size: clamp(48px, 6.7vw, 96px); font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.case-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.case-card__tags span { padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); font-family: var(--mono); font-size: 14px; line-height: 1.2; letter-spacing: .02em; text-transform: uppercase; color: var(--text-80); }
.case-card__text { max-width: 600px; text-wrap: pretty; font-size: 22px; line-height: 1.45; letter-spacing: -.01em; color: var(--text-66); }

/* ---------- Пилюля с кнопками внизу экрана — как навигация (та же подложка, что у шапки-пилюли) ---------- */
.case-bar {
  position: fixed; z-index: 45; left: 50%; bottom: 24px; translate: -50% 0;
  display: flex; gap: 6px; padding: 6px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(42, 42, 42, .88) 0%, rgba(18, 18, 18, .92) 100%);
  box-shadow: 0 0 0 1px #262626, inset 0 1px 0 rgba(255, 255, 255, .06), 0 12px 32px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
  animation: barIn .8s var(--ease) .3s both;
}
.case-bar:empty { display: none; }
.case-bar .btn { height: 44px; border-radius: 999px; padding: 0 18px; font-size: 14px; }
.btn--red { background: var(--red); color: #fff; --wave: #fff; }
.btn--red:hover .btn__label { color: #000; }
@keyframes barIn { from { opacity: 0; transform: translateY(24px); } }
body:has(.case-bar:not(:empty)) .footer { padding-bottom: 96px; } /* чтобы док не закрывал низ футера */

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .case-page { --frame-p: 32px; } /* планшет */
  .case-page { padding-top: 104px; }
  .case-card { gap: 28px; }
  .case-card__text { font-size: 18px; }
}
@media (max-width: 600px) {
  .case-page { --frame-p: 16px; --gap: 16px; } /* телефон */
  .case-card { padding: 32px 16px 24px; }

  .shots { padding-bottom: 96px; }
  .shot--left, .shot--right { width: 92%; }
  .player__bar { left: 8px; right: 8px; bottom: 8px; }
  .player__seek { margin: 0 4px; }
  .player__time { padding: 0 4px; font-size: 12px; }
  .case-bar { left: 16px; right: 16px; bottom: 12px; translate: none; }
  .case-bar .btn { flex: 1; min-width: 0; justify-content: center; padding: 0 14px; height: 48px; font-size: 15px; }
  .case-bar .btn--white { flex: none; }
  .case-bar .btn__label { min-width: 0; max-width: 100%; }
  .bar__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; padding-bottom: 2px; margin-bottom: -2px; } /* длинное название — с многоточием, стрелка на месте */
}
@media (max-height: 500px) { .shot--portrait .player__time { display: none; } } /* телефон боком: вертикальный ролик узкий, панель не вмещает время */
@media (prefers-reduced-motion: reduce) { .case-bar { animation: none; } .player__bar, .player__big { transition: none; } .player.is-idle .player__bar { transform: none; } }
