/* =================================================
   JAESWIFT Sitewide Effects CSS
   ================================================= */

/* 1. CRT */
html.fx-crt {
    filter: contrast(1.1) saturate(1.2) brightness(0.95);
    animation: fx-crt-flicker 0.15s infinite;
}
html.fx-crt body {
    transform: perspective(1500px) rotateX(0.5deg);
    transform-origin: center top;
    background: radial-gradient(ellipse at center, #0a1a0a 0%, #000 100%);
}
@keyframes fx-crt-flicker {
    0%, 98% { opacity: 1; }
    99% { opacity: 0.94; }
    100% { opacity: 1; }
}
.fx-crt-overlay {
    position: fixed; inset: 0; pointer-events: none; z-index: 9400;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0,0,0,0) 0px,
            rgba(0,0,0,0) 2px,
            rgba(0,0,0,0.18) 3px,
            rgba(0,0,0,0.18) 4px
        ),
        radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.7) 100%);
    mix-blend-mode: multiply;
}
.fx-crt-overlay::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(255,0,0,0.03), transparent 3%, transparent 97%, rgba(0,255,255,0.03));
    mix-blend-mode: screen;
}

/* 2. VHS */
html.fx-vhs body {
    filter: saturate(1.4) contrast(1.1) hue-rotate(-4deg);
    text-shadow: -1px 0 rgba(255,0,0,0.5), 1px 0 rgba(0,255,255,0.5);
}
.fx-vhs-roll {
    position: fixed; left: 0; right: 0; height: 60px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.09), transparent);
    pointer-events: none; z-index: 9300;
    animation: fx-vhs-roll 8s linear infinite;
}
@keyframes fx-vhs-roll {
    0% { top: -10%; } 100% { top: 110%; }
}
.fx-vhs-glitch-block {
    position: fixed; left: 0; right: 0;
    background: rgba(0,255,255,0.4);
    mix-blend-mode: difference;
    pointer-events: none; z-index: 9310;
    transform: translateX(5px);
}

/* 3. GLITCH */
html.fx-glitch body {
    animation: fx-glitch-shake 3.5s infinite steps(1);
}
html.fx-glitch h1, html.fx-glitch h2, html.fx-glitch .panel-title {
    position: relative;
    animation: fx-glitch-chroma 2.8s infinite steps(1);
}
@keyframes fx-glitch-shake {
    0%, 97%, 100% { transform: translate(0, 0); }
    98% { transform: translate(2px, -1px); }
    99% { transform: translate(-2px, 1px); }
}
@keyframes fx-glitch-chroma {
    0%, 95%, 100% { text-shadow: none; }
    96% { text-shadow: -2px 0 red, 2px 0 cyan; }
    97% { text-shadow: 3px 0 lime, -3px 0 magenta; }
    98% { text-shadow: -1px 0 red, 1px 0 cyan; }
}

/* 4. RED ALERT */
html.fx-redalert body {
    filter: sepia(1) hue-rotate(-50deg) saturate(4) brightness(0.95);
    animation: fx-redalert-pulse 1s infinite;
}
@keyframes fx-redalert-pulse {
    0%, 100% { box-shadow: inset 0 0 60px 10px rgba(255,0,0,0.3); }
    50% { box-shadow: inset 0 0 120px 20px rgba(255,0,0,0.7); }
}
html.fx-redalert body::after {
    content: '';
    position: fixed; inset: 0;
    border: 8px solid transparent;
    box-shadow: inset 0 0 80px 20px rgba(255,0,0,0.5);
    pointer-events: none; z-index: 9400;
    animation: fx-redalert-pulse 1s infinite;
}
.fx-redalert-banner {
    position: fixed; top: 0; left: 0; right: 0;
    background: rgba(120,0,0,0.95); color: #fff;
    text-align: center; padding: 8px;
    font-family: 'Orbitron', monospace; letter-spacing: 4px;
    font-size: 14px; font-weight: bold;
    z-index: 9700;
    animation: fx-redalert-blink 0.8s infinite;
    border-bottom: 2px solid #ff3333;
}
@keyframes fx-redalert-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.4; }
}

/* 5. INVERT */
html.fx-invert { filter: invert(1) hue-rotate(180deg); }

/* 6. BLUEPRINT */
html.fx-blueprint body {
    filter: sepia(1) hue-rotate(180deg) saturate(3) brightness(0.9);
}
.fx-blueprint-grid {
    position: fixed; inset: 0; pointer-events: none; z-index: 9050;
    background-image:
        linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    mix-blend-mode: screen;
}

/* 7. TYPEWRITER (no special styling, just spans) */
.fx-typewriter-span { display: inline; }

/* 10. LOW GRAVITY */
html.fx-lowgrav .panel, html.fx-lowgrav .card {
    transition: transform 1.2s ease-out !important;
}
.fx-lowgrav-bob {
    animation: fx-lowgrav-bob 4s ease-in-out infinite;
}
@keyframes fx-lowgrav-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* 13. RAIN thunder flash */
html.fx-rain-flash body {
    filter: brightness(1.3);
}

/* 15. FOG */
.fx-fog {
    position: fixed; inset: 0; pointer-events: none; z-index: 9300;
    background: radial-gradient(
        circle 150px at var(--fx-fog-x, 50%) var(--fx-fog-y, 50%),
        transparent 0%,
        rgba(20,25,35,0.5) 40%,
        rgba(10,15,25,0.92) 100%
    );
}

