/* 농장 지도 움직임 — farm-map-motion.js 가 body 에 fmm(움직여도 됨) · fmm-in(처음 여는 중) 을 붙이고 뗀다.
   지연은 calc(… + var(--fmm-t)) — 처음 여는 도중에 다시 그려지면 지난 시간만큼 앞당겨 이어서.
   ① 길이 그어지고 건물이 위에서부터 차례로 내려앉음  ② 숫자 0 에서 올라감(JS) · 빈 방 게이지 차오름 · 위 숫자 칸 톡
   ③ 확인할 방에서 물결 한 번 · 위 알약 톡  ④ 고른 방 테두리 + 물결 · 상세 줄 차례로  ⑤ 스타일을 바꾸면 흐림에서 또렷하게
   ⑥ 길 위 작은 점이 천천히 오감 (계속). 움직임 줄이기면 fmm 이 붙지 않는다. */
body { --fmm-ease: cubic-bezier(.22, 1, .36, 1); --fmm-spring: cubic-bezier(.34, 1.56, .64, 1); }

/* ① 길 · 건물 */
body.fmm.fmm-in #map .fmm-road { stroke-dasharray: 0 100; animation: fmm-road 1.1s cubic-bezier(.5, 0, .3, 1) both; animation-delay: calc(.1s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #map .fmm-roadline { animation: fmm-fade .5s ease-out both; animation-delay: calc(1s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #map .fmm-b { animation: fmm-drop .5s var(--fmm-spring) both; animation-delay: calc(.35s + var(--i, 0) * .07s + var(--fmm-t, 0s)); }
/* ② 빈 방 게이지 */
body.fmm.fmm-in #map .fmm-fill-v { animation: fmm-fill-v .9s var(--fmm-ease) both; animation-delay: calc(.8s + var(--i, 0) * .07s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #map .fmm-fill-h { animation: fmm-fill-h .9s var(--fmm-ease) both; animation-delay: calc(.8s + var(--i, 0) * .07s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #stats .stat { animation: fmm-pop .5s var(--fmm-spring) both; }
body.fmm.fmm-in #stats .stat:nth-child(2) { animation-delay: calc(.08s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #stats .stat:nth-child(3) { animation-delay: calc(.16s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #stats .stat:nth-child(4) { animation-delay: calc(.24s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #stats .stat:nth-child(5) { animation-delay: calc(.32s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #stats .stat:nth-child(6) { animation-delay: calc(.4s + var(--fmm-t, 0s)); }
/* ③ 확인할 방 */
#map .fmm-ping { fill: none; stroke-width: 3px; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0; }
#map .fmm-ping.stale { stroke: var(--warn); } #map .fmm-ping.death { stroke: var(--bad); } #map .fmm-ping.age { stroke: var(--info); }
body.fmm.fmm-in #map .fmm-ping { animation: fmm-ping 1.1s ease-out both; animation-delay: calc(1.6s + var(--fmm-t, 0s)); }
body.fmm.fmm-in #attbar > * { animation: fmm-pop .45s var(--fmm-spring) both; animation-delay: calc(.3s + var(--i, 0) * .06s + var(--fmm-t, 0s)); }
/* ④ 고른 방 */
#map .fmm-pick { fill: none; stroke: var(--accent); stroke-width: 3px; vector-effect: non-scaling-stroke; pointer-events: none; }
#map .fmm-ripple { fill: none; stroke: var(--accent); stroke-width: 3px; vector-effect: non-scaling-stroke; pointer-events: none; animation: fmm-wave .8s ease-out both; }
#detail.fmm-dt > * { animation: fmm-row .4s var(--fmm-ease) both; animation-delay: calc(var(--n, 0) * 45ms); }
/* ⑤ 스타일 바꿈 */
#mapBox.fmm-swap #map { animation: fmm-swap .45s ease-out both; }
/* ⑥ 길 위 점 */
#map .fmm-pig { fill: var(--accent); opacity: .75; pointer-events: none; }
body:not(.fmm) #map #fmmPigs { display: none; }
body.fmm.fmm-in #map #fmmPigs { animation: fmm-fade .6s ease-out both; animation-delay: calc(1.4s + var(--fmm-t, 0s)); }

@keyframes fmm-road { from { stroke-dasharray: 0 100; } to { stroke-dasharray: 100 0; } }
@keyframes fmm-fade { from { opacity: 0; } }
@keyframes fmm-drop { from { opacity: 0; translate: 0 -14px; } to { opacity: 1; translate: 0 0; } }
@keyframes fmm-fill-v { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes fmm-fill-h { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes fmm-pop { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes fmm-ping { 0% { opacity: .9; stroke-width: 3px; } 100% { opacity: 0; stroke-width: 24px; } }
@keyframes fmm-wave { from { opacity: .9; stroke-width: 3px; } to { opacity: 0; stroke-width: 22px; } }
@keyframes fmm-row { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes fmm-swap { from { opacity: .2; filter: blur(4px); } to { opacity: 1; filter: none; } }

@media (prefers-reduced-motion: reduce) {
  #map .fmm-road, #map .fmm-roadline, #map .fmm-b, #map .fmm-fill-v, #map .fmm-fill-h, #stats .stat, #attbar > *, #detail > *, #mapBox #map { animation: none !important; }
  #map #fmmPigs, #map .fmm-ripple { display: none; }
}
@media print { #map #fmmPigs, #map .fmm-pick, #map .fmm-ripple { display: none; } }
