/* ==========================================================================
   CASE STUDY PAGES — layout on top of the root styles.css tokens.
   Reuses --divider, --hair, --accent, --expo and the Inter Display /
   JetBrains Mono stacks. Introduces no new colours or fonts.
   ========================================================================== */

.cs-body { background: #000; color: #fff; overflow-x: hidden; }

@media (pointer: fine) {
  body.cs-body, body.cs-body a, body.cs-body button, body.cs-body .btn, body.cs-body .cs-tag, body.cs-body .cs-back, body.cs-body .cs-brand, body.cs-body .cs-figure, body.cs-body video, body.cs-body [role="button"] {
    cursor: none !important;
  }
}

.cs-wrap { max-width: 1120px; margin: 0 auto; }

/* --- Sticky top bar / back link --- */
.cs-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--divider);
}
.cs-nav-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 1.1rem clamp(1.5rem, 5vw, 4rem);
  display: flex; align-items: center; justify-content: space-between;
}
.cs-back, .cs-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #FAF9F5; text-decoration: none;
}
.cs-back { display: inline-flex; align-items: center; gap: 0.5rem; }
.cs-back:hover { opacity: 0.65; }
.cs-brand { color: #888; }

/* --- Hero --- */
.cs-hero {
  padding: clamp(90px, 16vh, 170px) clamp(1.5rem, 5vw, 4rem) clamp(44px, 8vh, 84px);
  border-bottom: 1px solid var(--divider);
}
.cs-hero-meta {
  display: flex; gap: clamp(1rem, 4vw, 3rem); flex-wrap: wrap;
  align-items: baseline;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #999; margin-bottom: 1.75rem;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--divider);
}
.cs-hero-meta .cs-accent { color: #FAF9F5; }
.cs-hero h1 {
  font-family: 'Inter Display', Inter, system-ui, sans-serif;
  font-size: clamp(2.6rem, 7.5vw, 6.2rem); line-height: 0.98;
  letter-spacing: -0.035em; font-weight: 500; color: #fff;
}
.cs-hero-problem {
  margin-top: 1.6rem; max-width: 660px;
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem); line-height: 1.5; color: #c8c8ce;
}
.cs-hero-actions { margin-top: 2.25rem; display: flex; gap: 1rem; flex-wrap: wrap; }

/* --- Generic section --- */
.cs-section {
  padding: clamp(56px, 9vh, 112px) clamp(1.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--divider);
}
.cs-meta {
  display: flex; gap: clamp(1rem, 4vw, 3rem); flex-wrap: wrap; align-items: baseline;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #999;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--divider);
}
.cs-meta .cs-num { color: #FAF9F5; }
.cs-section-title {
  font-family: 'Inter Display', Inter, system-ui, sans-serif;
  font-size: clamp(1.9rem, 4.2vw, 3.1rem); line-height: 1.02;
  letter-spacing: -0.03em; font-weight: 500; color: #fff; margin-top: 1.75rem;
}
.cs-prose p {
  max-width: 700px;
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.7; color: #b8b8be;
  margin-top: 1.3rem;
}

/* --- What I built: numbered list --- */
.cs-list { margin-top: 2.25rem; list-style: none; padding: 0; max-width: 780px; counter-reset: cs; }
.cs-list li {
  display: flex; gap: 1.25rem; align-items: baseline;
  padding: 1.15rem 0; border-top: 1px solid var(--divider);
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(1rem, 2vw, 1.18rem); color: #ddd;
}
.cs-list li:last-child { border-bottom: 1px solid var(--divider); }
.cs-list li::before {
  counter-increment: cs; content: counter(cs, decimal-leading-zero);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.1em; color: #FAF9F5; flex: 0 0 auto; padding-top: 0.15rem;
}

/* --- Metrics grid --- */
.cs-metrics { margin-top: 2.5rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.cs-metric { padding: 1.9rem 1.4rem 1.9rem 0; border-top: 1px solid var(--divider); }
.cs-metric-num {
  font-family: 'Inter Display', Inter, system-ui, sans-serif;
  font-size: clamp(2.2rem, 3.8vw, 3.3rem); font-weight: 500;
  letter-spacing: -0.03em; line-height: 1; color: #fff;
}
.cs-metric-label {
  margin-top: 0.85rem; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #8C8C98; line-height: 1.5;
}

/* --- Figure / diagram slot --- */
.cs-figure {
  margin-top: 2.5rem; border: 1px solid var(--divider); border-radius: 1rem;
  overflow: hidden; background: #08080A; aspect-ratio: 16 / 9;
}
.cs-figure img, .cs-figure video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-figure-cap {
  margin-top: 0.9rem; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #777;
}
.cs-thumbs { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.cs-thumbs figure {
  margin: 0; border: 1px solid var(--divider); border-radius: 0.75rem;
  overflow: hidden; aspect-ratio: 4 / 3; background: #08080A;
}
.cs-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Stack tags --- */
.cs-tags { margin-top: 2.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.cs-tag {
  font-family: 'Inter Display', Inter, system-ui, sans-serif;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: #ccc;
  border: 1px solid var(--divider); border-radius: 999px; padding: 0.6rem 1.15rem;
}

/* --- Client quote --- */
.cs-quote { margin-top: 2.5rem; border-left: 2px solid #FAF9F5; padding-left: 1.6rem; max-width: 660px; }
.cs-quote p {
  font-family: 'Inter Display', Inter, system-ui, sans-serif; font-style: italic;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem); line-height: 1.4; color: #fff;
}
.cs-quote cite {
  display: block; margin-top: 1rem; font-style: normal;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.1em; color: #8C8C98;
}

/* --- Footer CTA --- */
.cs-cta { padding: clamp(70px, 12vh, 140px) clamp(1.5rem, 5vw, 4rem); }
.cs-cta a {
  display: inline-flex; align-items: baseline; gap: 0.5rem;
  font-family: 'Inter Display', Inter, system-ui, sans-serif;
  font-size: clamp(1.7rem, 5vw, 3.3rem); font-weight: 500; letter-spacing: -0.03em;
  color: #fff; text-decoration: none;
}
.cs-cta a:hover { color: #FAF9F5; }
.cs-foot {
  padding: 2rem clamp(1.5rem, 5vw, 4rem); border-top: 1px solid var(--divider);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: #666;
}
.cs-foot a { color: #666; text-decoration: none; }
.cs-foot a:hover { color: #FAF9F5; }

/* --- Responsive --- */
@media (max-width: 860px) {
  .cs-metrics { grid-template-columns: repeat(2, 1fr); }

  /* Mobile Overlapping Sliding Card Deck Animation */
  .cs-section {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 56px;
    background: #0C0C0E !important;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.95);
    margin-bottom: 25vh;
    padding: clamp(36px, 6vh, 60px) clamp(1.25rem, 5vw, 2.5rem);
    will-change: transform, opacity;
    transform-origin: 50% 0%;
    transition: border-color 0.4s var(--expo) !important;
  }
  .cs-section:last-of-type {
    margin-bottom: 8vh;
  }
  .cs-section:nth-of-type(1) { z-index: 1; }
  .cs-section:nth-of-type(2) { z-index: 2; }
  .cs-section:nth-of-type(3) { z-index: 3; }
  .cs-section:nth-of-type(4) { z-index: 4; }
  .cs-section:nth-of-type(5) { z-index: 5; }
  .cs-section:nth-of-type(6) { z-index: 6; }

  .cs-cta {
    position: relative;
    z-index: 10;
    background: #000;
  }
  .cs-foot {
    position: relative;
    z-index: 10;
    background: #000;
  }
}
@media (max-width: 520px) {
  .cs-metrics { grid-template-columns: 1fr; }
  .cs-thumbs { grid-template-columns: 1fr; }
  .cs-metric { padding-right: 0; }
}
