/* ==========================================
   AUTHENTIC GLITCH - Visual Effects
   Vaporwave Dream Edition
   ========================================== */

/* ==========================================
   ANIMATED GRADIENT HEADERS
   ========================================== */
.zine-header {
    background: linear-gradient(
        135deg,
        #1a1a2e,
        #16213e,
        #0f3460,
        #16213e,
        #1a1a2e
    );
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
}

.zine-header.dark {
    background: linear-gradient(
        135deg,
        #0D0D1A,
        #1A1A2E,
        #2D1B4E,
        #1A1A2E,
        #0D0D1A
    );
    background-size: 300% 300%;
    animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Hero section gradient */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 113, 206, 0.05) 50%,
        rgba(1, 205, 254, 0.05) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* ==========================================
   READING PROGRESS BAR
   ========================================== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-color),
        var(--secondary-color)
    );
    z-index: 9999;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px var(--glow-pink), 0 0 20px var(--glow-cyan);
}

/* ==========================================
   NOISE / GRAIN OVERLAY
   ========================================== */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Animated noise */
@keyframes noiseMove {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(5%, 5%); }
    30% { transform: translate(-5%, 5%); }
    40% { transform: translate(5%, -5%); }
    50% { transform: translate(-5%, 0); }
    60% { transform: translate(5%, 0); }
    70% { transform: translate(0, 5%); }
    80% { transform: translate(0, -5%); }
    90% { transform: translate(-5%, 5%); }
    100% { transform: translate(0, 0); }
}

[data-ambient="true"] .noise-overlay {
    opacity: 0.06;
    animation: noiseMove 0.5s steps(10) infinite;
}

/* ==========================================
   CRT SCANLINES EFFECT
   ========================================== */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* Show scanlines on ambient mode */
[data-ambient="true"] .scanlines {
    opacity: 1;
}

/* CRT flicker effect */
@keyframes crtFlicker {
    0% { opacity: 0.97; }
    5% { opacity: 1; }
    10% { opacity: 0.98; }
    15% { opacity: 1; }
    50% { opacity: 1; }
    55% { opacity: 0.99; }
    70% { opacity: 1; }
    80% { opacity: 0.98; }
    100% { opacity: 1; }
}

[data-ambient="true"] body {
    animation: crtFlicker 4s infinite;
}

/* ==========================================
   PAGE LOAD GLITCH EFFECT
   ========================================== */
.page-glitch {
    animation: pageGlitch 0.5s ease-out;
}

@keyframes pageGlitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    10% {
        transform: translate(-5px, 5px);
        filter: hue-rotate(90deg);
    }
    20% {
        transform: translate(5px, -5px);
        filter: hue-rotate(180deg);
    }
    30% {
        transform: translate(-3px, 3px);
        filter: hue-rotate(270deg);
    }
    40% {
        transform: translate(3px, -3px);
        filter: hue-rotate(360deg);
    }
    50% {
        transform: translate(-2px, 2px);
        filter: hue-rotate(0deg);
    }
    60% {
        transform: translate(2px, -2px);
    }
    70% {
        transform: translate(-1px, 1px);
    }
    80% {
        transform: translate(1px, -1px);
    }
    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

/* Glitch text effect for titles */
.glitch-text-effect {
    position: relative;
}

.glitch-text-effect::before,
.glitch-text-effect::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text-effect::before {
    color: var(--secondary-color);
    animation: glitchText 2s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-2px, -2px);
    opacity: 0.8;
}

.glitch-text-effect::after {
    color: var(--primary-color);
    animation: glitchText 2s infinite reverse;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    transform: translate(2px, 2px);
    opacity: 0.8;
}

@keyframes glitchText {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
}

/* ==========================================
   SCROLL-TRIGGERED ANIMATIONS
   ========================================== */
.scroll-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

.scroll-rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-rotate-in.visible {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Stagger delays for multiple elements */
.scroll-delay-1 { transition-delay: 0.1s; }
.scroll-delay-2 { transition-delay: 0.2s; }
.scroll-delay-3 { transition-delay: 0.3s; }
.scroll-delay-4 { transition-delay: 0.4s; }

/* ==========================================
   AMBIENT MODE TOGGLE BUTTON
   ========================================== */
.ambient-toggle {
    position: fixed;
    bottom: 80px;
    left: 20px;
    background: var(--surface-color);
    border: 2px solid var(--accent-color);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-color);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 15px var(--glow-purple);
}

.ambient-toggle:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--glow-purple);
}

.ambient-toggle .toggle-icon {
    font-size: 1rem;
}

[data-ambient="true"] .ambient-toggle {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 30px var(--glow-purple), 0 0 60px var(--glow-cyan);
}

/* ==========================================
   GLOW EFFECTS
   ========================================== */
.glow-pink {
    box-shadow: 0 0 20px var(--glow-pink);
}

.glow-cyan {
    box-shadow: 0 0 20px var(--glow-cyan);
}

.glow-purple {
    box-shadow: 0 0 20px var(--glow-purple);
}

.text-glow {
    text-shadow: 0 0 10px var(--glow-pink), 0 0 20px var(--glow-cyan);
}

/* Neon border effect */
.neon-border {
    border: 2px solid var(--primary-color);
    box-shadow:
        0 0 5px var(--glow-pink),
        0 0 10px var(--glow-pink),
        inset 0 0 5px var(--glow-pink);
}

/* ==========================================
   VAPORWAVE EXTRAS
   ========================================== */

/* Gradient text */
.gradient-text {
    background: linear-gradient(
        135deg,
        var(--primary-color),
        var(--accent-color),
        var(--secondary-color)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Chrome/metallic text effect */
.chrome-text {
    background: linear-gradient(
        180deg,
        #fff 0%,
        #B967FF 50%,
        #01CDFE 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

/* Floating animation for ambient elements */
@keyframes ambientFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-5px) rotate(-1deg);
    }
    75% {
        transform: translateY(-15px) rotate(1deg);
    }
}

[data-ambient="true"] .collage-shape {
    animation: ambientFloat 6s ease-in-out infinite;
}

/* Pulsing glow for ambient mode */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px var(--glow-pink);
    }
    50% {
        box-shadow: 0 0 40px var(--glow-pink), 0 0 60px var(--glow-cyan);
    }
}

[data-ambient="true"] .floating-badge {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS FOR EFFECTS
   ========================================== */
@media (max-width: 768px) {
    .ambient-toggle {
        bottom: 70px;
        left: 10px;
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }

    .reading-progress {
        height: 2px;
    }
}

@media (max-width: 480px) {
    .ambient-toggle {
        bottom: auto;
        top: 70px;
        left: 10px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .scroll-fade-in,
    .scroll-slide-left,
    .scroll-slide-right,
    .scroll-scale-in,
    .scroll-rotate-in {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .page-glitch {
        animation: none;
    }

    @keyframes gradientShift {
        0%, 100% { background-position: 0% 50%; }
    }
}
