/* 24racks Cloud — home-ddos: Anti-DDoS intro stats + chart panel + auto-rotating feature showcase. Main page only. */

/* ── Anti-DDoS intro (paymenter-minimal + reveal-text title) ─ */
/* ─────────────────────────────────────────────────────────────
   Anti-DDoS section — dark chart panel + features grid
   ───────────────────────────────────────────────────────────── */

/* ── Anti-DDoS — paymenter-minimal intro + reveal-text title ─── */

.ddos-intro {
    max-width: 980px;
    margin: 0 0 56px;
}

/* Title — large, tight tracking, two lines. Second line in brand blue
   with a sharp marker underline that draws in once revealed. */
.ddos-intro-title {
    margin: 0;
    color: var(--text-1);
    font-family: var(--font-display);
    font-size: clamp(36px, 5.2vw, 72px);
    font-weight: 840;
    line-height: 1.02;
    letter-spacing: -.024em;
}

.ddos-intro-title .rt-line {
    display: block;
}

.ddos-intro-title .rt-line--accent {
    position: relative;
    color: var(--brand);
    padding-bottom: 28px;
    width: fit-content;
    max-width: 100%;
}

:root[data-theme="dark"] .ddos-intro-title .rt-line--accent {
    color: #93c5fd;
}

.ddos-intro-title .rt-line--accent::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 4px;
    background: currentColor;
    border-radius: 2px;
    transition: width .85s cubic-bezier(.22, .61, .36, 1) .55s;
}

.ddos-intro-title.is-rt-revealed .rt-line--accent::after {
    width: clamp(96px, 22%, 280px);
}

/* Description — clean prose with a monospace inline accent for the tech */
.ddos-intro-desc {
    max-width: 700px;
    margin: 22px 0 0;
    color: var(--text-2);
    font-size: 16.5px;
    line-height: 1.6;
}

.ddos-intro-desc .ddos-mono {
    padding: 1px 7px;
    color: var(--text-1);
    background: var(--bg-raised);
    border: 1px solid var(--border-dim);
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: .9em;
    font-weight: 600;
    white-space: nowrap;
}

/* Stats — paymenter big numerals, no card frames, only thin dividers */
.ddos-stats {
    margin: 44px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--border-dim);
    border-bottom: 1px solid var(--border-dim);
}

.ddos-stat {
    padding: 24px 28px;
    border-right: 1px solid var(--border-dim);
}

.ddos-stat:last-child {
    border-right: 0;
}

.ddos-stat-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
    color: var(--text-1);
    font-family: var(--font-display);
    font-size: clamp(34px, 4vw, 52px);
    font-weight: 820;
    line-height: 1;
    letter-spacing: -.028em;
    font-variant-numeric: tabular-nums;
}

.ddos-stat-prefix {
    color: var(--brand);
    font-size: .68em;
    font-weight: 760;
}

:root[data-theme="dark"] .ddos-stat-prefix {
    color: #93c5fd;
}

.ddos-stat-unit {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: .35em;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    transform: translateY(-.6em);
}

.ddos-stat-label {
    display: block;
    margin: 14px 0 0;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* Reveal-text — character-by-character spring rise. Two activation modes:
    • Explicit: <h2 data-reveal-text> with .rt-line children inside.
    • Auto:     any .section-title (handled by bindRevealText in app.js).
   .rt-word stays inline so the title wraps at word boundaries normally;
   white-space: nowrap keeps the inline-block chars inside each word glued
   together so a word is never split mid-letter. */
[data-reveal-text] .rt-word,
.section-title .rt-word {
    white-space: nowrap;
}

[data-reveal-text] .rt-char,
.section-title .rt-char {
    display: inline-block;
    transform: translateY(0.55em) scale(.84);
    opacity: 0;
    transition:
        transform .62s cubic-bezier(.2, 1.36, .38, 1),
        opacity .42s ease;
    will-change: transform, opacity;
}

[data-reveal-text].is-rt-revealed .rt-char,
.section-title.is-rt-revealed .rt-char {
    transform: translateY(0) scale(1);
    opacity: 1;
    transition-delay: calc(var(--i, 0) * 22ms);
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal-text] .rt-char,
    .section-title .rt-char {
        transition: none;
        transform: none;
        opacity: 1;
    }

    .ddos-intro-title .rt-line--accent::after {
        transition: none;
        width: clamp(96px, 22%, 280px);
    }
}

