/* ============================================================
   SOFT DAYS NIGHT V6.5
   Moon + meteor + hero transition polish ONLY.
   Existing V6.4 star density/distribution remains untouched.
   ============================================================ */

/* Disable older V6 moon/meteor renderers visually.
   Their timers may exist, but they cannot appear. */
body.sd-night-v6 .sd-night-moon-v6,
body.sd-night-v6 .sd-night-meteor-layer-v6{
  display:none !important;
}

/* ============================================================
   MOON V6.5
   Detailed procedural canvas + pearl light + subtle earthshine
   ============================================================ */

.sd-night-moon-v65{
  --moon-halo:.18;

  position:absolute;
  left:7.2%;
  top:7.4%;

  width:104px;
  height:104px;

  z-index:7;
  border-radius:50%;

  pointer-events:none;
  isolation:isolate;

  filter:
    drop-shadow(0 0 4px rgba(255,253,249,.14))
    drop-shadow(0 0 15px rgba(255,250,244,.08))
    drop-shadow(0 13px 20px rgba(0,0,0,.17));
}

.sd-night-moon-v65::before{
  content:"";

  position:absolute;
  inset:-105%;
  z-index:-2;

  border-radius:50%;

  background:
    radial-gradient(
      circle,
      rgba(255,253,248,.11) 0%,
      rgba(255,253,248,.052) 24%,
      rgba(255,253,248,.020) 43%,
      transparent 69%
    );

  opacity:var(--moon-halo);
  filter:blur(13px);
}

.sd-night-moon-v65::after{
  content:"";

  position:absolute;
  inset:-25%;
  z-index:-1;

  border-radius:50%;

  background:
    radial-gradient(
      circle,
      rgba(255,255,255,.065),
      transparent 67%
    );

  filter:blur(8px);
}

.sd-night-moon-v65 canvas{
  display:block;
  width:100%;
  height:100%;

  border-radius:50%;

  image-rendering:auto;
}

/* ============================================================
   METEOR V6.5
   Shorter, faster, cleaner.
   ============================================================ */

.sd-night-meteor-layer-v65{
  position:absolute;
  inset:0;

  z-index:9;
  overflow:hidden;
  pointer-events:none;
}

.sd-night-meteor-v65{
  --angle:27deg;
  --travel:480px;

  position:absolute;

  width:132px;
  height:1.1px;

  border-radius:999px;

  opacity:0;

  transform-origin:100% 50%;

  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(255,255,255,.018) 18%,
      rgba(255,251,246,.08) 46%,
      rgba(255,252,248,.42) 78%,
      rgba(255,255,255,.95) 100%
    );

  filter:
    blur(.12px)
    drop-shadow(0 0 3px rgba(255,252,247,.24));

  animation:
    sdMeteorV65
    .78s
    cubic-bezier(.16,.68,.18,1)
    forwards;
}

.sd-night-meteor-v65::after{
  content:"";

  position:absolute;
  right:-1px;
  top:50%;

  width:3.4px;
  height:3.4px;

  transform:translateY(-50%);
  border-radius:50%;

  background:#fffefa;

  box-shadow:
    0 0 6px 2px rgba(255,253,247,.68),
    0 0 13px 4px rgba(255,250,244,.13);
}

@keyframes sdMeteorV65{
  0%{
    opacity:0;

    transform:
      rotate(var(--angle))
      translate3d(0,0,0)
      scaleX(.48);
  }

  16%{
    opacity:.28;
  }

  34%{
    opacity:.94;
  }

  58%{
    opacity:.72;
  }

  100%{
    opacity:0;

    transform:
      rotate(var(--angle))
      translate3d(var(--travel),0,0)
      scaleX(.92);
  }
}

/* ============================================================
   HERO BOTTOM
   Remove the white/grey night strip.
   Use the EXISTING Soft Days theme background variable.
   No custom brand colour introduced.
   ============================================================ */

body.sd-night-v6 .sd-weather-fade-bottom{
  height:19% !important;

  background:
    linear-gradient(
      180deg,
      transparent 0%,
      color-mix(in srgb,var(--bg) 28%,transparent) 42%,
      color-mix(in srgb,var(--bg) 76%,transparent) 76%,
      var(--bg) 100%
    ) !important;
}

/* In case an older weather implementation contributes its own haze */
body.sd-night-v6 .sd-weather-haze{
  opacity:.055 !important;
}

/* weather chip stays readable but deliberately secondary */
body.sd-night-v6 .sd-weather-chip{
  opacity:.82;
}

@media(max-width:900px){
  .sd-night-moon-v65{
    left:6%;
    top:8%;

    width:84px;
    height:84px;
  }
}

@media(prefers-reduced-motion:reduce){
  .sd-night-meteor-v65{
    animation:none !important;
  }
}

/* ============================================================
   V6.6 — keep new meteor only
   Force-hide any legacy meteor implementations
   ============================================================ */

body.sd-night-v6 .sd-night-meteor-layer-v6,
body.sd-night-v6 .sd-night-meteor-v6,
body.sd-night-v6 .sd-weather-meteor,
body.sd-night-v6 .sd-weather-meteor-layer,
body.sd-night-v6 .sd-weather-meteors{
  display:none !important;
  opacity:0 !important;
  visibility:hidden !important;
}
