/* ============================================
   Japanese Countryside Animated Background
   Lo-fi Anime Style - Inspired by Studio Ghibli
   ============================================ */

/* Background Container */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background: #0f0f1a;
}

/* Sky - Beautiful warm sunset gradient */
.sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        #0d0d1a 0%,
        #1a1a2e 10%,
        #2d2d4a 20%,
        #4a3d5c 30%,
        #6b4d6a 40%,
        #8c5d6d 48%,
        #b87a5a 55%,
        #d4944a 62%,
        #e8a840 70%,
        #f5c035 78%,
        #ffd93d 88%,
        #ffeb80 100%
    );
}

/* Atmospheric glow near horizon */
.sky::after {
    content: '';
    position: absolute;
    bottom: 20%;
    left: 0;
    width: 100%;
    height: 40%;
    background: radial-gradient(
        ellipse 100% 60% at 50% 100%,
        rgba(255, 220, 150, 0.4) 0%,
        rgba(255, 180, 100, 0.2) 30%,
        transparent 70%
    );
    pointer-events: none;
}

/* Stars - subtle twinkling */
.sky::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background-image: 
        radial-gradient(1px 1px at 50px 30px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 150px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 250px 20px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 350px 60px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 450px 40px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 550px 90px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 650px 25px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 750px 70px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 100px 100px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 300px 50px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 500px 15px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 700px 85px, rgba(255,255,255,0.6), transparent);
    background-size: 800px 150px;
    animation: starTwinkle 5s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
    0% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

/* Sun - Large warm glowing sun */
.sun {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 50% 50%,
        #fffef5 0%,
        #fff5d4 15%,
        #ffe4a0 30%,
        #ffc857 50%,
        #ff9f43 70%,
        rgba(255, 120, 50, 0.5) 85%,
        transparent 100%
    );
    box-shadow: 
        0 0 80px 40px rgba(255, 200, 100, 0.4),
        0 0 150px 80px rgba(255, 150, 50, 0.2);
    animation: sunPulse 8s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% {
        box-shadow: 
            0 0 80px 40px rgba(255, 200, 100, 0.4),
            0 0 150px 80px rgba(255, 150, 50, 0.2);
    }
    50% {
        box-shadow: 
            0 0 100px 50px rgba(255, 200, 100, 0.5),
            0 0 180px 100px rgba(255, 150, 50, 0.25);
    }
}

/* Clouds - Soft atmospheric clouds */
.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cloud {
    position: absolute;
    border-radius: 100px;
    filter: blur(8px);
    opacity: 0.6;
}

.cloud-1 {
    width: 400px;
    height: 80px;
    top: 12%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 200, 170, 0.5) 20%,
        rgba(255, 180, 150, 0.6) 50%,
        rgba(255, 200, 170, 0.5) 80%,
        transparent 100%
    );
    animation: cloudFloat 90s linear infinite;
}

.cloud-2 {
    width: 300px;
    height: 60px;
    top: 20%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 190, 160, 0.4) 20%,
        rgba(255, 170, 140, 0.5) 50%,
        rgba(255, 190, 160, 0.4) 80%,
        transparent 100%
    );
    animation: cloudFloat 120s linear infinite;
    animation-delay: -40s;
}

.cloud-3 {
    width: 350px;
    height: 70px;
    top: 8%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 210, 180, 0.4) 20%,
        rgba(255, 190, 160, 0.5) 50%,
        rgba(255, 210, 180, 0.4) 80%,
        transparent 100%
    );
    animation: cloudFloat 100s linear infinite;
    animation-delay: -70s;
}

@keyframes cloudFloat {
    0% { transform: translateX(-500px); }
    100% { transform: translateX(calc(100vw + 500px)); }
}

/* Distant Hills/Mountains - Layered silhouettes */
.mountains {
    position: absolute;
    bottom: 8%;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
}

.mountain {
    position: absolute;
    bottom: 0;
    border-radius: 50% 50% 0 0;
}

/* Far distant mountains - purple haze */
.mountain-1 {
    left: -10%;
    width: 50%;
    height: 45%;
    background: linear-gradient(
        to bottom,
        rgba(60, 50, 80, 0.9) 0%,
        rgba(50, 40, 70, 0.95) 100%
    );
    border-radius: 40% 60% 0 0;
}

.mountain-2 {
    left: 20%;
    width: 60%;
    height: 55%;
    background: linear-gradient(
        to bottom,
        rgba(70, 55, 85, 0.85) 0%,
        rgba(55, 45, 75, 0.9) 100%
    );
    border-radius: 45% 55% 0 0;
}

.mountain-3 {
    left: 50%;
    width: 55%;
    height: 40%;
    background: linear-gradient(
        to bottom,
        rgba(80, 60, 90, 0.8) 0%,
        rgba(60, 50, 80, 0.85) 100%
    );
    border-radius: 55% 45% 0 0;
}