@media (max-width: 980px) {
    .ddos-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ddos-stat {
        padding: 20px 22px;
    }

    .ddos-stat:nth-child(2) {
        border-right: 0;
    }

    .ddos-stat:nth-child(1),
    .ddos-stat:nth-child(2) {
        border-bottom: 1px solid var(--border-dim);
    }
}

@media (max-width: 560px) {
    .ddos-intro {
        margin-bottom: 40px;
    }

    .ddos-intro-title {
        font-size: clamp(30px, 9vw, 44px);
    }
}

/* ── Anti-DDoS chart panel (theme-aware) ───────────────────── */
/* Chart panel — theme-aware. Defaults to light paper; dark theme overrides
   the CSS vars defined on .ddos-panel. Tooltip stays dark in both modes
   for data-viz contrast against the chart surface. */
.ddos-panel {
    --panel-bg: #F7F3EA;
    --panel-fg: #0D1117;
    --panel-fg-soft: rgba(13, 17, 23, .78);
    --panel-fg-mute: rgba(13, 17, 23, .54);
    --panel-fg-faint: rgba(13, 17, 23, .32);
    --panel-grid: rgba(13, 17, 23, .08);
    --panel-grid-base: rgba(13, 17, 23, .18);
    --panel-border: rgba(13, 17, 23, .10);
    --panel-divider: rgba(13, 17, 23, .08);
    --panel-chart-stroke: #3b82f6;

    position: relative;
    margin-bottom: 36px;
    color: var(--panel-fg);
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    overflow: hidden;
}

:root[data-theme="dark"] .ddos-panel {
    --panel-bg: #0D1117;
    --panel-fg: #F7F3EA;
    --panel-fg-soft: rgba(247, 243, 234, .82);
    --panel-fg-mute: rgba(247, 243, 234, .58);
    --panel-fg-faint: rgba(247, 243, 234, .32);
    --panel-grid: rgba(247, 243, 234, .07);
    --panel-grid-base: rgba(247, 243, 234, .14);
    --panel-border: rgba(247, 243, 234, .08);
    --panel-divider: rgba(247, 243, 234, .07);
    --panel-chart-stroke: #60a5fa;
}

.ddos-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--panel-divider);
}

.ddos-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--panel-fg);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 760;
    letter-spacing: 0;
}

.ddos-panel-title-link {
    color: var(--panel-fg);
    text-decoration: underline;
    text-decoration-color: var(--panel-fg-faint);
    text-underline-offset: 3px;
}

.ddos-panel-meta {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--panel-fg-mute);
    font-family: var(--font-mono);
    font-size: 11px;
}

.ddos-panel-time {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ddos-panel-tz {
    padding: 2px 6px;
    border: 1px solid var(--panel-fg-faint);
    border-radius: 4px;
    color: var(--panel-fg-soft);
    font-size: 10px;
    letter-spacing: .05em;
}

.ddos-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-2);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    transition: color .25s ease, background .25s ease, border-color .25s ease;
}

.ddos-status-pill::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    box-sizing: border-box;
    transition: background .25s ease, border-color .25s ease;
}

/* Attack state — warm/orange with spinner */
.ddos-status-pill.is-attack {
    color: #F2DEC5;
    background: rgba(184, 121, 57, .18);
    border-color: rgba(184, 121, 57, .42);
}

.ddos-status-pill.is-attack::before {
    border: 1.6px solid currentColor;
    border-right-color: transparent;
    background: transparent;
    animation: ddosSpin 1.4s linear infinite;
}

/* Idle state — green operational solid dot */
.ddos-status-pill.is-idle {
    color: #BFE4C5;
    background: rgba(78, 118, 86, .18);
    border-color: rgba(78, 118, 86, .42);
}

.ddos-status-pill.is-idle::before {
    border: 0;
    background: #4E7656;
    box-shadow: 0 0 0 0 rgba(78, 118, 86, .5);
    animation: ddosIdlePulse 2.4s ease-out infinite;
}

