/**
 * ATMOSPHERIC EFFECTS
 * Particles, fog, lighting, animations
 */

/* === ATMOSPHERIC OVERLAY LAYERS === */
#atmospheric-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-particles, 5);
    overflow: hidden;
}

/* === FOG LAYERS === */
.fog-layer {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    opacity: 0.4;
}

.fog-layer-1 {
    background: radial-gradient(
        ellipse at 20% 30%,
        rgba(180, 180, 180, 0.05) 0%,
        transparent 40%
    ),
    radial-gradient(
        ellipse at 80% 70%,
        rgba(180, 180, 180, 0.06) 0%,
        transparent 50%
    );
    animation: fogDrift1 30s ease-in-out infinite;
}

.fog-layer-2 {
    background: radial-gradient(
        ellipse at 60% 50%,
        rgba(180, 180, 180, 0.04) 0%,
        transparent 60%
    ),
    radial-gradient(
        ellipse at 30% 80%,
        rgba(180, 180, 180, 0.05) 0%,
        transparent 45%
    );
    animation: fogDrift2 40s ease-in-out infinite;
    animation-delay: 5s;
}

.fog-layer-3 {
    background: radial-gradient(
        ellipse at 70% 20%,
        rgba(180, 180, 180, 0.03) 0%,
        transparent 55%
    );
    animation: fogDrift3 50s ease-in-out infinite;
    animation-delay: 10s;
}

@keyframes fogDrift1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-3%, 2%) scale(1.05);
    }
    50% {
        transform: translate(2%, -2%) scale(1);
    }
    75% {
        transform: translate(-2%, 3%) scale(1.03);
    }
}

@keyframes fogDrift2 {
    0%, 100% {
        transform: translate(0, 0) scale(1.02);
    }
    33% {
        transform: translate(3%, -2%) scale(1);
    }
    66% {
        transform: translate(-2%, 2%) scale(1.04);
    }
}

@keyframes fogDrift3 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(-4%, 1%) rotate(2deg);
    }
}

/* === DUST PARTICLES === */
.dust-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 234, 167, 0.4);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 3px rgba(255, 234, 167, 0.3);
}

/* Multiple particle animations */
.dust-particle:nth-child(1) {
    left: 10%;
    animation: dustFloat1 15s linear infinite;
}

.dust-particle:nth-child(2) {
    left: 25%;
    animation: dustFloat2 20s linear infinite;
    animation-delay: 2s;
}

.dust-particle:nth-child(3) {
    left: 40%;
    animation: dustFloat3 18s linear infinite;
    animation-delay: 5s;
}

.dust-particle:nth-child(4) {
    left: 60%;
    animation: dustFloat1 22s linear infinite;
    animation-delay: 8s;
}

.dust-particle:nth-child(5) {
    left: 75%;
    animation: dustFloat2 17s linear infinite;
    animation-delay: 3s;
}

.dust-particle:nth-child(6) {
    left: 90%;
    animation: dustFloat3 19s linear infinite;
    animation-delay: 7s;
}

@keyframes dustFloat1 {
    0% {
        top: -5%;
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        top: 105%;
        opacity: 0;
    }
}

@keyframes dustFloat2 {
    0% {
        top: -5%;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 0.5;
    }
    50% {
        transform: translateX(30px);
    }
    90% {
        opacity: 0.3;
    }
    100% {
        top: 105%;
        opacity: 0;
        transform: translateX(0);
    }
}

@keyframes dustFloat3 {
    0% {
        top: -5%;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 0.7;
    }
    50% {
        transform: translateX(-25px);
    }
    90% {
        opacity: 0.2;
    }
    100% {
        top: 105%;
        opacity: 0;
        transform: translateX(0);
    }
}

/* === TORCH LIGHT EFFECTS === */
.torch-corner {
    position: fixed;
    width: 600px;              /* Zwiększone z 400px -> 600px */
    height: 600px;             /* Zwiększone z 400px -> 600px */
    pointer-events: none;
    z-index: var(--z-particles, 5);
    mix-blend-mode: screen;    /* Blend mode - nakładają się addytywnie */
}

.torch-top-left {
    top: -50px;                /* Przesunięte wyżej dla lepszego efektu */
    left: -50px;
    background: radial-gradient(
        circle at 100px 100px,  /* Pozycja światła pochodni */
        rgba(255, 159, 67, 0.6) 0%,
        rgba(255, 159, 67, 0.35) 15%,
        rgba(255, 120, 40, 0.18) 30%,
        rgba(255, 80, 20, 0.08) 50%,
        transparent 70%
    );
    animation: torchFlicker1 3s ease-in-out infinite;
}

.torch-top-right {
    top: -50px;
    right: -50px;
    background: radial-gradient(
        circle at calc(100% - 100px) 100px,
        rgba(255, 159, 67, 0.55) 0%,
        rgba(255, 159, 67, 0.32) 15%,
        rgba(255, 120, 40, 0.16) 30%,
        rgba(255, 80, 20, 0.07) 50%,
        transparent 70%
    );
    animation: torchFlicker2 4s ease-in-out infinite;
    animation-delay: 1s;
}

