/* ==========================================================================
   Olprime - кейсы (single-case.php, archive-case.php). Поверх дизайн-системы
   и service.css (переиспользуем .svc-hero, .crumbs, .svc-metric, .cases__grid).
   ========================================================================== */

/* ---------- HERO кейса: эйбрау-ниша, каналы-теги ---------- */
.case-hero__niche {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.72); margin-bottom: 14px;
}
.case-hero__niche::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-right: 8px; flex: none;
}
.case-hero__niche a { color: inherit; }
.case-hero__niche a:hover { color: #fff; }
.case-hero__sub {
  color: rgba(255,255,255,.7); font-size: 16px; font-weight: 600; margin-top: 14px;
}
.case-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.case-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  padding: 7px 14px; border-radius: var(--r-pill);
}
.case-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); flex: none; }
@media (max-width: 640px) {
  .case-hero__sub { font-size: 15px; }
  .case-tags { gap: 8px; margin-top: 18px; }
}

/* ---------- Тело кейса (нарратив, читаемая колонка) ---------- */
.case-body { max-width: 820px; margin-inline: auto; }
.case-body > *:first-child { margin-top: 0; }
.case-body p { font-size: 17px; line-height: 1.65; color: #2c2a26; margin: 0 0 18px; }
.case-body h2 {
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.02em;
  margin: 44px 0 16px; scroll-margin-top: 90px;
}
.case-body h2::after { content: "."; color: var(--brand); }
.case-body h3 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin: 28px 0 10px; }
.case-body ul, .case-body ol { margin: 0 0 18px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.case-body ul li { position: relative; padding-left: 26px; font-size: 16px; line-height: 1.55; color: #2c2a26; }
.case-body ul li::before {
  content: ""; position: absolute; left: 4px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
}
.case-body ol { counter-reset: olp; }
.case-body ol li { position: relative; padding-left: 34px; font-size: 16px; line-height: 1.55; color: #2c2a26; counter-increment: olp; }
.case-body ol li::before {
  content: counter(olp, decimal-leading-zero); position: absolute; left: 0; top: 0;
  font-size: 14px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums;
}
.case-body strong { font-weight: 700; color: var(--ink); }

/* ---------- Картинки в теле ---------- */
/* Картинки в теле не растягиваем на всю колонку: ограничиваем по высоте и центрируем,
   чтобы высокие/плотные скриншоты не «съедали» экран при чтении. */
.case-figure { margin: 30px 0; text-align: center; }
.case-figure img {
  display: inline-block; width: auto; height: auto; max-width: 100%; max-height: 520px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--mist);
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04), 0 20px 44px -28px rgba(var(--shadow-rgb), .22);
}
.case-figure figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.case-figure--pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.case-figure--pair img { max-height: 420px; }
@media (max-width: 640px) {
  .case-figure img { max-height: 400px; }
  .case-figure--pair { grid-template-columns: 1fr; }
}

/* ---------- Результаты: отдельная тёмная панель на каждый канал ---------- */
.case-period {
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #f2793a, #d24e0f); padding: 8px 16px; border-radius: var(--r-pill); margin-bottom: 22px;
}
.case-result {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: var(--r-lg); padding: 32px; margin: 0 0 20px; color: #fff;
  background: radial-gradient(130% 130% at 12% 0%, #26262a 0%, #17171a 55%, #101012 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.case-result::before {
  content: ""; position: absolute; width: 360px; height: 360px; right: -90px; top: -130px; border-radius: 50%;
  background: radial-gradient(circle, rgba(229,97,33,.30), transparent 66%); filter: blur(22px); z-index: -1; pointer-events: none;
}
.case-result__head { display: inline-flex; align-items: center; font-size: 16px; font-weight: 700; margin-bottom: 22px; }
.case-result__head::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 9px; flex: none; }
.case-result__kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.case-result-kpi { display: flex; flex-direction: column; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-md); padding: 20px; }
.case-result-kpi__num { display: block; font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -.02em; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1; }
.case-result-kpi__cap { display: block; font-size: 13px; color: rgba(255,255,255,.72); margin-top: 8px; }
.case-result__shot { margin-top: 22px; }
.case-result__shot img {
  display: block; width: 100%; height: auto; max-height: 460px; object-fit: contain; object-position: left top;
  border-radius: var(--r-md); background: #fff; border: 1px solid rgba(255,255,255,.1);
}
@media (max-width: 640px) {
  .case-result { padding: 24px 20px; }
  .case-result__kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .case-result-kpi { padding: 15px; }
}

