/* ========================= Our Workflow styles ========================= */
:root {
    --wf-accent: #3ec9f5;
    --wf-text-dim: #6c757d;
    --wf-bsz: 80px;
    --wf-bsz-sm: 62px;
}

/* -- Connector SVG overlay -- */
.wf-pipeline-wrap {
    position: relative;
}

#wf-connector-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

/* -- Pipeline container -- */
.wf-pipeline {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* -- Bubble node -- */
.bnode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    animation: wf-fade-up 0.45s ease both;
}

@keyframes wf-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bubble {
    width: var(--wf-bsz);
    height: var(--wf-bsz);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #e8f4fd, #c5dff5);
    border: 2px solid var(--wf-accent);
    box-shadow: 0 0 0 4px rgba(62, 201, 245, 0.08), 0 0 18px rgba(62, 201, 245, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: box-shadow 0.25s, transform 0.2s, border-color 0.25s;
    flex-shrink: 0;
}

.bnode:hover .bubble,
.bubble.wf-highlighted {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(62, 201, 245, 0.14), 0 0 30px rgba(62, 201, 245, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: #1ab8e8;
}

.bubble.sm {
    width: var(--wf-bsz-sm);
    height: var(--wf-bsz-sm);
}

.bicon {
    width: 85%;
    height: 85%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.blabel {
    text-align: center;
    max-width: 95px;
}

.blabel .title {
    font-size: 0.75rem;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.9), 0 0 8px rgba(255, 255, 255, 0.7);
}

.wf-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
}

.wf-spacer {
    height: 44px;
    width: 100%;
    flex-shrink: 0;
}

.wf-spacer-sm {
    height: 16px;
    width: 100%;
    flex-shrink: 0;
}

@keyframes wf-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.35;
        transform: scale(0.65);
    }
}

@keyframes wf-dash {
    to {
        stroke-dashoffset: -20;
    }
}

/* -- Product cards -- */
.wf-card-slot {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    min-width: 185px;
    padding-top: 0.3rem;
}

.wf-card-slot.right {
    justify-content: flex-start;
}

.wf-product-card {
    background: #fff;
    border: 1.5px solid var(--wf-accent);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    align-self: flex-start;
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.2s;
}

.wf-product-card:hover,
.wf-product-card.wf-highlighted {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(62, 201, 245, 0.14), 0 0 24px rgba(62, 201, 245, 0.28);
    border-color: #1ab8e8;
}

.wf-product-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.wf-product-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
    padding: 0.2rem;
    transition: background 0.2s, color 0.2s;
}

.wf-product-item a:hover {
    background: rgba(62, 201, 245, 0.12);
    color: #1ab8e8;
}