/* 16. NIGHT */
html.fx-night body {
    filter: brightness(0.5) contrast(1.2);
    cursor: crosshair;
}
.fx-night-spot {
    position: fixed; inset: 0; pointer-events: none; z-index: 9300;
    background: radial-gradient(
        circle 200px at var(--fx-spot-x, 50%) var(--fx-spot-y, 50%),
        rgba(255,240,180,0.3) 0%,
        transparent 100%
    );
    mix-blend-mode: screen;
}

/* 17. UNDERWATER */
html.fx-underwater body {
    filter: hue-rotate(180deg) saturate(1.3) brightness(0.85);
    animation: fx-underwater-sway 6s ease-in-out infinite;
}
@keyframes fx-underwater-sway {
    0%, 100% { transform: skewX(0deg); }
    50% { transform: skewX(0.5deg); }
}

/* 18. DIMENSIONS */
html.fx-dimensions body {
    transform: perspective(1000px)
        rotateX(var(--fx-tilt-x, 0deg))
        rotateY(var(--fx-tilt-y, 0deg));
    transition: transform 0.3s ease-out;
    transform-style: preserve-3d;
}
html.fx-dimensions .panel {
    transform: translateZ(20px);
    transform-style: preserve-3d;
}

/* 19. PORTAL */
.fx-portal {
    position: fixed;
    width: 150px; height: 150px;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 9400;
    border: 2px solid #00ffc8;
    box-shadow:
        0 0 30px rgba(0,255,200,0.6),
        inset 0 0 30px rgba(0,255,200,0.4);
    animation: fx-portal-ripple 1.5s ease-in-out infinite;
}
.fx-portal iframe {
    width: 1200px; height: 900px;
    border: 0;
    pointer-events: none;
}
@keyframes fx-portal-ripple {
    0%, 100% { box-shadow: 0 0 30px rgba(0,255,200,0.6), inset 0 0 30px rgba(0,255,200,0.4); }
    50% { box-shadow: 0 0 60px rgba(0,255,200,0.9), inset 0 0 60px rgba(0,255,200,0.7); }
}

/* 20. RETRO */
html.retro-1995 body {
    font-family: 'Comic Sans MS', 'Comic Sans', cursive !important;
    background: #ffff99 !important;
    color: #000 !important;
}
html.retro-1995 a { color: #0000ee !important; text-decoration: underline !important; }
html.retro-1995 a:visited { color: #551a8b !important; }
html.retro-1995 .panel {
    border: 3px ridge #c0c0c0 !important;
    background: #e0e0e0 !important;
    color: #000 !important;
}
html.retro-1995 h1, html.retro-1995 h2, html.retro-1995 h3 {
    color: #ff0066 !important;
    text-shadow: 2px 2px 0 #ffff00 !important;
}
.fx-retro-1995-banner {
    position: fixed; top: 0; left: 0; right: 0;
    background: #ffcc00; color: #000;
    text-align: center; padding: 6px;
    font-family: 'Comic Sans MS', cursive;
    font-weight: bold; font-size: 13px;
    border-bottom: 3px ridge #ff0000;
    z-index: 9700;
}
.fx-retro-1995-banner blink {
    animation: fx-blink 1s steps(2) infinite;
}
@keyframes fx-blink { to { visibility: hidden; } }

html.retro-2005 body {
    background: linear-gradient(180deg, #cfe8ff 0%, #9dc5f0 100%) !important;
    font-family: 'Trebuchet MS', 'Verdana', sans-serif !important;
}
html.retro-2005 .panel {
    background: linear-gradient(180deg, #ffffff 0%, #d6e8ff 100%) !important;
    border: 1px solid #4a90d9 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(74,144,217,0.3), inset 0 1px 0 #fff !important;
    color: #0a3a6a !important;
}
html.retro-2005 h1, html.retro-2005 h2 {
    background: linear-gradient(180deg, #1a5eae, #0a3a6a) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    text-shadow: none !important;
}

html.retro-2015 body {
    background: #fafafa !important;
    color: #212121 !important;
    font-family: 'Roboto', 'Arial', sans-serif !important;
}
html.retro-2015 .panel {
    background: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.08) !important;
    color: #212121 !important;
}
html.retro-2015 h1 { color: #ff5722 !important; font-weight: 300 !important; }
html.retro-2015 h2 { color: #2196f3 !important; font-weight: 300 !important; }
html.retro-2015 a { color: #2196f3 !important; }

/* 21. PARTY */
html.fx-party body {
    animation: fx-party-hue 2s linear infinite;
}
@keyframes fx-party-hue {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* 22. GHOST */
html.fx-ghost * {
    cursor: none !important;
}
html.fx-ghost body,
html.fx-ghost .panel,
html.fx-ghost a,
html.fx-ghost button,
html.fx-ghost h1, html.fx-ghost h2, html.fx-ghost h3, html.fx-ghost p, html.fx-ghost span {
    transition: opacity 0.3s;
}
html.fx-ghost .panel,
html.fx-ghost h1, html.fx-ghost h2, html.fx-ghost h3,
html.fx-ghost p, html.fx-ghost a, html.fx-ghost button, html.fx-ghost li {
    opacity: 0.08;
}
html.fx-ghost .panel:hover,
html.fx-ghost h1:hover, html.fx-ghost h2:hover, html.fx-ghost h3:hover,
html.fx-ghost p:hover, html.fx-ghost a:hover, html.fx-ghost button:hover, html.fx-ghost li:hover {
    opacity: 1;
}

/* 25. HACKER */
html.fx-hacker body > *:not(canvas):not(script):not(style) {
    filter: brightness(0.25);
}

/* Reduced motion: neutralize heavy animations */
@media (prefers-reduced-motion: reduce) {
    html.fx-crt, html.fx-redalert body, html.fx-party body,
    .fx-vhs-roll, .fx-redalert-banner {
        animation: none !important;
    }
}