/* ---------- Mid-content CTA (оффер в середине кейса) - тёмная панель + оранжевая кнопка ---------- */
.case-cta {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  border-radius: var(--r-lg); padding: 34px 38px; margin: 40px 0;
  background: radial-gradient(130% 130% at 12% 0%, #26262a 0%, #17171a 55%, #101012 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.case-cta::before {
  content: ""; position: absolute; width: 380px; height: 380px; right: -90px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(229,97,33,.34), transparent 66%); filter: blur(24px); z-index: -1; pointer-events: none;
}
.case-cta__text { display: flex; flex-direction: column; gap: 8px; max-width: 60ch; }
.case-cta__text strong { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.case-cta__text span { font-size: 15px; line-height: 1.5; color: rgba(255,255,255,.72); }
.case-cta .btn { flex: none; }
@media (max-width: 640px) { .case-cta { padding: 26px 22px; } .case-cta .btn { width: 100%; justify-content: center; } }

/* ---------- Выводы (01/02/03) ---------- */
.case-outcomes { margin: 30px 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.case-outcome {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px 26px;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
}
.case-outcome__n { font-size: 22px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.case-outcome p { margin: 0; font-size: 16px; line-height: 1.55; color: #2c2a26; }

/* ---------- Автор кейса (фото слева, лейбл над именем) ---------- */
.case-author {
  max-width: 820px; margin: 40px auto 0; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
}
.case-author__ava { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.case-author__ava--mono {
  display: inline-flex; align-items: center; justify-content: center; border: none;
  font-size: 19px; font-weight: 800; color: #fff; letter-spacing: .02em;
  background: radial-gradient(120% 120% at 30% 20%, #f2793a, #d24e0f);
}
.case-author__meta { display: flex; flex-direction: column; gap: 3px; }
.case-author__label { font-size: 13px; color: var(--ink-soft); }
.case-author__name { font-size: 17px; font-weight: 700; color: var(--ink); }

/* Стили карточки кейса (оверлей, метрика, клиент-лейбл) - в home.css:
   карточка выводится и на главной/услугах, где case.css не грузится. */

/* ---------- Фильтры архива (ниша + тип): компактные дропдауны ---------- */
.case-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 30px; }
.case-filters__title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft);
  margin-right: 2px;
}

/* Кнопка-выпадашка (summary). Нативный <details> - работает без JS. */
.case-drop { position: relative; }
.case-drop__btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 600; color: var(--ink);
  background: #fff; border: 1px solid var(--line); padding: 9px 15px; border-radius: var(--r-pill);
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04); user-select: none;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.case-drop__btn::-webkit-details-marker { display: none; } /* убрать нативный треугольник */
.case-drop__btn:hover { border-color: var(--brand); color: var(--brand-strong); }
.case-drop__cap { color: var(--ink-soft); font-weight: 700; }
.case-drop__val { font-weight: 600; }
.case-drop__caret { display: inline-flex; margin-left: 2px; transition: transform .2s ease; }
.case-drop__caret svg { width: 11px; height: 8px; display: block; }
.case-drop[open] .case-drop__caret { transform: rotate(180deg); }

/* Активный фильтр - оранжевая кнопка (как раньше активная пилюля). */
.case-drop.is-active .case-drop__btn { background: linear-gradient(135deg, #f2793a, #d24e0f); border-color: transparent; color: #fff; }
.case-drop.is-active .case-drop__cap { color: rgba(255,255,255,.85); }

/* Панель со списком опций. */
.case-drop__panel {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0;
  min-width: 220px; max-height: 340px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(var(--shadow-rgb), .16); padding: 6px;
}
.case-drop__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.case-drop__opt:hover { background: var(--surface, #f6f4f1); color: var(--brand-strong); }
.case-drop__count { font-size: 12px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.case-drop__opt.is-active { background: rgba(229, 97, 33, .1); color: var(--brand-strong); }
.case-drop__opt.is-active .case-drop__count { color: var(--brand-strong); }

/* Сброс всех фильтров. */
.case-filters__reset {
  font-size: 13px; font-weight: 600; color: var(--ink-soft); text-decoration: none;
  padding: 8px 4px; border-bottom: 1px dashed currentColor; line-height: 1;
}
.case-filters__reset:hover { color: var(--brand-strong); }

@media (max-width: 560px) {
  .case-drop { flex: 1 1 auto; }
  .case-drop__btn { width: 100%; justify-content: space-between; }
  .case-drop__panel { min-width: 100%; }
}

/* ---------- Шапка / пустое состояние архива ---------- */
.cases-archive__head { max-width: 720px; }
.cases-archive__lead { font-size: 18px; line-height: 1.55; color: rgba(255,255,255,.75); max-width: 60ch; margin-top: 20px; }
.cases-archive__empty { color: var(--ink-soft); font-size: 17px; }
.cases-archive__empty a { color: var(--brand-strong); font-weight: 600; }

/* Сетка архива: flex вместо grid, чтобы неполная последняя строка
   (напр. 1 кейс) центрировалась, а не висла сиротой слева.
   Scoped на .cases-archive - главную и посадочные (общий .cases__grid) не трогаем. */
.cases-archive .cases__grid { display: flex; flex-wrap: wrap; justify-content: center; }
.cases-archive .cases__grid .case { flex: 0 1 calc((100% - 40px) / 3); max-width: calc((100% - 40px) / 3); }
@media (max-width: 860px) {
  .cases-archive .cases__grid .case { flex-basis: 100%; max-width: 100%; }
}

/* ---------- Пагинация (архив кейсов) ---------- */
.cases-archive .pagination { margin-top: 44px; }
.cases-archive .pagination .nav-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.cases-archive .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 14px;
  font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-pill);
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
  font-variant-numeric: tabular-nums;
  transition: border-color .18s ease, color .18s ease, transform .18s ease;
}
.cases-archive a.page-numbers:hover { border-color: var(--brand); color: var(--brand-strong); transform: translateY(-2px); }
.cases-archive .page-numbers.current {
  background: linear-gradient(135deg, #f2793a, #d24e0f); border-color: transparent; color: #fff;
}
.cases-archive .page-numbers.dots {
  min-width: auto; padding: 0 4px; border: none; background: none; box-shadow: none; color: var(--ink-soft);
}
.cases-archive .page-numbers.prev, .cases-archive .page-numbers.next { padding: 0 18px; }

/* ---------- Lightbox (клик по картинке кейса) ---------- */
.case-body img, .case-result__shot img { cursor: zoom-in; }
.case-lightbox {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(10, 8, 6, .88); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s ease;
}
.case-lightbox.is-open { opacity: 1; }
.case-lightbox img {
  max-width: min(1200px, 95vw); max-height: 92vh; width: auto; height: auto;
  border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); cursor: zoom-out;
}
.case-lightbox__close {
  position: fixed; top: 18px; right: 22px; width: 44px; height: 44px; padding: 0; border: none; cursor: pointer;
  border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 26px; line-height: 44px;
}
.case-lightbox__close:hover { background: rgba(255, 255, 255, .26); }
@media (prefers-reduced-motion: reduce) { .case-lightbox { transition: none; } }
