/* ==========================================================================
   🪔 DIWALI THEME - Shared Effects (website + affiliate dashboard)
   Night-sky banner, welcome loader, sparkle canvas.

   This file is a PURE OVERLAY — it does NOT modify any existing styles.
   To disable: set DIWALI_THEME_ENABLED=false in .env
   ========================================================================== */

:root {
    --dw-night: #120A2E;
    --dw-plum: #3B0A2A;
    --dw-maroon: #7A1238;
    --dw-rani: #C50A5B;
    --dw-marigold: #FF9A00;
    --dw-gold: #F5C044;
    --dw-cream: #FFF6E5;
}

/* --------------------------------------------------------------------------
   1. SHARED SCENE PARTS
   -------------------------------------------------------------------------- */
.dw-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 8% 22%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 17% 58%, #ffe9b8 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 29% 14%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 38% 42%, #fff 50%, transparent 51%),
        radial-gradient(2px 2px at 47% 18%, #ffe9b8 50%, transparent 51%),
        radial-gradient(1px 1px at 58% 50%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 66% 12%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 75% 36%, #ffe9b8 50%, transparent 51%),
        radial-gradient(2px 2px at 86% 20%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 94% 48%, #fff 50%, transparent 51%);
    animation: dwTwinkle 3s ease-in-out infinite alternate;
}

.dw-skyline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: url('../images/diwali/ayodhya-skyline.svg') center bottom / auto 100% repeat-x;
}

@keyframes dwTwinkle {
    0%   { opacity: 0.45; }
    100% { opacity: 1; }
}

@keyframes dwFlicker {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 154, 0, 0.7)); }
    45%      { filter: drop-shadow(0 0 10px rgba(255, 180, 50, 1)); }
    70%      { filter: drop-shadow(0 0 6px rgba(255, 154, 0, 0.85)); }
}

/* --------------------------------------------------------------------------
   2. NIGHT-SKY BANNER
   -------------------------------------------------------------------------- */
.dw-banner {
    position: relative;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    padding: 10px 48px 26px;
    overflow: hidden;
    text-align: center;
    background: linear-gradient(180deg, var(--dw-night) 0%, #2A0B3F 55%, #7A1D3A 88%, #C4561A 100%);
}

.dw-banner .dw-skyline {
    height: 46px;
    opacity: 0.95;
}

.dw-banner-diyas {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    height: 16px;
    pointer-events: none;
    background: url('../images/diya.svg') 0 100% / 44px 16px repeat-x;
    background-size: auto 16px;
    background-repeat: space no-repeat;
    animation: dwFlicker 2.2s ease-in-out infinite;
}

.dw-banner-vimana {
    position: absolute;
    top: 6px;
    left: 0;
    width: 74px;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(255, 200, 90, 0.7));
    animation: dwVimanaCross 22s linear infinite;
}

@keyframes dwVimanaCross {
    0%   { transform: translateX(-100px) translateY(4px); }
    50%  { transform: translateX(50vw) translateY(-2px); }
    100% { transform: translateX(calc(100vw + 40px)) translateY(4px); }
}

.dw-banner-text {
    position: relative;
    z-index: 1;
    margin: 0;
    color: #FFE3A3;
    text-align: center;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 6px rgba(10, 4, 30, 0.95);
}

.dw-banner-text strong {
    display: block;
    color: #FFD36B;
    font-size: 19px;
    font-weight: 700;
}

.dw-banner-close {
    position: absolute;
    z-index: 2;
    right: 14px;
    top: 12px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 227, 163, 0.18);
    color: #FFE3A3;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.dw-banner-close:hover {
    background: rgba(255, 227, 163, 0.34);
    transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   3. WELCOME LOADER (home page, once per browser session)
   -------------------------------------------------------------------------- */
.dw-intro[hidden] {
    display: none;
}

.dw-intro {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 20px 22vh;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(180deg, #0A0620 0%, var(--dw-night) 40%, #2F0C42 72%, #8A2237 92%, #D9681C 100%);
    transition: opacity 0.7s ease;
}

.dw-intro.is-leaving {
    opacity: 0;
    pointer-events: none;
}

.dw-intro .dw-skyline {
    height: clamp(120px, 26vh, 240px);
    animation: dwRise 1.2s ease-out both;
}

@keyframes dwRise {
    0%   { transform: translateY(40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.dw-intro-diyas {
    position: absolute;
    left: 2%;
    right: 2%;
    bottom: 6px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.dw-intro-diyas img {
    width: clamp(20px, 3vw, 38px);
    height: auto;
    opacity: 0.35;
    filter: grayscale(1) brightness(0.45);
    transition: opacity 0.35s ease, filter 0.35s ease;
}

.dw-intro-diyas img.is-lit {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 170, 40, 1)) drop-shadow(0 -6px 14px rgba(255, 140, 0, 0.7));
}

.dw-intro-vimana {
    position: absolute;
    top: 2vh;
    left: 0;
    width: clamp(84px, 10vw, 150px);
    pointer-events: none;
    filter: drop-shadow(0 0 16px rgba(255, 205, 100, 0.8));
    animation: dwIntroFlight 5.2s cubic-bezier(0.3, 0.1, 0.6, 1) 0.2s both;
}

@keyframes dwIntroFlight {
    0%   { transform: translate(-30vw, 5vh) rotate(-4deg); }
    50%  { transform: translate(42vw, 0) rotate(-1deg); }
    100% { transform: translate(112vw, 3vh) rotate(3deg); }
}

/* Lanterns hanging in the top corners */
.dw-intro-lantern {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transform-origin: top center;
    animation: dwLanternSway 5s ease-in-out infinite;
}

.dw-intro-lantern::before {
    content: '';
    width: 1px;
    height: clamp(30px, 11vh, 110px);
    background: rgba(255, 211, 107, 0.7);
}

.dw-intro-lantern img {
    width: clamp(44px, 6vw, 84px);
    filter: drop-shadow(0 0 18px rgba(255, 120, 60, 0.9));
}

.dw-intro-lantern-1 {
    left: 7%;
}

.dw-intro-lantern-2 {
    right: 7%;
    animation-delay: -2.2s;
}

@keyframes dwLanternSway {
    0%, 100% { transform: rotate(-3deg); }
    50%      { transform: rotate(3deg); }
}

.dw-intro-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: dwCopyIn 1s ease-out 0.5s both;
}

/* Warm glow pooled behind the greeting */
.dw-intro-copy::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -2;
    width: min(120vw, 900px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, rgba(255, 150, 40, 0.3), rgba(197, 10, 91, 0.12) 55%, transparent);
    pointer-events: none;
}

.dw-intro-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -1;
    width: min(96vw, 76vh, 680px);
    height: min(96vw, 76vh, 680px);
    margin: calc(min(96vw, 76vh, 680px) / -2) 0 0 calc(min(96vw, 76vh, 680px) / -2);
    opacity: 0.3;
    pointer-events: none;
    animation: dwHaloSpin 50s linear infinite;
}