@keyframes ddosSpin {
    to { transform: rotate(360deg); }
}

@keyframes ddosIdlePulse {
    0%   { box-shadow: 0 0 0 0 rgba(78, 118, 86, .55); }
    70%  { box-shadow: 0 0 0 6px rgba(78, 118, 86, 0); }
    100% { box-shadow: 0 0 0 0 rgba(78, 118, 86, 0); }
}

/* Live indicator next to the panel time */
.ddos-live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    margin-right: 4px;
    animation: ddosIdlePulse 1.8s ease-out infinite;
}

.ddos-chart-wrap {
    position: relative;
    padding: 22px 22px 8px 78px;
}

.ddos-chart {
    display: block;
    width: 100%;
    height: 340px;
}

.ddos-chart-grid line {
    stroke: var(--panel-grid);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

.ddos-chart-grid line.is-base {
    stroke: var(--panel-grid-base);
    stroke-dasharray: 0;
}

.ddos-chart-area {
    fill: url(#ddos-area-gradient);
    animation: ddosBreathe 5s ease-in-out infinite;
}

.ddos-chart-stroke {
    fill: none;
    stroke: var(--panel-chart-stroke);
    stroke-width: 1.4;
    stroke-linejoin: round;
    stroke-linecap: round;
    /* Keep stroke width constant under the scrollG scaleY transform */
    vector-effect: non-scaling-stroke;
}

.ddos-chart-now {
    stroke: var(--panel-fg-faint);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

@keyframes ddosBreathe {
    0%, 100% { fill-opacity: .85; }
    50%      { fill-opacity: 1; }
}

.ddos-yaxis,
.ddos-xaxis {
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--panel-fg-mute);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .02em;
}

.ddos-yaxis {
    position: absolute;
    top: 22px;
    bottom: 38px;
    left: 18px;
    width: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    pointer-events: none;
}

.ddos-yaxis li {
    line-height: 1;
    padding-right: 8px;
}

.ddos-xaxis {
    display: flex;
    justify-content: space-between;
    padding: 4px 22px 16px 78px;
    color: var(--panel-fg-mute);
}

.ddos-xaxis li {
    flex: 0 0 auto;
}

.ddos-tooltip {
    position: absolute;
    top: 22px;
    left: 22%;
    min-width: 190px;
    padding: 12px 14px;
    color: #F7F3EA;
    background: rgba(13, 17, 23, .96);
    border: 1px solid rgba(247, 243, 234, .14);
    border-radius: 10px;
    font-size: 12px;
    pointer-events: none;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .55);
    opacity: 0;
    transition: opacity 180ms ease;
    will-change: opacity;
    z-index: 5;
}

.ddos-chart-wrap {
    cursor: crosshair;
}

.ddos-crosshair {
    stroke: var(--panel-fg-mute);
    stroke-width: 1;
    stroke-dasharray: 3 4;
    opacity: 0;
    transition: opacity 160ms ease;
    pointer-events: none;
}

.ddos-tooltip-time {
    margin: 0 0 6px;
    color: rgba(247, 243, 234, .58);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .01em;
}

.ddos-tooltip-metric {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
    color: rgba(247, 243, 234, .82);
    font-family: var(--font-mono);
    font-size: 12px;
}

.ddos-tooltip-metric strong {
    color: #F7F3EA;
    font-weight: 700;
}

.ddos-tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    flex: 0 0 auto;
}

/* Scroll group — GPU-accelerated horizontal slide only (lossless translate).
   The vertical Y-zoom is baked into the path geometry per frame (see app.js
   animateScale) so it never rasterizes/stretches a bitmap → no pixelation. */
.ddos-chart-scroll {
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

/* ── Anti-DDoS auto-rotating feature showcase ──────────────── */
/* ── Anti-DDoS — auto-rotating feature showcase ─────────────── */

.ddos-showcase {
    --showcase-border: rgba(13, 17, 23, .10);
    --showcase-fg: var(--text-1);
    --showcase-fg-soft: var(--text-2);
    --showcase-fg-mute: var(--text-3);
    --showcase-accent: var(--brand);

    position: relative;
    margin-top: 8px;
    border: 1px solid var(--showcase-border);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-raised) 0%, transparent 100%);
}

