/* Parker: страница кейсов. Использует токены и компоненты из site.css */

.cs-page-title { max-width: 16ch; }
.cs-hero .lead { margin-top: 30px; max-width: 50ch; }

/* ---------- Фильтр ---------- */
.cs-section { padding-bottom: clamp(88px, 10vw, 150px); }
.cs-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; margin-bottom: clamp(24px, 3vw, 40px); }
.cs-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-filter .chip { min-height: 42px; padding: 0 18px; font-size: 15px; }
@media (hover: hover) and (pointer: fine) { .cs-filter .chip[aria-pressed="false"]:hover { border-color: var(--text-3); color: var(--text); } }
.cs-filter .chip:active { transform: scale(0.97); }
.cs-count { flex: none; font-size: 15px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Кейс ---------- */
.cs-list { display: grid; gap: clamp(16px, 2vw, 28px); }
.cs {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  transition: border-color 0.3s ease;
}
/* внутри есть кнопки и ссылки: обрезаем без собственной прокрутки */
.cs.glow-card { overflow: clip; }
@media (hover: hover) and (pointer: fine) { .cs:hover { border-color: var(--line-2); } }
.cs[hidden] { display: none; }
.cs.is-shown { animation: cs-in 0.5s var(--ease-out) both; }
@keyframes cs-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.cs-viz { position: relative; min-height: 380px; overflow: clip; background: radial-gradient(120% 100% at 50% 0%, #161b23, #0e1116 70%); border-right: 1px solid var(--line); }
.cs-viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* У схемы датчиков подписи слева: на узком холсте даём ей ширину, правый край обрезается */
.cs-viz canvas[data-viz="sensors"] { right: auto; width: max(100%, 480px); max-width: none; }

.cs-body { display: flex; flex-direction: column; gap: 22px; padding: clamp(24px, 3.2vw, 52px); min-width: 0; }
.cs-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 14px; }
.cs-client { font-weight: 500; color: var(--text-2); }
.cs-term { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-title { font-weight: 400; font-size: clamp(26px, 2.4vw, 38px); letter-spacing: -0.028em; line-height: 1.12; text-wrap: balance; max-width: 24ch; }
.cs-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.cs-metrics dt { font-weight: 330; font-size: clamp(28px, 2.6vw, 42px); letter-spacing: -0.04em; line-height: 1; font-variant-numeric: lining-nums; white-space: nowrap; }
.cs-metrics dd { margin-top: 10px; font-size: 14px; line-height: 1.4; color: var(--text-2); max-width: 20ch; }
.cs-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.cs-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-stack .chip { min-height: 30px; padding: 0 12px; font-size: 13px; }
.cs-toggle, .cs-read { flex: none; }
.cs-toggle { gap: 12px; padding-right: 16px; }
.cs-toggle .acc-icon { width: 16px; height: 16px; }
.cs-toggle .acc-icon::before, .cs-toggle .acc-icon::after { width: 12px; margin-left: -6px; }
.cs-toggle[aria-expanded="true"] .acc-icon::after { transform: rotate(0deg); }

/* Подробности раскрываются на месте, во всю ширину карточки */
.cs-more { grid-column: 1 / -1; display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.5s var(--ease-out); }
.js .cs-more { grid-template-rows: 0fr; }
.js .cs-more.is-open { grid-template-rows: 1fr; }
.cs-more > div { min-height: 0; overflow: clip; }
.cs-more-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px clamp(24px, 3vw, 56px);
  padding: clamp(28px, 3.2vw, 52px); border-top: 1px solid var(--line); background: var(--bg-2);
}
.js .cs-more-grid { opacity: 0; transform: translateY(-6px); transition: opacity 0.35s ease, transform 0.5s var(--ease-out); }
.js .cs-more.is-open .cs-more-grid { opacity: 1; transform: none; transition-delay: 0.08s; }
.cs-more h3 { font-size: 14px; font-weight: 500; color: var(--accent); margin-bottom: 12px; }
.cs-more p { font-size: 16px; line-height: 1.6; color: var(--text-2); max-width: 44ch; text-wrap: pretty; }
.cs-more p + p { margin-top: 12px; }
html:not(.js) .cs-toggle { display: none; }

/* ---------- Пустое состояние фильтра ---------- */
.cs-empty { display: grid; justify-items: start; gap: 12px; padding: clamp(32px, 5vw, 72px); border: 1px dashed var(--line-2); border-radius: var(--r-l); }
.cs-empty[hidden] { display: none; }
.cs-empty-title { font-weight: 400; font-size: clamp(24px, 2.2vw, 32px); letter-spacing: -0.02em; line-height: 1.2; }
.cs-empty p:not(.cs-empty-title) { color: var(--text-2); max-width: 50ch; }
.cs-empty .btn { margin-top: 12px; }

/* ---------- Призыв ---------- */
.cs-cta { border-top: 1px solid var(--line); }
.cs-cta-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px clamp(32px, 5vw, 96px); align-items: end; }
.cs-cta .h2 { font-size: clamp(34px, 3.8vw, 58px); max-width: 17ch; }
.cs-cta-side p { font-size: 18px; line-height: 1.55; color: var(--text-2); max-width: 42ch; }
.cs-cta-side .btn { margin-top: 28px; }

/* Правило .footer a в site.css перекрашивает текст кнопки в серый (контраст 1,9:1). Возвращаем цвет кнопки */

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .cs { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
  .cs-more-grid { grid-template-columns: 1fr 1fr; }
  .cs-more-grid section:last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .cs-toolbar { flex-direction: column; align-items: stretch; }
  .cs-filter {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 36px), transparent);
  }
  .cs-filter::-webkit-scrollbar { display: none; }
  .cs-filter .chip { flex: none; }
  .cs-count { order: -1; }
  .cs { grid-template-columns: 1fr; }
  .cs-viz { min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--line); }
  .cs-cta-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cs-body { gap: 18px; }
  /* "120,000" has to fit a third of the card down to 320px */
  .cs-metrics { gap: 8px; }
  .cs-metrics dt { font-size: clamp(19px, 6.2vw, 28px); }
  .cs-metrics dd { font-size: 13px; }
  .cs-foot { flex-direction: column; align-items: stretch; }
  .cs-toggle, .cs-read { width: 100%; }
  .cs-more-grid { grid-template-columns: 1fr; gap: 24px; }
  .cs-cta-side .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cs.is-shown { animation: none; }
  .js .cs-more-grid { opacity: 1; transform: none; }
}
