/* Natural cloud-to-candle lightning: the channel starts inside the cloud bank. */
.storm-external-lightning {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  isolation: isolate;
}

.storm-sky-illumination,
.storm-cloud-corona,
.storm-light-burst {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

/* A broad, dim sky response makes the flash feel like light inside real clouds. */
.storm-sky-illumination {
  z-index: 0;
  width: min(92%, 860px);
  height: min(48%, 360px);
  translate: -50% -15%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(239, 252, 255, .48) 0 4%, rgba(123, 207, 255, .27) 16%, transparent 58%),
    radial-gradient(ellipse at 50% 8%, rgba(255, 255, 255, .22), transparent 66%);
  filter: blur(18px);
}

/* The concentrated cloud charge sits around the bolt's hidden origin. */
.storm-cloud-corona {
  z-index: 1;
  width: 230px;
  height: 122px;
  translate: -50% -50%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 255, 255, .78) 0 4%, rgba(190, 240, 255, .6) 8%, rgba(58, 170, 255, .32) 25%, transparent 68%),
    radial-gradient(ellipse at 50% 40%, rgba(171, 224, 255, .26), transparent 74%);
  filter: blur(8px);
}

/* Short internal pulses keep the charge inside the cloud instead of leaving dots. */
.storm-cloud-corona::before,
.storm-cloud-corona::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  mix-blend-mode: screen;
}
.storm-cloud-corona::before {
  inset: 18% 4%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, .74) 0 3%, rgba(167, 231, 255, .52) 12%, transparent 62%);
  filter: blur(3px);
}
.storm-cloud-corona::after {
  inset: -14% 12%;
  background: radial-gradient(ellipse at 36% 52%, rgba(113, 211, 255, .58) 0 2%, transparent 24%), radial-gradient(ellipse at 68% 45%, rgba(219, 249, 255, .64) 0 2%, transparent 27%);
  filter: blur(2px);
}

.storm-light-burst {
  z-index: 3;
  width: 142px;
  height: 142px;
  translate: -50% -50%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .88) 0 2%, rgba(217, 248, 255, .55) 4% 8%, transparent 18%),
    radial-gradient(circle, rgba(137, 222, 255, .28) 0 13%, rgba(38, 161, 255, .12) 31%, transparent 70%);
  filter: blur(1px) saturate(1.12);
}

/* A brief smoky bloom keeps the contact point grounded without adding dots. */
.storm-impact-smoke {
  z-index: 2;
  width: 118px;
  height: 76px;
  translate: -50% -50%;
  border-radius: 50%;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 50% 54%, rgba(224, 246, 255, .34) 0 8%, rgba(136, 203, 232, .2) 24%, transparent 59%),
    radial-gradient(ellipse at 30% 56%, rgba(179, 224, 244, .22) 0 10%, transparent 42%),
    radial-gradient(ellipse at 71% 48%, rgba(194, 233, 247, .18) 0 11%, transparent 46%);
  filter: blur(7px) saturate(.78);
}

.storm-impact-smoke::before,
.storm-impact-smoke::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
}
.storm-impact-smoke::before {
  inset: -12% 20% 12%;
  background: radial-gradient(ellipse, rgba(201, 235, 247, .25) 0 12%, rgba(113, 184, 214, .12) 34%, transparent 72%);
  filter: blur(6px);
}
.storm-impact-smoke::after {
  inset: 20% -8% -18%;
  background: radial-gradient(ellipse at 50% 40%, rgba(224, 245, 251, .2), transparent 65%);
  filter: blur(8px);
}

.storm-dynamic-svg {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  filter: saturate(1.08) brightness(1.02);
}

.storm-dynamic-svg.is-active {
  animation: stormBoltFlash 4200ms steps(1, end) 1 both;
}

.storm-cloud-electric-path,
.storm-dynamic-halo-path,
.storm-dynamic-glow-path,
.storm-dynamic-core-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Thin filaments shimmer laterally but remain between the cloud ceiling and base. */
.storm-cloud-electric-path {
  stroke: rgba(196, 242, 255, .88);
  stroke-width: 1.05px;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  opacity: .72;
  filter: blur(.55px) drop-shadow(0 0 4px rgba(73, 185, 255, .72));
}

