/* Case studies: homepage index + carousel (#case-studies) and detail pages
   (case-studies/*.html). Ported 1:1 from the previous site, so sizes are in px
   (this site sets html{font-size:65%}) and colors live in local --cs-* vars. */

.csh,
.csd {
  --cs-paper: #d4dad7;
  --cs-paper-card: #e6e9e7;
  --cs-paper-deep: #c3c8d3;
  --cs-ink: #3c434f;
  --cs-ink-soft: #4d5564;
  --cs-ink-mute: #6e7583;
  --cs-rule: #bfc5c6;
  --cs-sage: #5f6e5a;
  --cs-sage-soft: #9aa797;
  --cs-display: "Host Grotesk", Helvetica, Arial, sans-serif;
  --cs-sub: "Space Grotesk", Helvetica, Arial, sans-serif;
  --cs-text: "Open Sans", Helvetica, Arial, sans-serif;
}
.csh h2,
.csh h3,
.csd h1,
.csd h2,
.csd h3 {
  text-wrap: wrap;
}

/* ───────────── Homepage section ───────────── */
.csh__head {
  margin-bottom: clamp(3rem, 5vw, 5.6rem);
}
.csh__title {
  font-size: var(--t-2xl);
  max-width: 14ch;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
}

/* index (accordion list) */
.cs-index {
  background: #ffffff;
  border: 1px solid var(--cs-rule);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 48px;
  font-family: var(--cs-text);
}
.cs-index__row + .cs-index__row {
  border-top: 1px solid var(--cs-rule);
}
.cs-index__line {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 28px;
}
.cs-index__num {
  flex: 0 0 auto;
  width: 28px;
  font-size: 12.5px;
  color: var(--cs-ink-mute);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.cs-index__main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cs-index__title {
  font-family: var(--cs-display);
  font-weight: 500;
  font-size: 16.5px;
  line-height: 1.3;
  color: var(--cs-ink);
  transition: color 0.15s;
}
.cs-index__title:hover {
  color: var(--cs-sage);
}
.cs-index__toggle {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cs-text);
  font-size: 16px;
  line-height: 1;
  color: var(--cs-ink-soft);
  transition: color 0.15s;
}
.cs-index__toggle:hover {
  color: var(--cs-sage);
}
.cs-index__panel {
  padding: 0 28px 20px 76px;
}
.cs-index__panel[hidden] {
  display: none;
}
.cs-index__panel p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--cs-ink-soft);
  margin: 0;
  max-width: 640px;
}

/* carousel */
.cs-carousel {
  position: relative;
  font-family: var(--cs-text);
}
.cs-carousel__track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 4px 12px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 5%,
    #000 95%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 5%,
    #000 95%,
    transparent
  );
}
.cs-carousel__track::-webkit-scrollbar {
  display: none;
}
.cs-card {
  flex: 0 0 clamp(258px, 74vw, 320px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--cs-paper-card);
  border: 1px solid var(--cs-rule);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(48, 54, 64, 0.04);
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}
.cs-card:hover {
  transform: translateY(-6px);
  border-color: var(--cs-sage);
  box-shadow:
    0 1px 2px rgba(48, 54, 64, 0.05),
    0 26px 46px -30px rgba(48, 54, 64, 0.45);
}
.cs-card__thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--cs-paper-deep);
  overflow: hidden;
}
.cs-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-card__tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
  background: linear-gradient(
    160deg,
    rgba(202, 215, 225, 0.3) 0%,
    rgba(110, 125, 106, 0.16) 55%,
    rgba(132, 124, 144, 0.2) 100%
  );
}
.cs-card__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(48, 54, 64, 0.06) 3px,
    rgba(48, 54, 64, 0.06) 4px
  );
}
.cs-card__call {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: var(--cs-paper);
  background: rgba(48, 54, 64, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: 4px 9px;
  border-radius: 6px;
}
.cs-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}
.cs-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cs-card__label {
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cs-sage);
}
.cs-card__dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--cs-sage-soft);
}
.cs-card__title {
  font-family: var(--cs-display);
  font-weight: 500;
  font-size: 18.5px;
  line-height: 1.25;
  letter-spacing: normal;
  color: var(--cs-ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-card__open {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--cs-rule);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--cs-sage);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cs-card__arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}
.cs-card:hover .cs-card__arrow {
  transform: translateX(4px);
}
.cs-carousel__nav {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--cs-rule);
  background: var(--cs-paper);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(48, 54, 64, 0.12);
  color: var(--cs-ink);
  font-size: 16px;
  line-height: 1;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}
.cs-carousel__nav--prev {
  left: -4px;
}
.cs-carousel__nav--next {
  right: -4px;
}
.cs-carousel__nav:hover:not(:disabled) {
  background: var(--cs-sage);
  color: var(--cs-paper);
}
.cs-carousel__nav:disabled {
  opacity: 0;
  pointer-events: none;
}

