/* =========================================================================
   SkillWaala — Happy Diwali Premium Animation (homepage only)
   Scoped under #diwali-fx / .diwali-fx-* to avoid clashing with site styles.
   Palette: Golden #FFD700 · Saffron #FF9933 · Warm orange #FF7A00 · Amber #FFE6A3
   All decorative layers use pointer-events:none so they never block clicks.
   ========================================================================= */

:root {
    --dw-gold: #FFD700;
    --dw-saffron: #FF9933;
    --dw-orange: #FF7A00;
    --dw-amber: #FFE6A3;
}

/* ---- Root overlay: sits above content, below sticky header & modals ---- */
#diwali-fx {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    overflow: hidden;
    contain: strict;
}

/* Canvas carries sparkles + occasional fireworks */
#diwali-fx .dw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===== DIYA LAYER — anchored inside the hero so the diyas scroll away with it
   (no diya ever persists over the mid-page content). ===== */
.dw-diya-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

/* ===================== REALISTIC CLAY-LAMP DIYAS ===================== */
.dw-diya-layer .dw-diya {
    position: absolute;
    width: 74px;
    height: 72px;
    pointer-events: none;
    animation: dw-float 6s ease-in-out infinite;
    will-change: transform;
}

/* Soft cast light that gently illuminates the nearby background */
.dw-diya-layer .dw-diya .dw-glow {
    position: absolute;
    left: 50%;
    top: 36%;
    width: 128px;
    height: 128px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 184, 74, 0.28) 0%, rgba(255, 140, 40, 0.11) 36%, rgba(255, 140, 40, 0) 70%);
    animation: dw-glowpulse 1.8s ease-in-out infinite alternate;
    will-change: opacity, transform;
}

/* Clay lamp — inline SVG sits at the bottom of the diya and casts a soft shadow */
.dw-diya-layer .dw-diya .dw-lamp {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 74px;
    height: auto;
    display: block;
    filter: drop-shadow(0 7px 7px rgba(70, 30, 8, 0.3));
}

/* Oil-lamp flame: cool blue base + bright yellow core + warm orange halo */
.dw-diya-layer .dw-diya .dw-flame {
    position: absolute;
    left: 50%;
    bottom: 33px;
    width: 15px;
    height: 30px;
    transform: translateX(-50%);
    transform-origin: 50% 96%;
    background: radial-gradient(ellipse at 50% 74%, #fff4bd 0%, #ffd34d 30%, #ff9a1f 66%, rgba(255, 122, 0, 0) 100%);
    border-radius: 50% 50% 48% 48% / 68% 68% 42% 42%;
    box-shadow: 0 0 16px 5px rgba(255, 170, 45, 0.5), 0 0 34px 13px rgba(255, 120, 0, 0.24);
    animation: dw-flicker 1.7s ease-in-out infinite alternate;
    will-change: transform, opacity;
}

/* Bright inner core */
.dw-diya-layer .dw-diya .dw-flame::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 6px;
    height: 16px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at 50% 70%, #fffdf2 0%, #fff0a8 55%, rgba(255, 235, 150, 0) 100%);
    border-radius: 50% 50% 50% 50% / 64% 64% 42% 42%;
}

/* Cool blue base at the wick */
.dw-diya-layer .dw-diya .dw-flame::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    width: 8px;
    height: 9px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at 50% 85%, rgba(96, 156, 255, 0.95) 0%, rgba(80, 130, 255, 0.45) 55%, rgba(80, 130, 255, 0) 100%);
    border-radius: 50%;
}

/* Placement inside the hero: 2 on the left edge, 2 on the right edge, 1 centre-bottom.
   Kept clear of the heading, paragraph, buttons and robot. */
.dw-diya-layer .dw-diya.d1 { top: 13%; left: 2%;    animation-delay: 0s;   animation-duration: 6.5s; }
.dw-diya-layer .dw-diya.d5 { top: 58%; left: 2%;    right: auto; bottom: auto; animation-delay: .9s; animation-duration: 7.1s; }
.dw-diya-layer .dw-diya.d3 { top: 13%; right: 2.5%; left: auto; animation-delay: .6s; animation-duration: 6.8s; }
.dw-diya-layer .dw-diya.d4 { top: 58%; right: 2.5%; left: auto; animation-delay: 1.8s; animation-duration: 7.9s; }
/* Centre-bottom of the hero — the single "beech" diya */
.dw-diya-layer .dw-diya.d2 { bottom: 4%; left: calc(50% - 37px); top: auto; right: auto; animation-delay: 1.2s; animation-duration: 7.4s; }