/* Trees - Elegant Japanese style silhouettes */
.trees {
    position: absolute;
    bottom: 2%;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
}

.tree {
    position: absolute;
    bottom: 0;
}

/* Left side trees */
.tree-1 {
    left: 2%;
    width: 60px;
    height: 180px;
}

.tree-1::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 60px;
    background: linear-gradient(to bottom, #2a2035 0%, #1a1525 100%);
}

.tree-1::after {
    content: '';
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 55px;
    height: 130px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, 
        #3a2a45 0%, 
        #2a1a35 60%, 
        transparent 100%
    );
    border-radius: 50%;
}

.tree-2 {
    left: 8%;
    width: 80px;
    height: 220px;
}

.tree-2::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 80px;
    background: linear-gradient(to bottom, #2a2035 0%, #1a1525 100%);
}

.tree-2::after {
    content: '';
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 75px;
    height: 150px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, 
        #3a2a45 0%, 
        #2a1a35 60%, 
        transparent 100%
    );
    border-radius: 50%;
}

/* Right side trees */
.tree-3 {
    right: 12%;
    width: 90px;
    height: 250px;
}

.tree-3::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 90px;
    background: linear-gradient(to bottom, #2a2035 0%, #1a1525 100%);
}

.tree-3::after {
    content: '';
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 85px;
    height: 170px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, 
        #3a2a45 0%, 
        #2a1a35 60%, 
        transparent 100%
    );
    border-radius: 50%;
}

.tree-4 {
    right: 3%;
    width: 70px;
    height: 200px;
}

.tree-4::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 70px;
    background: linear-gradient(to bottom, #2a2035 0%, #1a1525 100%);
}

.tree-4::after {
    content: '';
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 65px;
    height: 140px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, 
        #3a2a45 0%, 
        #2a1a35 60%, 
        transparent 100%
    );
    border-radius: 50%;
}

.tree-5 {
    right: 22%;
    width: 50px;
    height: 150px;
}

.tree-5::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 50px;
    background: linear-gradient(to bottom, #2a2035 0%, #1a1525 100%);
}

.tree-5::after {
    content: '';
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 110px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, 
        #3a2a45 0%, 
        #2a1a35 60%, 
        transparent 100%
    );
    border-radius: 50%;
}

/* Falling Leaves Container */
.leaves-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/* Leaf base style */
.leaf {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0;
    animation: leafDrift linear infinite;
}

@keyframes leafDrift {
    0% {
        opacity: 0;
        transform: translateY(-20px) rotate(0deg) translateX(0);
    }
    10% {
        opacity: 0.8;
    }
    25% {
        transform: translateY(25vh) rotate(180deg) translateX(30px);
    }
    50% {
        transform: translateY(50vh) rotate(360deg) translateX(-20px);
    }
    75% {
        transform: translateY(75vh) rotate(540deg) translateX(40px);
    }
    90% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) translateX(-10px);
    }
}

/* Train Track - Subtle railway */
.train-track {
    position: absolute;
    bottom: 5%;
    left: 0;
    width: 100%;
    height: 12px;
    background: linear-gradient(
        to bottom,
        #3a3545 0%,
        #2a2535 50%,
        #1a1525 100%
    );
}

.train-track::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(100, 90, 110, 0.6);
}

.train-track::after {
    content: '';
    position: absolute;
    bottom: 1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(100, 90, 110, 0.6);
}

/* Train - Lo-fi anime style */
.train {
    position: absolute;
    bottom: 6%;
    left: -400px;
    display: flex;
    align-items: flex-end;
    animation: trainJourney 40s linear infinite;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.5));
}

@keyframes trainJourney {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(100vw + 450px));
    }
}

/* Train Engine */
.train-engine {
    width: 100px;
    height: 60px;
    background: linear-gradient(
        to bottom,
        #3a3545 0%,
        #2a2535 60%,
        #1a1525 100%
    );
    border-radius: 10px 30px 5px 5px;
    position: relative;
}

/* Engine wheels */
.train-engine::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10px;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #2a2535 40%, #1a1525 100%);
    border-radius: 50%;
    box-shadow: 
        28px 0 0 #1a1525,
        56px 0 0 #1a1525;
    border: 2px solid #3a3545;
}

/* Engine front light */
.train-engine::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -8px;
    width: 12px;
    height: 8px;
    background: radial-gradient(ellipse, 
        rgba(255, 240, 200, 0.9) 0%, 
        rgba(255, 200, 100, 0.6) 50%,
        transparent 100%
    );
    border-radius: 50%;
    box-shadow: 0 0 20px 10px rgba(255, 220, 150, 0.3);
}

