/* Light-ray edge flare for the second section (30 Oct, Shali: "more cinematic"). An anamorphic lens flare riding the bottom
   edge of the screen: a long horizontal streak, a hot core with layered bloom, a soft haze rising off the edge. It travels left to right with the scroll through "The body's quiet
   changes" and fades in and out with the section. Horizon Gold light on Void. story-flare.js sets --f (0..1) and --o. */
.story-flare { position: fixed; inset: auto 0 0 0; height: 100vh; z-index: 40; pointer-events: none; overflow: hidden;
  opacity: var(--o, 0); mix-blend-mode: screen; --f: 0; --x: calc(var(--f) * 100%); }
.story-flare > * { position: absolute; pointer-events: none; }

/* haze rising off the edge, wide and faint, so the whole bottom of the frame warms where the light is */
.sf-haze { bottom: -30vh; left: var(--x); width: 120vw; height: 70vh; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(231, 192, 137, .16) 0%, rgba(231, 192, 137, .06) 40%, rgba(231, 192, 137, 0) 70%); }
/* bloom: two layers, warm outer, near-white inner, centred on the edge */
.sf-bloom { bottom: -180px; left: var(--x); width: min(90vw, 1200px); height: 360px; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 238, 210, .55) 0%, rgba(231, 192, 137, .38) 14%, rgba(201, 157, 98, .14) 40%, rgba(201, 157, 98, 0) 68%);
  filter: blur(6px); animation: sf-breathe 4.8s ease-in-out infinite; }
.sf-core { bottom: -46px; left: var(--x); width: 180px; height: 92px; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, #fffaf0 0%, rgba(255, 240, 214, .9) 22%, rgba(231, 192, 137, .45) 50%, rgba(231, 192, 137, 0) 74%);
  filter: blur(2px); animation: sf-breathe 4.8s ease-in-out infinite; }
/* anamorphic streak: a hairline core plus a soft wide band, both much wider than the frame */
.sf-streak { bottom: 0; left: var(--x); width: 160vw; height: 2px; transform: translate(-50%, 50%);
  background: linear-gradient(90deg, rgba(231, 192, 137, 0) 0%, rgba(231, 192, 137, .35) 30%, #fff6e6 50%, rgba(231, 192, 137, .35) 70%, rgba(231, 192, 137, 0) 100%); }
.sf-band { bottom: 0; left: var(--x); width: 110vw; height: 26px; transform: translate(-50%, 50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 236, 206, .42) 0%, rgba(231, 192, 137, .16) 45%, rgba(231, 192, 137, 0) 75%); filter: blur(3px); }
@keyframes sf-breathe { 0%, 100% { opacity: .92; } 50% { opacity: 1; } }
@media (max-width: 759px) {
  .sf-bloom { height: 260px; bottom: -130px; } .sf-core { width: 130px; height: 70px; bottom: -35px; }
}
@media (prefers-reduced-motion: reduce) { .sf-bloom, .sf-core { animation: none; } }
@media (forced-colors: active) { .story-flare { display: none; } }

/* 30 Oct (Shali): slow, uneven flicker in the light, like a real lamp through glass; and a little film grain over the frame
   while the section is on screen. Grain is a tiny SVG noise tile shifted in steps; both stop for reduced motion. */
.sf-core, .sf-bloom { animation: sf-flicker 7.3s linear infinite; }
.sf-streak, .sf-band { animation: sf-flicker 7.3s linear infinite -2.1s; }
.sf-haze { animation: sf-flicker-soft 11s ease-in-out infinite; }
@keyframes sf-flicker {
  0% { opacity: 1; } 9% { opacity: .9; } 14% { opacity: .97; } 23% { opacity: .84; } 27% { opacity: .95; } 41% { opacity: 1; }
  52% { opacity: .88; } 56% { opacity: .99; } 68% { opacity: .91; } 77% { opacity: .82; } 81% { opacity: .96; } 93% { opacity: .9; } 100% { opacity: 1; } }
@keyframes sf-flicker-soft { 0%, 100% { opacity: 1; } 35% { opacity: .78; } 62% { opacity: .92; } }
.sf-grain { inset: -50%; width: 200%; height: 200%; opacity: .085;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 .93  0 0 0 0 .84  0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: sf-grain .9s steps(6) infinite; }
@keyframes sf-grain { 0% { transform: translate(0, 0); } 17% { transform: translate(-6%, 4%); } 33% { transform: translate(5%, -7%); }
  50% { transform: translate(-3%, 9%); } 67% { transform: translate(8%, 2%); } 83% { transform: translate(-7%, -4%); } 100% { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { .sf-core, .sf-bloom, .sf-streak, .sf-band, .sf-haze, .sf-grain { animation: none; } }

/* 2 Nov: the flare now runs under all three sections after the hero (story-flare.js, [data-flare]). On the Starlight Horizon
   story, light added with "screen" vanishes, so the light-ground look (.sf-light) tints instead: warm Horizon Gold glow rising
   off the bottom edge with "multiply", no white core, no grain. Same travel, same timing, kept soft. */
.story-flare.sf-light { mix-blend-mode: multiply; }
.story-flare.sf-light .sf-grain, .story-flare.sf-light .sf-core { display: none; }
.story-flare.sf-light .sf-haze { background: radial-gradient(50% 50% at 50% 50%, rgba(214, 170, 112, .22) 0%, rgba(214, 170, 112, .08) 40%, rgba(214, 170, 112, 0) 70%); }
.story-flare.sf-light .sf-bloom { background: radial-gradient(50% 50% at 50% 50%, rgba(206, 158, 96, .34) 0%, rgba(214, 170, 112, .2) 18%, rgba(214, 170, 112, .07) 42%, rgba(214, 170, 112, 0) 68%); }
.story-flare.sf-light .sf-streak { background: linear-gradient(90deg, rgba(196, 148, 86, 0) 0%, rgba(196, 148, 86, .3) 30%, rgba(184, 136, 74, .55) 50%, rgba(196, 148, 86, .3) 70%, rgba(196, 148, 86, 0) 100%); }
.story-flare.sf-light .sf-band { background: radial-gradient(50% 50% at 50% 50%, rgba(206, 158, 96, .26) 0%, rgba(214, 170, 112, .1) 45%, rgba(214, 170, 112, 0) 75%); }
