/* ==========================================================================
   API connector flow diagram
   Pure HTML/CSS replacement for ./landing-page/api-integration.png
   All selectors are namespaced with .bpe-api- so nothing here can leak into
   the rest of the page. No Tailwind dependency.
   ========================================================================== */

.bpe-api-diagram {
    --bpe-api-brand: #076395;
    --bpe-api-brand-2: #0e86c0;
    --bpe-api-ink: #0f172a;
    --bpe-api-muted: #64748b;
    --bpe-api-line: #b9cde0;
    --bpe-api-border: #e2e8f0;
    --bpe-api-card: #ffffff;
    --bpe-api-gap: 14px;

    padding: 26px 22px 30px;
    background: linear-gradient(180deg, #fbfdff 0%, #eef4fb 100%);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--bpe-api-ink);
    container-type: inline-size;
}

.bpe-api-stage {
    max-width: 460px;
    margin: 0 auto;
}

/* --- Nodes ---------------------------------------------------------------- */

.bpe-api-sources {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--bpe-api-gap);
}

.bpe-api-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--bpe-api-border);
    border-radius: 10px;
    background: var(--bpe-api-card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* short line joining the top row of a column to the bottom row */
.bpe-api-node.is-top::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 1px;
    height: var(--bpe-api-gap);
    background: var(--bpe-api-line);
}

.bpe-api-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #fff;
    background: #334155;
}

.bpe-api-badge.is-bubble {
    background: #1f2937;
}

.bpe-api-badge.is-aws {
    background: #232f3e;
}

.bpe-api-badge.is-stripe {
    background: #635bff;
}

.bpe-api-badge.is-deel {
    background: #1d3fcf;
}

.bpe-api-badge.is-mixp {
    background: #7856ff;
}

.bpe-api-badge.is-json {
    background: var(--bpe-api-brand);
    font-size: 8px;
}

/* --- Hub ------------------------------------------------------------------ */

.bpe-api-hub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bpe-api-brand) 0%, var(--bpe-api-brand-2) 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 6px 16px -6px rgba(7, 99, 149, .55);
}

.bpe-api-hub svg {
    width: 15px;
    height: 15px;
}

.bpe-api-center {
    display: flex;
    justify-content: center;
}

.bpe-api-json {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--bpe-api-border);
    border-radius: 10px;
    background: var(--bpe-api-card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    font-size: 12px;
    font-weight: 600;
}

.bpe-api-json small {
    font-weight: 500;
    font-size: 11px;
    color: var(--bpe-api-muted);
}

/* --- Connectors ----------------------------------------------------------- */

.bpe-api-wire {
    display: block;
    width: 100%;
    overflow: visible;
}

.bpe-api-wire path {
    fill: none;
    stroke: var(--bpe-api-line);
    stroke-width: 1.25;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

/* animated "data flowing" overlay */
.bpe-api-wire .bpe-api-flow {
    stroke: var(--bpe-api-brand-2);
    stroke-width: 1.75;
    stroke-dasharray: 10 190;
    animation: bpe-api-dash 3.6s linear infinite;
}

@keyframes bpe-api-dash {
    to {
        stroke-dashoffset: -200;
    }
}

/* --- Parsed tables -------------------------------------------------------- */

.bpe-api-tables {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--bpe-api-gap);
}

.bpe-api-table {
    height: 62px;
    border: 1px solid var(--bpe-api-border);
    border-radius: 8px;
    background:
        repeating-linear-gradient(to right, #edf2f7 0 1px, transparent 1px 25%),
        repeating-linear-gradient(to bottom, #edf2f7 0 1px, transparent 1px 20%),
        var(--bpe-api-card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.bpe-api-table::before {
    content: "";
    display: block;
    height: 20%;
    border-radius: 7px 7px 0 0;
    background: #f1f6fb;
}

/* --- Outputs -------------------------------------------------------------- */

.bpe-api-outputs {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: var(--bpe-api-gap);
}

.bpe-api-card {
    padding: 10px;
    border: 1px solid var(--bpe-api-border);
    border-radius: 10px;
    background: var(--bpe-api-card);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .07);
}

.bpe-api-chart {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    height: 104px;
}

.bpe-api-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 7px;
    font-weight: 600;
    color: #94a3b8;
    text-align: right;
}

.bpe-api-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-left: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    padding: 0 2px 0 4px;
}

.bpe-api-bars i {
    flex: 1;
    height: var(--h, 40%);
    min-width: 2px;
    border-radius: 1.5px 1.5px 0 0;
    background: linear-gradient(180deg, #7fb4d4 0%, #b9d4e6 100%);
    transform-origin: bottom;
    animation: bpe-api-grow .7s cubic-bezier(.22, 1, .36, 1) backwards;
}

@keyframes bpe-api-grow {
    from {
        transform: scaleY(0);
    }
}

.bpe-api-donut {
    display: grid;
    place-items: center;
    height: 104px;
}

.bpe-api-donut span {
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: conic-gradient(var(--bpe-api-brand) 0 46%,
            #8fbcd8 46% 68%,
            #c3d9e8 68% 86%,
            #e4edf5 86% 100%);
}

.bpe-api-donut span::after {
    content: "";
    position: absolute;
    inset: 21px;
    border-radius: 50%;
    background: var(--bpe-api-card);
}

/* --- Caption -------------------------------------------------------------- */

.bpe-api-caption {
    margin: 16px 0 0;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--bpe-api-muted);
}

/* --- Responsive ----------------------------------------------------------- */

@container (max-width: 420px) {
    .bpe-api-diagram {
        padding: 20px 14px 24px;
    }

    .bpe-api-node {
        font-size: 11px;
        padding: 7px 8px;
        gap: 6px;
    }

    .bpe-api-badge {
        width: 18px;
        height: 18px;
        font-size: 8px;
    }

    .bpe-api-table {
        height: 48px;
    }

    .bpe-api-chart,
    .bpe-api-donut {
        height: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bpe-api-wire .bpe-api-flow {
        animation: none;
        opacity: 0;
    }

    .bpe-api-bars i {
        animation: none;
    }
}