/* =====================================================================
   Image lifecycle diagram (image-management-system)
   Same dark card language as the other diagrams. The source PNG uses
   real product photography for steps 1/2/4 — not reproduced here since
   there's no real asset for it and this site's case studies are kept
   deliberately anonymised (see case_study_voice memory); abstracted to
   the same icon+card vocabulary as the rest of the system instead.
   Functional colour (muted red/green) is used on steps 2 and 4 only,
   matching the source PNG's own red "flag" / green "updated" moments —
   this is one of the diagrams that actually earns the accent, per the
   "functional colour, not decorative" rule in project memory.
   ===================================================================== */

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

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

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

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

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

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

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

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

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

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

.im-subtitle {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--im-muted);
  margin: 0;
}

/* Steps -------------------------------------------------------------- */

.im-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.im-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.im-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--im-bg);
  border: 1px solid var(--im-border);
  color: var(--im-text);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  flex-shrink: 0;
}

.im-step-card {
  width: 100%;
  background: var(--im-card);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
}

.im-step-card .diagram-icon {
  color: var(--im-text);
  margin-bottom: var(--space-1);
}

.im-step-card.im-accent-problem {
  border-color: var(--im-problem);
}

.im-step-card.im-accent-problem .diagram-icon {
  color: var(--im-problem);
}

.im-step-card.im-accent-solution {
  border-color: var(--im-solution);
}

.im-step-card.im-accent-solution .diagram-icon {
  color: var(--im-solution);
}

.im-step-title {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 500;
  margin: 0;
}

.im-step-desc {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--im-muted);
  margin: 0;
}

.im-arrow {
  color: var(--im-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.im-arrow .diagram-icon {
  transform: rotate(90deg);
}

/* Step 3 — decision paths -------------------------------------------- */

.im-paths {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--im-border);
}

.im-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.im-path .diagram-icon {
  color: var(--im-text);
}

.im-path-title {
  font-weight: 500;
  font-size: var(--fs-sm);
}

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

.im-or {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--im-muted);
}

.im-note {
  width: 100%;
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  border: 1px dashed var(--im-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--im-muted);
  text-align: center;
}

/* Desktop — single row, same container-cap-safe breakpoint as the
   other diagrams (see project memory on the 1024–1151px pinch zone) */

@media (min-width: 78rem) {
  .im-steps {
    flex-direction: row;
    align-items: flex-start;
  }

  .im-step {
    flex: 1 1 11rem;
    min-width: 9rem;
  }

  .im-step-wide {
    flex: 1.6 1 16rem;
    min-width: 14rem;
  }

  .im-arrow {
    height: 2.5rem;
  }

  .im-arrow .diagram-icon {
    transform: none;
  }

  .im-paths {
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
  }

  .im-path {
    flex: 1;
  }
}