:root[data-theme="dark"] .ddos-showcase {
    --showcase-border: rgba(255, 255, 255, .10);
    --showcase-accent: #93c5fd;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045) 0%, transparent 100%);
}

/* Top progress bar — counts down to next slide */
.ddos-showcase-progress {
    position: relative;
    height: 2px;
    background: var(--showcase-border);
}

.ddos-showcase-progress-bar {
    display: block;
    width: 0%;
    height: 100%;
    background: var(--showcase-accent);
    box-shadow: 0 0 8px currentColor;
    color: var(--showcase-accent);
    transition: width 5500ms linear;
}

.ddos-showcase-body {
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* Left rail — vertical tablist with numbered features */
.ddos-showcase-nav {
    display: flex;
    flex-direction: column;
    flex: 0 0 320px;
    padding: 14px 0;
    border-right: 1px solid var(--showcase-border);
}

.ddos-showcase-tab {
    appearance: none;
    background: none;
    border: 0;
    cursor: pointer;
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    gap: 8px;
    padding: 16px 22px 16px 28px;
    text-align: left;
    color: var(--showcase-fg-mute);
    transition: color .25s ease, background .25s ease;
}

.ddos-showcase-tab::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: var(--showcase-accent);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform .35s cubic-bezier(.22, .61, .36, 1);
    border-radius: 2px;
}

.ddos-showcase-tab:hover {
    color: var(--showcase-fg-soft);
}

.ddos-showcase-tab.is-active {
    color: var(--showcase-fg);
    background: linear-gradient(90deg, rgba(59, 130, 246, .07), transparent 80%);
}

:root[data-theme="dark"] .ddos-showcase-tab.is-active {
    background: linear-gradient(90deg, rgba(147, 197, 253, .08), transparent 80%);
}

.ddos-showcase-tab.is-active::before {
    transform: scaleY(1);
}

.ddos-showcase-tab-num {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--showcase-fg-mute);
    transition: color .25s ease;
}

.ddos-showcase-tab.is-active .ddos-showcase-tab-num {
    color: var(--showcase-accent);
}

.ddos-showcase-tab-label {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 720;
    letter-spacing: -.005em;
    line-height: 1.25;
}

/* Right stage — slides overlap, only the active one is visible */
.ddos-showcase-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 460px;
    padding: 44px 48px;
    overflow: hidden;
}

.ddos-showcase-slide {
    position: absolute;
    inset: 44px 48px;
    display: flex;
    flex-direction: column;
    gap: 0;
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition:
        opacity .42s ease,
        transform .55s cubic-bezier(.22, .61, .36, 1);
}

.ddos-showcase-slide[hidden] {
    display: flex;
}

.ddos-showcase-slide.is-active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ddos-showcase-slide-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.ddos-showcase-slide-eyebrow {
    color: var(--showcase-fg-mute);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.ddos-showcase-slide-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    color: var(--showcase-accent);
    background: var(--brand-soft-2);
    border: 1px solid var(--blue-border);
    border-radius: 14px;
    box-shadow: 0 0 0 6px var(--blue-dim);
    transition: transform .55s cubic-bezier(.22, 1.36, .38, 1) .15s;
}

:root[data-theme="dark"] .ddos-showcase-slide-icon {
    background: rgba(59, 130, 246, .14);
    border-color: rgba(147, 197, 253, .35);
    box-shadow: 0 0 0 6px rgba(59, 130, 246, .12);
}

.ddos-showcase-slide-icon svg {
    width: 26px;
    height: 26px;
}

.ddos-showcase-slide.is-active .ddos-showcase-slide-icon {
    transform: scale(1.04);
}

.ddos-showcase-slide-title {
    margin: 0;
    color: var(--showcase-fg);
    font-family: var(--font-display);
    font-size: clamp(28px, 3.2vw, 44px);
    font-weight: 820;
    line-height: 1.05;
    letter-spacing: -.022em;
}

.ddos-showcase-slide-desc {
    max-width: 560px;
    margin: 18px 0 0;
    color: var(--showcase-fg-soft);
    font-size: 16px;
    line-height: 1.6;
}