/* ───────────── Detail pages ───────────── */
.csd {
  --cs-d-paper: #ffffff;
  --cs-d-card: #cad7e1;
  --cs-d-header: #d4dad7;
  --cs-d-ink: #4d5564;
  --cs-d-body: #242424;
  --cs-d-mute: #9994a3;
  --cs-d-rule: #c2c7d4;
  --cs-d-sage: #99a696;
  background: var(--cs-d-paper);
  color: var(--cs-d-body);
  font-family: var(--cs-text);
  font-size: 16px;
  line-height: 1.5;
}
.csd-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 48px;
}

.csd-head {
  padding: 110px 0 64px;
  border-bottom: 1px solid var(--cs-d-rule);
  background: var(--cs-d-header);
}
.csd-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-family: var(--cs-sub);
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--cs-d-sage);
}
.csd-kicker {
  font-family: var(--cs-sub);
  font-size: 11.5px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cs-d-sage);
  margin-bottom: 24px;
}
.csd-title {
  font-family: var(--cs-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.1;
  margin: 0 0 20px;
  color: var(--cs-d-ink);
  max-width: 860px;
}
.csd-sub {
  font-family: var(--cs-sub);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.6;
  color: var(--cs-d-ink);
  margin: 0;
  max-width: 680px;
}

.csd-article {
  padding: 64px 0 80px;
}
.cs-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 48px;
  color: var(--cs-d-body);
}
.cs-body p {
  font-size: 16.8px;
  font-weight: 400;
  line-height: 1.85;
  margin: 0 0 21.6px;
  color: var(--cs-d-body);
}
.cs-body .cs-heading {
  font-family: var(--cs-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--cs-d-ink);
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.cs-body > div:first-child .cs-heading {
  margin-top: 0;
}
.cs-body .cs-heading strong,
.cs-body .cs-heading b {
  color: inherit;
  font-weight: 400;
}
.cs-body h1,
.cs-body h2 {
  font-family: var(--cs-display);
  font-size: 22.4px;
  font-weight: 400;
  color: var(--cs-d-ink);
  margin: 40px 0 12px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cs-d-rule);
}
.cs-body h3 {
  font-family: var(--cs-sub);
  font-size: 18.4px;
  font-weight: 300;
  color: var(--cs-d-ink);
  margin: 28px 0 8px;
  line-height: 1.5;
  letter-spacing: -0.015em;
}

.cs-body .cs-steps-grid {
  display: flex;
  flex-direction: column;
  margin: 40px 0;
}
.cs-body .cs-steps-grid > div {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--cs-d-rule);
}
.cs-body .cs-steps-grid > div:first-child {
  padding-top: 0;
}
.cs-body .cs-steps-grid > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.cs-body .cs-steps-grid .number {
  flex: 0 0 auto;
  width: 36px;
  font-family: var(--cs-sub);
  font-size: 13.6px;
  font-weight: 400;
  color: var(--cs-d-mute);
  letter-spacing: 0.02em;
  margin: 0;
  padding-top: 3.2px;
  line-height: 1.5;
}
.cs-body .cs-steps-grid p,
.cs-body .cs-steps-grid h3 {
  font-family: var(--cs-text);
  font-size: 16.8px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.85;
  color: var(--cs-d-body);
  margin: 0;
  flex: 1 1 auto;
}

.cs-body ul {
  margin: 12px 0 21.6px;
  padding-left: 0;
}
.cs-body ul li {
  list-style: none;
  padding-left: 22.4px;
  position: relative;
  font-size: 16.8px;
  font-weight: 400;
  color: var(--cs-d-body);
  line-height: 1.8;
  margin-bottom: 8px;
}
.cs-body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10.4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cs-d-sage);
}
.cs-body ol {
  margin: 12px 0 21.6px 24px;
  padding: 0;
}
.cs-body ol li {
  list-style: decimal;
  font-size: 16.8px;
  font-weight: 400;
  color: var(--cs-d-body);
  line-height: 1.8;
  margin-bottom: 8px;
}
.cs-body strong,
.cs-body b {
  font-weight: 600;
  color: var(--cs-d-ink);
}
.cs-body em {
  font-style: italic;
  color: var(--cs-d-body);
}
.cs-body a {
  color: var(--cs-d-sage);
  text-decoration: underline;
}
.cs-body a:hover {
  color: var(--cs-d-ink);
}
.cs-body img {
  max-width: 100%;
  height: auto;
  margin: 40px auto;
  display: block;
  border: 1px solid var(--cs-d-rule);
  border-radius: 6px;
}
.cs-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
}
.cs-body td,
.cs-body th {
  padding: 12.8px 16px;
  border: 1px solid var(--cs-d-rule);
  font-size: 15.2px;
  color: var(--cs-d-body);
  text-align: left;
  line-height: 1.5;
}
.cs-body th {
  background: var(--cs-d-ink);
  color: #ffffff;
  font-weight: 300;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.07em;
  font-family: var(--cs-sub);
}
.cs-body tr:nth-child(even) td {
  background: var(--cs-d-paper);
}
.cs-body blockquote {
  border-left: 3px solid var(--cs-d-sage);
  padding: 16px 24px;
  margin: 32px 0;
  background: rgba(153, 166, 150, 0.08);
  font-style: italic;
  font-size: 16.8px;
  color: var(--cs-d-body);
  border-radius: 0 6px 6px 0;
}

