/* ============================================================
   CallD.AI — Diagram Components
   Architecture SVG, Signal Flow pipeline, voice bars
   ============================================================ */

/* ── Architecture diagram (hero) ── */
.arch-diagram {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.arch-diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

/* SVG wires and flow animations */
.arch-wire {
  stroke: rgba(20, 40, 60, 0.18);
  stroke-width: 2;
  fill: none;
}

.arch-flow {
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 10 22;
  fill: none;
  filter: drop-shadow(0 10px 18px rgba(20, 40, 60, 0.12));
}

.arch-flow--a { stroke: var(--c-teal); animation: dash 2.8s linear infinite; }
.arch-flow--b { stroke: var(--c-blue);   animation: dash 3.0s linear infinite; }
.arch-flow--c { stroke: var(--c-purple); animation: dash 2.9s linear infinite; }
.arch-flow--d { stroke: var(--c-warm);   animation: dash 3.2s linear infinite; }
.arch-flow--e { stroke: var(--c-blue);   animation: dash 3.4s linear infinite; }

/* Floating pills */
.arch-pill {
  filter: drop-shadow(0 10px 18px rgba(20, 40, 60, 0.10));
  animation: float 6s ease-in-out infinite;
  transform-origin: center;
}

.arch-pill--a { animation-delay: 0s; }
.arch-pill--b { animation-delay: -2.2s; }
.arch-pill--c { animation-delay: -4.1s; }

/* Center glow */
.arch-glow {
  animation: pulse 3.2s ease-in-out infinite;
  transform-origin: 50% 50%;
}

/* ── Signal Flow Pipeline ── */
.signal-flow {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border: 2px solid var(--c-border-subtle);
  border-radius: var(--r-xl);
  overflow: hidden;
}

/* Dark header band */
.signal-flow__header {
  background: var(--c-dark);
  padding: var(--sp-12) var(--sp-8) var(--sp-10);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.signal-flow__header .section-label {
  color: var(--c-teal);
}

.signal-flow__header .section-label::before,
.signal-flow__header .section-label::after {
  background-color: var(--c-teal);
}

.signal-flow__header h2 {
  font-family: var(--f-serif);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-regular);
  color: var(--c-cream);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-heading);
  margin-block-end: var(--sp-3);
}

.signal-flow__header h2 em {
  font-style: italic;
  color: var(--c-teal);
}

.signal-flow__header p {
  font-size: var(--fs-base);
  color: var(--c-cream);
  line-height: var(--lh-body);
  max-width: none;
}

/* Cream body with pipeline */
.signal-flow__body {
  background: var(--c-white);
  padding: var(--sp-10) var(--sp-8) var(--sp-12);
}

/* Pipeline track */
.pipeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* Individual node */
.pipeline__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  cursor: default;
  transition: transform 0.18s ease;
}

.pipeline__node:hover {
  transform: translateY(-4px);
}

.pipeline__circle {
  width: 54px;
  height: 54px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(13, 20, 18, 0.06);
}

.pipeline__node:hover .pipeline__circle {
  border-color: var(--c-green);
  background: rgba(0, 100, 98, 0.06);
  box-shadow: 0 0 0 5px rgba(0, 100, 98, 0.06), 0 4px 16px rgba(0, 100, 98, 0.12);
}

.pipeline__circle svg {
  width: 17px;
  height: 17px;
  stroke: var(--c-muted);
  transition: stroke 0.2s;
}

.pipeline__node:hover .pipeline__circle svg {
  stroke: var(--c-green);
}

.pipeline__label {
  margin-block-start: 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--c-muted);
  transition: color 0.2s;
  white-space: nowrap;
}

.pipeline__node:hover .pipeline__label {
  color: var(--c-ink);
}