.ddos-showcase-slide-callout {
    margin: auto 0 0;
    padding-top: 28px;
    color: var(--showcase-accent);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    border-top: 1px solid var(--showcase-border);
}

/* Per-element stagger on active slide */
.ddos-showcase-slide.is-active .ddos-showcase-slide-eyebrow,
.ddos-showcase-slide.is-active .ddos-showcase-slide-title,
.ddos-showcase-slide.is-active .ddos-showcase-slide-desc,
.ddos-showcase-slide.is-active .ddos-showcase-slide-callout {
    animation: ddosShowcaseRise .65s cubic-bezier(.22, .61, .36, 1) both;
}

.ddos-showcase-slide.is-active .ddos-showcase-slide-title {
    animation-delay: .06s;
}

.ddos-showcase-slide.is-active .ddos-showcase-slide-desc {
    animation-delay: .14s;
}

.ddos-showcase-slide.is-active .ddos-showcase-slide-callout {
    animation-delay: .22s;
}

@keyframes ddosShowcaseRise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .ddos-showcase-progress-bar {
        transition: none;
        width: 100% !important;
    }

    .ddos-showcase-slide {
        transition: opacity .2s ease;
        transform: none !important;
    }

    .ddos-showcase-slide.is-active .ddos-showcase-slide-eyebrow,
    .ddos-showcase-slide.is-active .ddos-showcase-slide-title,
    .ddos-showcase-slide.is-active .ddos-showcase-slide-desc,
    .ddos-showcase-slide.is-active .ddos-showcase-slide-callout {
        animation: none;
    }
}

