/* Final backlit reveal: preserve the original light routes and their timing. */
.hat-rear-light, .hat-rear-atmosphere {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  animation: hat-surface-exposure var(--hat-cycle-duration, 59.4992s) linear infinite;
  animation-delay: var(--hat-entry-offset, 0s);
  animation-fill-mode: both;
  animation-play-state: var(--home-scene-play-state, paused);
}
.svg-light-scene .hat-rear-light {
  z-index: -1;
  /* The original SVG remains opaque in front of this identical rear source.
     Static filters spill light outside the precise crown, brim and band slit. */
  filter:
    drop-shadow(0 0 2px rgb(var(--hat-rgb-f0dfff, 240 223 255) / .85))
    drop-shadow(0 0 8px rgb(var(--hat-rgb-d5afff, 213 175 255) / .72))
    drop-shadow(0 0 22px rgb(var(--hat-rgb-b856ff, 184 86 255) / .66))
    drop-shadow(0 0 43px rgb(var(--hat-rgb-8b1ef0, 139 30 240) / .5));
}
.hat-rear-atmosphere {
  z-index: -2;
  inset: -29% -39% -23%;
  background:
    radial-gradient(ellipse 41% 40% at 50% 41%,
      rgb(var(--hat-rgb-d5afff, 213 175 255) / .4) 0%,
      rgb(var(--hat-rgb-b856ff, 184 86 255) / .28) 31%,
      rgb(var(--hat-rgb-8b1ef0, 139 30 240) / .17) 53%,
      rgb(var(--hat-rgb-410985, 65 9 133) / .07) 74%,
      rgb(var(--hat-rgb-410985, 65 9 133) / 0) 100%);
}
/* The former front reveal becomes an opaque silhouette on the same envelope.
   It covers the residual front pools gradually as the rear light rises. */
.svg-light-scene .edge-light-wash {
  z-index: 4;
  background: var(--hat-colour-09080d, #09080d);
}
.svg-light-scene .edge-light-wash::before,
.svg-light-scene .edge-light-wash::after { display: none; }
/* Only the final reveal receives this inward light. The containing wash uses
   the existing final-exposure curve, remaining completely absent beforehand.
   A broad, feathered edge catches more light on the upper left than the right,
   so the crown rolls into shadow instead of becoming a flat luminous outline. */
.svg-light-scene .edge-light-wash::before {
  display: block;
  content: "";
  position: absolute;
  inset: 0;
  transform: none;
  animation: none;
  background:
    radial-gradient(ellipse 66% 70% at 31% 13%,
      rgb(var(--hat-rgb-d5afff, 213 175 255) / .72) 0%,
      rgb(var(--hat-rgb-b856ff, 184 86 255) / .5) 41%,
      rgb(var(--hat-rgb-8b1ef0, 139 30 240) / .2) 76%,
      rgb(var(--hat-rgb-410985, 65 9 133) / .08) 100%),
    radial-gradient(ellipse 41% 66% at 92% 51%,
      rgb(var(--hat-rgb-b856ff, 184 86 255) / .34) 0%,
      rgb(var(--hat-rgb-410985, 65 9 133) / 0) 100%);
  -webkit-mask-image: var(--edge-bloom-mask);
  mask-image: var(--edge-bloom-mask);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

@media (prefers-reduced-motion: reduce) {
  .hat-rear-light, .hat-rear-atmosphere { animation: none; opacity: .3; }
}
