/* ════════════════════════════════════════
   CASE STUDY (inner page)
   ════════════════════════════════════════ */

.page-case {
  --case-surface: #0a0a0a;
  --case-raised: #0e0e0e;
}

.case-page {
  background: var(--case-surface);
}

/* ─── Hero: только верхний экран (задачи — ниже, отдельным блоком) ─ */
.case-shell--intro {
  padding-top: calc(var(--header-h) + 40px);
  padding-bottom: clamp(20px, 3vw, 32px);
  overflow-x: clip;
}

.case-intro-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 40px);
  min-width: 0;
}

.case-intro-layout__main {
  min-width: 0;
}

.case-intro-layout__media {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  justify-self: center;
}

@media (min-width: 900px) {
  .case-intro-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 318px);
    gap: 28px 36px;
    align-items: start;
  }

  .case-intro-layout__media {
    justify-self: end;
    padding-top: 4px;
  }
}

.case-presentation {
  width: 100%;
  max-width: min(304px, 100%);
  margin: 0 auto;
}

.case-phone--presentation {
  justify-content: center;
}

.case-phone__frame--presentation {
  max-width: min(304px, 90vw);
  width: 100%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
}

.case-phone__frame--presentation > .case-phone__video,
.case-phone__frame--presentation > .case-presentation__void,
.case-phone__frame--presentation > .case-phone__img--presentation-still {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.case-phone__video {
  display: block;
  border-radius: 28px;
  object-fit: cover;
  object-position: top center;
  pointer-events: none;
  background: #080808;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.case-presentation__void {
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 55% at 50% 12%, rgba(255, 179, 71, 0.18) 0%, transparent 55%),
    linear-gradient(168deg, #222 0%, #0d0d0d 48%, #090909 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.case-presentation__void-glow {
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 179, 71, 0.07) 48%,
    transparent 62%
  );
  animation: case-pres-shimmer 7s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .case-presentation__void-glow {
    animation: none;
    opacity: 0.6;
  }
}

@keyframes case-pres-shimmer {
  0%,
  100% {
    transform: translateX(-8%) translateY(4%) rotate(0deg);
  }
  50% {
    transform: translateX(12%) translateY(-2%) rotate(0.5deg);
  }
}

.case-phone__img--presentation-still {
  display: block;
  border-radius: 28px;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0a0a0a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.case-back-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.case-back-link:hover {
  color: var(--accent);
}

/* «Реализованные работы» — отдельный блок после hero */
.case-shell--tasks {
  padding-top: 0;
  padding-bottom: 0;
}

.case-tasks {
  margin: 0;
  padding: clamp(28px, 3.8vw, 44px) 0 clamp(40px, 5vw, 64px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.case-tasks__title {
  margin-bottom: clamp(22px, 3.2vw, 32px);
}

.case-tasks .case-task-list__item {
  padding-left: 40px;
  margin-bottom: 22px;
  font-size: 16px;
  line-height: 1.68;
  letter-spacing: 0.01em;
}

.case-tasks .case-task-list__item::before {
  width: 26px;
  height: 26px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.085);
  box-shadow: 0 0 20px rgba(255, 179, 71, 0.06);
}

@media (max-width: 767px) {
  .case-tasks .case-task-list__item:last-child {
    margin-bottom: 0;
  }
}

.case-task-list--grid {
  max-width: none;
}

@media (min-width: 768px) {
  .case-task-list--grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(32px, 3.8vw, 48px);
    row-gap: 24px;
    align-items: start;
  }

  .case-task-list--grid .case-task-list__item {
    margin-bottom: 0;
  }
}

/* Разделитель и начало блока со скриншотом главной */
.case-desktop-chapter {
  padding-top: clamp(20px, 3.2vw, 44px);
}

.case-desktop-chapter__rule {
  display: block;
  height: 1px;
  width: 100%;
  margin: 0 0 clamp(24px, 3.5vw, 40px);
  border: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 15%,
    rgba(255, 179, 71, 0.38) 50%,
    rgba(255, 255, 255, 0.08) 85%,
    transparent 100%
  );
}

.case-shell--hero-caption {
  padding-top: 0;
  padding-bottom: clamp(4px, 1vw, 10px);
}

.case-desktop-chapter .case-shell--hero-caption .case-block__title {
  margin-bottom: clamp(12px, 2vw, 18px);
}

.case-desktop-chapter__lead {
  max-width: 42rem;
  margin: 0 0 clamp(8px, 1.4vw, 14px);
  font-size: 15px;
  line-height: 1.62;
  color: var(--text-secondary);
  opacity: 0.92;
}

/* ─── Полный скрин главной (на всю ширину секции, без обрезки по высоте) ─ */
.case-desktop-full {
  width: 100%;
  margin-top: clamp(8px, 1.25vw, 16px);
  background: #050505;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 179, 71, 0.1);
}