@media (max-width: 980px) {
    .ddos-showcase-body {
        flex-direction: column;
    }

    .ddos-showcase-nav {
        flex: 0 0 auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px 0;
        border-right: 0;
        border-bottom: 1px solid var(--showcase-border);
        scrollbar-width: none;
    }

    .ddos-showcase-nav::-webkit-scrollbar {
        display: none;
    }

    .ddos-showcase-tab {
        flex: 0 0 auto;
        grid-template-columns: auto auto;
        padding: 10px 16px;
    }

    .ddos-showcase-tab::before {
        left: 14px;
        right: 14px;
        top: auto;
        bottom: 0;
        width: auto;
        height: 2px;
        transform: scaleX(0);
        transform-origin: left;
    }

    .ddos-showcase-tab.is-active::before {
        transform: scaleX(1);
    }

    .ddos-showcase-tab-label {
        font-size: 13px;
    }

    .ddos-showcase-stage {
        padding: 32px 28px;
        min-height: 380px;
    }

    .ddos-showcase-slide {
        inset: 32px 28px;
    }

    .ddos-chart-wrap {
        padding: 16px 14px 8px 58px;
    }

    .ddos-yaxis {
        width: 44px;
        left: 10px;
    }

    .ddos-xaxis {
        padding: 4px 14px 14px 58px;
        font-size: 9px;
    }

    .ddos-tooltip {
        left: 14%;
        min-width: 160px;
        font-size: 11px;
    }

    .ddos-chart {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .ddos-chart {
        height: 220px;
    }

    .ddos-xaxis li:nth-child(even) {
        display: none;
    }

    .ddos-tooltip {
        left: 50%;
        transform: translateX(-50%);
        top: 16px;
    }
}

/* ── Anti-DDoS pipeline flow — "Así protegemos el tráfico" ─────
   4-stage card pipeline (Internet → Protección inicial → Inspección
   → Tus servicios) with animated particle channels, an orange
   divert-to-extra-cleaning branch, and a live stat bar. Inherits the
   theme-aware vars from .ddos-panel; the JS binder (bindDdosFlow)
   spawns .ddos-flow-dot particles into each .ddos-flow-channel and
   drives the [data-flow-*] counters off the chart's ddos:tick stream.
   Semantic colors: clean #22c55e · divert #f97316 · analysis #3b82f6. */
.ddos-flow {
    --flow-clean: #22c55e;
    --flow-divert: #f97316;
    --flow-analysis: #3b82f6;
    margin-top: -8px;
    margin-bottom: 36px;
}

:root[data-theme="dark"] .ddos-flow {
    --flow-analysis: #60a5fa;
}

/* Header — branded title block (left) + 3-key legend (right) */
.ddos-flow-heading {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ddos-flow-heading-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 11px;
    color: var(--flow-clean);
    border: 1px solid rgba(34, 197, 94, .32);
    background: rgba(34, 197, 94, .08);
}

.ddos-flow-heading-title {
    margin: 0;
    color: var(--panel-fg);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 780;
    letter-spacing: -.01em;
    line-height: 1.12;
}

.ddos-flow-heading-sub {
    margin: 2px 0 0;
    color: var(--panel-fg-mute);
    font-size: 11.5px;
    line-height: 1.2;
}

.ddos-flow-legend {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    color: var(--panel-fg-mute);
    font-family: var(--font-mono);
    font-size: 11px;
}

.ddos-flow-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.ddos-flow-key-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.ddos-flow-key-dot.is-clean    { background: var(--flow-clean);    box-shadow: 0 0 7px rgba(34, 197, 94, .6); }
.ddos-flow-key-dot.is-divert   { background: var(--flow-divert);   box-shadow: 0 0 7px rgba(249, 115, 22, .6); }
.ddos-flow-key-dot.is-analysis { background: var(--flow-analysis); box-shadow: 0 0 7px rgba(59, 130, 246, .6); }

/* Canvas — holds the card grid plus the absolutely-positioned divert
   branch. Bottom padding reserves room for the branch loop. */
.ddos-flow-canvas {
    position: relative;
    padding: 30px 24px;
    border-bottom: 1px solid var(--panel-divider);
}

.ddos-flow-grid {
    display: grid;
    grid-template-columns: 1fr 56px 1fr 56px 1fr 56px 1fr;
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 0;
}

/* Divert branch occupies its own grid row, spanning the Análisis →
   Clean columns (lines 5–8) so the dashed arcs land on the real card
   centers (x≈22% = Análisis, 50% = pill, x≈78% = Clean) at any width. */
.ddos-flow-branch-wrap {
    position: relative;
    grid-column: 5 / 8;
    grid-row: 2;
    height: 92px;
    margin-top: 4px;
}

@media (min-width: 1180px) {
    .ddos-flow-grid {
        grid-template-columns: 1fr 96px 1fr 96px 1fr 96px 1fr;
    }
}

/* Stage cards — centered icon + eyebrow + title + sub */
.ddos-flow-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 22px 16px 26px;
    text-align: center;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: var(--panel-bg);
    overflow: hidden;
    transition: border-color .25s ease, background .25s ease;
}

:root[data-theme="dark"] .ddos-flow-node {
    background: rgba(247, 243, 234, .02);
}

.ddos-flow-node--origin { border-color: rgba(34, 197, 94, .22); }
.ddos-flow-node--filter { border-color: rgba(34, 197, 94, .28); }
.ddos-flow-node--out    { border-color: rgba(34, 197, 94, .34); }

/* Glowing accent line at the card base */
.ddos-flow-node::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 14px;
    width: 46px;
    height: 2px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: var(--flow-clean);
    box-shadow: 0 0 10px 1px var(--flow-clean);
    opacity: .85;
}

/* Active analysis stage — blue ring, border and accent */
.ddos-flow-node--analysis {
    border-color: rgba(59, 130, 246, .55);
}

.ddos-flow-node--analysis.is-active {
    background: rgba(59, 130, 246, .06);
}

:root[data-theme="dark"] .ddos-flow-node--analysis.is-active {
    background: rgba(96, 165, 250, .07);
}

.ddos-flow-node--analysis::after {
    background: var(--flow-analysis);
    box-shadow: 0 0 10px 1px var(--flow-analysis);
}

.ddos-flow-node-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 6px;
    border-radius: 50%;
    color: var(--flow-clean);
    border: 1px solid rgba(34, 197, 94, .4);
    background: rgba(34, 197, 94, .06);
}

.ddos-flow-node-icon svg {
    width: 24px;
    height: 24px;
}

.ddos-flow-node--analysis .ddos-flow-node-icon {
    color: var(--flow-analysis);
    border-color: rgba(59, 130, 246, .5);
    background: rgba(59, 130, 246, .08);
}