.cs-video {
  margin: 48px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--cs-d-rule);
}
.cs-video__frame {
  aspect-ratio: 16 / 9;
}
.cs-video iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.cs-metrics {
  text-align: center;
  margin: 48px 0;
  padding: 48px 32px;
  background: var(--cs-d-card);
  border: 1px solid var(--cs-d-rule);
  border-radius: 8px;
}
.cs-body .cs-metrics__title {
  font-family: var(--cs-sub);
  color: var(--cs-d-ink);
  font-size: 19.2px;
  font-weight: 300;
  margin: 0 0 28px;
  letter-spacing: -0.02em;
  line-height: 1.5;
}
.cs-metrics__row {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}
.cs-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6.4px;
  max-width: 160px;
}
.cs-metric__k,
.cs-metric__cap {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
}
.cs-metric__k {
  color: var(--cs-d-mute);
}
.cs-metric__cap {
  color: var(--cs-d-ink);
  letter-spacing: 0.08em;
  text-align: center;
}
.cs-metric__track {
  stroke: var(--cs-d-rule);
}
.cs-metric__bar {
  stroke: var(--cs-d-sage);
}
.cs-metric__bar.is-animating {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.cs-metric__val {
  fill: var(--cs-d-ink);
  font-family: var(--cs-sub);
  font-size: 19px;
  font-weight: 700;
}

.csd-cta {
  max-width: 860px;
  margin: 48px auto 0;
  padding: 48px 48px 0;
  border-top: 1px solid var(--cs-d-rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
}
.csd-cta__back {
  font-family: var(--cs-sub);
  font-size: 13px;
  font-weight: 300;
  color: var(--cs-d-sage);
}
.csd-cta__btn {
  background: var(--cs-d-ink);
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 5px;
  font-family: var(--cs-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  transition: background 0.18s;
}
.csd-cta__btn:hover {
  background: #242424;
}

.csd-related {
  padding: 80px 0;
  border-top: 1px solid var(--cs-d-rule);
  background: var(--cs-d-card);
}
.csd-related__kicker {
  font-family: var(--cs-sub);
  font-size: 11px;
  color: var(--cs-d-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 300;
  margin-bottom: 40px;
}
.csd-related__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.csd-rcard {
  display: block;
  background: #ffffff;
  border: 1px solid var(--cs-d-rule);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.csd-rcard:hover {
  box-shadow: 0 4px 24px rgba(77, 85, 100, 0.15);
}
.csd-rcard__thumb {
  aspect-ratio: 16 / 9;
  background: var(--cs-d-header);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.csd-rcard__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.csd-rcard__body {
  padding: 20px 24px 24px;
  border-top: 1px solid var(--cs-d-rule);
}
.csd-rcard__title {
  font-family: var(--cs-sub);
  font-weight: 300;
  font-size: 15px;
  color: var(--cs-d-ink);
  line-height: 1.4;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.csd-rcard__more {
  font-family: var(--cs-sub);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--cs-d-sage);
}

.page-case-study .footer {
  margin-top: clamp(4rem, 8vw, 7rem);
}

@media (max-width: 680px) {
  .csd-container {
    padding: 0 24px;
  }
  .cs-body {
    padding: 0 24px;
  }
  .csd-cta {
    padding: 40px 24px 0;
  }
  .csd-related__grid {
    grid-template-columns: 1fr;
  }
  .cs-index__line {
    padding: 16px 20px;
    gap: 14px;
  }
  .cs-index__panel {
    padding: 0 20px 18px 62px;
  }
}
@media (max-width: 900px) and (min-width: 681px) {
  .csd-related__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs-card,
  .cs-card__arrow,
  .cs-carousel__nav,
  .cs-metric__bar.is-animating {
    transition: none;
  }
  .cs-carousel__track {
    scroll-behavior: auto;
  }
}

/* homepage "view all" link under the carousel; index page top clearance for the fixed nav */
.page-case-studies .csh {
  padding-top: clamp(10rem, 14vw, 14rem);
}
.csh__intro {
  max-width: 52ch;
  margin-bottom: clamp(2rem, 3.5vw, 3.2rem);
}
