/* SPX workflow diagrams (page-local styles) */

/* Block layout: the global section style is a centered flex box, which shrinks the panel to its content */
.wfd {
    display: block;
    position: relative;
    margin: 2em 0 3em 0;
    padding: 0;
}

.wfd-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.wfd-stage {
    position: relative;
    overflow-x: auto;
    padding: clamp(12px, 2.5vw, 40px);
    border-radius: 0.8em;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background-color: rgba(255, 255, 255, 0.015);
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}

.wfd-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

/* Nodes */

.wfd-node rect {
    stroke-width: 1.5;
}

.wfd-node text {
    font-family: "REGU", sans-serif;
    font-size: 21px;
    pointer-events: none;
}

.wfd-node--hub rect:not(.wfd-glow) {
    fill: var(--color-primary);
    stroke: none;
}

.wfd-node--hub text {
    font-family: "BOLD", sans-serif;
    font-size: 30px;
    fill: white;
}

.wfd-glow {
    fill: var(--color-primary);
    opacity: 0.45;
}

.wfd-node--spx rect {
    fill: rgba(51, 182, 56, 0.14);
    stroke: rgba(51, 182, 56, 0.6);
}

.wfd-node--spx text {
    fill: #c9f0cb;
}

.wfd-node--ext rect {
    fill: rgba(255, 152, 0, 0.1);
    stroke: rgba(255, 152, 0, 0.55);
}

.wfd-node--ext text {
    fill: #ffd08a;
}

.wfd-node--out rect {
    fill: #2b2e33;
    stroke: rgba(255, 255, 255, 0.14);
}

.wfd-node--out text {
    fill: #f0f0f0;
}

.wfd-node--infra rect {
    fill: rgba(51, 182, 56, 0.06);
    stroke: rgba(51, 182, 56, 0.5);
    stroke-dasharray: 5 5;
}

.wfd-node--infra text {
    font-size: 17px;
    fill: var(--color-primary);
}

.wfd-node--tip {
    cursor: help;
    outline: none;
}

.wfd-node--tip rect:not(.wfd-glow) {
    transition: stroke 0.2s ease, fill 0.2s ease;
}

.wfd-node--spx.wfd-node--tip:hover rect,
.wfd-node--spx.wfd-node--tip:focus-visible rect {
    fill: rgba(51, 182, 56, 0.24);
    stroke: var(--color-primary);
}

.wfd-node--infra.wfd-node--tip:hover rect,
.wfd-node--infra.wfd-node--tip:focus-visible rect {
    fill: rgba(51, 182, 56, 0.12);
    stroke: var(--color-primary);
}

.wfd-node--hub.wfd-node--tip:focus-visible rect:not(.wfd-glow) {
    stroke: white;
    stroke-width: 2;
}

/* Tooltip */

.wfd-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    max-width: 320px;
    padding: 0.8em 1em;
    border-radius: 0.6em;
    border: 1px solid rgba(51, 182, 56, 0.5);
    background: rgba(20, 22, 25, 0.94);
    box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    font-size: 0.85em;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s;
}

.wfd-tip.is-visible {
    opacity: 1;
    visibility: visible;
}

.wfd-tip b {
    display: block;
    margin-bottom: 0.3em;
    font-family: "BOLD", sans-serif;
    color: var(--color-primary);
}

.wfd-tip p {
    margin: 0;
    line-height: 1.5;
}

/* Edges */

.wfd-line {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 1.5;
}

.wfd-arrow {
    fill: rgba(255, 255, 255, 0.6);
}

.wfd-pulse {
    fill: none;
    stroke: #8dff91;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 8 152;
    animation: wfd-flow 1.8s linear infinite;
}

.wfd-edge:not(.wfd-edge--flow) .wfd-pulse,
.wfd-edge:not(.wfd-edge--flow) .wfd-arrow {
    display: none;
}

@keyframes wfd-flow {
    to {
        stroke-dashoffset: -160;
    }
}

/* Captions */

.wfd-captions {
    max-width: 52em;
    margin: 1.5em auto 0 auto;
    text-align: center;
}

.wfd-caption {
    display: none;
}

.wfd-caption.is-active {
    display: block;
    animation: wfd-fade-in 0.6s ease both;
}

.wfd-caption h3 {
    margin-top: 0;
}

@keyframes wfd-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* Legend */

.wfd-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1.8em;
    justify-content: center;
    margin: 1.5em 0 0 0;
    padding: 0;
    list-style: none;
    font-family: "REGU", sans-serif;
    font-size: 0.85em;
    opacity: 0.8;
}

.wfd-legend li {
    display: flex;
    gap: 0.6em;
    align-items: center;
}

.wfd-key {
    display: inline-block;
    width: 1.6em;
    height: 1em;
    border-radius: 0.3em;
    border: 1.5px solid transparent;
}

.wfd-key--spx {
    background: rgba(51, 182, 56, 0.14);
    border-color: rgba(51, 182, 56, 0.6);
}

.wfd-key--ext {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.55);
}

.wfd-swipe-hint {
    display: none;
}

@media (max-width: 768px) {
    .wfd-svg {
        min-width: 760px;
    }

    .wfd-swipe-hint {
        display: block;
        margin-top: 0.5em;
        text-align: center;
        font-size: 0.8em;
        opacity: 0.6;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wfd-pulse {
        display: none;
    }

    .wfd-caption.is-active {
        animation: none;
    }
}
