/* =============================================================
   CRASH SITE — FX STYLES
   All effects scoped to .fx-enabled body class.
   Toggle $FX = false in crash-site.php to disable entirely.
   ============================================================= */

/* ── Scanlines overlay on hero ──────────────────────────────── */
.fx-enabled .crash-site-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.18) 3px,
        rgba(0, 0, 0, 0.18) 4px
    );
    will-change: opacity;
}

/* ── Vertical sweep line ────────────────────────────────────── */
.fx-enabled .crash-site-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 48%,
        rgba(255, 255, 255, 0.07) 50%,
        rgba(255, 255, 255, 0.03) 52%,
        transparent 100%
    );
    animation: cs-sweep 8s linear infinite;
    will-change: transform;
}

@keyframes cs-sweep {
    0%   { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ── Grid pulse ─────────────────────────────────────────────── */
.fx-enabled .grid-overlay {
    animation: cs-grid-pulse 6s ease-in-out infinite;
}

@keyframes cs-grid-pulse {
    0%, 100% { opacity: 0.02; }
    50%       { opacity: 0.07; }
}

/* ── Glitch keyframes ───────────────────────────────────────── */
@keyframes cs-glitch-clip1 {
    0%   { clip-path: inset(15% 0 70% 0); transform: translateX(-2px); opacity: 0.6; }
    40%  { clip-path: inset(60% 0 15% 0); transform: translateX(2px);  opacity: 0.8; }
    70%  { clip-path: inset(35% 0 45% 0); transform: translateX(-1px); opacity: 0.5; }
    100% { clip-path: inset(15% 0 70% 0); transform: translateX(0);    opacity: 0.6; }
}

@keyframes cs-glitch-clip2 {
    0%   { clip-path: inset(65% 0 10% 0); transform: translateX(2px);  opacity: 0.5; }
    40%  { clip-path: inset(20% 0 60% 0); transform: translateX(-2px); opacity: 0.7; }
    70%  { clip-path: inset(45% 0 35% 0); transform: translateX(1px);  opacity: 0.6; }
    100% { clip-path: inset(65% 0 10% 0); transform: translateX(0);    opacity: 0.5; }
}

/* Glitch applied to signal + tagline via JS .glitch-active */
.fx-enabled .glitch-active {
    position: relative;
}

.fx-enabled .glitch-active::before,
.fx-enabled .glitch-active::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fx-enabled .glitch-active::before {
    color: #ff003c;
    text-shadow: 1px 0 #ff003c;
    animation: cs-glitch-clip1 0.55s ease-in-out infinite;
    opacity: 0.6;
}

.fx-enabled .glitch-active::after {
    color: #00eaff;
    text-shadow: -1px 0 #00eaff;
    animation: cs-glitch-clip2 0.55s ease-in-out infinite;
    opacity: 0.6;
}

/* ── Signal HUD ─────────────────────────────────────────────── */
.crash-site-hud {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    z-index: 10;
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.7;
    pointer-events: none;
    letter-spacing: 0.08em;
    text-align: right;
}

.crash-site-hud .hud-row {
    display: block;
    white-space: nowrap;
}

.crash-site-hud .hud-label {
    color: rgba(255, 255, 255, 0.25);
    margin-right: 0.3em;
}

.crash-site-hud .hud-value {
    color: rgba(255, 255, 255, 0.55);
}

.crash-site-hud .hud-bars {
    display: inline-flex;
    gap: 2px;
    align-items: flex-end;
    height: 10px;
    margin-left: 0.4em;
    vertical-align: middle;
}

.crash-site-hud .hud-bar {
    width: 3px;
    background: rgba(255, 255, 255, 0.4);
    animation: cs-hud-bar 1.2s ease-in-out infinite;
}

.crash-site-hud .hud-bar:nth-child(1) { animation-delay: 0s;    }
.crash-site-hud .hud-bar:nth-child(2) { animation-delay: 0.15s; }
.crash-site-hud .hud-bar:nth-child(3) { animation-delay: 0.3s;  }
.crash-site-hud .hud-bar:nth-child(4) { animation-delay: 0.45s; }
.crash-site-hud .hud-bar:nth-child(5) { animation-delay: 0.6s;  }

@keyframes cs-hud-bar {
    0%, 100% { height: 3px;  opacity: 0.3; }
    50%       { height: 10px; opacity: 0.8; }
}

@media (max-width: 768px) {
    .crash-site-hud {
        bottom: 1rem;
        right: 50%;
        transform: translateX(50%);
        text-align: center;
        font-size: 0.55rem;
    }
    /* Hide the less critical rows on mobile, keep freq + sig */
    .crash-site-hud .hud-row:nth-child(1),
    .crash-site-hud .hud-row:nth-child(2),
    .crash-site-hud .hud-row:nth-child(5) {
        display: none;
    }
}

/* ── Frequency visualizer bars (Apply section) ──────────────── */
.crash-site-signal-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 32px;
    margin: 1.5rem auto 0;
}

.cs-freq-bar {
    width: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
    animation: cs-freq 1.4s ease-in-out infinite;
    will-change: height, opacity;
}

.cs-freq-bar:nth-child(1) { animation-delay: 0s;    animation-duration: 1.1s; }
.cs-freq-bar:nth-child(2) { animation-delay: 0.1s;  animation-duration: 0.9s; }
.cs-freq-bar:nth-child(3) { animation-delay: 0.2s;  animation-duration: 1.3s; }
.cs-freq-bar:nth-child(4) { animation-delay: 0.0s;  animation-duration: 0.8s; }
.cs-freq-bar:nth-child(5) { animation-delay: 0.3s;  animation-duration: 1.5s; }
.cs-freq-bar:nth-child(6) { animation-delay: 0.15s; animation-duration: 1.0s; }
.cs-freq-bar:nth-child(7) { animation-delay: 0.05s; animation-duration: 1.2s; }

@keyframes cs-freq {
    0%, 100% { height: 4px;  opacity: 0.3; }
    50%       { height: 28px; opacity: 0.9; }
}

/* ── Scramble text — hide overflow during animation ─────────── */
.cs-scrambling {
    display: inline-block;
}