.case-desktop-full__img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.case-desktop-full__placeholder {
  min-height: min(52vh, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(255, 179, 71, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
}

.case-desktop-full__placeholder-inner {
  text-align: center;
  padding: 48px 24px;
  max-width: 520px;
}

.case-desktop-full__placeholder-label {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.case-desktop-full__placeholder-hint {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.case-desktop-full__placeholder-hint code {
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
}

/* ─── Shell (нижняя часть контента) ───── */
.case-shell--rest {
  padding-top: 64px;
  padding-bottom: 88px;
}

.case-shell--rest .case-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.case-header__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0 0 16px;
  max-width: 920px;
}

.case-header__badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  margin-bottom: 24px;
}

.case-header--hero .case-header__title {
  font-size: clamp(30px, 4.25vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.034em;
  margin-bottom: 18px;
}

.case-header--hero .case-header__badge {
  margin-bottom: 20px;
}

.case-header--hero .case-meta {
  margin: 0 0 20px;
  padding-bottom: 20px;
}

.case-hero__summary {
  font-size: clamp(15px, 1.45vw, 17px);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 36rem;
  margin: 0 0 22px;
}

.case-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 28px;
}

.case-meta__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.case-meta__key {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.75;
}

.case-meta__val,
.case-meta__link {
  font-size: 15px;
  color: var(--text-primary);
}

.case-meta__link {
  text-decoration: none;
  color: var(--accent);
  transition: opacity 0.2s;
}

.case-meta__link:hover {
  opacity: 0.85;
}

.case-lead__h {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.case-lead__p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0;
}

/* ─── Blocks ─────────────────────────── */
.case-block {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.case-block__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 20px;
}

.case-block__intro {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 640px;
  margin: -8px 0 36px;
}

.case-task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: case-task;
  max-width: 720px;
}

.case-task-list__item {
  position: relative;
  padding-left: 36px;
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.case-task-list__item::before {
  counter-increment: case-task;
  content: counter(case-task);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 2px;
  background: rgba(255, 179, 71, 0.06);
}

/* ─── Mobile grid + phone frame ───────── */
.case-mobile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 32px;
}

.case-mobile-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.case-phone {
  display: flex;
  justify-content: center;
}

.case-phone__frame {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9 / 19;
  border-radius: 36px;
  padding: 10px;
  background: linear-gradient(160deg, #2a2a2a 0%, #121212 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.case-phone__img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  object-fit: cover;
  object-position: top center;
}

.case-phone__placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 179, 71, 0.12) 0%, transparent 45%),
    #161616;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.case-mobile-card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.case-mobile-card__desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* ─── Related (3 cards) ───────────────── */
.case-related {
  padding: 88px 0 96px;
  background: var(--case-raised);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.case-related__title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 40px;
}

.case-related__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.case-related-card {
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #141414;
  overflow: hidden;
  transition:
    border-color 0.3s var(--ease-smooth),
    transform 0.3s var(--ease-out),
    box-shadow 0.35s var(--ease-out);
}

.case-related-card:hover {
  border-color: rgba(255, 179, 71, 0.28);
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.case-related-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.case-related-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
}

.case-related-card__thumb-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 80% at 30% 20%, rgba(255, 179, 71, 0.16) 0%, transparent 55%),
    linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
}

/* На странице кейса не подключается cases.css — дублируем поведение превью портфолио */
.case-related-card .cases-card__thumb-img {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.45s var(--ease-out);
}

.case-related-card__link:hover .cases-card__thumb-img {
  transform: scale(1.03);
}

.case-related-card .cases-card__thumb-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.38);
}

.case-related-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  background: rgba(10, 10, 10, 0.7);
}

.case-related-card__body {
  padding: 18px 18px 20px;
}

.case-related-card__name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.case-related-card__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* ─── CTA ────────────────────────────── */
.case-cta {
  padding: 88px 0 100px;
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, rgba(255, 179, 71, 0.07) 0%, transparent 55%),
    var(--case-surface);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.case-cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.case-cta__label {
  margin-bottom: 12px;
}

.case-cta__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.case-cta__text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0;
}

.case-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.page-case .reveal-delay-1 { transition-delay: 0.08s; }
.page-case .reveal-delay-2 { transition-delay: 0.16s; }
.page-case .reveal-delay-3 { transition-delay: 0.24s; }

@media (max-width: 900px) {
  .case-mobile-grid {
    grid-template-columns: 1fr;
  }

  .case-related__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .case-shell--intro {
    padding-top: calc(var(--header-h) + 28px);
    padding-bottom: 32px;
    min-height: 0;
  }

  .case-tasks {
    padding: 28px 0 36px;
  }

  .case-desktop-chapter .case-shell--hero-caption .case-block__title {
    margin-bottom: 18px;
  }

  .case-shell--rest {
    padding-top: 48px;
    padding-bottom: 64px;
  }

  .case-block {
    margin-top: 48px;
    padding-top: 36px;
  }

  .case-cta__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Hero CTA: одинаковая ширина кнопок, стек, блок по ширине контента и по центру */
  .case-hero__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .case-hero__actions .btn {
    width: 100%;
    min-width: 0;
  }
}
