/* Station glyphs (glyphs.js). The parent element gets class "inked" when the pen arrives: each stroke draws on,
   dots fade in, then a few glyphs keep one quiet motion. Parent class "sg-rest" shows a glyph drawn and at rest,
   as reduced motion does. Tunables on any ancestor: --sg-w (stroke width in glyph units), --sg-accent. */
.sg{fill:none;stroke:currentColor;stroke-width:var(--sg-w,1.6);stroke-linecap:round;stroke-linejoin:round}
.sg-fit{stroke-width:calc(var(--sg-w,1.6) * 1px / var(--sg-k,1))}
.sg .a{stroke:var(--sg-accent,var(--route,#A34E1B))}
.sg .d{fill:currentColor;stroke:none;opacity:0}
.sg .d.a{fill:var(--sg-accent,var(--route,#A34E1B))}
.sg .s{stroke-dasharray:1 1;stroke-dashoffset:1;opacity:0}
.sg-flow{stroke-dasharray:.07 .18;opacity:0}

.inked .sg .s{animation:sg-ink 520ms cubic-bezier(.25,.1,.25,1) calc(var(--i,0) * 70ms) forwards}
.inked .sg .d{animation:sg-fade 260ms ease-out calc(var(--i,0) * 70ms + 300ms) forwards}
@keyframes sg-ink{from{stroke-dashoffset:1;opacity:1}to{stroke-dashoffset:0;opacity:1}}
@keyframes sg-fade{to{opacity:1}}

/* the stream: flecks of current move along the middle line, slowly, for as long as it is on screen */
.inked .sg-flow{animation:sg-fade 600ms ease 640ms forwards,sg-flow 5.2s linear 640ms infinite}
@keyframes sg-flow{from{stroke-dashoffset:0}to{stroke-dashoffset:-.25}}

/* the hindrances: once drawn, they drift outward once and stay faint */
.sg-drift{opacity:1}
.inked .sg-drift{animation:sg-drift 2400ms cubic-bezier(.25,.1,.25,1) 900ms forwards}
@keyframes sg-drift{to{transform:translate(var(--dx,0),var(--dy,0));opacity:var(--o,.3)}}

/* nibbāna: the flame is drawn, stays a moment, goes out once; the lamp stays */
.inked .sg-flame{animation:sg-out 1600ms ease-in-out 1500ms forwards}
@keyframes sg-out{to{opacity:0}}

.sg-rest .sg .s,.sg-rest .sg .d,.sg-rest .sg-flow{animation:none;stroke-dashoffset:0;opacity:1}
.sg-rest .sg .s{stroke-dasharray:none}
.sg-rest .sg-drift{animation:none;transform:translate(var(--dx,0),var(--dy,0));opacity:var(--o,.3)}
.sg-rest .sg-flame{animation:none;opacity:0}
@media (prefers-reduced-motion: reduce){
  .sg .s,.sg .d,.sg-flow{animation:none!important;stroke-dashoffset:0;opacity:1}
  .sg .s{stroke-dasharray:none}
  .sg-drift{animation:none!important;transform:translate(var(--dx,0),var(--dy,0));opacity:var(--o,.3)}
  .sg-flame{animation:none!important;opacity:0}
}
