.candle-nav-icon,
.candle-nav-icon * {
    box-sizing: content-box !important;
}

body {
  background-color: #FFF;
  /* This transition is for the re-light (dark to light) */
  /* It delays the BG change to look better */
}

/* --- STATE 1: BLOWING OUT --- */
/* This class is added by JS and lasts 2.1s */
body.blowing-out {
  /* This transition is for the blow-out (light to dark) */
  /* It delays the BG change to match the flame fade-out */
  transition: background-color 0.5s linear 1.7s;
  background-color: #000;
}

/* --- STATE 2: IS DARK (Frozen) --- */
/* This class holds the "off" state */
body.is-dark {
  background-color: #000;

}

body.is-dark .candle2__fire {
  opacity: 0;
  animation: none;
  transition: none;
}

body.is-dark .light__wave {
  /* This prevents the grey circle from appearing when the lights are off */
  transform: translate(-25%, -50%) scale(0); /* Shrink it to nothing */
  border-color: transparent; /* Make the border invisible */
  animation: none; /* Stop any animation that might be running */
}
/* --- STATE 3: RE-LIGHTING --- */
/* This class is added by JS and lasts 0.9s */
/* --- STATE 3: RE-LIGHTING --- */
/* This class is added by JS and lasts 0.9s */
body.re-lighting {
  background-color: #FFF;
  
  /* THIS IS THE FIX: */
  /* This rule now overrides body.is-dark */
  /* It waits 0.7s for the flame, then fades to white */
  transition: background-color 0.2s linear 0.7s;
}

.wrapper {
  position: absolute;
  left: 50%;
  top: 70%;
  transform: scale(1.5, 1.5) translate(-50%, -50%);
}

@media (max-width: 600px) {
  .wrapper {
    transform: scale(0.9) translate(-50%, -50%);
  }
}


.floor {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 350px;
  height: 5px;
  background: #673C63;
  transform: translate(-50%, -50%);
  box-shadow: 0px 2px 5px #111;
  z-index: 2;
}

.candles {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 250px;
  height: 150px;
  transform: translate(-50%, -100%);
  z-index: 1;
}

/* ADD THIS NEW RULE */
.candle1,
.candle2 {
  cursor: pointer;
}

.candle1 {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 35px;
  height: 100px;
  background: #fff;
  border: 3px solid #673C63;
  border-bottom: 0px;
  border-radius: 3px;
  transform-origin: center right;
  transform: translate(60%, -25%);
  box-shadow: -2px 0px 0px #95c6f2 inset;
}

/* --- ANIMATION TRIGGERS: BLOWING OUT --- */
/* These run for 2.1s, playing the 0%-70% part of the keyframes */
body.blowing-out .candle1 {
  animation: expand-body 2.1s linear;
}
body.blowing-out .candle1__mouth {
  animation: uff 2.1s linear;
}
body.blowing-out .candle__smoke-one {
  animation: move-left 2.1s linear;
}
body.blowing-out .candle__smoke-two {
  animation: move-top 2.1s linear;
}
body.blowing-out .candle1__eyes-one,
body.blowing-out .candle1__eyes-two {
  animation: blink-eyes 2.1s linear;
}
body.blowing-out .candle2 {
  animation: shake-left 2.1s linear;
}
body.blowing-out .candle2__stick {
  animation: stick-animation 2.1s linear;
}
body.blowing-out .candle2__eyes-one {
  animation: changeto-lower 2.1s linear;
}
body.blowing-out .candle2__eyes-two {
  animation: changeto-greater 2.1s linear;
}
/* ADD THIS BLOCK */
body.blowing-out .light__wave {
    /* Force the light wave to be collapsed and transparent */
    transform: translate(-25%, -50%) scale(0, 0) !important;
    border: 2px solid rgba(255, 255, 255, 0) !important;
    animation: none !important; /* Explicitly stop any rogue animation */
    transition: none !important; /* Prevents any lingering transition effects */
}
/* END OF ADDED BLOCK */
/* --- ANIMATION TRIGGERS: RE-LIGHTING --- */
/* These play the *same* 3s animation, but with a -2.1s delay */
/* This makes them play *only* the 70%-100% part (the last 0.9s) */
body.re-lighting .candle2 {
  animation: shake-left 3s linear -2.1s;
}
body.re-lighting .candle2__stick {
  animation: stick-animation 3s linear -2.1s;
}
body.re-lighting .light__wave {
  animation: expand-light 3s linear -2.1s;
}
body.re-lighting .candle2__eyes-one {
  animation: changeto-lower 3s linear -2.1s;
}
body.re-lighting .candle2__eyes-two {
  animation: changeto-greater 3s linear -2.1s;
}