@keyframes dw-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-12px) rotate(-1deg); }
}

/* Natural, subtle flame flicker — slight lean and breathe, never jittery */
@keyframes dw-flicker {
    0%   { transform: translateX(-50%) scaleY(1)    scaleX(1);    opacity: .9; }
    25%  { transform: translateX(-51%) scaleY(1.06) scaleX(.96);  opacity: 1; }
    50%  { transform: translateX(-49%) scaleY(.96)  scaleX(1.04); opacity: .95; }
    75%  { transform: translateX(-50.5%) scaleY(1.05) scaleX(.97); opacity: 1; }
    100% { transform: translateX(-50%) scaleY(1)    scaleX(1);    opacity: .88; }
}

@keyframes dw-glowpulse {
    0%   { opacity: .6;  transform: translate(-50%, -50%) scale(.94); }
    100% { opacity: .95; transform: translate(-50%, -50%) scale(1.07); }
}

/* ============================ GREETING CARD ============================ */
/* Slim, dismissible slide-in — not a full-screen popup. Shown once/session. */
#diwali-greet {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1040;
    max-width: 330px;
    padding: 18px 42px 18px 20px;
    border-radius: 16px;
    color: #4a2600;
    background: linear-gradient(135deg, #fff6df 0%, var(--dw-amber) 55%, #ffd98a 100%);
    border: 1px solid rgba(255, 153, 51, 0.55);
    box-shadow: 0 14px 34px rgba(255, 122, 0, 0.28), 0 0 0 4px rgba(255, 215, 0, 0.12);
    pointer-events: auto;
    transform: translateY(26px);
    opacity: 0;
    transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .55s ease;
}

#diwali-greet.dw-show {
    transform: translateY(0);
    opacity: 1;
}

#diwali-greet .dw-greet-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    background: linear-gradient(90deg, var(--dw-orange), var(--dw-saffron) 60%, #c47a00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#diwali-greet .dw-greet-sub {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: #6a3b00;
}

#diwali-greet .dw-spark {
    font-size: 15px;
    margin-right: 4px;
}

#diwali-greet .dw-greet-close {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: #8a4b00;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
}

#diwali-greet .dw-greet-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

/* ============================ HEADER TORAN ============================ */
/* Subtle marigold + mango-leaf garland pinned to the very top of the header.
   pointer-events:none and purely decorative — logo & nav positions are untouched. */
#diwali-toran {
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    right: 0;
    height: 30px;
    z-index: 1002;          /* above the sticky header (z-index 10), below modals */
    pointer-events: none;
    opacity: .95;
    animation: !important;
    line-height: 0;
}

#diwali-toran svg {
    display: block;
    width: 100%;
    height: 30px;
}

@media (max-width: 575px) {
    #diwali-toran,
    #diwali-toran svg { height: 24px; }
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 991px) {
    /* Tablets: one per side + the centre diya */
    .dw-diya-layer .dw-diya.d4,
    .dw-diya-layer .dw-diya.d5 { display: none; }
}

@media (max-width: 575px) {
    .dw-diya-layer .dw-diya { width: 54px; height: 54px; }
    .dw-diya-layer .dw-diya .dw-lamp { width: 54px; }
    .dw-diya-layer .dw-diya .dw-glow { width: 94px; height: 94px; }
    .dw-diya-layer .dw-diya .dw-flame { bottom: 24px; width: 12px; height: 24px; }
    /* Keep only two diyas on phones, tucked into the top corners below the nav */
    .dw-diya-layer .dw-diya.d2,
    .dw-diya-layer .dw-diya.d4,
    .dw-diya-layer .dw-diya.d5 { display: none; }
    .dw-diya-layer .dw-diya.d1 { top: 0.5%; left: 1%; }
    .dw-diya-layer .dw-diya.d3 { top: 0.5%; right: 1%; }

    #diwali-greet {
        right: 12px;
        left: 12px;
        bottom: 14px;
        max-width: none;
    }
}

/* ============================ REDUCED MOTION ============================ */
@media (prefers-reduced-motion: reduce) {
    .dw-diya-layer .dw-diya,
    .dw-diya-layer .dw-diya .dw-flame,
    .dw-diya-layer .dw-diya .dw-glow {
        animation: none !important;
    }
    #diwali-fx .dw-canvas { display: none; }
    #diwali-greet { transition: opacity .3s ease; transform: none; }
}
