/* Diwali theme, only during DIWALI_DAYS */

/* inline logo sized like an img */
svg.logo {
  width: auto;
  height: auto;
}

/* svg logo colours itself, no invert; img logos keep theirs */
body.dark svg.logo,
body.auto svg.logo {
  filter: none;
}

/* prefix beats home.html's navbar background */
.diwali-season .top-nav-holder,
.diwali-season .bottom-menu-bar::before,
.diwali-footer::before {
  background-image: var(--rangoli-layers);
  background-repeat: no-repeat;
  background-position: var(--rangoli-positions);
  background-size: var(--rangoli-sizes);
}

.diwali-season .bottom-menu-bar::before,
.diwali-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--z-background);
}

/* faint rangolis on phone's bottom bar */
.diwali-season .bottom-menu-bar::before {
  opacity: 0.4;
}

/* footer's glowing top edge */
#large-footer {
  position: relative;
  isolation: isolate;
  border-top: 2px solid;
  border-image: linear-gradient(
      90deg,
      transparent,
      #f59e0b 15%,
      #f97316 50%,
      #f59e0b 85%,
      transparent
    )
    1;
  box-shadow: 0 -6px 16px -8px hsla(30, 100%, 55%, 0.7);
}

.diwali-footer {
  position: absolute;
  inset: 0;
  z-index: var(--z-background);
  display: flex;
  justify-content: space-around;
  /* keeps flame aligned over bowl */
  align-items: flex-start;
  pointer-events: none;
}

/* faint, behind footer text */
.diwali-footer::before {
  opacity: 0.35;
}

/* bowl rests on the edge */
.diwali-footer > span {
  position: relative;
  margin-top: -21px;
}

.diwali-footer svg {
  display: block;
  transition: filter 0.6s;
}

/* feed's muhurat trading row */
/* muhurat row in the feed: a soft festive tint, edge to edge */
.diwali-muhurat {
  background: linear-gradient(90deg, hsla(38, 100%, 55%, 0.2), transparent);
}

.diwali-lit svg {
  filter: drop-shadow(0 0 6px hsla(38, 100%, 55%, 0.7));
}

/* html flames, unlit until seen */
.diwali-flame {
  position: absolute;
  inset: 0;
  opacity: 0;
  scale: 0;
  /* `scale`, not `transform`, keeps GPU path */
  transition:
    scale 0.5s ease-out,
    opacity 0.5s;
}

/* core and svgs fill flame box */
.diwali-flame-core,
.diwali-flame svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* logo's svg flame: turn about the points the html boxes did,
   in the logo's viewBox units */
svg.logo .diwali-flame,
svg.logo .diwali-flame-core {
  transform-box: view-box;
}

svg.logo .diwali-flame {
  transform-origin: 331px 28px;
}

svg.logo .diwali-flame-core {
  transform-origin: 331px 27px;
}

/* sway name via class keeps GPU */
.diwali-lit .diwali-flame {
  opacity: 1;
  scale: var(--flame-size);
  animation: diwali-sway-uneven var(--flame-duration) ease-in-out var(--flame-delay) infinite
    var(--flame-direction);
}

.diwali-lit .diwali-sway-gentle {
  animation-name: diwali-sway-gentle;
}

.diwali-lit .diwali-sway-wild {
  animation-name: diwali-sway-wild;
}

/* gentle: a small, even swing */
@keyframes diwali-sway-gentle {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: scale(0.96, 1.06) rotate(6deg);
  }
}

/* uneven: irregular leans, stretching tall */
@keyframes diwali-sway-uneven {
  0%,
  100% {
    transform: rotate(-10deg);
  }
  20% {
    transform: scale(0.94, 1.1) rotate(6deg);
  }
  35% {
    transform: rotate(-3deg);
  }
  55% {
    transform: scale(0.92, 1.14) rotate(10deg);
  }
  75% {
    transform: scale(1.04, 0.96) rotate(-7deg);
  }
}

/* wild: big quick leans */
@keyframes diwali-sway-wild {
  0%,
  100% {
    transform: rotate(-14deg);
  }
  30% {
    transform: scale(0.9, 1.2) rotate(9deg);
  }
  50% {
    transform: scale(1.05, 0.92) rotate(-5deg);
  }
  80% {
    transform: scale(0.92, 1.16) rotate(14deg);
  }
}

/* pale core flickers on its own */
.diwali-lit .diwali-flame-core {
  transform-origin: 50% 48%;
  animation: diwali-core var(--core-duration) ease-in-out infinite alternate;
}

@keyframes diwali-core {
  to {
    transform: scale(0.8, 0.88);
    opacity: 0.7;
  }
}

/* off screen: paused, after shorthand rules */
.diwali-paused .diwali-flame,
.diwali-paused .diwali-flame-core {
  animation-play-state: paused;
}

/* reduced motion: lit but still */
@media (prefers-reduced-motion: reduce) {
  .diwali-lit .diwali-flame,
  .diwali-lit .diwali-flame-core {
    animation: none;
  }

  .diwali-flame,
  .diwali-footer svg {
    transition: none;
  }
}
