/* ===========================================================
   case-study.css — Asymmetric split-screen with sticky right column.
   Left: scrolling narrative (story + metrics + quote).
   Right: sticky visual that morphs from "before" to "after" as user scrolls.
   =========================================================== */

.case-study {
  position: relative;
  padding: 120px var(--section-pad-x) 100px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.case-study-index {
  position: absolute;
  top: 120px; left: var(--section-pad-x);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gray);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.case-study-index span { color: var(--orange); }

.case-study-head {
  max-width: var(--container-max);
  margin: 0 auto 80px;
  padding-left: 40px;
}
.case-study-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
}
.case-study-eyebrow::before {
  content: ''; display: inline-block;
  width: 30px; height: 1px; background: var(--orange);
}
.case-study-eyebrow .repr {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--orange);
  padding: 4px 8px;
  border: 1px dashed var(--orange);
  margin-left: auto;
}

.case-study-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(40px, 5.4vw, 78px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--gray-deep);
  max-width: 1100px;
}
.case-study-title .orange { color: var(--orange); }
.case-study-title .light { font-weight: 400; color: var(--gray); }

/* === Split layout =============================================== */
.case-study-split {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 40px;
  display: grid;
  grid-template-columns: 1fr 540px;
  gap: 80px;
  /* No align-items here — sticky needs the grid cell to be tall
     (matching the narrative column) so the visual has room to stick within. */
}

.case-study-narrative {
  display: flex; flex-direction: column;
  gap: 90px;
}

.case-study-visual {
  position: sticky;
  top: 110px;
  /* Constrain height so the sticky element doesn't try to occupy the
     full grid cell — that would defeat the sticky behavior. */
  height: fit-content;
  max-height: calc(100vh - 130px);
}

/* === Narrative blocks =========================================== */
.cs-block {
  display: flex; flex-direction: column;
  gap: 18px;
}
.cs-block-num {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--orange);
  display: flex; align-items: center; gap: 12px;
}
.cs-block-num::before {
  content: ''; display: inline-block;
  width: 24px; height: 1px; background: var(--orange);
}
.cs-block-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--gray-deep);
}
.cs-block-body {
  font-size: 16px;
  line-height: 1.65;
  color: var(--gray);
  max-width: 560px;
}
.cs-block-body strong {
  color: var(--gray-deep); font-weight: 600;
}

/* Before/After columns inside the "the situation" block */
.cs-before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 12px;
}
.cs-ba-col {
  border: 1px solid var(--rule-strong);
  padding: 20px 22px;
  background: var(--bone);
}
.cs-ba-col.after { background: var(--paper); border-color: var(--orange); position: relative; }
.cs-ba-col.after::before {
  content: ''; position: absolute;
  top: -4px; left: -4px; right: 4px; bottom: 4px;
  border: 1px solid var(--orange);
  z-index: -1;
}
.cs-ba-label {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 12px;
}
.cs-ba-col.after .cs-ba-label { color: var(--orange); }
.cs-ba-text {
  font-size: 14px; line-height: 1.55;
  color: var(--gray-deep);
}

/* Engagement phases — horizontal chip row */
.cs-phases {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.cs-phase {
  border: 1px solid var(--rule-strong);
  padding: 16px 14px;
  background: var(--paper);
  position: relative;
  transition: border-color 0.25s, transform 0.25s var(--ease-out);
}
.cs-phase:hover { border-color: var(--orange); transform: translateY(-2px); }
.cs-phase-num {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--orange);
  margin-bottom: 8px;
}
.cs-phase-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--gray-deep);
  margin-bottom: 4px;
}
.cs-phase-desc {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.4;
}

/* Pull quote */
.cs-quote {
  position: relative;
  padding: 32px 0 32px 40px;
  border-left: 3px solid var(--orange);
}
.cs-quote-mark {
  position: absolute;
  top: 16px; left: -2px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 70px;
  line-height: 1;
  color: var(--orange);
  opacity: 0.18;
  pointer-events: none;
}
.cs-quote-text {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.35;
  letter-spacing: -0.025em;
  color: var(--gray-deep);
  margin-bottom: 20px;
  max-width: 600px;
}
.cs-quote-attr {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gray);
  display: flex; flex-direction: column;
  gap: 4px;
}
.cs-quote-attr strong {
  color: var(--gray-deep); font-weight: 600;
}