.train-engine .train-window {
    position: absolute;
    top: 12px;
    left: 15px;
    width: 28px;
    height: 20px;
    background: linear-gradient(
        to bottom,
        rgba(255, 220, 150, 0.8) 0%,
        rgba(255, 200, 120, 0.6) 100%
    );
    border-radius: 4px 4px 2px 2px;
    box-shadow: 
        0 0 15px 5px rgba(255, 200, 100, 0.4),
        inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.train-engine .train-chimney {
    position: absolute;
    top: -20px;
    right: 20px;
    width: 16px;
    height: 25px;
    background: linear-gradient(
        to bottom,
        #4a4555 0%,
        #3a3545 100%
    );
    border-radius: 4px 4px 0 0;
}

/* Smoke from chimney */
.train-engine .train-chimney::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, 
        rgba(200, 200, 210, 0.4) 0%, 
        transparent 70%
    );
    border-radius: 50%;
    animation: smoke 2s ease-out infinite;
}

.train-engine .train-chimney::after {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, 
        rgba(200, 200, 210, 0.3) 0%, 
        transparent 70%
    );
    border-radius: 50%;
    animation: smoke 2s ease-out infinite;
    animation-delay: 0.5s;
}

@keyframes smoke {
    0% {
        opacity: 0.6;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-40px) scale(2);
    }
}

/* Train Cars */
.train-car {
    width: 80px;
    height: 45px;
    background: linear-gradient(
        to bottom,
        #3a3545 0%,
        #2a2535 60%,
        #1a1525 100%
    );
    margin-left: 8px;
    border-radius: 5px;
    position: relative;
}

/* Car wheels */
.train-car::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 12px;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #2a2535 40%, #1a1525 100%);
    border-radius: 50%;
    box-shadow: 40px 0 0 #1a1525;
    border: 2px solid #3a3545;
}

/* Car connector */
.train-car::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 6px;
    background: #2a2535;
    border-radius: 2px;
}

.train-car .train-window {
    position: absolute;
    top: 10px;
    width: 20px;
    height: 16px;
    background: linear-gradient(
        to bottom,
        rgba(255, 220, 150, 0.85) 0%,
        rgba(255, 200, 120, 0.65) 100%
    );
    border-radius: 3px;
    box-shadow: 
        0 0 12px 4px rgba(255, 200, 100, 0.35),
        inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.train-car .train-window:first-child {
    left: 12px;
}

.train-car .train-window:last-child {
    right: 12px;
}

/* Ground - Rich dark grass */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5%;
    background: linear-gradient(
        to bottom,
        #1a2518 0%,
        #151d14 40%,
        #101510 100%
    );
}

/* Grass texture */
.ground::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 10px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 3px,
        #1a2518 3px,
        #1a2518 4px,
        transparent 4px,
        transparent 8px
    );
    opacity: 0.5;
}

/* Firefly styles */
.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, 
        #ffffcc 0%, 
        #ffff99 40%, 
        transparent 100%
    );
    border-radius: 50%;
    box-shadow: 
        0 0 8px 3px rgba(255, 255, 150, 0.6),
        0 0 16px 6px rgba(255, 255, 100, 0.3);
    animation: fireflyFloat 6s ease-in-out infinite;
    opacity: 0;
}

@keyframes fireflyFloat {
    0%, 100% {
        opacity: 0;
        transform: translate(0, 0) scale(0.8);
    }
    15% {
        opacity: 1;
        transform: translate(10px, -15px) scale(1);
    }
    30% {
        opacity: 0.6;
        transform: translate(-5px, -30px) scale(0.9);
    }
    50% {
        opacity: 1;
        transform: translate(15px, -20px) scale(1.1);
    }
    70% {
        opacity: 0.5;
        transform: translate(-10px, -40px) scale(0.9);
    }
    85% {
        opacity: 0.8;
        transform: translate(5px, -25px) scale(1);
    }
}

/* Atmospheric overlay - warm glow */
.background-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 80% 50% at 50% 80%,
        rgba(255, 180, 100, 0.08) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 1;
}

/* Vignette effect */
.background-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 70% 70% at 50% 50%,
        transparent 40%,
        rgba(10, 10, 20, 0.4) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sun {
        width: 140px;
        height: 140px;
        bottom: 22%;
    }
    
    .mountain-1, .mountain-2, .mountain-3 {
        height: 35%;
    }
    
    .tree-1, .tree-2, .tree-3, .tree-4, .tree-5 {
        transform: scale(0.7);
    }
    
    .train {
        transform: scale(0.75);
        bottom: 7%;
    }
}

@media (max-width: 480px) {
    .sun {
        width: 100px;
        height: 100px;
        bottom: 25%;
    }
    
    .train {
        transform: scale(0.55);
    }
    
    .tree-1, .tree-2, .tree-3, .tree-4, .tree-5 {
        transform: scale(0.5);
    }
    
    .cloud-1, .cloud-2, .cloud-3 {
        transform: scale(0.6);
    }
}