.candle1__stick, .candle2__stick {
  position: absolute;
  left: 50%;
  top: 0%;
  width: 3px;
  height: 15px;
  background: #673C63;
  border-radius: 8px;
  transform: translate(-50%, -100%);
}

.candle2__stick {
  height: 12px;
  transform-origin: bottom center;
}

.candle1__eyes, .candle2__eyes {
  position: absolute;
  left: 50%;
  top: 0%;
  width: 35px;
  height: 30px;
  transform: translate(-50%, 0%);
}

.candle1__eyes-one {
  position: absolute;
  left: 30%;
  top: 20%;
  width: 5px;
  height: 5px;
  border-radius: 100%;
  background: #673C63;
  transform: translate(-70%, 0%);
}

.candle1__eyes-two {
  position: absolute;
  left: 70%;
  top: 20%;
  width: 5px;
  height: 5px;
  border-radius: 100%;
  background: #673C63;
  transform: translate(-70%, 0%);
}

.candle1__mouth {
  position: absolute;
  left: 40%;
  top: 20%;
  width: 0px;
  height: 0px;
  border-radius: 20px;
  background: #673C63;
  transform: translate(-50%, -50%);
}

.candle__smoke-one {
  position: absolute;
  left: 30%;
  top: 50%;
  width: 30px;
  height: 3px;
  background: grey;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.candle__smoke-two {
  position: absolute;
  left: 30%;
  top: 40%;
  width: 10px;
  height: 10px;
  border-radius: 10px;
  background: grey;
  transform: translate(-50%, -50%);
  opacity: 0;
}

/* Make smoke visible when animations run */
body.blowing-out .candle__smoke-one,
body.blowing-out .candle__smoke-two {
  opacity: 1;
}


.candle2 {
  position: absolute;
  left: 20%;
  top: 65%;
  width: 42px;
  height: 60px;
  background: #fff;
  border: 3px solid #673C63;
  border-bottom: 0px;
  border-radius: 3px;
  transform: translate(60%, -15%);
  transform-origin: center right;
  box-shadow: -2px 0px 0px #95c6f2 inset;
}

.candle2__eyes-one {
  position: absolute;
  left: 30%;
  top: 50%;
  width: 5px;
  height: 5px;
  display: inline-block;
  border: 0px solid #673C63;
  border-radius: 100%;
  float: left;
  background: #673C63;
  transform: translate(-80%, 0%);
}

.candle2__eyes-two {
  position: absolute;
  left: 70%;
  top: 50%;
  width: 5px;
  height: 5px;
  display: inline-block;
  border: 0px solid #673C63;
  border-radius: 100%;
  float: left;
  background: #673C63;
  transform: translate(-80%, 0%);
}

/* --- HIDE THE WHITE RING ANIMATION --- */
.light__wave {
  display: none !important; /* This completely removes the ring */
  
  /* You can keep the old styles below just in case, but display:none overrides them */
  position: absolute;
  top: 35%;
  left: 35%;
  width: 75px;
  height: 75px;
  border-radius: 100%;
  z-index: 0;
  transform: translate(-25%, -50%) scale(2.5, 2.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.candle2__fire {
  position: absolute;
  top: 50%;
  left: 40%;
  display: block;
  width: 16px;
  height: 20px;
  background-color: red;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: #FF9800;
  transform: translate(-50%, -50%);
  
  /* Flame dances by default */
  animation: dance-fire 3s infinite linear;
  transition: opacity 0.2s linear;
}

/* This rule extinguishes the flame */
body.blowing-out .candle2__fire {
  animation: none; /* Stop the dance */
  opacity: 0; /* Make it invisible */
  transition-delay: 1.7s; /* Delay the fade-out to sync */
}

/* This rule re-lights the flame */
body.re-lighting .candle2__fire {
  animation: none; /* No dancing during re-light */
  opacity: 1;
  /* Fade in at 0.7s, during the 0.9s re-light anim */
  transition: opacity 0.2s linear 0.7s; 
}


/* --- ALL KEYFRAMES REMAIN UNCHANGED --- */
/* They are now just triggered in two separate parts */

@keyframes blink-eyes {
  0%,35% {
    opacity: 1;
    transform: translate(-70%, 0%);
  }
  36%,39% {
    opacity: 0;
    transform: translate(-70%, 0%);
  }
  40% {
    opacity: 1;
    transform: translate(-70%, 0%);
  }
  50%,65% {
    transform: translate(-140%, 0%);
  }
  66% {
    transform: translate(-70%, 0%);
  }
  /* 70% - 100% is idle */
}
@keyframes expand-body {
  0%,40% {
    transform: scale(1, 1) translate(60%, -25%);
  }
  45%,55% {
    transform: scale(1.1, 1.1) translate(60%, -28%);
  }
  60% {
    transform: scale(0.89, 0.89) translate(60%, -25%);
  }
  65% {
    transform: scale(1, 1) translate(60%, -25%);
  }
  70% {
    transform: scale(0.95, 0.95) translate(60%, -25%);
  }
  75% {
    transform: scale(1, 1) translate(60%, -25%);
  }
  /* 75% - 100% is idle */
}
@keyframes uff {
  0%,40% {
    width: 0px;
    height: 0px;
  }
  50%,54% {
    width: 15px;
    height: 15px;
    left: 30%;
  }
  59% {
    width: 5px;
    height: 5px;
    left: 20%;
  }
  62% {
    width: 2px;
    height: 2px;
    left: 20%;
  }
  67% {
    width: 0px;
    height: 0px;
    left: 30%;
  }
  /* 67% - 100% is idle */
}
@keyframes move-left {
  0%,59%,100% {
    width: 0px;
    left: 40%;
    opacity: 0;
  }
  60% {
    width: 30px;
    left: 30%;
    opacity: 1;
  }
  68% {
    width: 0px;
    left: 20%;
    opacity: 0;
  }
  /* 68% - 100% is idle */
}
@keyframes move-top {
  0%,64%,100% {
    width: 0px;
    height: 0px;
    top: 0%;
    opacity: 0;
  }
  65% {
    width: 10px;
    height: 10px;
    top: 40%;
    left: 40%;
    opacity: 1;
  }
  80% {
    width: 0px;
    height: 0px;
    top: 20%;
    opacity: 0;
  }
  /* 80% - 100% is idle, but this one has a late part... */
  /* Ah, this is fine. The .blowing-out will stop at 70%, */
  /* so the puff at 80% will never play. */
}
@keyframes shake-left {
  /* --- BLOW OUT (0% - 70%) --- */
  0%,40% {
    left: 20%;
    transform: translate(60%, -15%);
  }
  50%,54% {
    left: 20%;
    transform: translate(60%, -15%);
  }
  59% {
    left: 20%;
    transform: translate(60%, -15%);
  }
  62% {
    left: 18%;
    transform: translate(60%, -15%);
  }
  65% {
    left: 21%;
    transform: translate(60%, -15%);
  }
  67%, 70% { /* Added 70% here */
    left: 20%;
    transform: translate(60%, -15%);
  }
  /* --- RE-LIGHT (70% - 100%) --- */
  75% {
    left: 20%;
    transform: scale(1.15, 0.85) translate(60%, -15%);
    background: #fff;
    border-color: #673C63;
  }
  91% {
    left: 20%;
    transform: scale(1.18, 0.82) translate(60%, -10%);
    background: #F44336;
    border-color: #F44336;
    box-shadow: -2px 0px 0px #F44336 inset;
  }
  92% {
    left: 20%;
    transform: scale(0.85, 1.15) translate(60%, -15%);
  }
  95% {
    left: 20%;
    transform: scale(1.05, 0.95) translate(60%, -15%);
  }
  97%, 100% { /* Added 100% here */
    left: 20%;
    transform: scale(1, 1) translate(60%, -15%);
  }
}
@keyframes stick-animation {
  /* --- BLOW OUT (0% - 70%) --- */
  0%,40% {
    left: 50%;
    top: 0%;
    transform: translate(-50%, -100%);
  }
  50%,54% {
    left: 50%;
    top: 0%;
    transform: translate(-50%, -100%);
  }
  59% {
    left: 50%;
    top: 0%;
    transform: translate(-50%, -100%);
  }
  62% {
    left: 50%;
    top: 0%;
    transform: rotateZ(-15deg) translate(-50%, -100%);
  }
  65% {
    left: 50%;
    top: 0%;
    transform: rotateZ(15deg) translate(-50%, -100%);
  }
  70% {
    left: 50%;
    top: 0%;
    transform: rotateZ(-5deg) translate(-50%, -100%);
  }
  72% {
    left: 50%;
    top: 0%;
    transform: rotateZ(5deg) translate(-50%, -100%);
  }
  74% { /* End of blow-out part */
    left: 50%;
    top: 0%;
    transform: rotateZ(0deg) translate(-50%, -100%);
  }
  /* --- RE-LIGHT (74% - 100%) --- */
  85% {
    transform: rotateZ(180deg) translate(0%, 120%);
  }
  92%, 100% { /* Added 100% */
    left: 50%;
    top: 0%;
    transform: translate(-50%, -100%);
  }
}
@keyframes expand-light {
  /* --- BLOW OUT (0% - 70%) --- */
  /* This part is idle, which is perfect. */
  10%,29%,59%, 70% { /* Added 70% */
    transform: translate(-25%, -50%) scale(0, 0);
    border: 2px solid rgba(255, 255, 255, 0);
  }
  /* --- RE-LIGHT (70% - 100%) --- */
  90%,20%,50% {
    transform: translate(-25%, -50%) scale(1, 1);
  }
  95%,96%,26%,27%,56%,57% {
    transform: translate(-25%, -50%) scale(2, 2);
    border: 2px solid rgba(255, 255, 255, 0.5);
  }
  0%,28%,58%,100% {
    transform: translate(-25%, -50%) scale(2.5, 2.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
  }
}

@keyframes dance-fire {
  /* This is unchanged */
  90%,0%,7%,15%,23%,31%,39%,47%,55% {
    left: 40.8%;
    width: 16px;
    height: 20px;
    background: #FFC107;
  }
  94%,3%,11%,19%,27%,35%,43%,51%,58% {
    left: 41.2%;
    width: 16px;
    height: 20px;
    background: #FF9800;
  }
}
@keyframes changeto-lower {
  /* --- BLOW OUT (0% - 70%) --- */
  0%,70% {
    padding: 0px;
    display: inline-block;
    border-radius: 100%;
    background: #673C63;
    border-width: 0 0 0 0;
    border: 0px solid #673C63;
    transform: translate(-90%, 0%);
  }
  /* --- RE-LIGHT (71% - 100%) --- */
  71%,89% {
    background: none;
    border: solid #673C63;
    border-radius: 0px;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 1px;
    float: left;
    transform-origin: bottom left;
    transform: rotate(-45deg) translate(-50%, -65%);
    -webkit-transform: rotate(-45deg) translate(-50%, -65%);
  }
  90%, 100% { /* Added 100% */
    padding: 0px;
    display: inline-block;
    border-radius: 100%;
    background: #673C63;
    border-width: 0 0 0 0;
    border: 0px solid #673C63;
    transform: translate(-90%, 0%);
  }
}
@keyframes changeto-greater {
  /* --- BLOW OUT (0% - 70%) --- */
  0%,70% {
    top: 50%;
    padding: 0px;
    display: inline-block;
    border-radius: 100%;
    background: #673C63;
    border-width: 0 0 0 0;
    border: 0px solid #673C63;
    transform: translate(-80%, 0%);
  }
  /* --- RE-LIGHT (71% - 100%) --- */
  71%,89% {
    top: 30%;
    background: none;
    border: solid #673C63;
    border-radius: 0px;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 1px;
    float: left;
    transform-origin: bottom left;
    transform: rotate(135deg) translate(-80%, 20%);
    -webkit-transform: rotate(135deg) translate(-80%, 20%);
  }
  90%, 100% { /* Added 100% */
    top: 50%;
    padding: 0px;
    display: inline-block;
    border-radius: 100%;
    background: #673C63;
    border-width: 0 0 0 0;
    border: 0px solid #673C63;
    transform: translate(-80%, 0%);
  }
}

/* ======================================= */
/* ====== NEW INTEGRATION STYLES ========= */
/* ======================================= */

/* ------------------------------------- */
/* --- NAV BAR POSITIONING (Default) --- */
/* ------------------------------------- */

/* --- NAV BAR POSITIONING (Default) --- */

/* In animation2.css */

.candle-nav-icon {
    display: block;
    line-height: 1; 
    z-index: 1000;

    /* --- THIS IS THE ALIGNMENT & SIZE FIX --- */

    /* 1. Position it absolutely inside the wrapper */
    position: absolute;
    top: 0%;  /* Center it vertically relative to the wrapper */
    right: -100px;  /* Pin it to the right edge of the wrapper */

    /* 2. Set the FULL, UN-SCALED size (for internals) */
    width: 450px;
    height: 450px;

    /* 3. Scale it UP and align it */
    /* - translateY(-50%) perfects the vertical centering */
    /* - scale(0.18) makes it 50% larger than before */
    transform: translateY(-41%) scale(0.5);

    /* 4. Scale from the center-right edge */
    transform-origin: right; 

    /* 5. Remove all margins/positioning */
    margin: 0;
    top: 0; 
}
/* Ensure the main page content is ready for blur/fixed positioning */
#main-page-content {
    transition: filter 0.5s; /* Smooth blur transition */
}

/* ------------------------------------- */
/* --- STATE 1: ENLARGED/BLURRED (The Pop-Up) --- */
/* ------------------------------------- */

/* A. Blur the background content */
body.is-enlarged #main-page-content {
    filter: blur(8px); 
    pointer-events: none;
    user-select: none;
}

/* B. Center and Enlarge the Candles */
body.is-enlarged .candle-nav-icon {
    /* Make the candles fixed, centered, and enlarged */
    position: fixed;
    top: 50%;
    left: 50%;
    /* Enlarge and center */
    transform: scale(1.5) translate(-50%, -50%); /* Adjust 1.5 for final size */
    transform-origin: center center;
    transition: transform 0.05s; /* INSTANT move to center for a "pop-up" effect */
    z-index: 9999; 
    /* The width/height are overridden by the scale factor */
    width: 250px; 
    height: 150px;
}


/* ------------------------------------- */
/* --- STATE 3: IS DARK NAV (The Final Dark State) --- */
/* ------------------------------------- */

/* Apply dark background to the page wrapper (must override default body background) */
body.is-dark-nav {
    background-color: #000 !important; /* Force dark background */
}

/* Ensure the flame and light wave are OFF when dark in the nav */
body.is-dark-nav .candle2__fire {
  opacity: 0;
  animation: none;
  transition: none;
}
body.is-dark-nav .light__wave {
  /* Use the previously fixed state to hide the gray circle */
  transform: translate(-25%, -50%) scale(0);
  border-color: transparent;
  animation: none;
}