/* Metrics grid */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule-strong);
  border: 1px solid var(--rule-strong);
}
.cs-metric {
  background: var(--paper);
  padding: 24px 22px;
  display: flex; flex-direction: column;
  gap: 6px;
}
.cs-metric-label {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gray);
}
.cs-metric-value {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--gray-deep);
}
.cs-metric-value .unit {
  font-size: 0.5em; color: var(--orange);
  font-weight: 600; margin-left: 4px;
}
.cs-metric-note {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.4;
  margin-top: 4px;
}

/* CTA out */
.cs-cta {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 22px 32px;
  background: var(--orange);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  position: relative;
  transition: all 0.3s var(--ease-out);
  border: 1px solid var(--orange);
  align-self: flex-start;
}
.cs-cta::after {
  content: ''; position: absolute;
  top: 6px; left: 6px; right: -6px; bottom: -6px;
  border: 1px solid var(--gray-deep);
  z-index: -1;
  transition: all 0.3s var(--ease-out);
}
.cs-cta:hover { background: var(--gray-deep); border-color: var(--gray-deep); }
.cs-cta:hover::after {
  top: 0; left: 0; right: 0; bottom: 0;
  border-color: var(--orange);
}
.cs-cta svg { transition: transform 0.3s; }
.cs-cta:hover svg { transform: translateX(4px); }

/* === STICKY VISUAL ============================================== */
.cs-visual-frame {
  border: 1px solid var(--rule-strong);
  background: var(--bone);
  position: relative;
  padding: 24px;
  min-height: 600px;
  display: flex; flex-direction: column;
}
.cs-visual-head {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gray);
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--rule);
  margin-bottom: 24px;
}
.cs-visual-head-left { display: flex; align-items: center; gap: 8px; }
.cs-visual-dot {
  width: 7px; height: 7px; background: var(--orange);
  border-radius: 50%;
  animation: hero-blink 2s infinite;
}

/* Stage indicators */
.cs-stage-row {
  display: flex; gap: 6px;
  margin-bottom: 24px;
}
.cs-stage-dot {
  flex: 1;
  height: 3px;
  background: var(--bone-deep);
  position: relative;
  overflow: hidden;
}
.cs-stage-dot.active { background: var(--orange); }
.cs-stage-dot.done { background: var(--gray-deep); }

/* The morphing diagram itself */
.cs-diagram {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}
.cs-diagram svg {
  width: 100%;
  max-width: 480px;
  height: auto;
}

/* Each "scene" overlays the same space; only one visible at a time */
.cs-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.cs-scene.active { opacity: 1; }

.cs-visual-foot {
  display: flex; justify-content: space-between;
  padding-top: 16px;
  margin-top: 24px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gray);
}
.cs-visual-foot .ts { color: var(--orange); }

/* Animated lines between system nodes (after-state) */
@keyframes pulse-line {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.cs-pulse { animation: pulse-line 2s ease-in-out infinite; }
.cs-pulse-2 { animation: pulse-line 2s ease-in-out infinite 0.5s; }
.cs-pulse-3 { animation: pulse-line 2s ease-in-out infinite 1s; }

/* === Responsive ================================================ */
@media (max-width: 1100px) {
  .case-study-split {
    grid-template-columns: 1fr;
    gap: 60px;
  }
  .case-study-visual {
    position: static;
    order: -1;
  }
  .cs-visual-frame { min-height: 480px; }
}
@media (max-width: 768px) {
  .case-study { padding: 80px var(--section-pad-x) 70px; }
  .case-study-index { display: none; }
  .case-study-head { padding-left: 0; margin-bottom: 50px; }
  .case-study-eyebrow .repr { display: none; }
  .case-study-split { padding-left: 0; gap: 40px; }
  .case-study-narrative { gap: 60px; }
  .cs-before-after { grid-template-columns: 1fr; }
  .cs-phases { grid-template-columns: 1fr 1fr; }
  .cs-metrics { grid-template-columns: 1fr; }
  .cs-quote { padding-left: 24px; }
  .cs-quote-mark { display: none; }
}