.ddos-flow-node-eyebrow {
    color: var(--flow-clean);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.ddos-flow-node--analysis .ddos-flow-node-eyebrow {
    color: var(--flow-analysis);
}

.ddos-flow-node-title {
    margin: 2px 0 0;
    color: var(--panel-fg);
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 760;
    letter-spacing: -.014em;
    line-height: 1.14;
}

.ddos-flow-node-sub {
    margin: 2px 0 0;
    max-width: 19ch;
    color: var(--panel-fg-mute);
    font-size: 11.5px;
    line-height: 1.4;
}

/* Channels — animated particle tubes between cards. The JS binder
   reads .ddos-flow-channel widths and spawns .ddos-flow-dot particles;
   the dashed line + double-chevron are static flow hints. currentColor
   carries the channel's semantic tint to line, arrow and legit dots. */
.ddos-flow-channel {
    position: relative;
    align-self: center;
    height: 64px;
    overflow: hidden;
    color: var(--flow-clean);
}

.ddos-flow-channel--analysis { color: var(--flow-analysis); }
.ddos-flow-channel--clean    { color: var(--flow-clean); }

.ddos-flow-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ddos-flow-line path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1;
    stroke-dasharray: 3 6;
    opacity: .32;
    vector-effect: non-scaling-stroke;
}

.ddos-flow-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    opacity: .55;
    filter: drop-shadow(0 0 4px currentColor);
}

.ddos-flow-dot {
    position: absolute;
    top: 50%;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--flow-clean);
    color: var(--flow-clean);
    box-shadow: 0 0 6px currentColor;
    transform: translate3d(0, -50%, 0);
    animation: ddosFlowMove var(--dur, 2s) linear forwards;
}

/* Legit traffic under inspection reads blue in the analysis channel */
.ddos-flow-channel--analysis .ddos-flow-dot {
    background: var(--flow-analysis);
    color: var(--flow-analysis);
}

/* Diverted traffic — orange, overrides the analysis-channel blue */
.ddos-flow-dot.is-attack {
    background: var(--flow-divert);
    color: var(--flow-divert);
}

.ddos-flow-dot.is-filtered {
    animation-name: ddosFlowMoveFiltered;
    animation-timing-function: ease-out;
}

