/* ========================================
   AMBIENT EFFECTS - Reusable Components
   ======================================== */

/* ----------------------------------------
   FRAME OVERLAY - Vignette Effect
   ----------------------------------------
   Usage: Add .ambient-frame to container

   <div class="ambient-frame">
       <div class="frame-border"></div>
   </div>
---------------------------------------- */
.ambient-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.ambient-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 70% at 50% 50%,
        transparent 30%,
        rgba(0, 0, 0, 0.3) 60%,
        rgba(0, 0, 0, 0.7) 100%
    );
    animation: ambient-vignette-pulse 8s ease-in-out infinite;
}

@keyframes ambient-vignette-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Decorative border inside frame */
.ambient-frame > .frame-border {
    position: absolute;
    inset: 15px;
    border: 3px solid #3a2a28;
    box-shadow:
        inset 0 0 0 1px #1a0c10,
        inset 0 0 0 6px #0a0608,
        inset 0 0 0 7px #2a1a18,
        inset 0 0 20px rgba(0, 0, 0, 0.8),
        0 0 0 1px #1a0c10,
        0 0 30px rgba(0, 0, 0, 0.9);
}

.ambient-frame > .frame-border::after {
    content: '';
    position: absolute;
    inset: 20px;
    border: 1px solid #2a1a18;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Variant: no border, only vignette */
.ambient-frame.no-border > .frame-border {
    display: none;
}

/* Variant: stronger vignette */
.ambient-frame.strong::before {
    background: radial-gradient(ellipse 70% 60% at 50% 50%,
        transparent 20%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.85) 100%
    );
}

/* ----------------------------------------
   CORNER DECORATIONS
   ----------------------------------------
   Usage: Add inside .ambient-frame

   <div class="ambient-frame">
       <div class="frame-border"></div>
       <div class="frame-corner corner-tl"><div class="corner-diamond"></div></div>
       <div class="frame-corner corner-tr"><div class="corner-diamond"></div></div>
       <div class="frame-corner corner-bl"><div class="corner-diamond"></div></div>
       <div class="frame-corner corner-br"><div class="corner-diamond"></div></div>
   </div>
---------------------------------------- */
.ambient-frame > .frame-corner {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none;
    z-index: 3;
}

.ambient-frame > .frame-corner::before,
.ambient-frame > .frame-corner::after {
    content: '';
    position: absolute;
    background: #3a2a28;
}

.ambient-frame > .frame-corner::before {
    width: 40px;
    height: 2px;
}

.ambient-frame > .frame-corner::after {
    width: 2px;
    height: 40px;
}

.ambient-frame > .frame-corner > .corner-diamond {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #5a4a45 0%, #3a2a28 100%);
    transform: rotate(45deg);
    box-shadow: 0 0 6px rgba(90, 74, 69, 0.5);
    z-index: 5;
}

.ambient-frame > .frame-corner.corner-tl { top: 15px; left: 15px; }
.ambient-frame > .frame-corner.corner-tl::before { top: 10px; left: 10px; }
.ambient-frame > .frame-corner.corner-tl::after { top: 10px; left: 10px; }
.ambient-frame > .frame-corner.corner-tl .corner-diamond { top: 5px; left: 5px; }

.ambient-frame > .frame-corner.corner-tr { top: 15px; right: 15px; }
.ambient-frame > .frame-corner.corner-tr::before { top: 10px; right: 10px; }
.ambient-frame > .frame-corner.corner-tr::after { top: 10px; right: 10px; }
.ambient-frame > .frame-corner.corner-tr .corner-diamond { top: 5px; right: 5px; }

.ambient-frame > .frame-corner.corner-bl { bottom: 15px; left: 15px; }
.ambient-frame > .frame-corner.corner-bl::before { bottom: 10px; left: 10px; }
.ambient-frame > .frame-corner.corner-bl::after { bottom: 10px; left: 10px; }
.ambient-frame > .frame-corner.corner-bl .corner-diamond { bottom: 5px; left: 5px; }

.ambient-frame > .frame-corner.corner-br { bottom: 15px; right: 15px; }
.ambient-frame > .frame-corner.corner-br::before { bottom: 10px; right: 10px; }
.ambient-frame > .frame-corner.corner-br::after { bottom: 10px; right: 10px; }
.ambient-frame > .frame-corner.corner-br .corner-diamond { bottom: 5px; right: 5px; }

