/* atmosphere — texture and air. Meant to be felt, not seen.
   1. grain : one noise tile repeated on a fixed layer, jittered with steps()
   2. motes : small sparkles / asterisks drifting in the hero and the closing panel
   3. light : soft pools of chalk and stone behind the hero, a slow sheen on the dark panels
   Every layer except the grain is created by js/fx/atmosphere.js, so nothing here
   exists without JS or with reduced motion. Only transform and opacity animate, and
   only while the owning section is on screen (class .fx-atmosphere-live). */

/* ---------- 1. grain ---------- */
.fx-atmosphere-grain{display:none}
html.js .fx-atmosphere-grain{display:block;position:fixed;inset:0;z-index:80;overflow:hidden;pointer-events:none}
/* the tile is oversized by the jitter distance, so the edges never show */
.fx-atmosphere-grain::before{content:"";position:absolute;inset:-64px;opacity:.05;
  background:var(--fx-atmosphere-tile,none) 0 0/160px 160px;
  animation:fx-atmosphere-grain .84s steps(1) infinite;will-change:transform}
/* dense screens: one noise pixel per device pixel, a touch stronger because finer grain reads fainter */
@media (min-resolution:2dppx){.fx-atmosphere-grain::before{background-size:80px 80px;opacity:.065}}
@keyframes fx-atmosphere-grain{
  0%{transform:translate3d(0,0,0)}
  14%{transform:translate3d(-41px,23px,0)}
  28%{transform:translate3d(29px,-52px,0)}
  42%{transform:translate3d(-17px,-31px,0)}
  57%{transform:translate3d(48px,37px,0)}
  71%{transform:translate3d(-56px,-9px,0)}
  85%{transform:translate3d(13px,58px,0)}
}

/* ---------- shared layer ---------- */
.fx-atmosphere-air{position:absolute;inset:0;pointer-events:none}
/* inside a dark .panel-bg: follow its radius and clip to it */
.fx-atmosphere-panel{border-radius:inherit;overflow:hidden}

@keyframes fx-atmosphere-float{to{transform:translate3d(var(--fx-atmosphere-dx),var(--fx-atmosphere-dy),0) scale(var(--fx-atmosphere-s,1))}}

/* ---------- 3a. soft light behind the hero (under the big letters) ---------- */
.fx-atmosphere-glow{position:absolute;z-index:0;border-radius:50%;
  background:radial-gradient(closest-side,rgba(var(--fx-atmosphere-rgb),.95) 0,rgba(var(--fx-atmosphere-rgb),.6) 34%,rgba(var(--fx-atmosphere-rgb),.2) 68%,rgba(var(--fx-atmosphere-rgb),0) 100%)}
.fx-atmosphere-glow:nth-child(1){--fx-atmosphere-rgb:255,255,255;--fx-atmosphere-dx:7vw;--fx-atmosphere-dy:5vh;--fx-atmosphere-s:1.12;
  left:-12vw;top:-18vh;width:62vw;height:88vh;opacity:.85}
.fx-atmosphere-glow:nth-child(2){--fx-atmosphere-rgb:255,255,255;--fx-atmosphere-dx:-6vw;--fx-atmosphere-dy:-7vh;--fx-atmosphere-s:.9;
  right:-8vw;top:22vh;width:52vw;height:80vh;opacity:.7}
.fx-atmosphere-glow:nth-child(3){--fx-atmosphere-rgb:154,156,150;--fx-atmosphere-dx:9vw;--fx-atmosphere-dy:-4vh;--fx-atmosphere-s:1.1;
  left:26vw;bottom:-34vh;width:58vw;height:70vh;opacity:.24}
.fx-atmosphere-live .fx-atmosphere-glow{animation:fx-atmosphere-float 23s ease-in-out infinite alternate}
.fx-atmosphere-live .fx-atmosphere-glow:nth-child(2){animation-duration:31s}
.fx-atmosphere-live .fx-atmosphere-glow:nth-child(3){animation-duration:27s}

/* ---------- 2. motes ---------- */
/* .fx-atmosphere-motes gets a little scroll parallax from JS; each mote drifts on its
   own clock and its glyph pops in, then twinkles (sparkle) or turns (asterisk) */
.fx-atmosphere-motes{position:absolute;inset:0;z-index:1}
.fx-atmosphere-panel .fx-atmosphere-motes{inset:0 0 auto;height:min(100%,92vh)}
.fx-atmosphere-mote{position:absolute;left:var(--fx-atmosphere-x);top:var(--fx-atmosphere-y);aspect-ratio:1}
.fx-atmosphere-mote svg{width:100%;height:100%;transform:scale(0)}
.fx-atmosphere-ink{color:var(--ink)}
.fx-atmosphere-stone{color:var(--stone)}
.fx-atmosphere-chalk{color:var(--chalk)}
.fx-atmosphere-verm{color:var(--verm)}

.fx-atmosphere-live .fx-atmosphere-mote{animation:fx-atmosphere-float var(--fx-atmosphere-t) ease-in-out var(--fx-atmosphere-d) infinite alternate}
.fx-atmosphere-live .fx-atmosphere-mote svg{transform:none;
  animation:fx-atmosphere-pop .8s var(--spring) var(--fx-atmosphere-d) backwards,
            fx-atmosphere-twinkle calc(var(--fx-atmosphere-t)*.55) ease-in-out calc(var(--fx-atmosphere-d) + .8s) infinite}
.fx-atmosphere-live .fx-atmosphere-mote svg.fx-atmosphere-ast{
  animation:fx-atmosphere-pop .8s var(--spring) var(--fx-atmosphere-d) backwards,
            fx-atmosphere-turn calc(var(--fx-atmosphere-t)*3) linear calc(var(--fx-atmosphere-d) + .8s) infinite}
@keyframes fx-atmosphere-pop{from{transform:scale(0) rotate(-120deg)}}
@keyframes fx-atmosphere-twinkle{50%{transform:scale(.62) rotate(45deg)}}
@keyframes fx-atmosphere-turn{to{transform:rotate(360deg)}}

/* ---------- 3b. sheen crossing the dark panels ---------- */
.fx-atmosphere-sheen{position:absolute;top:-20%;left:0;width:44%;height:140%;
  background:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.045) 38%,rgba(255,255,255,.085) 50%,rgba(255,255,255,.045) 62%,rgba(255,255,255,0) 100%);
  transform:translate3d(-130%,0,0) skewX(-18deg)}
.fx-atmosphere-live .fx-atmosphere-sheen{animation:fx-atmosphere-sheen var(--fx-atmosphere-t,17s) cubic-bezier(.45,0,.25,1) infinite}
/* crosses in the first 60% of the loop, then the panel rests */
@keyframes fx-atmosphere-sheen{60%,100%{transform:translate3d(270%,0,0) skewX(-18deg)}}

/* ---------- small screens: less of everything ---------- */
@media (max-width:820px){
  .fx-atmosphere-glow:nth-child(1){left:-40vw;top:-10vh;width:130vw;height:60vh}
  .fx-atmosphere-glow:nth-child(2){right:-45vw;top:38vh;width:130vw;height:60vh}
  .fx-atmosphere-glow:nth-child(3){display:none}
  .fx-atmosphere-sheen{width:90%}
  .fx-atmosphere-mote{left:var(--fx-atmosphere-mx);top:var(--fx-atmosphere-my)}
  .fx-atmosphere-wide{display:none}
}
