/* ==========================================================================
   chatCOS — Lifecycle Animation Module
   Scope: styles for #anim-lifecycle only. All colors via global CSS variables
   (--bg, --surface, --surface-2, --text, --text-muted, --accent, --accent-2,
   --accent-soft, --border). No hard-coded colors. Mobile-first (vertical flow),
   horizontal flow from 860px up.
   ========================================================================== */

#anim-lifecycle {
  --lc-node: 48px;         /* node diameter */
  --lc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  display: block;
  width: 100%;
  box-sizing: border-box;
}

#anim-lifecycle *,
#anim-lifecycle *::before,
#anim-lifecycle *::after {
  box-sizing: border-box;
}

.lc-wrap {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 4px 4px;
}

/* --- SVG path layer (sits behind the stage cards) --- */
.lc-svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.lc-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.lc-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lc-pulse-glow {
  fill: var(--accent);
  opacity: 0;
  filter: blur(6px);
}

.lc-pulse {
  fill: var(--accent);
  opacity: 0;
}

.lc-pulse-core {
  fill: var(--bg);
  opacity: 0;
}

/* --- Stage grid --- */
.lc-stages {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lc-stage {
  position: relative;
  display: grid;
  grid-template-columns: var(--lc-node) 1fr;
  gap: 16px;
  padding: 10px 0 22px;
  align-items: start;
}

.lc-stage:last-child {
  padding-bottom: 4px;
}

/* Node (icon disc) */
.lc-node {
  position: relative;
  width: var(--lc-node);
  height: var(--lc-node);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition:
    background 0.5s var(--lc-ease),
    border-color 0.5s var(--lc-ease),
    color 0.5s var(--lc-ease),
    transform 0.5s var(--lc-ease),
    box-shadow 0.5s var(--lc-ease);
  z-index: 2;
}

.lc-node svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s var(--lc-ease);
}

.lc-stage.is-active .lc-node {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 6px 18px -6px var(--accent-soft);
}

/* One-shot activation ring */
.lc-node::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.lc-stage.is-active .lc-node::after {
  animation: lc-ring 0.7s var(--lc-ease) forwards;
}

@keyframes lc-ring {
  0%   { opacity: 0.7; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(1.55); }
}

/* Card */
.lc-card {
  min-width: 0;
  padding-top: 3px;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.55s var(--lc-ease),
    transform 0.55s var(--lc-ease);
}

.lc-stage.is-active .lc-card {
  opacity: 1;
  transform: translateY(0);
}

.lc-step {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}

.lc-title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

.lc-desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ==========================================================================
   Horizontal flow (desktop / wide tablet)
   ========================================================================== */
@media (min-width: 860px) {
  .lc-wrap {
    padding: 12px 8px;
  }

  .lc-stages {
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
  }

  .lc-stage {
    flex: 1 1 0;
    min-width: 0;
    grid-template-columns: 1fr;
    grid-template-rows: var(--lc-node) 1fr;
    gap: 18px;
    padding: 4px 6px 6px;
    text-align: center;
    justify-items: center;
  }

  .lc-node {
    justify-self: center;
  }

  .lc-card {
    padding-top: 0;
    transform: translateY(14px);
    max-width: 190px;
  }

  .lc-stage.is-active .lc-card {
    transform: translateY(0);
  }
}

/* ==========================================================================
   Reduced motion — show final state immediately
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  #anim-lifecycle * {
    transition: none !important;
    animation: none !important;
  }

  .lc-node,
  .lc-card {
    transition: none !important;
  }

  .lc-node {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
  }

  .lc-card {
    opacity: 1;
    transform: none;
  }

  .lc-progress {
    stroke-dashoffset: 0 !important;
  }

  .lc-pulse,
  .lc-pulse-glow,
  .lc-pulse-core {
    opacity: 0 !important;
  }
}
