/* ============================================================
   challenges.css
   Bessemer Legacy — Phase 2 Challenge & Case Study Components
   Imported by: challenges/*/index.html, case-studies/detail-template.html
   Design tokens inherited from each page's :root block.
   ============================================================ */

/* ── Dark-section token override ───────────────────────────── */
.challenge-hero,
.challenge-cta {
  --steel:      #6B9BC0;
  --steel-dark: #5A8AAE;
}

/* ============================================================
   CHALLENGE SWITCHER — sticky tab bar below nav
   ============================================================ */
.ch-switcher {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 52px;
  position: sticky;
  top: 72px;
  z-index: 50;
}
.ch-switcher-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
}
.ch-switcher-link {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  padding: 14px 20px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.ch-switcher-link:hover {
  color: var(--charcoal);
}
.ch-switcher-link.active {
  color: var(--charcoal);
  font-weight: 600;
  border-bottom-color: var(--orange);
}
@media (max-width: 768px) {
  .ch-switcher { padding: 0 16px; overflow-x: auto; }
  .ch-switcher-inner { min-width: max-content; }
  .ch-switcher-link { padding: 12px 14px; font-size: 12px; }
}

/* ============================================================
   SECTION 1: CHALLENGE HERO
   ============================================================ */
.challenge-hero {
  background: #3a5773;
  padding: 100px 52px 80px;
  /* top padding accounts for fixed nav (72px) + breathing room */
  padding-top: 144px;
  min-height: 420px;
}

.challenge-hero-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.ch-credential {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel); /* resolves to #6B9BC0 via override */
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ch-credential::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--steel);
  flex-shrink: 0;
}

.ch-h1 {
  font-family: 'Source Serif 4', serif;
  font-weight: 800;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--white);
  max-width: 620px;
  margin-bottom: 20px;
}

.ch-subhead {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.65;
  max-width: 500px;
}

/* ============================================================
   SECTION 2: PROBLEM NARRATIVE
   ============================================================ */
.ch-narrative {
  padding: 80px 52px;
  background: var(--bg);
}

.ch-prose-inner {
  max-width: 680px;
  margin: 0 auto;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
}

.ch-prose-inner p + p {
  margin-top: 16px;
}

.ch-prose-inner strong {
  font-weight: 600;
  color: var(--charcoal);
}

/* ============================================================
   SECTION 3: COST / CONSEQUENCE
   ============================================================ */
.ch-cost {
  padding: 60px 52px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.ch-cost-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 60px;
  align-items: start;
}

.ch-cost-prose {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
}

.ch-cost-prose p + p {
  margin-top: 16px;
}

/* Shared section heading — used in cost, diagnostic, method, outcomes */
.ch-section-h {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  margin-bottom: 24px;
  line-height: 1.2;
}

.ch-cost-callout {
  background: var(--orange-bg);
  border: 1px solid var(--orange-border);
  border-radius: 8px;
  padding: 32px;
  position: sticky;
  top: 92px; /* clear fixed nav */
}

.cost-callout-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 20px;
}

.cost-metric {
  margin-bottom: 20px;
}

.cost-metric:last-child {
  margin-bottom: 0;
}

.cost-metric-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--orange);
  line-height: 1;
}

.cost-metric-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
  line-height: 1.4;
}

/* ============================================================
   SECTION 4: DIAGNOSTIC
   ============================================================ */
.ch-diagnostic {
  padding: 60px 52px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.ch-diag-inner {
  max-width: 800px;
  margin: 0 auto;
}

.ch-diag-intro {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 40px;
}

/* -- Option A: Numbered diagnostic (lead-follow-up, disconnected-systems) -- */
.diagnostic-numbered {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.diag-item {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.diag-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--steel);
  flex-shrink: 0;
  width: 32px;
  line-height: 1.3;
  padding-top: 2px;
}

.diag-content {
  flex: 1;
}

.diag-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 8px;
  line-height: 1.4;
}

.diag-body {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.7;
}

/* -- Option B: Bordered diagnostic (scaling-operations, why-automation-fails) -- */
.diagnostic-bordered {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.diag-bordered-item {
  /* Both border shorthand declarations — second wins, giving left-border emphasis */
  border: 1px solid var(--border);
  border-left: 4px solid var(--steel);
  padding: 20px 24px;
  border-radius: 0 var(--r) var(--r) 0;
}

.diag-bordered-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 8px;
  line-height: 1.4;
}

