/* ============================================================
   INFOGRAPHICS & CODE CARDS (FLOWS, TREES, CODE)
   ============================================================ */

/* Flowchart Infographics */
.infographic-flow {
  margin: 28px 0;
  padding: 24px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(13, 22, 35, 0.95), rgba(8, 14, 23, 0.98));
  border: 1px solid rgba(111, 229, 255, 0.22);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.flow-steps-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 620px;
  margin: 0 auto;
}

.flow-step-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.flow-step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #041019;
  background: linear-gradient(135deg, #6fe5ff, #38bdf8);
  box-shadow: 0 0 16px rgba(111, 229, 255, 0.4);
}

.flow-step-badge.final {
  background: linear-gradient(135deg, #86efac, #22c55e);
  box-shadow: 0 0 16px rgba(134, 239, 172, 0.4);
}

.flow-step-box {
  flex: 1;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(22, 34, 52, 0.85);
  border: 1px solid rgba(111, 229, 255, 0.18);
  color: #edf5ff;
  font-weight: 600;
  font-size: 0.96rem;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.flow-step-box:hover {
  border-color: rgba(111, 229, 255, 0.5);
  transform: translateY(-1px);
  background: rgba(28, 44, 68, 0.95);
}

.flow-step-box.flow-step-start {
  border-left: 4px solid #6fe5ff;
}

.flow-step-box.flow-step-end {
  border-left: 4px solid #86efac;
}

.flow-step-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6fe5ff;
  padding: 2px 0 2px 46px;
  width: 100%;
  opacity: 0.85;
}

.flow-footer-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed rgba(111, 229, 255, 0.2);
}

.flow-footer-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(111, 229, 255, 0.1);
  border: 1px solid rgba(111, 229, 255, 0.25);
  color: #a7f3d0;
  font-size: 0.84rem;
  font-weight: 600;
}

/* Tree Infographics */
.infographic-tree {
  margin: 28px 0;
  padding: 24px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(13, 22, 35, 0.95), rgba(8, 14, 23, 0.98));
  border: 1px solid rgba(127, 232, 199, 0.25);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.tree-root-card {
  text-align: center;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(23, 40, 60, 0.9), rgba(15, 27, 42, 0.9));
  border: 1px solid rgba(127, 232, 199, 0.35);
  max-width: 440px;
  margin: 0 auto 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tree-root-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #7fe8c7;
  background: rgba(127, 232, 199, 0.15);
  border: 1px solid rgba(127, 232, 199, 0.3);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.tree-root-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f0fdf4;
  letter-spacing: -0.02em;
}

.tree-branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.tree-branch-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(18, 29, 44, 0.85);
  border: 1px solid rgba(127, 232, 199, 0.2);
  color: #e2e8f0;
  font-size: 0.93rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tree-branch-card:hover {
  background: rgba(26, 42, 64, 0.95);
  border-color: rgba(127, 232, 199, 0.45);
  transform: translateY(-2px);
}

.tree-branch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fe8c7;
  box-shadow: 0 0 10px #7fe8c7;
}

/* Note Code Card (Replaces awkward centered typewriter) */
.note-code-card {
  margin: 20px 0 24px;
  border-radius: 14px;
  background: #080f18;
  border: 1px solid rgba(143, 169, 206, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(16, 26, 40, 0.9);
  border-bottom: 1px solid rgba(143, 169, 206, 0.16);
}

.code-card-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-card-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-card-dots .dot.red { background: #ef4444; }
.code-card-dots .dot.yellow { background: #f59e0b; }
.code-card-dots .dot.green { background: #10b981; }

.code-card-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #6fe5ff;
  text-transform: uppercase;
}

.note-code-card pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
  text-align: left;
}

.note-code-card pre code {
  font-family: var(--font-mono, "JetBrains Mono", Consolas, monospace);
  font-size: 0.94rem;
  line-height: 1.65;
  color: #edf5ff;
  white-space: pre;
}

/* Fallback .note-flow modern upgrade */
.note-flow {
  margin: 20px 0 24px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #0b1422;
  border: 1px solid rgba(111, 229, 255, 0.2);
  color: #f1f7ff;
  font-family: var(--font-mono, "JetBrains Mono", Consolas, monospace);
  font-size: 0.95rem;
  line-height: 1.65;
  text-align: left;
  white-space: pre-wrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* Light Theme Overrides */
.theme-light .infographic-flow,
.theme-light .infographic-tree,
.theme-light .note-code-card,
body.reader-page.theme-light .infographic-flow,
body.reader-page.theme-light .infographic-tree,
body.reader-page.theme-light .note-code-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06) !important;
}

.theme-light .flow-step-box,
body.reader-page.theme-light .flow-step-box {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

.theme-light .flow-step-box:hover,
body.reader-page.theme-light .flow-step-box:hover {
  background: #f1f5f9 !important;
  border-color: #0284c7 !important;
}

.theme-light .flow-step-connector,
body.reader-page.theme-light .flow-step-connector {
  color: #0284c7 !important;
}

.theme-light .tree-root-card,
body.reader-page.theme-light .tree-root-card {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}

.theme-light .tree-root-badge,
body.reader-page.theme-light .tree-root-badge {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #15803d !important;
}

.theme-light .tree-root-title,
body.reader-page.theme-light .tree-root-title {
  color: #14532d !important;
}

.theme-light .tree-branch-card,
body.reader-page.theme-light .tree-branch-card {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.theme-light .tree-branch-dot,
body.reader-page.theme-light .tree-branch-dot {
  background: #10b981 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4) !important;
}

.theme-light .code-card-header,
body.reader-page.theme-light .code-card-header {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

.theme-light .code-card-tag,
body.reader-page.theme-light .code-card-tag {
  color: #0284c7 !important;
}

.theme-light .note-code-card pre code,
body.reader-page.theme-light .note-code-card pre code {
  color: #0f172a !important;
}

.theme-light .note-flow,
body.reader-page.theme-light .note-flow {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Mobile Infographics Refinement */
@media (max-width: 640px) {
  .infographic-flow {
    padding: 16px 12px;
    margin: 20px 0;
  }

  .flow-step-box {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .flow-step-badge {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .flow-step-connector {
    padding: 2px 0 2px 38px;
  }

  .tree-branches-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .infographic-flow {
    padding: 14px 10px;
  }

  .flow-step-item {
    gap: 8px;
  }

  .flow-step-badge {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .flow-step-box {
    padding: 8px 12px;
    font-size: 0.86rem;
  }

  .flow-step-connector {
    padding: 2px 0 2px 32px;
  }
}