/* ----------------------------------------
   DUST PARTICLES
   ----------------------------------------
   Usage: Add .ambient-particles to container
   Inside add multiple .particle divs

   <div class="ambient-particles">
       <div class="particle"></div>
       ... (repeat 15-25x)
   </div>
---------------------------------------- */
.ambient-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 6;
}

.ambient-particles > .particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 200, 150, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(255, 180, 120, 0.3);
    animation: ambient-float-particle 15s linear infinite;
}

/* Particle positions and timings */
.ambient-particles > .particle:nth-child(1) { left: 5%; animation-delay: 0s; animation-duration: 18s; }
.ambient-particles > .particle:nth-child(2) { left: 10%; animation-delay: -3s; animation-duration: 15s; }
.ambient-particles > .particle:nth-child(3) { left: 15%; animation-delay: -6s; animation-duration: 20s; }
.ambient-particles > .particle:nth-child(4) { left: 20%; animation-delay: -2s; animation-duration: 17s; }
.ambient-particles > .particle:nth-child(5) { left: 25%; animation-delay: -8s; animation-duration: 14s; }
.ambient-particles > .particle:nth-child(6) { left: 30%; animation-delay: -4s; animation-duration: 19s; }
.ambient-particles > .particle:nth-child(7) { left: 35%; animation-delay: -1s; animation-duration: 16s; }
.ambient-particles > .particle:nth-child(8) { left: 40%; animation-delay: -5s; animation-duration: 21s; }
.ambient-particles > .particle:nth-child(9) { left: 45%; animation-delay: -7s; animation-duration: 13s; }
.ambient-particles > .particle:nth-child(10) { left: 50%; animation-delay: -9s; animation-duration: 22s; }
.ambient-particles > .particle:nth-child(11) { left: 55%; animation-delay: -11s; animation-duration: 18s; }
.ambient-particles > .particle:nth-child(12) { left: 60%; animation-delay: -13s; animation-duration: 16s; }
.ambient-particles > .particle:nth-child(13) { left: 65%; animation-delay: -2s; animation-duration: 19s; }
.ambient-particles > .particle:nth-child(14) { left: 70%; animation-delay: -4s; animation-duration: 17s; }
.ambient-particles > .particle:nth-child(15) { left: 75%; animation-delay: -6s; animation-duration: 15s; }
.ambient-particles > .particle:nth-child(16) { left: 80%; animation-delay: -8s; animation-duration: 20s; }
.ambient-particles > .particle:nth-child(17) { left: 85%; animation-delay: -10s; animation-duration: 14s; }
.ambient-particles > .particle:nth-child(18) { left: 90%; animation-delay: -12s; animation-duration: 21s; }
.ambient-particles > .particle:nth-child(19) { left: 95%; animation-delay: -14s; animation-duration: 16s; }
.ambient-particles > .particle:nth-child(20) { left: 8%; animation-delay: -1s; animation-duration: 18s; }
.ambient-particles > .particle:nth-child(21) { left: 22%; animation-delay: -5s; animation-duration: 15s; }
.ambient-particles > .particle:nth-child(22) { left: 38%; animation-delay: -9s; animation-duration: 19s; }
.ambient-particles > .particle:nth-child(23) { left: 52%; animation-delay: -3s; animation-duration: 17s; }
.ambient-particles > .particle:nth-child(24) { left: 68%; animation-delay: -7s; animation-duration: 20s; }
.ambient-particles > .particle:nth-child(25) { left: 82%; animation-delay: -11s; animation-duration: 14s; }

@keyframes ambient-float-particle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
        transform: translateY(80vh) translateX(10px) scale(1);
    }
    50% {
        opacity: 0.4;
        transform: translateY(40vh) translateX(-10px) scale(0.8);
    }
    90% {
        opacity: 0.2;
        transform: translateY(5vh) translateX(5px) scale(0.5);
    }
    100% {
        transform: translateY(-5vh) translateX(0) scale(0);
        opacity: 0;
    }
}

/* Variant: smaller particles */
.ambient-particles.small > .particle {
    width: 2px;
    height: 2px;
}

/* Variant: larger particles */
.ambient-particles.large > .particle {
    width: 6px;
    height: 6px;
}

/* Variant: purple/magic color */
.ambient-particles.magic > .particle {
    background: rgba(180, 130, 255, 0.6);
    box-shadow: 0 0 3px rgba(150, 100, 220, 0.3);
}

