/* ============================================================
   CASE STUDIES LISTING PAGE
   New, page-specific components only. Everything scoped under
   .cs-index so nothing here can leak into other pages. Reuses
   existing design tokens (colour, type, spacing, radius, shadow)
   and existing global classes (.case-study-tag, .case-study-link,
   .final-cta-band) from styles.css - see handoff notes for the
   full reused-vs-new list.
   ============================================================ */

.cs-index .page-hero { padding-bottom: 32px; }

/* ---- Resource-type tab row ---- */
.cs-index-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--section-px) 28px;
  max-width: var(--container);
  margin: 0 auto;
}
.cs-index-tab {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  transition: background 150ms ease, color 150ms ease;
}
.cs-index-tab:hover { background: var(--white); color: var(--ink-800); }
.cs-index-tab.is-active {
  background: var(--accent-500);
  color: var(--white);
  font-weight: var(--fw-semibold);
}

/* ---- Filter chip rows ---- */
.cs-filters {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--section-px) 8px;
}
.cs-filter-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.cs-filter-group { flex: 1 1 0; min-width: 0; }
.cs-filter-group-label {
  display: block;
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-3xs);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cs-filter-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  color: var(--ink-800);
  background: var(--white) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23566970" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>') no-repeat right 14px center;
  background-size: 14px;
  border: 1px solid var(--border-strong);
  padding: 10px 38px 10px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color 150ms ease;
}
.cs-filter-select:hover { border-color: var(--accent-500); }
.cs-filter-select:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }

@media (max-width: 900px) {
  .cs-filter-row { flex-direction: column; gap: 0; }
  .cs-filter-group { margin-bottom: 18px; }
  .cs-filter-group:last-of-type { margin-bottom: 0; }
}

.cs-filters-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}
.cs-result-count {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.cs-result-count strong { color: var(--ink-800); font-weight: var(--fw-medium); }
.cs-clear-filters {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  color: var(--accent-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.cs-clear-filters:hover { text-decoration: underline; }
.cs-clear-filters:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }

/* ---- Card list ---- */
.cs-card-list {
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px var(--section-px) 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cs-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.cs-card:hover { box-shadow: var(--shadow-3); transform: translateY(-2px); }

.cs-card-media {
  order: -1;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
}

.cs-card-media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-sunken);
  border: 1px dashed var(--border-subtle);
}
.cs-card-media--placeholder span {
  font-family: var(--font-sans);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cs-card-body { padding: 28px; min-width: 0; }

.cs-card-title {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-h4);
  line-height: 1.3;
  margin: 10px 0 18px;
}
.cs-card-title-link {
  color: var(--ink-800);
  text-decoration: none;
}
.cs-card:hover .cs-card-title-link,
.cs-card-title-link:focus-visible { color: var(--accent-600); text-decoration: underline; }

.cs-card-block { margin-bottom: 16px; }
.cs-card-block-label {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-3xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-600);
  margin-bottom: 4px;
}
.cs-card-block-text {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--slate-500);
}

.cs-card-stats {
  display: flex;
  gap: 24px;
}
.cs-card-stat { min-width: 0; }
.cs-card-stat-value {
  display: block;
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-lg);
  color: var(--accent-500);
  line-height: 1.2;
}
.cs-card-stat-label {
  display: block;
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-3xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stats stay on one row down to small phones; below that, the
   third (least important) stat drops rather than letting all
   three squeeze into illegible columns. */
@media (max-width: 420px) {
  .cs-card-stat:nth-child(3) { display: none; }
}

.cs-card-body .case-study-link { margin-top: 6px; }

@media (min-width: 768px) {
  .cs-card { flex-direction: row; align-items: stretch; }
  .cs-card-body { flex: 0 0 65%; max-width: 65%; order: 1; padding: 36px; }
  .cs-card-media { flex: 0 0 35%; max-width: 35%; order: 2; aspect-ratio: auto; }
}

/* ---- Empty state ---- */
.cs-empty-state {
  display: none;
  max-width: var(--container);
  margin: 0 auto;
  padding: 60px var(--section-px);
  text-align: center;
}
.cs-empty-state.is-visible { display: block; }
.cs-empty-state-text {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  color: var(--ink-800);
  margin-bottom: 20px;
}
.cs-empty-state-clear {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  color: var(--white);
  background: var(--accent-500);
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px 24px;
  cursor: pointer;
  transition: background 150ms ease;
}
.cs-empty-state-clear:hover { background: var(--accent-600); }

@media (prefers-reduced-motion: reduce) {
  .cs-card { transition: none; }
}