.torch-bottom-left {
    bottom: -50px;             /* Przesuniemy w górę aby były widoczne */
    left: -50px;
    background: radial-gradient(
        circle at 100px calc(100% - 100px),
        rgba(255, 159, 67, 0.5) 0%,
        rgba(255, 159, 67, 0.28) 15%,
        rgba(255, 120, 40, 0.14) 30%,
        rgba(255, 80, 20, 0.06) 50%,
        transparent 70%
    );
    animation: torchFlicker3 3.5s ease-in-out infinite;
    animation-delay: 2s;
}

.torch-bottom-right {
    bottom: -50px;
    right: -50px;
    background: radial-gradient(
        circle at calc(100% - 100px) calc(100% - 100px),
        rgba(255, 159, 67, 0.58) 0%,
        rgba(255, 159, 67, 0.33) 15%,
        rgba(255, 120, 40, 0.17) 30%,
        rgba(255, 80, 20, 0.08) 50%,
        transparent 70%
    );
    animation: torchFlicker1 4.5s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes torchFlicker1 {
    0%, 100% {
        opacity: 1;
        filter: blur(30px);      /* Zwiększony blur dla miękkiego światła */
    }
    20% {
        opacity: 0.92;
        filter: blur(35px);
    }
    40% {
        opacity: 1;
        filter: blur(28px);
    }
    60% {
        opacity: 0.88;
        filter: blur(38px);
    }
    80% {
        opacity: 0.95;
        filter: blur(32px);
    }
}

@keyframes torchFlicker2 {
    0%, 100% {
        opacity: 0.96;
        filter: blur(32px);
    }
    25% {
        opacity: 1;
        filter: blur(30px);
    }
    50% {
        opacity: 0.90;
        filter: blur(36px);
    }
    75% {
        opacity: 0.88;
        filter: blur(34px);
    }
}

@keyframes torchFlicker3 {
    0%, 100% {
        opacity: 0.92;
        filter: blur(33px);
    }
    33% {
        opacity: 0.97;
        filter: blur(36px);
    }
    66% {
        opacity: 1;
        filter: blur(29px);
    }
}

/* === EMBER PARTICLES === */
.ember-particle {
    position: absolute;
    width: 5px;              /* Zwiększone z 3px -> 5px */
    height: 5px;             /* Zwiększone z 3px -> 5px */
    background: rgba(255, 140, 60, 0.95);  /* Jaśniejszy kolor */
    border-radius: 50%;
    pointer-events: none;
    box-shadow:
        0 0 8px rgba(255, 140, 60, 1),     /* Większy glow */
        0 0 15px rgba(255, 99, 72, 0.6);   /* Dodatkowy glow */
}

.ember-particle:nth-child(odd) {
    animation: emberRise 8s ease-out infinite;
}

.ember-particle:nth-child(even) {
    animation: emberRise 10s ease-out infinite;
    animation-delay: 3s;
}

@keyframes emberRise {
    0% {
        bottom: 0;
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    50% {
        transform: translateX(20px) scale(0.8);
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: translateX(-10px) scale(0.3);
    }
}

/* === VIGNETTE EFFECT === */
.dark-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 30%,
        rgba(10, 8, 6, 0.4) 70%,
        rgba(10, 8, 6, 0.8) 100%
    );
    pointer-events: none;
    z-index: var(--z-particles, 5);
}

/* === GLOWING ELEMENTS === */
.glow-hover {
    transition: all var(--transition-base);
}

.glow-hover:hover {
    text-shadow:
        0 0 10px currentColor,
        var(--shadow-text);
    filter: brightness(1.2);
}

/* Magic glow animation */
.magic-glow {
    position: relative;
}

.magic-glow::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        rgba(95, 61, 196, 0.3),
        rgba(74, 103, 65, 0.3),
        rgba(45, 90, 74, 0.3),
        rgba(95, 61, 196, 0.3)
    );
    background-size: 300% 300%;
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    animation: magicGlowPulse 4s ease-in-out infinite;
    pointer-events: none;
    filter: blur(8px);
}

.magic-glow:hover::after {
    opacity: 1;
}

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

/* === PARALLAX BACKGROUND === */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background, -1);
    transform: translateZ(-10px) scale(2);
}

/* === SHIMMER EFFECT (for special items) === */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmerSlide 3s ease-in-out infinite;
}

@keyframes shimmerSlide {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* === FLOATING ANIMATION (for special buttons/elements) === */
.float-animation {
    animation: floatUp 3s ease-in-out infinite;
}

@keyframes floatUp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* === PULSE ANIMATION === */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 234, 167, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 234, 167, 0.6);
    }
}

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

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

/* === HOVER SCALE EFFECT === */
.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fog-layer,
    .dust-particle,
    .torch-corner,
    .ember-particle {
        animation: none !important;
    }
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    /* Disable heavy effects on mobile */
    .fog-layer,
    .dust-particle,
    .ember-particle,
    .torch-corner {
        display: none;
    }

    .dark-vignette {
        opacity: 0.5;
    }

    /* Reduce animation complexity */
    .magic-glow::after,
    .shimmer::before {
        display: none;
    }
}

/* === PERFORMANCE MODE (optional class) === */
.performance-mode .fog-layer,
.performance-mode .dust-particle,
.performance-mode .torch-corner,
.performance-mode .ember-particle {
    display: none;
}

.performance-mode .dark-vignette {
    opacity: 0.3;
}
