/* ==========================================================================
   AUTOMATIONS HERO: n8n WORKFLOW NODE FLOW
   A small n8n-style workflow rendered below the hero text — trigger,
   i-doit read, KI model, i-doit write — connected by animated data lines.
   Pure CSS animation, no JS.
   ========================================================================== */

.ah-flow {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    max-width: 860px;
    margin: 48px auto 0;
}

/* --- Node card --- */
.ah-node {
    flex: 0 0 158px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 14px 16px;
    background: linear-gradient(155deg, rgba(22, 24, 38, 0.95), rgba(13, 15, 24, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    animation: ah-node-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ah-node-1 { animation-delay: 0.10s; }
.ah-node-2 { animation-delay: 0.40s; }
.ah-node-3 { animation-delay: 0.70s; }
.ah-node-4 { animation-delay: 1.00s; }

@keyframes ah-node-in {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* i-doit nodes get the brand-green accent ring */
.ah-node-idoit {
    border-color: rgba(180, 255, 0, 0.22);
}

.ah-node-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.55);
}

.ah-node-idoit .ah-node-icon {
    background: rgba(180, 255, 0, 0.10);
    color: var(--donamic-primary, #b4ff00);
}

.ah-node-icon svg { display: block; }

.ah-node-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.25;
}

.ah-node-sub {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    line-height: 1.3;
}

/* --- Connector between nodes --- */
.ah-connector {
    flex: 1 1 auto;
    min-width: 28px;
    position: relative;
    align-self: center;
    height: 2px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 2px;
    overflow: visible;
}

/* the line "draws in" after the preceding node appears */
.ah-connector::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(180, 255, 0, 0.55), rgba(180, 255, 0, 0.15));
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    animation: ah-line-in 0.30s ease forwards;
}

.ah-connector-1::before { animation-delay: 0.38s; }
.ah-connector-2::before { animation-delay: 0.68s; }
.ah-connector-3::before { animation-delay: 0.98s; }

@keyframes ah-line-in {
    to { transform: scaleX(1); }
}

/* travelling data pulse */
.ah-pulse {
    position: absolute;
    top: 50%;
    left: 0;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--donamic-primary, #b4ff00);
    box-shadow: 0 0 10px 2px rgba(180, 255, 0, 0.55);
    opacity: 0;
    animation: ah-pulse-move 2.4s linear infinite;
}

.ah-connector-1 .ah-pulse { animation-delay: 1.3s; }
.ah-connector-2 .ah-pulse { animation-delay: 2.1s; }
.ah-connector-3 .ah-pulse { animation-delay: 2.9s; }

@keyframes ah-pulse-move {
    0%   { left: 0;    opacity: 0; }
    15%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* ==========================================================================
   RESPONSIVE — stack vertically on narrow screens
   ========================================================================== */

@media (max-width: 820px) {
    .ah-flow {
        flex-direction: column;
        align-items: center;
        max-width: 280px;
        gap: 0;
    }
    .ah-node {
        flex: 0 0 auto;
        width: 100%;
    }
    .ah-connector {
        width: 2px;
        height: 26px;
        min-width: 0;
        flex: 0 0 auto;
    }
    .ah-connector::before {
        transform-origin: top center;
    }
    @keyframes ah-line-in {
        to { transform: scaleY(1); }
    }
    .ah-connector::before {
        transform: scaleY(0);
    }
    .ah-pulse {
        top: 0;
        left: 50%;
        margin-top: 0;
        margin-left: -4px;
        animation-name: ah-pulse-move-v;
    }
    @keyframes ah-pulse-move-v {
        0%   { top: 0;    opacity: 0; }
        15%  { opacity: 1; }
        85%  { opacity: 1; }
        100% { top: 100%; opacity: 0; }
    }
}

/* ==========================================================================
   ACCESSIBILITY — reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .ah-node {
        opacity: 1;
        transform: none;
        animation: none;
    }
    .ah-connector::before {
        transform: scaleX(1);
        animation: none;
    }
    .ah-pulse {
        display: none;
    }
}
