/* ============================================================
   DripBack Call-Flow Animation — Homepage-Komponente
   Animierter Business-Flow mit Integrations-Chips
   Token-System: --t-accent (#3D7BFF), True-Grey
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Registrierung nötig, damit transition auf --progress-width (Z.72) real
   animiert — unregistrierte Custom-Properties sind nicht interpolierbar. */
@property --progress-width {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 25%;
}

#callflow-mount {
  width: 100%;
  max-width: 100%;
}

.callflow {
  background: var(--t-bg, #0A0A0B);
  color: var(--t-ink, #F5F5F7);
  padding: 48px 24px;
  font-family: -apple-system, system-ui, "Inter", "Segoe UI", sans-serif;
  overflow: hidden;
}

.callflow__header {
  max-width: 900px;
  margin: 0 auto 48px;
  text-align: center;
}

.callflow__title {
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.callflow__subtitle {
  font-size: 15px;
  color: var(--t-ink-2, #A1A1AA);
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ── Flow Container ────────────────────────────────────── */
.callflow__flow {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

/* Vertical progress line (desktop) / horizontal (mobile) */
.callflow__line {
  position: absolute;
  background: linear-gradient(to right,
    var(--t-accent, #3D7BFF) 0%,
    var(--t-accent, #3D7BFF) var(--progress-width, 25%),
    rgba(255, 255, 255, 0.08) var(--progress-width, 25%),
    rgba(255, 255, 255, 0.08) 100%);
  height: 3px;
  top: 28px;
  left: 0;
  right: 0;
  z-index: 1;
  border-radius: 2px;
  transition: --progress-width var(--dur-morph, 0.3s) ease-out;
}

/* Responsive: switch to vertical on smaller screens */
@media (max-width: 900px) {
  .callflow__line {
    width: 3px;
    height: auto;
    top: 0;
    left: 28px;
    right: auto;
    bottom: 0;
    background: linear-gradient(to bottom,
      var(--t-accent, #3D7BFF) 0%,
      var(--t-accent, #3D7BFF) var(--progress-width, 25%),
      rgba(255, 255, 255, 0.08) var(--progress-width, 25%),
      rgba(255, 255, 255, 0.08) 100%);
  }
}

/* ── Stations Grid ─────────────────────────────────────── */
.callflow__stations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  position: relative;
  z-index: 2;
}

/* Breiter Viewport: alle 5 Stationen in einer Reihe statt 4+1-Umbruch */
@media (min-width: 1240px) {
  .callflow__stations {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 900px) {
  .callflow__stations {
    grid-template-columns: 1fr;
    margin-left: 60px;
  }
}

/* ── Station Card ──────────────────────────────────────── */
.callflow__station {
  padding: 34px 20px 20px; /* Kopffreiraum: Nummern-Badge ragt von oben hinein */
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  position: relative;
  transition: all var(--dur-morph, 0.3s) ease-out;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}

/* Active state */
.callflow__station.is-active {
  background: rgba(61, 123, 255, 0.08);
  border-color: var(--t-accent, #3D7BFF);
  box-shadow: 0 0 0 1px rgba(61, 123, 255, 0.3),
              0 8px 24px rgba(61, 123, 255, 0.12);
}

/* ── Numbered circle ───────────────────────────────────── */
.callflow__number {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: var(--t-bg, #0A0A0B);
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--t-ink-2, #A1A1AA);
  transition: all var(--dur-morph, 0.3s) ease-out;
  font-family: ui-monospace, monospace;
}

.callflow__station.is-active .callflow__number {
  background: var(--t-accent, #3D7BFF);
  border-color: var(--t-accent, #3D7BFF);
  color: #FFF;
  box-shadow: 0 0 0 4px rgba(61, 123, 255, 0.2);
}

@media (max-width: 900px) {
  .callflow__number {
    top: 50%;
    left: -30px;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 16px;
  }
}

/* ── Station Header ────────────────────────────────────── */
.callflow__station-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--t-ink, #F5F5F7);
  margin-top: 8px;
}

.callflow__station-meta {
  font-size: 12px;
  color: var(--t-ink-2, #A1A1AA);
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

/* ── Action Text ───────────────────────────────────────── */
.callflow__action {
  font-size: 13px;
  color: var(--t-ink, #F5F5F7);
  margin: 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

/* ── Integration Chips ─────────────────────────────────── */
.callflow__integrations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.callflow__chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  font-size: 11px;
  color: var(--t-ink-2, #A1A1AA);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: all var(--dur-tap, 0.2s) ease-out;
}

.callflow__chip.active {
  background: rgba(61, 123, 255, 0.15);
  border-color: var(--t-accent, #3D7BFF);
  /* e11-licht: #3D7BFF auf blau-getöntem Chip = 4,1:1 @11px (AA-Fail) —
     hellere Stufe für Kleintext auf Tint-Fläche. */
  color: #7FA8FF;
}

/* Planned badge */
.callflow__chip.planned {
  color: var(--t-signal, #FFB020);
  border-color: rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.05);
}

/* ── Progress Pulse ────────────────────────────────────── */
.callflow__pulse {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--t-accent, #3D7BFF);
  top: 22px;
  left: var(--pulse-left, 0);
  box-shadow: 0 0 0 4px rgba(61, 123, 255, 0.3);
  animation: pulse-throb 1.5s ease-in-out infinite;
  z-index: 3;
  transition: left var(--dur-morph, 0.4s) cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pulse-throb {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(61, 123, 255, 0.3);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(61, 123, 255, 0.1);
    transform: scale(1.1);
  }
}

@media (max-width: 900px) {
  .callflow__pulse {
    top: var(--pulse-top, 0);
    left: 6px;
  }
}

/* ── State Indicator ───────────────────────────────────── */
.callflow__status {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--t-ink-2, #A1A1AA);
  margin-top: 4px;
}

.callflow__station.is-active .callflow__status {
  color: var(--t-accent, #3D7BFF);
}

.callflow__station.is-completed .callflow__status {
  color: var(--t-emerald, #22C55E);
}

/* ── No-Motion Variant ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .callflow__station {
    opacity: 1 !important;
  }
  .callflow__pulse {
    display: none;
  }
}

/* Mobile optimizations */
@media (max-width: 600px) {
  .callflow {
    padding: 32px 16px;
  }
  .callflow__title {
    font-size: 22px;
  }
  .callflow__subtitle {
    font-size: 13px;
  }
  .callflow__station {
    min-height: 200px;
  }
}
