/* motion.css — 공통 움직임 (설계 1-1).
   숨기는 상태는 모두 html.mo 아래에서만 건다 → 움직임 줄이기를 켠 사람은 처음부터 다 보인다.
   움직이는 속성은 opacity · translate · scale · rotate · clip-path · stroke-dashoffset 뿐.
   (translate/scale 낱 속성을 써서, 원래 transform(기울기 등)과 겹쳐도 지워지지 않게) */
:root{
  --t-fast:160ms; --t-mid:320ms; --t-slow:640ms; --t-draw:900ms;
  --ease:cubic-bezier(.16,1,.3,1);
  --ease-soft:cubic-bezier(.22,.61,.36,1);
  --ease-pop:cubic-bezier(.34,1.56,.64,1);
  --mo-step:80ms;
}

/* 나타나기 4가지 */
html.mo [data-mo]{opacity:0;transition:opacity var(--t-slow) var(--ease),translate var(--t-slow) var(--ease),scale 480ms var(--ease-pop),clip-path var(--t-draw) var(--ease);transition-delay:calc(var(--i,0) * var(--mo-step) + var(--d,0ms))}
html.mo [data-mo="up"]{translate:0 18px}
html.mo [data-mo="pop"]{scale:.94}
html.mo [data-mo="wipe"]{opacity:1;clip-path:inset(-60px 100% -60px -60px)}
html.mo [data-mo="draw"]{opacity:1}
html.mo [data-mo].in{opacity:1;translate:none;scale:none}
html.mo [data-mo="wipe"].in{clip-path:inset(-60px)} /* 그림자가 잘리지 않게 바깥까지 */
/* 묶음: 부모가 보이면 자식이 --i 차례대로 */
html.mo [data-mo-group]>*{opacity:0;translate:0 16px;transition:opacity var(--t-slow) var(--ease),translate var(--t-slow) var(--ease),scale 480ms var(--ease-pop);transition-delay:calc(var(--i,0) * var(--mo-step) + var(--d,0ms))}
html.mo [data-mo-group="pop"]>*{translate:none;scale:.8}
html.mo [data-mo-group].in>*{opacity:1;translate:none;scale:none}

/* 선 그리기: path·rect·circle 에 pathLength="1" */
html.mo .mo-draw *{stroke-dasharray:1 1;stroke-dashoffset:1;transition:stroke-dashoffset var(--t-draw) var(--ease);transition-delay:calc(var(--i,0) * 150ms + var(--d,0ms))}
html.mo .in .mo-draw *,html.mo .mo-draw.in *{stroke-dashoffset:0}

/* 계속 도는 것: [data-live].is-live 안에서만 돎 (화면 밖·가린 탭에서는 멈춤) */
html.mo .mo-loop{animation-play-state:paused}
html.mo .is-live .mo-loop,html.mo .mo-loop.is-live{animation-play-state:running}

/* 구름 띠 (CSS 그림). 부모가 position 을 가져야 함. --cl 로 투명도, --cs 로 한 바퀴 시간, --cc 로 색(기본 흰색) */
.mo-cloud{position:absolute;left:0;width:200%;height:var(--ch,90px);pointer-events:none;opacity:var(--cl,.85);
  background:
    radial-gradient(closest-side,var(--cc,#fff) 62%,rgba(255,255,255,0)) 2% 62%/16% 70% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 9% 30%/12% 80% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 17% 66%/18% 64% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 62%,rgba(255,255,255,0)) 30% 56%/14% 72% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 38% 26%/10% 70% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 52% 62%/16% 70% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 59% 30%/12% 80% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 67% 66%/18% 64% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 62%,rgba(255,255,255,0)) 80% 56%/14% 72% no-repeat,
    radial-gradient(closest-side,var(--cc,#fff) 60%,rgba(255,255,255,0)) 88% 26%/10% 70% no-repeat}
html.mo .mo-cloud{will-change:transform;animation:mo-drift var(--cs,60s) linear infinite}
@keyframes mo-drift{to{transform:translateX(-50%)}}

/* 떠다니는 무지개 빛 (흐림은 이 한 곳에만) */
.mo-rainbow{position:absolute;left:-20%;width:140%;height:var(--rh,34%);pointer-events:none;opacity:.16;mix-blend-mode:screen;filter:blur(40px);
  background:linear-gradient(90deg,#F28B82,#F6B38F,#F3D27A,#9ED39A,#8EC5E8,#A8A4E6)}
html.mo .mo-rainbow{animation:mo-sway 18s var(--ease-soft) infinite alternate}
@keyframes mo-sway{from{transform:translateX(-10%)}to{transform:translateX(10%)}}

/* 사진 알갱이 (움직이지 않음) */
.mo-grain{position:relative}
.mo-grain::after{content:"";position:absolute;inset:0;pointer-events:none;opacity:.07;mix-blend-mode:multiply;border-radius:inherit;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E")}

/* 한 번 콩 (이름 적을 때 미리보기 제목 등) */
html.mo .mo-bump{animation:mo-bump 180ms var(--ease-soft)}
@keyframes mo-bump{50%{scale:1.04}}

/* 움직임 줄이기: 혹시 html.mo 가 붙었어도 숨긴 것은 모두 보이게 */
@media (prefers-reduced-motion:reduce){
  html.mo [data-mo],html.mo [data-mo-group]>*{opacity:1!important;translate:none!important;scale:none!important;clip-path:none!important}
  html.mo .mo-draw *{stroke-dashoffset:0!important}
}
