/* ==========================================================================
   SW MOTION - styles for /js/sw-motion.js (docs/sw-motion.md). Theme-neutral.
   html.sw-motion is rendered by _LayoutAI.cshtml for visitors only (never in
   the admin editor), so editors always see every element. Comments: ASCII only.
   ========================================================================== */

/* -- tokens a theme may override -- */
:root{
  --sw-ease-out:cubic-bezier(.16,1,.3,1);
  --sw-ease-expo:cubic-bezier(.19,1,.22,1);
  --sw-ease-back:cubic-bezier(.34,1.56,.64,1);
  --sw-hl:currentColor;              /* highlight sweep colour */
  --sw-stack-top:96px;               /* sticky offset of stacked cards */
  --sw-stack-gap:16px;               /* each next card sits this much lower */
  --sw-transition-bg:#0B0B12;        /* page transition overlay */
  --sw-progress-bg:currentColor;
}

@media (prefers-reduced-motion:no-preference){
  /* -- hidden until the element enters the view -- */
  html.sw-motion [data-sw-motion]:not([data-sw-motion-stagger]):not(.sw-motion-in),
  html.sw-motion [data-sw-motion][data-sw-motion-stagger]:not(.sw-motion-in)>*{opacity:0}
  /* failsafe: if sw-motion.js never runs, show everything after 3.5 s */
  html.sw-motion:not(.sw-motion-ready) [data-sw-motion]:not([data-sw-motion-stagger]),
  html.sw-motion:not(.sw-motion-ready) [data-sw-motion][data-sw-motion-stagger]>*{animation:sw-motion-failsafe .01s linear 3.5s forwards}
  @keyframes sw-motion-failsafe{to{opacity:1}}

  /* -- stacking cards (data-sw-scroll="stack") -- */
  html.sw-motion .sw-stack-on>*{position:sticky;top:calc(var(--sw-stack-top) + var(--sw-i,0) * var(--sw-stack-gap));transform-origin:50% 0;will-change:transform}

  /* -- gestures (pure CSS ones; magnetic/tilt are driven by JS) -- */
  html.sw-motion [data-sw-hover="lift"]{transition:transform .6s var(--sw-ease-out),box-shadow .6s var(--sw-ease-out)}
  html.sw-motion [data-sw-hover="lift"]:hover{transform:translate3d(0,-8px,0)}
  html.sw-motion [data-sw-hover="lift"]:active{transform:translate3d(0,-3px,0) scale(.985);transition-duration:.15s}
  html.sw-motion [data-sw-hover="scale"]{transition:transform .5s var(--sw-ease-back)}
  html.sw-motion [data-sw-hover="scale"]:hover{transform:scale(1.04)}
  html.sw-motion [data-sw-hover="scale"]:active,
  html.sw-motion [data-sw-hover="press"]:active{transform:scale(.95);transition-duration:.12s}
  html.sw-motion [data-sw-hover="press"]{transition:transform .35s var(--sw-ease-back)}
  html.sw-motion [data-sw-hover="shine"]{position:relative;overflow:hidden;isolation:isolate}
  html.sw-motion [data-sw-hover="shine"]::after{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;transform:translateX(-120%) skewX(-18deg);background:linear-gradient(90deg,transparent,rgba(255,255,255,.28),transparent)}
  html.sw-motion [data-sw-hover="shine"]:hover::after{transform:translateX(120%) skewX(-18deg);transition:transform .9s var(--sw-ease-out)}
  html.sw-motion [data-sw-hover="underline"]{text-decoration:none;background:linear-gradient(currentColor,currentColor) no-repeat 100% 100%/0% 1px;transition:background-size .5s var(--sw-ease-out)}
  html.sw-motion [data-sw-hover="underline"]:hover{background-position:0% 100%;background-size:100% 1px}
  html.sw-motion [data-sw-hover="magnetic"],html.sw-motion [data-sw-hover="tilt"]{will-change:transform}

  /* -- page transition overlay + progress bar -- */
  .sw-transition{position:fixed;inset:0;z-index:2147483000;pointer-events:none;background:var(--sw-transition-bg)}
  .sw-progress-bar{position:fixed;left:0;top:0;z-index:2147482000;width:100%;height:3px;transform-origin:0 50%;transform:scaleX(0);background:var(--sw-progress-bg);pointer-events:none}
}

/* -- text splitting (only exists after sw-motion.js ran) -- */
.sw-m-mask{display:inline-block;overflow:hidden;vertical-align:top;padding:0 .06em .16em;margin:0 -.06em -.16em}
.sw-m-word,.sw-m-char{display:inline-block;white-space:pre}
.sw-m-char{transform-origin:50% 100%;backface-visibility:hidden}

/* -- highlight: <em>/<mark>/<strong> inside get an underline that sweeps in -- */
.sw-m-hl :is(em,mark,strong,b){background:linear-gradient(var(--sw-hl),var(--sw-hl)) no-repeat 0 92%/0% .14em;transition:background-size 1.1s var(--sw-ease-expo)}
.sw-m-hl.sw-m-hl-on :is(em,mark,strong,b){background-size:100% .14em}
mark.sw-m-hl,.sw-m-hl mark{color:inherit;background-color:transparent}

/* -- typewriter caret -- */
.sw-m-caret::after{content:"";display:inline-block;width:.08em;height:1em;margin-left:.06em;vertical-align:-.12em;background:currentColor;animation:sw-caret 1s steps(1) infinite}
@keyframes sw-caret{50%{opacity:0}}