/* Variant: blue/cold color */
.ambient-particles.cold > .particle {
    background: rgba(150, 200, 255, 0.6);
    box-shadow: 0 0 3px rgba(120, 180, 255, 0.3);
}

/* ----------------------------------------
   CANDLE GLOW - Bottom Light
   ----------------------------------------
   Usage: Add .ambient-candle-glow to container

   <div class="ambient-candle-glow"></div>
---------------------------------------- */
.ambient-candle-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 120% 80% at 50% 100%,
        rgba(255, 160, 80, 0.15) 0%,
        rgba(255, 140, 60, 0.08) 30%,
        transparent 60%
    );
    animation: ambient-candle-flicker 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
}

@keyframes ambient-candle-flicker {
    0% { opacity: 0.6; }
    15% { opacity: 0.75; }
    30% { opacity: 0.65; }
    45% { opacity: 0.9; }
    60% { opacity: 0.7; }
    75% { opacity: 1; }
    90% { opacity: 0.8; }
    100% { opacity: 0.6; }
}

/* Variant: stronger glow */
.ambient-candle-glow.strong {
    background: radial-gradient(ellipse 120% 80% at 50% 100%,
        rgba(255, 160, 80, 0.25) 0%,
        rgba(255, 140, 60, 0.15) 30%,
        transparent 60%
    );
}

/* Variant: purple/magic glow */
.ambient-candle-glow.magic {
    background: radial-gradient(ellipse 120% 80% at 50% 100%,
        rgba(180, 100, 255, 0.15) 0%,
        rgba(150, 80, 220, 0.08) 30%,
        transparent 60%
    );
}

/* Variant: top position */
.ambient-candle-glow.top {
    background: radial-gradient(ellipse 120% 80% at 50% 0%,
        rgba(255, 160, 80, 0.15) 0%,
        rgba(255, 140, 60, 0.08) 30%,
        transparent 60%
    );
}

/* ----------------------------------------
   LIGHT RAYS
   ----------------------------------------
   Usage: Add .ambient-light-rays to container
   Inside add 4 .light-ray divs

   <div class="ambient-light-rays">
       <div class="light-ray"></div>
       <div class="light-ray"></div>
       <div class="light-ray"></div>
       <div class="light-ray"></div>
   </div>
---------------------------------------- */
.ambient-light-rays {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.15;
    z-index: 5;
}

.ambient-light-rays > .light-ray {
    position: absolute;
    top: -20%;
    width: 2px;
    height: 60%;
    background: linear-gradient(to bottom,
        rgba(255, 200, 150, 0.3),
        transparent
    );
    transform-origin: top center;
    animation: ambient-ray-sway 10s ease-in-out infinite;
}

.ambient-light-rays > .light-ray:nth-child(1) { left: 25%; animation-delay: 0s; }
.ambient-light-rays > .light-ray:nth-child(2) { left: 35%; animation-delay: -2s; height: 50%; }
.ambient-light-rays > .light-ray:nth-child(3) { left: 65%; animation-delay: -4s; }
.ambient-light-rays > .light-ray:nth-child(4) { left: 75%; animation-delay: -1s; height: 55%; }

@keyframes ambient-ray-sway {
    0%, 100% { transform: rotate(-2deg); opacity: 0.15; }
    50% { transform: rotate(2deg); opacity: 0.25; }
}

/* Variant: stronger rays */
.ambient-light-rays.strong {
    opacity: 0.25;
}

/* Variant: purple/magic rays */
.ambient-light-rays.magic > .light-ray {
    background: linear-gradient(to bottom,
        rgba(180, 150, 255, 0.3),
        transparent
    );
}

/* ----------------------------------------
   COMPLETE AMBIENT PACKAGE
   ----------------------------------------
   Usage: Add .ambient-full to get all effects

   <div class="ambient-full">
       <div class="ambient-frame"><div class="frame-border"></div></div>
       <div class="ambient-candle-glow"></div>
       <div class="ambient-light-rays">
           <div class="light-ray"></div>
           <div class="light-ray"></div>
           <div class="light-ray"></div>
           <div class="light-ray"></div>
       </div>
       <div class="ambient-particles">
           <div class="particle"></div>
           ... (25x)
       </div>
   </div>
---------------------------------------- */
.ambient-full {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