/* Connector line between nodes — modulating wave */
.pipeline__connector {
  flex: 1;
  position: relative;
  height: 12px;
  align-self: flex-start;
  margin-top: 21px; /* wave center (6px) lands at circle center: 21 + 6 = 27px */
  min-width: 8px;
  background: none;
  overflow: visible;
}

.pipeline__wave-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pipeline__wave-line path {
  stroke: var(--c-border);
  stroke-width: 1;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.pipeline__dot {
  position: absolute;
  top: 1.5px;
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  background: var(--c-green);
  animation: dot-flow-wave 3.2s linear infinite;
}

/* Waveform bookends */
.pipeline__wave {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 46px;
}

.pipeline__wave-label {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--c-muted);
}

/* Voice bars (waveform) */
.voice-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  transform: scale(1.25);
}

.voice-bars--out .voice-bars {
  transform: scale(1.25);
}

.voice-bars--out .voice-bar {
  background: var(--c-warm);
  opacity: 0.7;
}

/* Description strip below pipeline */
.pipeline__desc {
  border-top: 1px solid var(--c-border);
  padding-block-start: var(--sp-6);
  min-height: 140px;
}

.pipeline__desc-hint {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--c-muted);
  letter-spacing: var(--ls-wide);
}

.pipeline__desc-content {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
}

.pipeline__desc-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: rgba(0, 100, 98, 0.06);
  border: 1px solid rgba(0, 100, 98, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline__desc-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--c-green);
}

.pipeline__desc-step {
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--c-green);
  margin-block-end: var(--sp-2);
}