.diag-bordered-body {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ============================================================
   SECTION 5: METHODOLOGY
   ============================================================ */
.ch-method {
  padding: 60px 52px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.ch-method-inner {
  max-width: 900px;
  margin: 0 auto;
}

.ch-method-intro {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 40px;
}

.phase-blocks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.phase-block {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.phase-block:first-child {
  padding-top: 0;
}

.phase-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.phase-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 6px;
}

.phase-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 8px;
  line-height: 1.4;
}

.phase-body {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.7;
}

.phase-output {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.5;
}

/* ============================================================
   SECTION 6: OUTCOME EVIDENCE
   ============================================================ */
.ch-outcomes {
  padding: 60px 52px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.ch-outcomes-inner {
  max-width: 900px;
  margin: 0 auto;
}

.outcome-metrics {
  display: flex;
  gap: 48px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.outcome-metric {
  flex: 1;
  min-width: 120px;
}

.outcome-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 40px;
  font-weight: 600;
  color: var(--orange);
  line-height: 1;
  display: block;
}

.outcome-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.4;
  display: block;
}

.ch-outcomes-narrative {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 32px;
}

.ch-outcomes-narrative p + p {
  margin-top: 16px;
}

/* Pull quote */
.outcome-quote {
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  background: var(--bg-alt);
  padding: 24px;
  margin: 0 0 20px 0;
  border-radius: 0 var(--r) var(--r) 0;
}

.outcome-quote p {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-style: italic;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 12px;
}

.quote-name {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  font-style: normal;
}

.quote-role {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Victoria's outcome disclaimer — exact text required */
.disclaimer-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ============================================================
   RELATED CHALLENGES ROW
   ============================================================ */
.ch-related {
  padding: 40px 52px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.ch-related-inner {
  max-width: 900px;
  margin: 0 auto;
}

.ch-related-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.ch-related-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.ch-related-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--steel);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.ch-related-link:hover {
  gap: 12px;
}

.ch-related-name {
  /* inline — no special treatment needed */
}

/* ============================================================
   SECTION 7: CTA BLOCK
   ============================================================ */
.challenge-cta {
  background: var(--charcoal);
  padding: 60px 52px;
  text-align: center;
}

.ch-cta-inner {
  max-width: 600px;
  margin: 0 auto;
}

.ch-cta-copy {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--white);
  margin-bottom: 8px;
  line-height: 1.4;
}

.ch-cta-sub {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 28px;
  line-height: 1.6;
}

.ch-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  background: var(--steel); /* resolves to #6B9BC0 via override in .challenge-cta */
  padding: 16px 32px;
  border-radius: var(--r);
  text-decoration: none;
  transition: background 0.2s ease;
}

.ch-cta-btn:hover {
  background: var(--steel-dark);
}

/* ============================================================
   CASE STUDY DETAIL PAGE — Additional Components
   ============================================================ */

/* Context header (light background, unlike challenge hero) */
.cs-header {
  padding: 144px 52px 60px; /* 144px = 72px nav + 72px breathing room */
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.cs-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 20%, black 10%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}

.cs-header-inner {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.cs-context-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-context-tag::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--steel);
  flex-shrink: 0;
}

/* Track A vs Track B attribution variant */
.cs-context-tag.track-a {
  color: var(--charcoal);
}

.cs-h1 {
  font-family: 'Source Serif 4', serif;
  font-weight: 800;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--charcoal); /* light background — dark text, unlike challenge hero */
  max-width: 720px;
  margin-bottom: 16px;
}

.cs-meta-bar {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.cs-meta-bar span + span::before {
  content: ' · ';
}

/* Metrics anchor section */
.cs-metrics-anchor {
  padding: 60px 52px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.cs-metrics-anchor-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-metrics-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-metrics-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--steel);
  flex-shrink: 0;
}

/* Reuses .outcome-metrics/.outcome-val pattern but at 48px */
.cs-metrics-anchor .outcome-val {
  font-size: 48px;
}

