/* Agitation / Decay Section */
.agitation-section {
    padding: 100px 0;
    position: relative;
    /* Blend from Hero (#0a0a0a) to Slate (#0f172a) with Red Highlight */
    background: radial-gradient(circle at top left, rgba(239, 68, 68, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, #0a0a0a 0%, #0f172a 100%);
    overflow: hidden;
}

/* Seamless Transition Blend */
.agitation-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to bottom, #0a0a0a, transparent);
    z-index: 1;
    pointer-events: none;
}

.agitation-section .container {
    position: relative;
    z-index: 2;
    /* Ensure content is above the blend overlay */
}

.agitation-section .headline-md {
    margin-bottom: var(--spacing-md);
}

.text-error {
    color: #ef4444;
    /* Tailwind red-500 */
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.text-muted {
    color: #94a3b8;
    margin-bottom: var(--spacing-sm);
    display: block;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Red Icon X variant */
.icon-x.red svg circle {
    fill: #ef4444;
    transition: all 0.3s ease;
}

.icon-x.red svg:hover circle {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
}

/* Visualization Container */
.agitation-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.decay-container {
    width: 100%;
    height: 400px;
    background: #020617;
    /* Very dark slate */
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Grid overlay effect */
.decay-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(30, 41, 59, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 41, 59, 0.3) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
}

.decay-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.1), transparent 50%);
    z-index: 2;
    pointer-events: none;
}

#decay-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.decay-readout {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.decay-readout .label {
    font-size: 10px;
    color: #94a3b8;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.decay-readout .value {
    font-size: 14px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    animation: flash 2s infinite;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@media (max-width: 768px) {
    .reverse-mobile {
        flex-direction: column-reverse;
    }

    .agitation-content {
        text-align: center;
    }

    /* When moved via JS, the visual needs spacing */
    .agitation-visual {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .agitation-content .problem-list {
        /* Usually we want to keep icons aligned */
        display: inline-flex;
        align-items: flex-start;
        text-align: left;
        margin-top: 0.5rem;
    }

    /* Disable interaction on mobile to prevent scrolling glitches */
    .decay-container {
        pointer-events: none;
    }
}

/* Badges Marquee */
/* Badges Static Display (Desktop) */
.badges-marquee-container {
    overflow: visible;
    width: 100%;
    mask-image: none;
    /* Remove fade */
    display: flex;
    justify-content: center;
}

.badges-track {
    display: flex;
    gap: 1.5rem;
    animation: none;
    /* No scroll */
    width: auto;
    justify-content: center;
    flex-wrap: wrap;
    /* efficient wrapping if needed, but 4 should fit */
}

/* Force equal width on desktop */
/* Force equal width on desktop */
.badges-track .sp-badge {
    width: 180px;
    /* Reduced from 240px to match reference */
    flex: 0 0 180px;
}

/* Hide duplicates globally (Show only first 4) */
.badges-track .sp-badge:nth-child(n+5) {
    display: none !important;
}

@media (max-width: 768px) {
    .badges-track {
        gap: 1rem;
        animation: none !important;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2x2 Grid */
        justify-items: stretch;
        /* Stretch to fill column for equal width */
        margin: 0 auto;
    }

    /* Hide duplicates */
    .badges-track .sp-badge:nth-child(n+5) {
        display: none !important;
    }

    .badges-marquee-container {
        overflow: visible !important;
        mask-image: none !important;
        display: block !important;
        /* Override flex from stats.css */
        padding: 0 !important;
        /* Remove padding from stats.css */
        margin-bottom: -1rem;
    }

    .sp-badge {
        flex: unset;
        width: 100% !important;
        /* Force full width of grid column */
        max-width: none;
        scroll-snap-align: none;
        height: auto;
    }

    /* Reduce spacing for Agitation section */

    /* Reduce spacing for Agitation section */
    .agitation-section {
        margin-top: -2rem !important;
        /* Pull up closer to problem section */
        padding-top: 0 !important;
    }

    /* Reduce spacing for Agitation content specifically */
    .agitation-content {
        margin-top: 0rem !important;
    }
}