.storm-dynamic-halo-path {
  stroke: rgba(22, 127, 255, .34);
  stroke-width: 10px;
  opacity: .12;
  filter: blur(5px) drop-shadow(0 0 10px rgba(21, 127, 255, .48));
}

.storm-dynamic-glow-path {
  stroke: #70ddff;
  stroke-width: 2.8px;
  opacity: .34;
  filter: blur(1.35px) drop-shadow(0 0 6px rgba(26, 157, 255, .62));
}

.storm-dynamic-core-path {
  stroke: #ffffff;
  stroke-width: .82px;
  opacity: .95;
  filter: drop-shadow(0 0 1.5px #ffffff) drop-shadow(0 0 4px #b7f2ff) drop-shadow(0 0 8px rgba(22, 140, 255, .66));
}

.storm-dynamic-main.storm-dynamic-halo-path { stroke-width: 13px; opacity: .15; }
.storm-dynamic-main.storm-dynamic-glow-path { stroke-width: 3.8px; opacity: .55; }
.storm-dynamic-main.storm-dynamic-core-path { stroke-width: 1.05px; }
.storm-dynamic-main.storm-dynamic-halo-path,
.storm-dynamic-main.storm-dynamic-glow-path,
.storm-dynamic-main.storm-dynamic-core-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.storm-dynamic-fork.storm-dynamic-halo-path { stroke-width: 3px; opacity: .08; }
.storm-dynamic-fork.storm-dynamic-glow-path { stroke-width: 1.25px; opacity: .3; }
.storm-dynamic-fork.storm-dynamic-core-path { stroke-width: .5px; opacity: .84; }

/* The fine current flickers in short pulses instead of glowing as one solid tube. */
.storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-core-path {
  animation: stormCapillaryMain 780ms steps(8, end) infinite;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork.storm-dynamic-core-path {
  animation: stormCapillaryFork 690ms steps(7, end) infinite;
}
.storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-glow-path {
  animation: stormCapillaryGlow 780ms steps(8, end) infinite;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork.storm-dynamic-glow-path {
  animation: stormCapillaryGlow 690ms steps(7, end) infinite reverse;
}
/* The main channel peaks with the contact flash. Side channels split higher,
   arrive at different moments, then descend and fade away. */
.storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-core-path {
  animation: stormMainTravel 180ms ease-out 1 both, stormMainImpactCore 4200ms steps(12, end) 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-glow-path {
  animation: stormMainTravel 180ms ease-out 1 both, stormMainImpactGlow 4200ms steps(12, end) 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-halo-path {
  animation: stormMainTravel 180ms ease-out 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork-left.storm-dynamic-core-path {
  animation: stormForkArrival 1080ms steps(8, end) 120ms 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork-right.storm-dynamic-core-path {
  animation: stormForkArrival 980ms steps(8, end) 265ms 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork-left.storm-dynamic-glow-path {
  animation: stormForkGlowArrival 1080ms steps(8, end) 120ms 1 both;
}
.storm-dynamic-svg.is-active .storm-dynamic-fork-right.storm-dynamic-glow-path {
  animation: stormForkGlowArrival 980ms steps(8, end) 265ms 1 both;
}
.storm-dynamic-svg.is-active .storm-cloud-electric-path {
  animation: stormCloudTraceFlicker 820ms steps(9, end) infinite;
}

/* A restrained radial flare makes the candle contact feel hot and electrical. */
.storm-light-burst::before,
.storm-light-burst::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}
.storm-light-burst::before {
  inset: -28%;
  background: repeating-conic-gradient(
    from 6deg,
    transparent 0 8deg,
    rgba(205, 246, 255, .34) 9deg 10deg,
    transparent 11deg 23deg
  );
  -webkit-mask-image: radial-gradient(circle, transparent 0 16%, #000 27% 53%, transparent 73%);
  mask-image: radial-gradient(circle, transparent 0 16%, #000 27% 53%, transparent 73%);
  filter: blur(1.2px);
  opacity: 0;
}
.storm-light-burst::after {
  inset: 25%;
  background: radial-gradient(circle, rgba(255, 255, 255, .98) 0 14%, rgba(207, 247, 255, .7) 30%, transparent 72%);
  filter: blur(.5px);
  opacity: 0;
}
.storm-light-burst.is-active::before { animation: stormImpactNeedles 4200ms steps(1, end) 1 both; }
.storm-light-burst.is-active::after { animation: stormImpactHotspot 4200ms steps(1, end) 1 both; }

.storm-cloud-corona.is-active { animation: stormCloudCorona 4200ms steps(1, end) 1 both; }
.storm-cloud-corona.is-active::before { animation: stormCloudInnerFlash 4200ms steps(1, end) 1 both; }
.storm-cloud-corona.is-active::after { animation: stormCloudInnerFlashB 4200ms steps(1, end) 1 both; }
.storm-sky-illumination.is-active { animation: stormSkyWash 4200ms ease-out 1 both; }
.storm-light-burst.is-active { animation: stormImpactBurst 4200ms steps(1, end) 1 both; }
.storm-impact-smoke.is-active { animation: stormImpactSmoke 4200ms ease-out 1 both; }
.storm-impact-smoke.is-active::before { animation: stormImpactSmokeInner 4200ms ease-out 1 both; }
.storm-impact-smoke.is-active::after { animation: stormImpactSmokeOuter 4200ms ease-out 1 both; }

@keyframes stormBoltFlash {
  0%, 2%, 100% { opacity: 0; }
  3% { opacity: .82; }
  4% { opacity: 1; }
  5% { opacity: .14; }
  6.5% { opacity: .9; }
  8% { opacity: .24; }
  9.5% { opacity: .82; }
  12% { opacity: .4; }
  18% { opacity: .52; }
  30% { opacity: .26; }
  52% { opacity: .1; }
  72% { opacity: .035; }
}

@keyframes stormCloudCorona {
  0%, 2%, 100% { opacity: 0; scale: .72  .62; }
  3% { opacity: .52; scale: .94  .8; }
  4% { opacity: .96; scale: 1.08  .94; }
  5% { opacity: .26; scale: .88  .78; }
  7% { opacity: .72; scale: 1.02  .9; }
  11% { opacity: .42; scale: 1.12 1; }
  22% { opacity: .22; scale: 1.25 1.08; }
  48% { opacity: .08; scale: 1.42 1.16; }
}

@keyframes stormSkyWash {
  0%, 2%, 100% { opacity: 0; scale: .78  .66; }
  4% { opacity: .42; scale: .94  .82; }
  5% { opacity: .16; }
  8% { opacity: .3; scale: 1.02  .94; }
  14% { opacity: .2; scale: 1.08 1; }
  34% { opacity: .1; scale: 1.18 1.08; }
  68% { opacity: .025; scale: 1.3 1.16; }
}

@keyframes stormImpactSmoke {
  0%, 2%, 100% { opacity: 0; scale: .42 .3; }
  3% { opacity: .2; scale: .62 .46; }
  5% { opacity: .34; scale: .9 .68; }
  9% { opacity: .26; scale: 1.08 .8; }
  16% { opacity: .16; scale: 1.3 .98; }
  28% { opacity: .08; scale: 1.56 1.14; }
  48% { opacity: .025; scale: 1.84 1.3; }
}

@keyframes stormImpactSmokeInner {
  0%, 2%, 100% { opacity: 0; scale: .48 .42; translate: 0 10%; }
  5% { opacity: .3; scale: .78 .66; translate: -4% 0; }
  12% { opacity: .18; scale: 1.08 .9; translate: 5% -8%; }
  26% { opacity: .06; scale: 1.42 1.1; translate: -6% -14%; }
}

@keyframes stormImpactSmokeOuter {
  0%, 2%, 100% { opacity: 0; scale: .5 .4; translate: 0 8%; }
  6% { opacity: .2; scale: .86 .62; translate: 5% 0; }
  18% { opacity: .12; scale: 1.24 .92; translate: -5% -10%; }
  34% { opacity: .035; scale: 1.7 1.2; translate: 8% -18%; }
}

@keyframes stormImpactBurst {
  0%, 2%, 100% { opacity: 0; scale: .42; }
  3% { opacity: .42; scale: .7; }
  4% { opacity: .7; scale: .94; }
  5% { opacity: .12; scale: .76; }
  7% { opacity: .44; scale: 1.04; }
  9% { opacity: .1; scale: 1.2; }
  14% { opacity: .24; scale: 1.1; }
  25% { opacity: .045; scale: 1.34; }
  44% { opacity: .012; scale: 1.62; }
}

@keyframes stormCapillaryMain {
  0%, 100% { opacity: .62; filter: drop-shadow(0 0 1px #ffffff) drop-shadow(0 0 3px #b7f2ff) drop-shadow(0 0 6px rgba(22, 140, 255, .48)); }
  17% { opacity: 1; filter: drop-shadow(0 0 2px #ffffff) drop-shadow(0 0 5px #d5f8ff) drop-shadow(0 0 11px rgba(22, 140, 255, .8)); }
  29% { opacity: .28; }
  36% { opacity: .92; }
  62% { opacity: .72; }
}

@keyframes stormMainImpactCore {
  0%, 2%, 100% { opacity: 0; }
  3% { opacity: .72; filter: drop-shadow(0 0 2px #ffffff) drop-shadow(0 0 5px #b7f2ff) drop-shadow(0 0 10px rgba(22, 140, 255, .7)); }
  4% { opacity: 1; filter: drop-shadow(0 0 3px #ffffff) drop-shadow(0 0 8px #d5f8ff) drop-shadow(0 0 17px rgba(22, 140, 255, .95)); }
  5% { opacity: .2; }
  6.5% { opacity: .96; filter: drop-shadow(0 0 2px #ffffff) drop-shadow(0 0 6px #c9f5ff) drop-shadow(0 0 13px rgba(22, 140, 255, .84)); }
  10% { opacity: .38; }
  14% { opacity: .82; }
  20% { opacity: .3; }
  32% { opacity: .56; }
  48% { opacity: .18; }
  72% { opacity: .06; }
}

@keyframes stormMainTravel {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes stormMainImpactGlow {
  0%, 2%, 100% { opacity: 0; }
  3% { opacity: .48; }
  4% { opacity: .9; filter: blur(1px) drop-shadow(0 0 9px rgba(42, 178, 255, .82)); }
  5% { opacity: .12; }
  7% { opacity: .62; }
  12% { opacity: .28; }
  22% { opacity: .4; }
  42% { opacity: .1; }
  70% { opacity: .03; }
}

@keyframes stormForkArrival {
  0%, 8%, 100% { opacity: 0; }
  18% { opacity: .92; }
  31% { opacity: .42; }
  48% { opacity: .78; }
  67% { opacity: .25; }
  84% { opacity: .08; }
}

@keyframes stormForkGlowArrival {
  0%, 8%, 100% { opacity: 0; }
  18% { opacity: .58; }
  34% { opacity: .2; }
  52% { opacity: .46; }
  74% { opacity: .08; }
}

@keyframes stormCapillaryFork {
  0%, 100% { opacity: .5; }
  15% { opacity: .92; }
  28% { opacity: .3; }
  41% { opacity: .82; }
  64% { opacity: .46; }
  84% { opacity: .16; }
}

@keyframes stormCapillaryGlow {
  0%, 100% { opacity: .16; }
  18% { opacity: .62; }
  31% { opacity: .08; }
  42% { opacity: .46; }
  70% { opacity: .22; }
}

@keyframes stormCloudTraceFlicker {
  0%, 100% { opacity: .1; }
  14% { opacity: .9; }
  21% { opacity: .18; }
  39% { opacity: .78; }
  48% { opacity: .12; }
  69% { opacity: .86; }
  82% { opacity: .28; }
}

@keyframes stormCloudInnerFlash {
  0%, 2%, 100% { opacity: 0; scale: .72 .58; }
  3% { opacity: .82; scale: .92 .72; }
  4.5% { opacity: .2; scale: 1.08 .88; }
  7% { opacity: .72; scale: .9 .78; }
  10% { opacity: .12; scale: 1.18 .96; }
  16% { opacity: .5; scale: 1 .86; }
  28% { opacity: .08; scale: 1.26 1; }
}

@keyframes stormCloudInnerFlashB {
  0%, 2%, 100% { opacity: 0; scale: .64 .54; rotate: -3deg; }
  4% { opacity: .64; scale: .88 .72; rotate: 0deg; }
  6% { opacity: .14; scale: 1.04 .86; }
  9% { opacity: .48; scale: .96 .8; rotate: 2deg; }
  14% { opacity: .08; scale: 1.24 1; }
}

@keyframes stormImpactNeedles {
  0%, 2%, 100% { opacity: 0; scale: .56; rotate: -8deg; }
  3% { opacity: .72; scale: .78; rotate: 0deg; }
  4% { opacity: .94; scale: 1; }
  5% { opacity: .16; scale: .84; }
  7% { opacity: .54; scale: 1.08; }
  13% { opacity: .2; scale: 1.26; }
  28% { opacity: .05; scale: 1.5; }
}

@keyframes stormImpactHotspot {
  0%, 2%, 100% { opacity: 0; scale: .5; }
  3% { opacity: .92; scale: .78; }
  4% { opacity: 1; scale: 1.12; }
  5% { opacity: .28; scale: .9; }
  8% { opacity: .72; scale: 1; }
  15% { opacity: .26; scale: 1.28; }
  30% { opacity: .04; scale: 1.5; }
}

@media (max-width: 700px) {
  .storm-sky-illumination { width: 124%; height: 44%; filter: blur(15px); }
  .storm-cloud-corona { width: 174px; height: 96px; }
  .storm-light-burst { width: 116px; height: 116px; }
  .storm-impact-smoke { width: 98px; height: 64px; filter: blur(6px) saturate(.78); }
  .storm-dynamic-halo-path { stroke-width: 8px; }
  .storm-dynamic-glow-path { stroke-width: 2.15px; }
  .storm-dynamic-core-path { stroke-width: .66px; }
  .storm-dynamic-main.storm-dynamic-halo-path { stroke-width: 10px; }
  .storm-dynamic-main.storm-dynamic-glow-path { stroke-width: 3px; }
  .storm-dynamic-main.storm-dynamic-core-path { stroke-width: .9px; }
  .storm-dynamic-fork.storm-dynamic-halo-path { stroke-width: 2.4px; }
  .storm-dynamic-fork.storm-dynamic-glow-path { stroke-width: 1px; }
  .storm-dynamic-fork.storm-dynamic-core-path { stroke-width: .4px; }
  .storm-cloud-electric-path { stroke-width: .86px; }
}

@media (prefers-reduced-motion: reduce) {
  .storm-dynamic-svg.is-active { animation: none; opacity: .82; }
  .storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-halo-path,
  .storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-glow-path,
  .storm-dynamic-svg.is-active .storm-dynamic-main.storm-dynamic-core-path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .storm-dynamic-svg.is-active .storm-dynamic-fork-left.storm-dynamic-core-path,
  .storm-dynamic-svg.is-active .storm-dynamic-fork-right.storm-dynamic-core-path,
  .storm-dynamic-svg.is-active .storm-dynamic-fork-left.storm-dynamic-glow-path,
  .storm-dynamic-svg.is-active .storm-dynamic-fork-right.storm-dynamic-glow-path {
    animation: none;
  }
  .storm-dynamic-svg.is-active .storm-dynamic-core-path,
  .storm-dynamic-svg.is-active .storm-dynamic-glow-path,
  .storm-dynamic-svg.is-active .storm-cloud-electric-path,
  .storm-cloud-corona.is-active::before,
  .storm-cloud-corona.is-active::after,
  .storm-light-burst.is-active::before,
  .storm-light-burst.is-active::after,
  .storm-impact-smoke.is-active::before,
  .storm-impact-smoke.is-active::after { animation: none; }
  .storm-cloud-corona.is-active,
  .storm-sky-illumination.is-active,
  .storm-light-burst.is-active,
  .storm-impact-smoke.is-active { animation: none; opacity: .34; scale: 1; }
}