/* Challenge narrative section */
.cs-challenge {
  padding: 60px 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.cs-challenge-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-challenge-inner .ch-section-h {
  margin-bottom: 24px;
}

.cs-challenge-prose {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
  margin-bottom: 28px;
  max-width: 680px;
}

.cs-challenge-prose p + p {
  margin-top: 16px;
}

/* Cost callout inline (reuses .ch-cost-callout pattern but inline) */
.cs-cost-inline {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--orange-bg);
  border: 1px solid var(--orange-border);
  border-radius: var(--r);
  padding: 14px 20px;
  margin-top: 8px;
}

.cs-cost-inline-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  color: var(--orange);
  line-height: 1;
}

.cs-cost-inline-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-sub);
}

/* Diagnostic section */
.cs-diagnostic {
  padding: 60px 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.cs-diagnostic-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-diagnostic-prose {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 680px;
  margin-bottom: 28px;
}

.cs-diagnostic-prose p + p {
  margin-top: 16px;
}

/* "The Structural Issue" callout box */
.cs-diag-callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--steel);
  background: var(--bg-alt);
  padding: 24px;
  border-radius: 0 var(--r) var(--r) 0;
  max-width: 680px;
}

.cs-diag-callout-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 10px;
}

.cs-diag-callout-text {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--charcoal);
  line-height: 1.65;
  font-weight: 500;
}

/* Approach and architecture section */
.cs-approach {
  padding: 60px 52px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.cs-approach-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-approach-intro {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 680px;
}

/* cs-approach reuses .phase-blocks and .phase-block from above */

/* Results and verification section */
.cs-results {
  padding: 60px 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.cs-results-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-results-narrative {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
  margin-bottom: 32px;
  max-width: 680px;
}

.cs-results-narrative p + p {
  margin-top: 16px;
}

/* Related challenge link (single link, not the two-link row) */
.cs-related-challenge {
  padding: 40px 52px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.cs-related-challenge-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cs-related-challenge-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.cs-related-challenge-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--steel);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.cs-related-challenge-link:hover {
  gap: 12px;
}

/* SMB card "Read full case study" link — added to case-studies.html */
.smb-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--steel);
  text-decoration: none;
  margin-top: 16px;
  transition: gap 0.2s ease;
}

.smb-card-link:hover {
  gap: 10px;
}

/* ============================================================
   MOBILE BREAKPOINTS
   ============================================================ */
@media (max-width: 768px) {
  /* Section padding */
  .challenge-hero,
  .ch-narrative,
  .ch-cost,
  .ch-diagnostic,
  .ch-method,
  .ch-outcomes,
  .challenge-cta,
  .ch-related {
    padding: 60px 24px;
  }

  /* Challenge hero top padding accounts for fixed nav on mobile */
  .challenge-hero {
    padding-top: 100px;
    min-height: 480px;
  }

  .ch-subhead {
    font-size: 16px;
    line-height: 1.5;
  }

  /* Gradient scrim sits between image (::before) and text — backs the copy */
  .challenge-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #3a5773 45%, rgba(58, 87, 115, 0) 75%);
    pointer-events: none;
  }

  /* Cost section: stack columns */
  .ch-cost-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Cost callout: remove orange background on mobile, keep border */
  .ch-cost-callout {
    background: transparent;
    border-color: var(--orange-border);
    padding: 20px;
    position: static; /* remove sticky on mobile */
  }

  /* Outcome metrics: stack */
  .outcome-metrics {
    flex-direction: column;
    gap: 24px;
  }

  /* CTA button: full width */
  .ch-cta-btn {
    width: 100%;
    justify-content: center;
  }

  /* Related links: stack */
  .ch-related-links {
    flex-direction: column;
    gap: 12px;
  }

  /* Case study sections */
  .cs-header,
  .cs-metrics-anchor,
  .cs-challenge,
  .cs-diagnostic,
  .cs-approach,
  .cs-results,
  .cs-related-challenge {
    padding: 60px 24px;
  }

  .cs-header {
    padding-top: 100px;
  }

  .cs-metrics-anchor .outcome-metrics {
    flex-direction: column;
    gap: 24px;
  }

  .cs-metrics-anchor .outcome-val {
    font-size: 40px; /* reduce from 48px on mobile */
  }
}

@media (max-width: 480px) {
  .ch-h1 {
    font-size: 28px;
  }

  .ch-section-h {
    font-size: 22px;
  }

  .outcome-val {
    font-size: 32px;
  }

  .cs-h1 {
    font-size: 28px;
  }
}