.wf-product-item img {
    width: 64px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.wf-product-item span {
    font-size: 0.7rem;
    line-height: 1.2;
    text-align: center;
    color: var(--wf-text-dim);
    max-width: 72px;
    word-break: break-word;
}

/* -- AI badge on product card -- */
.wf-product-img-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.wf-ai-badge {
    font-size: 0.52rem;
    letter-spacing: 0.06em;
    color: #00467F;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    pointer-events: none;
}

.wf-ai-badge .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00467F;
    animation: wf-pulse 1.4s infinite;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .wf-card-slot {
        display: none;
    }

    /* hide inline product cards that are not in a wf-card-slot */
    .wf-product-card {
        display: none;
    }

    .wf-pipeline {
        padding: 0 0.5rem;
    }

    .wf-row {
        gap: 1rem;
    }

    :root {
        --wf-bsz: 64px;
        --wf-bsz-sm: 50px;
    }

    /* make bubbles feel tappable */
    .bnode {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
}

/* -- Mobile: indicator dot on bubbles with products -- */
.wf-bubble-dot {
    display: none;
    position: absolute;
    /* 45deg clockwise from top = top-right on the circle edge */
    top: calc(14.64% - 5px);
    left: calc(85.35% - 5px);
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 2;
}

.wf-bubble-dot-ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #e53e3e;
    opacity: 0.75;
    animation: wf-ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.wf-bubble-dot-solid {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #e53e3e;
}

@keyframes wf-ping {
    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@media (max-width: 767px) {
    .wf-bubble-dot {
        display: block;
    }
}

/* -- Mobile bubble popup -- */
.wf-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.wf-popup.is-open {
    display: block;
}

.wf-popup-box {
    position: absolute;
    background: #fff;
    border: 1.5px solid var(--wf-accent);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: wf-popup-in 0.18s ease both;
}

@keyframes wf-popup-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(6px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wf-popup-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--wf-text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    text-align: center;
}

.wf-popup-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* re-show product items inside the popup regardless of mobile hide rule */
.wf-popup-content .wf-product-item {
    display: flex;
}

/* -- Outer flex wrapper (pipeline + evidence sidebar) -- */
.wf-outer-wrap {
    display: flex;
    align-items: flex-start;
    max-width: 1240px;
    margin: 0 auto;
}

.wf-pipeline-wrap {
    flex: 4;
    min-width: 0;
}

/* -- MIRI Evidence sidebar -- */
.wf-evidence-sidebar {
    flex: 1;
    position: relative;
    align-self: stretch;
    padding-left: 26px;
    /* space for the 22px bracket */
}

/* Bracket: SVG drawn and animated via JS */
.wf-evidence-bracket {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 22px;
    pointer-events: none;
}

#wf-bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
}

/* Sticky container -- positioned via JS scroll handler */
.wf-evidence-sticky {
    position: relative;
}

/* MIRI Evidence card */
.wf-evidence-card {
    background: #fff;
    border: 1.5px solid var(--wf-accent);
    border-radius: 10px;
    padding: 0.85rem 0.9rem;
    box-shadow: 0 2px 12px rgba(62, 201, 245, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    transition: box-shadow 0.25s, transform 0.2s;
}

.wf-evidence-card:hover {
    transform: scale(1.04);
    box-shadow: 0 0 0 5px rgba(62, 201, 245, 0.14), 0 4px 18px rgba(62, 201, 245, 0.28);
    border-color: #1ab8e8;
}

.wf-evidence-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
    padding: 0.2rem;
    transition: background 0.2s, color 0.2s;
}

.wf-evidence-link:hover {
    background: rgba(62, 201, 245, 0.12);
    color: #1ab8e8;
}

.wf-evidence-card img {
    width: 72px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 6px;
}

.wf-evidence-card-header {
    font-size: 0.58rem;
    font-weight: 700;
    color: #00467F;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.wf-evidence-label {
    font-size: 0.7rem;
    line-height: 1.2;
    text-align: center;
    color: var(--wf-text-dim);
    white-space: nowrap;
}

.wf-evidence-tag {
    font-size: 0.6rem;
    color: var(--wf-text-dim);
    line-height: 1.3;
}

/* Top evidence sidebar & spacers -- hidden on desktop */
.wf-evidence-sidebar--top,
.wf-evidence-spacer {
    display: none;
}

@media (max-width: 991px) {
    /* Stack outer wrap vertically */
    .wf-outer-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    /* Re-show bottom sidebar below the pipeline */
    .wf-evidence-sidebar {
        display: block;
        flex: none;
        width: 100%;
        padding-left: 0;
        padding: 0 1.25rem;
    }

    /* Show top sidebar above the pipeline */
    .wf-evidence-sidebar--top {
        display: flex;
        flex-direction: column;
        padding: 0 1.25rem;
    }

    .wf-evidence-spacer {
        display: block;
        height: 1.5rem;
        flex-shrink: 0;
    }

    /* Horizontal bracket strips */
    .wf-evidence-bracket {
        display: block;
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        width: 100%;
        height: 22px;
        overflow: visible;
        z-index: 0;
    }

    .wf-evidence-sticky {
        z-index: 1;
    }

    #wf-bracket-svg,
    #wf-bracket-svg-top {
        position: relative;
        display: block;
        top: auto;
        left: auto;
    }

    /* Remove JS-driven transform */
    .wf-evidence-sticky {
        position: static !important;
        transform: none !important;
        width: 100%;
    }

    /* Vertical card layout -- full width */
    .wf-evidence-card {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.85rem 0.9rem;
        border-radius: 10px;
        text-align: center;
        max-width: none;
        margin: 0;
    }

    .wf-evidence-card img {
        width: 72px;
    }
}