@keyframes ddosFlowMove {
    0%   { transform: translate3d(-8px, var(--y, -50%), 0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translate3d(var(--w, 200px), var(--y, -50%), 0); opacity: 0; }
}

@keyframes ddosFlowMoveFiltered {
    0%   { transform: translate3d(-8px, var(--y, -50%), 0) scale(1); opacity: 0; background: #f97316; box-shadow: 0 0 6px #f97316; }
    12%  { opacity: 1; }
    55%  { transform: translate3d(calc(var(--w, 200px) * .55), var(--y, -50%), 0) scale(1); opacity: 1; background: #f97316; box-shadow: 0 0 6px #f97316; }
    72%  { transform: translate3d(calc(var(--w, 200px) * .68), var(--y, -50%), 0) scale(1.9); opacity: 1; background: #fbbf24; box-shadow: 0 0 14px #fbbf24; }
    100% { transform: translate3d(calc(var(--w, 200px) * .72), var(--y, -50%), 0) scale(0); opacity: 0; }
}

/* Divert branch — orange dashed loop dipping to the "Limpieza
   adicional" pill below the Análisis → Clean span. Decorative. */
.ddos-flow-branch-track {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ddos-flow-branch-path {
    fill: none;
    stroke: var(--flow-divert);
    stroke-width: 1.4;
    stroke-dasharray: 2 5;
    stroke-linecap: round;
    opacity: .7;
    vector-effect: non-scaling-stroke;
    animation: ddosBranchFlow 1.1s linear infinite;
}

@keyframes ddosBranchFlow {
    to { stroke-dashoffset: -14; }
}

.ddos-flow-branch {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 8px 16px 8px 11px;
    border: 1px solid rgba(249, 115, 22, .45);
    border-radius: 999px;
    background: rgba(249, 115, 22, .08);
    white-space: nowrap;
}

:root[data-theme="dark"] .ddos-flow-branch {
    background: rgba(249, 115, 22, .1);
}

.ddos-flow-branch-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--flow-divert);
    border: 1px solid rgba(249, 115, 22, .5);
    background: rgba(249, 115, 22, .1);
}

.ddos-flow-branch-icon svg {
    width: 15px;
    height: 15px;
}

.ddos-flow-branch-text {
    display: flex;
    flex-direction: column;
    line-height: 1.18;
}

.ddos-flow-branch-text strong {
    color: var(--flow-divert);
    font-size: 12.5px;
    font-weight: 700;
}

.ddos-flow-branch-text span {
    color: var(--panel-fg-mute);
    font-size: 10.5px;
}

/* Stat bar — 4 live KPIs with semantic icon badges */
.ddos-flow-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
}

.ddos-flow-stat {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 24px;
    border-left: 1px solid var(--panel-divider);
}

.ddos-flow-stat:first-child {
    border-left: 0;
}

.ddos-flow-stat-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.ddos-flow-stat-icon svg {
    width: 18px;
    height: 18px;
}

.ddos-flow-stat-icon.is-danger   { color: #ef4444;            border: 1px solid rgba(239, 68, 68, .34);  background: rgba(239, 68, 68, .08); }
.ddos-flow-stat-icon.is-clean    { color: var(--flow-clean);  border: 1px solid rgba(34, 197, 94, .34);  background: rgba(34, 197, 94, .08); }
.ddos-flow-stat-icon.is-analysis { color: var(--flow-analysis); border: 1px solid rgba(59, 130, 246, .34); background: rgba(59, 130, 246, .08); }

.ddos-flow-stat-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ddos-flow-stat-label {
    color: var(--panel-fg-mute);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
}

.ddos-flow-stat-figure {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.ddos-flow-stat-value {
    color: var(--panel-fg);
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.ddos-flow-stat-value span {
    margin-left: 1px;
    color: var(--panel-fg-mute);
    font-size: 13px;
    font-weight: 700;
}

.ddos-flow-stat-value.is-clean-text {
    color: var(--flow-clean);
}

.ddos-flow-stat-delta {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.ddos-flow-stat-delta.is-danger   { color: #ef4444; }
.ddos-flow-stat-delta.is-clean    { color: var(--flow-clean); }
.ddos-flow-stat-delta.is-analysis { color: var(--flow-analysis); }

.ddos-flow-pulse {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--flow-clean);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
    animation: ddosFlowPulse 1.8s ease-out infinite;
    align-self: center;
}

@keyframes ddosFlowPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (max-width: 980px) {
    .ddos-flow-canvas {
        padding: 22px 16px;
    }

    .ddos-flow-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 8px;
    }

    .ddos-flow-channel {
        height: 40px;
    }

    .ddos-flow-line {
        display: none;
    }

    .ddos-flow-arrow {
        transform: translate(-50%, -50%) rotate(90deg);
    }

    .ddos-flow-dot {
        display: none;
    }

    .ddos-flow-branch-wrap {
        grid-column: 1 / -1;
        grid-row: auto;
        height: auto;
        margin-top: 8px;
        display: flex;
        justify-content: center;
    }

    .ddos-flow-branch-track {
        display: none;
    }

    .ddos-flow-branch {
        position: static;
        left: auto;
        transform: none;
    }

    .ddos-flow-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ddos-flow-stat {
        padding: 14px 16px;
    }

    .ddos-flow-stat:nth-child(odd) {
        border-left: 0;
    }

    .ddos-flow-stat:nth-child(n+3) {
        border-top: 1px solid var(--panel-divider);
    }
}

@media (max-width: 560px) {
    .ddos-flow .ddos-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ddos-flow-legend {
        flex-wrap: wrap;
        gap: 10px 14px;
    }

    .ddos-flow-stats {
        grid-template-columns: 1fr;
    }

    .ddos-flow-stat {
        border-left: 0;
        border-top: 1px solid var(--panel-divider);
    }

    .ddos-flow-stat:first-child {
        border-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ddos-flow-dot,
    .ddos-flow-pulse,
    .ddos-flow-branch-path {
        animation: none;
    }
}

