/* ==========================================================================
   XSECURE — XWAF PAGE SECTIONS (services/xwaf.html)
   Shared tokens, icons, badges, tab cards and feature cards: product.css
   --------------------------------------------------------------------------
   1. XSECURE WAF overview
   2. Threat strip
   3. Traffic flow
   4. Responsive
   ========================================================================== */

.page-xwaf {
    --banner-image: url('../assets/svg/xwaf-features-bg.webp');
}

/* 1. XSECURE WAF OVERVIEW ================================================= */
.waf-overview {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 60px;
}

.waf-overview__visual img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 30px 50px rgba(43, 70, 255, 0.35));
    animation: waf-float 6s ease-in-out infinite;
}

@keyframes waf-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-14px); }
}

.waf-overview__list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    list-style: none;
}

/* 2. THREAT STRIP ========================================================= */
.threat-strip {
    display: flex;
    align-items: center;
    gap: 36px;
    padding: 24px 32px;
}

.threat-strip__label {
    flex-shrink: 0;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.threat-strip__list {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
    justify-content: space-between;
    gap: 20px;
    list-style: none;
}

.threat-strip__list li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

/* 3. TRAFFIC FLOW ========================================================= */
.traffic {
    --lane-y: 52px;          /* centre of the badge row */
    --good: var(--color-accent);
    --bad: var(--p-red);
    --waf-stop: 51%;         /* where malicious traffic is stopped */
    --app-end: 91.6%;        /* centre of the last stage */
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "sources track"
        "legend  legend";
    align-items: start;
    gap: 34px 30px;
    padding: 44px 36px 32px;
}

.traffic__sources {
    grid-area: sources;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: 12px;
}

.traffic__source {
    display: flex;
    align-items: center;
    gap: 12px;
}

.traffic__source h3 {
    font-size: 0.95rem;
    color: var(--good);
}

.traffic__source--bad h3 {
    color: #ff8a93;
}

.traffic__track {
    grid-area: track;
    position: relative;
}

.lane {
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, var(--lane-color) 0 10px, transparent 10px 16px);
    background-size: 32px 4px;
    opacity: 0.75;
    animation: lane-run 1s linear infinite;
}

.lane--good {
    --lane-color: var(--good);
    top: calc(var(--lane-y) - 8px);
    width: var(--app-end);
}

.lane--bad {
    --lane-color: var(--bad);
    top: calc(var(--lane-y) + 4px);
    width: var(--waf-stop);
}

@keyframes lane-run {
    to { background-position: 32px 0; }
}

.packet {
    position: absolute;
    left: 0;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    z-index: 2;
}

.packet--good {
    top: calc(var(--lane-y) - 13px);
    background: #d9fcff;
    box-shadow: 0 0 14px var(--good), 0 0 4px #ffffff;
    animation: packet-good 4.2s linear infinite;
}

.packet--late {
    animation-delay: 2.1s;
}

.packet--bad {
    top: calc(var(--lane-y) - 1px);
    background: #ff6b76;
    box-shadow: 0 0 14px var(--bad);
    animation: packet-bad 2.8s ease-in infinite;
}

@keyframes packet-good {
    0%   { left: 0; opacity: 0; }
    6%   { opacity: 1; }
    94%  { opacity: 1; }
    100% { left: var(--app-end); opacity: 0; }
}

@keyframes packet-bad {
    0%   { left: 0; opacity: 0; transform: scale(1); }
    8%   { opacity: 1; }
    78%  { left: var(--waf-stop); opacity: 1; transform: scale(1); }
    90%  { left: var(--waf-stop); opacity: 0; transform: scale(2.6); }
    100% { left: var(--waf-stop); opacity: 0; transform: scale(2.6); }
}

.block-mark {
    position: absolute;
    top: calc(var(--lane-y) - 14px);
    left: var(--waf-stop);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: -16px;
    border-radius: 50%;
    color: #ffffff;
    background: var(--bad);
    box-shadow: 0 0 18px rgba(224, 38, 47, 0.7);
    animation: block-hit 2.8s ease-in infinite;
}

.block-mark .ico {
    width: 18px;
    height: 18px;
    stroke-width: 6;
}

@keyframes block-hit {
    0%, 76%, 100% { transform: scale(1); }
    84%           { transform: scale(1.35); }
}

.traffic__stages {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    list-style: none;
}