.pipeline__desc-text {
  font-family: var(--f-serif);
  font-size: var(--fs-base);
  color: var(--c-body);
  line-height: 1.6;
  max-width: 50ch;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .signal-flow__header {
    padding: var(--sp-8) var(--sp-6);
  }

  .signal-flow__body {
    padding: var(--sp-8) var(--sp-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pipeline {
    min-width: 620px;
  }
}

@media (max-width: 600px) {
  .arch-diagram {
    border-radius: var(--r-lg);
  }

  .pipeline {
    min-width: 500px;
  }
}

/* ── Voice bars (waveform) ── */
.voice-bar {
  display: inline-block;
  width: 3px;
  border-radius: 1.5px;
  background: var(--c-green);
  opacity: 0.4;
  transform-origin: center;
  animation: bar 1.2s ease-in-out infinite;
}

.voice-bar--muted {
  background: var(--c-muted);
  opacity: 0.3;
}

/* Pipeline node active state (via JS) */
.pipeline__node.is-active .pipeline__circle {
  border-color: var(--c-green);
  background: rgba(0, 100, 98, 0.06);
  box-shadow: 0 0 0 5px rgba(0, 100, 98, 0.06), 0 4px 16px rgba(0, 100, 98, 0.12);
}

.pipeline__node.is-active .pipeline__circle svg {
  stroke: var(--c-green);
}

.pipeline__node.is-active .pipeline__label {
  color: var(--c-ink);
}

/* ── Compact Call Flow (dark section preview) ── */
.callflow {
  width: 100%;
  border-radius: var(--r-xl);
  overflow: visible;
  border: 1px solid rgba(245, 240, 235, 0.08);
}

.callflow__layer {
  display: grid;
  grid-template-columns: 110px 1fr;
  border-bottom: 1px solid rgba(245, 240, 235, 0.06);
}

.callflow__layer:last-child {
  border-bottom: none;
}

/* Layer tab (left column) */
.callflow__tab {
  padding: 14px 14px 14px 16px;
  border-right: 1px solid rgba(245, 240, 235, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.callflow__tab-num {
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  opacity: 0.4;
}

.callflow__tab-name {
  font-family: var(--f-serif);
  font-size: 13px;
  font-weight: var(--fw-regular);
  font-style: italic;
  line-height: 1.3;
}

/* Layer accent tints */
.callflow__layer--green .callflow__tab { background: rgba(0, 100, 98, 0.12); }
.callflow__layer--green .callflow__tab-num { color: rgba(0, 178, 175, 0.7); }
.callflow__layer--green .callflow__tab-name { color: var(--c-teal); }

.callflow__layer--blue .callflow__tab { background: rgba(78, 143, 224, 0.12); }
.callflow__layer--blue .callflow__tab-num { color: rgba(78, 143, 224, 0.7); }
.callflow__layer--blue .callflow__tab-name { color: var(--c-blue); }

.callflow__layer--violet .callflow__tab { background: rgba(139, 110, 199, 0.12); }
.callflow__layer--violet .callflow__tab-num { color: rgba(139, 110, 199, 0.7); }
.callflow__layer--violet .callflow__tab-name { color: var(--c-purple); }

.callflow__layer--amber .callflow__tab { background: rgba(232, 148, 58, 0.12); }
.callflow__layer--amber .callflow__tab-num { color: rgba(232, 148, 58, 0.7); }
.callflow__layer--amber .callflow__tab-name { color: var(--c-warm); }

/* Layer body (right column with nodes) */
.callflow__body {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 0;
  overflow: visible;
  background: rgba(13, 20, 18, 0.5);
}

.callflow__body::-webkit-scrollbar { height: 2px; }
.callflow__body::-webkit-scrollbar-thumb { background: rgba(245, 240, 235, 0.1); }

/* Compact node */
.callflow__node {
  flex-shrink: 0;
  border: 1px solid rgba(245, 240, 235, 0.1);
  border-radius: 5px;
  background: rgba(245, 240, 235, 0.04);
  padding: 7px 11px;
  min-width: 64px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s, border-color 0.15s;
}

.callflow__node:hover {
  background: rgba(245, 240, 235, 0.08);
}

.callflow__node svg {
  flex-shrink: 0;
  display: block;
  width: 13px;
  height: 13px;
}

.callflow__node-label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: rgba(240, 237, 232, 0.85);
  white-space: nowrap;
  line-height: 1.2;
}

.callflow__node-sub {
  font-family: var(--f-mono);
  font-size: 8.5px;
  color: rgba(240, 237, 232, 0.35);
  white-space: nowrap;
}

/* Node accent borders */
.callflow__node--green { border-color: rgba(0, 100, 98, 0.35); }
.callflow__node--green:hover { border-color: rgba(0, 178, 175, 0.5); }
.callflow__node--blue { border-color: rgba(78, 143, 224, 0.35); }
.callflow__node--blue:hover { border-color: rgba(107, 124, 255, 0.5); }
.callflow__node--violet { border-color: rgba(139, 110, 199, 0.35); }
.callflow__node--violet:hover { border-color: rgba(162, 124, 255, 0.5); }
.callflow__node--amber { border-color: rgba(232, 148, 58, 0.35); }
.callflow__node--amber:hover { border-color: rgba(255, 184, 107, 0.5); }

/* Hero node (larger) */
.callflow__node--hero {
  min-width: 80px;
  padding: 9px 14px;
}

.callflow__node--hero .callflow__node-label {
  font-size: 11px;
}

/* Compact connector */
.callflow__cn {
  flex-shrink: 0;
  position: relative;
  width: 24px;
  height: 1px;
}

.callflow__cn-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
}

.callflow__cn-arrow {
  position: absolute;
  right: -1px;
  top: -3px;
  width: 0;
  height: 0;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
}

/* Connector colours */
.callflow__cn--green .callflow__cn-track { background: rgba(0, 100, 98, 0.3); }
.callflow__cn--green .callflow__cn-arrow { border-left: 5px solid rgba(0, 100, 98, 0.6); }
.callflow__cn--blue .callflow__cn-track { background: rgba(78, 143, 224, 0.3); }
.callflow__cn--blue .callflow__cn-arrow { border-left: 5px solid rgba(78, 143, 224, 0.6); }
.callflow__cn--violet .callflow__cn-track { background: rgba(139, 110, 199, 0.3); }
.callflow__cn--violet .callflow__cn-arrow { border-left: 5px solid rgba(139, 110, 199, 0.6); }
.callflow__cn--amber .callflow__cn-track { background: rgba(232, 148, 58, 0.3); }
.callflow__cn--amber .callflow__cn-arrow { border-left: 5px solid rgba(232, 148, 58, 0.6); }
.callflow__cn--dim .callflow__cn-track { background: rgba(245, 240, 235, 0.1); }
.callflow__cn--dim .callflow__cn-arrow { border-left: 5px solid rgba(245, 240, 235, 0.2); }

/* Animated travel dot */
.callflow__cn::after {
  content: '';
  position: absolute;
  top: -2.5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: dot-travel 2.2s ease-in-out infinite;
  opacity: 0;
}

.callflow__cn--green::after { background: var(--c-teal); animation-delay: 0s; }
.callflow__cn--blue::after { background: var(--c-blue); animation-delay: 0.4s; }
.callflow__cn--violet::after { background: var(--c-purple); animation-delay: 0.8s; }
.callflow__cn--amber::after { background: var(--c-warm); animation-delay: 1.2s; }

@keyframes dot-travel {
  0%   { left: 0; opacity: 0; }
  5%   { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { left: calc(100% - 6px); opacity: 0; }
}

/* Decision diamond (compact) */
.callflow__diamond {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.callflow__diamond-shape {
  width: 30px;
  height: 30px;
  background: rgba(232, 148, 58, 0.1);
  border: 1px solid rgba(232, 148, 58, 0.3);
  border-radius: 3px;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.callflow__diamond-shape svg {
  transform: rotate(-45deg);
  width: 12px;
  height: 12px;
}

.callflow__diamond-label {
  font-family: var(--f-mono);
  font-size: 8px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.05em;
  color: var(--c-warm);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
}

/* Fork branches */
.callflow__fork {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 6px;
}

.callflow__fork-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.callflow__agent {
  border: 1px solid rgba(245, 240, 235, 0.1);
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 9.5px;
  font-weight: var(--fw-medium);
  color: rgba(240, 237, 232, 0.7);
  background: rgba(245, 240, 235, 0.04);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callflow__agent-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.callflow__agent--human { border-color: rgba(0, 100, 98, 0.3); }
.callflow__agent--human .callflow__agent-pip { background: var(--c-teal); }
.callflow__agent--ai { border-color: rgba(78, 143, 224, 0.3); }
.callflow__agent--ai .callflow__agent-pip { background: var(--c-blue); }

/* Stats strip below diagram */
.callflow__stats {
  display: flex;
  border-top: 1px solid rgba(245, 240, 235, 0.06);
}

.callflow__stat {
  flex: 1;
  padding: 12px 14px;
  border-right: 1px solid rgba(245, 240, 235, 0.06);
  text-align: center;
}

.callflow__stat:last-child { border-right: none; }

.callflow__stat-num {
  font-family: var(--f-serif);
  font-size: 18px;
  font-weight: var(--fw-regular);
  color: rgba(240, 237, 232, 0.9);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
  line-height: 1;
}

.callflow__stat-label {
  font-family: var(--f-mono);
  font-size: 8px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: rgba(240, 237, 232, 0.3);
}

/* Callflow responsive */
@media (max-width: 900px) {
  .callflow__layer {
    grid-template-columns: 90px 1fr;
  }

  .callflow__tab-name {
    font-size: 11.5px;
  }
}

@media (max-width: 600px) {
  .callflow__layer {
    grid-template-columns: 1fr;
  }

  .callflow__tab {
    padding: 10px 14px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .callflow__body {
    padding: 10px 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .arch-flow,
  .arch-glow,
  .arch-pill,
  .voice-bar,
  .pipeline__dot,
  .callflow__cn::after {
    animation: none !important;
  }
}
