/* =====================================================================
   Confidence journey diagram (the-final-step-to-conversion)
   Six stages, each with a header, a "current state" problem and a "new
   experience" solution. Mobile groups all three per stage as one card
   (natural reading order). Desktop re-flows into three aligned rows
   (header row / problem row / solution row) using `display: contents`
   on the per-stage wrapper plus `grid-auto-flow: column` on the grid —
   the three children of each stage become direct grid items and
   auto-place column-by-column, which lines them up by stage without
   needing manual grid-column/row indices per item.
   Functional colour (red/green) is used throughout this one, not just
   on isolated accents — the whole diagram's subject IS a before/after
   confidence contrast, so it earns it per the "functional, not
   decorative" rule in project memory.
   ===================================================================== */

.tcdiagram {
  --tc-bg: #1a1810;
  --tc-card: #221f16;
  --tc-text: #f4efe3;
  --tc-muted: #948d7c;
  --tc-border: #3a3527;
  --tc-radius: 16px;
  --tc-problem: #b8563f;
  --tc-solution: #7c9a5b;

  position: relative;
  background: var(--tc-bg);
  color: var(--tc-text);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: var(--space-6);
  margin: var(--space-4) 0;
}

@media (min-width: 48rem) {
  .tcdiagram { padding: var(--space-8); }
}

@media (min-width: 64rem) {
  .tcdiagram { padding: var(--space-12); }
}

.tcdiagram .diagram-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  flex-shrink: 0;
}

.tc-section-head {
  margin-bottom: var(--space-6);
}

.tc-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tc-muted);
  margin: 0 0 var(--space-2);
}

.tcdiagram h2 {
  font-family: var(--font-display);
  color: var(--tc-text);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}

@media (min-width: 48rem) {
  .tcdiagram h2 { font-size: var(--fs-xl); }
}

@media (min-width: 64rem) {
  .tcdiagram h2 { font-size: var(--fs-2xl); }
}

.tc-subtitle {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--tc-muted);
  margin: 0;
  max-width: 42rem;
}

/* Chart ------------------------------------------------------------ */

.tc-chart {
  display: none;
}

@media (min-width: 48rem) {
  .tc-chart {
    display: block;
    margin: var(--space-6) 0;
  }

  .tc-chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .tc-chart-guide {
    stroke: var(--tc-border);
    stroke-width: 1;
  }

  .tc-chart-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: var(--tc-muted);
  }

  .tc-chart-line-rise {
    fill: none;
    stroke: var(--tc-muted);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
  }

  .tc-chart-line-drop {
    fill: none;
    stroke: var(--tc-problem);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
  }

  .tc-chart-line-recover {
    fill: none;
    stroke: var(--tc-solution);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
  }

  .tc-chart-dot {
    fill: var(--tc-bg);
    stroke: var(--tc-muted);
    stroke-width: 2;
  }

  .tc-chart-dot-problem {
    stroke: var(--tc-problem);
  }

  .tc-chart-dot-solution {
    stroke: var(--tc-solution);
  }
}

/* Legend ------------------------------------------------------------ */

.tc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--tc-muted);
}

.tc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.tc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc-muted);
}

.tc-dot-problem {
  background: var(--tc-problem);
}

.tc-dot-solution {
  background: var(--tc-solution);
}

/* Stage grid ---------------------------------------------------------- */

.tc-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tc-stage-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--tc-card);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: var(--space-4);
}

.tc-stage-group.tc-accent {
  border-color: var(--tc-problem);
}

.tc-stage-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

.tc-stage-header .diagram-icon {
  color: var(--tc-text);
  margin-bottom: var(--space-1);
}

.tc-stage-title {
  font-weight: 600;
  font-size: var(--fs-md);
}

.tc-stage-desc {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--tc-muted);
}

.tc-stage-confidence {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--tc-muted);
  margin-top: var(--space-1);
}

.tc-problem-item,
.tc-solution-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--tc-border);
}

.tc-problem-item .diagram-icon {
  color: var(--tc-problem);
}

.tc-solution-item .diagram-icon {
  color: var(--tc-solution);
}

.tc-problem-item p,
.tc-solution-item p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--tc-muted);
}

/* Desktop — three aligned rows via the display:contents trick, same
   container-cap-safe breakpoint as the other diagrams */

@media (min-width: 78rem) {
  .tc-stage-confidence {
    display: none;
  }

  .tc-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    gap: var(--space-3);
    align-items: start;
  }

  .tc-stage-group {
    display: contents;
  }

  .tc-stage-header,
  .tc-problem-item,
  .tc-solution-item {
    background: var(--tc-card);
    border: 1px solid var(--tc-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    height: 100%;
  }

  .tc-accent .tc-stage-header,
  .tc-accent .tc-problem-item {
    border-color: var(--tc-problem);
  }

  .tc-accent .tc-solution-item {
    border-color: var(--tc-solution);
  }

  .tc-problem-item,
  .tc-solution-item {
    border-top: none;
    padding-top: var(--space-3);
    flex-direction: column;
  }
}

/* Result panel ---------------------------------------------------------- */

.tc-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--tc-card);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
}

.tc-result .diagram-icon {
  color: var(--tc-text);
}

.tc-result h3 {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0;
}

.tc-result p {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--tc-muted);
  margin: 0;
}

@media (min-width: 48rem) {
  .tc-result {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-4);
  }
}

/* Outcomes ---------------------------------------------------------------- */

.tc-outcomes {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.tc-outcome-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.tc-outcome-item .diagram-icon {
  color: var(--tc-solution);
}

@media (min-width: 48rem) {
  .tc-outcomes {
    flex-direction: row;
  }

  .tc-outcome-item {
    flex: 1;
  }
}