.traffic__stages li {
    display: grid;
    grid-template-rows: calc(var(--lane-y) * 2) auto;
    justify-items: center;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.traffic__stages h3 {
    align-self: start;
    max-width: 130px;
    font-size: 0.82rem;
    line-height: 1.35;
    letter-spacing: 0.8px;
    color: var(--color-text-muted);
}

.traffic__stages .is-waf h3 {
    font-size: 1.05rem;
    color: var(--good);
}

.traffic__stages .is-waf .hex {
    animation: waf-guard 2.8s ease-in infinite;
}

@keyframes waf-guard {
    0%, 76%, 100% { filter: drop-shadow(0 10px 26px var(--color-accent-glow)); }
    84%           { filter: drop-shadow(0 0 34px rgba(224, 38, 47, 0.9)); }
}

.traffic__stages .is-app h3 {
    color: #ffffff;
}

.traffic__legend {
    grid-area: legend;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 40px;
    padding-top: 22px;
    border-top: 1px solid var(--p-border);
    list-style: none;
    font-size: 0.92rem;
    color: var(--color-text-muted);
}

.traffic__legend li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 10px var(--good);
}

.legend-dot--bad {
    background: var(--bad);
    box-shadow: 0 0 10px var(--bad);
}

@media (prefers-reduced-motion: reduce) {
    .waf-overview__visual img,
    .lane,
    .block-mark,
    .traffic__stages .is-waf .hex { animation: none; }
    .packet { display: none; }
}

/* 4. RESPONSIVE =========================================================== */
@media (max-width: 1200px) {
    .waf-overview { grid-template-columns: 1fr; }
    .waf-overview__visual { max-width: 560px; margin: 0 auto; }

    .threat-strip { flex-direction: column; align-items: flex-start; gap: 18px; }
    .threat-strip__list { justify-content: flex-start; gap: 18px 36px; }
}

/* Vertical flow: lanes run top to bottom along the badge column */
@media (max-width: 900px) {
    .traffic {
        --lane-x: 52px;
        --waf-stop: 51%;
        --app-end: 91.6%;
        grid-template-columns: 1fr;
        grid-template-areas: "sources" "track" "legend";
        padding: 32px 22px 26px;
    }

    .traffic__sources {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px 28px;
        padding-top: 0;
    }

    .lane {
        top: 0;
        width: 4px;
        background: repeating-linear-gradient(180deg, var(--lane-color) 0 10px, transparent 10px 16px);
        background-size: 4px 32px;
        animation-name: lane-run-v;
    }

    .lane--good { left: calc(var(--lane-x) - 8px); height: var(--app-end); width: 4px; }
    .lane--bad  { left: calc(var(--lane-x) + 4px); height: var(--waf-stop); width: 4px; }

    .packet { left: auto; top: 0; margin-left: 0; margin-top: -7px; }
    .packet--good { left: calc(var(--lane-x) - 13px); animation-name: packet-good-v; }
    .packet--bad  { left: calc(var(--lane-x) - 1px);  animation-name: packet-bad-v; }

    .block-mark { top: var(--waf-stop); left: calc(var(--lane-x) + 6px); margin-left: -16px; margin-top: -16px; }

    .traffic__stages {
        grid-template-columns: 1fr;
        grid-auto-rows: 1fr;
        row-gap: 14px;
    }

    .traffic__stages li {
        grid-template-rows: none;
        grid-template-columns: calc(var(--lane-x) * 2) 1fr;
        justify-items: start;
        text-align: left;
        gap: 18px;
    }

    .traffic__stages li .hex { justify-self: center; }
    .traffic__stages h3 { align-self: center; max-width: none; font-size: 0.95rem; }

    .traffic__legend { justify-content: flex-start; }
}

@keyframes lane-run-v {
    to { background-position: 0 32px; }
}

@keyframes packet-good-v {
    0%   { top: 0; opacity: 0; }
    6%   { opacity: 1; }
    94%  { opacity: 1; }
    100% { top: var(--app-end); opacity: 0; }
}

@keyframes packet-bad-v {
    0%   { top: 0; opacity: 0; transform: scale(1); }
    8%   { opacity: 1; }
    78%  { top: var(--waf-stop); opacity: 1; transform: scale(1); }
    90%  { top: var(--waf-stop); opacity: 0; transform: scale(2.6); }
    100% { top: var(--waf-stop); opacity: 0; transform: scale(2.6); }
}

@media (max-width: 576px) {
    .threat-strip { padding: 22px 20px; }
}
