/*!
 * Landing page - animated agent pipeline (#agent-pipeline)
 *
 * Scoped entirely to the widget. Uses Bootstrap CSS variables so it follows
 * the active color scheme (light/dark) with no extra maintenance.
 */

.pipeline-widget {
    --pipeline-flow: 0.65s;
    max-width: 920px;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-xl, 0.75rem);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(var(--bs-primary-rgb), 0.08) 0%, transparent 55%),
        var(--bs-body-bg);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    overflow: hidden;
}

/* Window chrome */
.pipeline-chrome {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    font-size: var(--font-size-sm, 0.875rem);
}

.pipeline-chrome-dots {
    display: flex;
    gap: 0.35rem;
}

.pipeline-chrome-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--bs-border-color);
}

.pipeline-chrome-title {
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.pipeline-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-primary);
}

.pipeline-badge::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--bs-primary);
    animation: pipeline-pulse 1.4s ease-in-out infinite;
}

@keyframes pipeline-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.5);
    }
    50% {
        box-shadow: 0 0 0 0.35rem rgba(var(--bs-primary-rgb), 0);
    }
}

/* Pipeline track */
.pipeline-track {
    display: flex;
    align-items: center;
    padding: 1.75rem 1.5rem 1rem;
}

.pipeline-node {
    flex: 0 0 auto;
    width: 116px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-lg, 0.5rem);
    background: var(--bs-body-bg);
    transition:
        transform 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

.pipeline-node-icon {
    display: block;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    transition:
        color 0.3s ease,
        transform 0.3s ease;
}

.pipeline-node-label {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.pipeline-node-sub {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
}

.pipeline-node.is-done {
    border-color: rgba(var(--bs-primary-rgb), 0.35);
}

.pipeline-node.is-done .pipeline-node-icon {
    color: var(--bs-primary);
}

.pipeline-node.is-active {
    transform: translateY(-4px);
    border-color: var(--bs-primary);
    box-shadow:
        0 0 0 3px rgba(var(--bs-primary-rgb), 0.15),
        var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.pipeline-node.is-active .pipeline-node-icon {
    color: var(--bs-primary);
    transform: scale(1.08);
}

/* Connectors + travelling packet */
.pipeline-link {
    position: relative;
    flex: 1 1 auto;
    min-width: 24px;
    height: 2px;
    border-radius: 2px;
    background: var(--bs-border-color);
}

.pipeline-link.is-active {
    background: rgba(var(--bs-primary-rgb), 0.4);
}

.pipeline-packet {
    position: absolute;
    top: 50%;
    left: 0;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    margin-left: -4px;
    border-radius: 50%;
    background: var(--bs-primary);
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.18);
    opacity: 0;
}

.pipeline-link.is-active .pipeline-packet {
    animation: pipeline-flow-x var(--pipeline-flow) ease-in-out forwards;
}

@keyframes pipeline-flow-x {
    0% {
        left: 0;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* Reflection feedback bar */
.pipeline-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 1.5rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    transition:
        color 0.3s ease,
        border-color 0.3s ease,
        background-color 0.3s ease;
}

.pipeline-feedback i {
    transition: transform 0.6s ease;
}

.pipeline-feedback.is-active {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.06);
}

.pipeline-feedback.is-active i {
    transform: rotate(360deg);
}

/* Footer: live log + metrics */
.pipeline-footer {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}

.pipeline-log {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 6.5rem;
    padding: 0.75rem 0.9rem;
    background: var(--bs-secondary-bg);
    border-radius: var(--radius-lg, 0.5rem);
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.72rem;
}

.pipeline-log-line {
    opacity: 0;
    color: var(--bs-body-color);
    animation: fadeInUp 0.35s ease forwards;
}

.pipeline-log-line .dot {
    color: var(--bs-primary);
    margin-right: 0.35rem;
}

.pipeline-metrics {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.pipeline-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.pipeline-metric-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--bs-primary);
    font-variant-numeric: tabular-nums;
}

.pipeline-metric-label {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Responsive: stack the track vertically on small screens */
@media (max-width: 767.98px) {
    .pipeline-track {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem 1.25rem 0.75rem;
    }

    .pipeline-node {
        width: 100%;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'icon label'
            'icon sub';
        column-gap: 0.75rem;
        align-items: center;
        text-align: left;
        padding: 0.6rem 0.85rem;
    }

    .pipeline-node-icon {
        grid-area: icon;
    }

    .pipeline-node-label {
        grid-area: label;
        margin-top: 0;
    }

    .pipeline-node-sub {
        grid-area: sub;
        margin-top: 0;
    }

    .pipeline-node.is-active {
        transform: translateX(4px);
    }

    .pipeline-link {
        width: 2px;
        height: 26px;
        flex: 0 0 26px;
        margin: 0 auto;
    }

    .pipeline-packet {
        top: 0;
        left: 50%;
        margin-top: -4px;
        margin-left: -4px;
    }

    .pipeline-link.is-active .pipeline-packet {
        animation-name: pipeline-flow-y;
    }

    .pipeline-footer {
        grid-template-columns: 1fr;
    }
}

@keyframes pipeline-flow-y {
    0% {
        top: 0;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pipeline-badge::before {
        animation: none;
    }

    .pipeline-node,
    .pipeline-node-icon,
    .pipeline-packet,
    .pipeline-feedback,
    .pipeline-feedback i {
        transition: none;
    }

    .pipeline-log-line {
        animation: none;
        opacity: 1;
    }
}

/* Landing page - section helpers (replace former inline styles) */
.hero-badge {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.hero-lead {
    max-width: 42rem;
}

.section-tint {
    background-color: rgba(var(--bs-primary-rgb), 0.04);
}

.cta-gradient {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-hover) 100%);
    color: #fff;
}

.cta-gradient .cta-lead {
    max-width: 42rem;
    opacity: 0.9;
}

.pipeline-example-note {
    font-size: var(--font-size-sm, 0.875rem);
}