@keyframes dwHaloSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dw-intro-logo {
    margin-bottom: 14px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(255, 250, 240, 0.96);
    box-shadow: 0 0 0 1px rgba(245, 192, 68, 0.8), 0 0 26px rgba(255, 180, 60, 0.5);
}

.dw-intro-logo img {
    display: block;
    width: clamp(130px, 15vw, 190px);
    height: auto;
}

.dw-intro-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(420px, 74vw);
    margin: 0 0 12px;
}

.dw-intro-divider::before,
.dw-intro-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #F5C044);
}

.dw-intro-divider::after {
    background: linear-gradient(90deg, #F5C044, transparent);
}

.dw-intro-divider img {
    width: 30px;
    height: 30px;
    animation: dwFlicker 2.2s ease-in-out infinite;
}

.dw-intro-copy .dw-intro-tagline {
    margin: 0 0 6px;
    color: #FFD36B;
    font-size: clamp(18px, 2.4vw, 28px);
    font-weight: 600;
    line-height: 1.4;
}

/* Fills over exactly the loader's length (INTRO_LENGTH in diwali-theme.blade.php) */
.dw-intro-progress {
    width: min(300px, 62vw);
    height: 3px;
    margin-top: 20px;
    border-radius: 3px;
    background: rgba(255, 227, 163, 0.2);
}

.dw-intro-progress span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #FF8A00, #FFD36B);
    box-shadow: 0 0 10px rgba(255, 190, 70, 0.95);
    transform-origin: left center;
    animation: dwProgress 6.2s linear both;
}

@keyframes dwProgress {
    0%   { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

@keyframes dwCopyIn {
    0%   { opacity: 0; transform: translateY(18px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.dw-intro-copy p {
    text-align: center;
    text-wrap: balance;
}

.dw-intro-copy .dw-intro-kicker {
    margin: 0 0 6px;
    color: #FFE3A3;
    font-size: clamp(16px, 2.2vw, 24px);
    line-height: 1.4;
}

.dw-intro-copy h2 {
    margin: 0 0 8px;
    font-family: 'Rozha One', Georgia, serif;
    font-size: clamp(44px, min(10vw, 13vh), 118px);
    font-weight: 400;
    line-height: 1.25;
    background: linear-gradient(100deg, #FFB400 10%, #FFF3C4 35%, #FFB400 55%, #FF8A00 90%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: dwTitleShine 3s linear infinite;
    filter: drop-shadow(0 0 22px rgba(255, 170, 40, 0.45));
}

@keyframes dwTitleShine {
    0%   { background-position: 120% 0; }
    100% { background-position: -100% 0; }
}

.dw-intro-copy .dw-intro-sub {
    margin: 0;
    color: #F7E7CF;
    font-size: clamp(14px, 1.6vw, 18px);
    line-height: 1.5;
}

.dw-intro-skip {
    position: absolute;
    z-index: 2;
    top: 18px;
    right: 18px;
    padding: 7px 18px;
    border: 1px solid rgba(255, 227, 163, 0.5);
    border-radius: 999px;
    background: rgba(18, 10, 46, 0.5);
    color: #FFE3A3;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dw-intro-skip:hover {
    background: rgba(255, 227, 163, 0.2);
}

/* --------------------------------------------------------------------------
   4. SPARKLE + FIREWORKS CANVAS
   -------------------------------------------------------------------------- */
#dw-fx-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10002;
}

/* --------------------------------------------------------------------------
   5. MOBILE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .dw-banner {
        min-height: 84px;
        padding: 8px 40px 24px 14px;
    }

    .dw-banner .dw-skyline {
        height: 36px;
    }

    /* The text fills the width here, so the vimana would fly straight over it. */
    .dw-banner-vimana {
        display: none;
    }

    .dw-banner-text {
        font-size: 12px;
    }

    .dw-banner-text strong {
        font-size: 15px;
    }

    .dw-intro {
        padding-bottom: 26vh;
    }

    .dw-intro-vimana {
        top: 5vh;
    }

    .dw-intro-lantern-2 {
        right: 5%;
    }

    .dw-intro-lantern-1 {
        left: 5%;
    }
}

/* --------------------------------------------------------------------------
   6. REDUCED MOTION + PRINT
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .dw-stars,
    .dw-banner-diyas,
    .dw-banner-vimana {
        animation: none !important;
    }

    .dw-banner-vimana {
        transform: translateX(12vw);
    }
}

@media print {
    .dw-banner,
    .dw-intro,
    #dw-fx-canvas {
        display: none !important;
    }
}
