/* 파일핏 소개 첫 화면의 움직임 — 이 페이지(filefit/index.html)만 싣는다. 정책 페이지는 styles.css 만 쓴다.
   오른쪽 그림이 9초에 한 번 돈다: 큰 사진이 들어오고 → 「500 KB」 조건이 붙고 → 사진과 용량 막대가 함께 줄어
   모서리 틀 안에 맞춰지면 → 확인 표시가 선다. 스크립트 없이 CSS 로만 움직인다. */
:root:has(> body.motion), .motion { overflow-x: clip; }

/* ── 첫 화면 글: 차례로 떠오른다 ── */
.motion .hero { position: relative; isolation: isolate; }
.motion .hero h1 .line { display: block; overflow: hidden; padding-bottom: .06em; }
.motion .hero h1 .line > span { display: inline-block; animation: filefit-rise .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.12s + var(--l) * .14s); }
.motion .hero .eyebrow, .motion .hero-copy, .motion .hero .actions, .motion .hero .age-note { animation: filefit-fade .8s ease both; }
.motion .hero-copy { animation-delay: .45s; }
.motion .hero .actions { animation-delay: .6s; }
.motion .hero .age-note { animation-delay: .75s; }
@keyframes filefit-rise { from { transform: translateY(105%); } }
@keyframes filefit-fade { from { opacity: 0; transform: translateY(14px); } }

/* 첫 화면 뒤에서 앱의 라임빛이 천천히 떠다닌다 */
.motion .hero::before {
  content: ""; position: absolute; z-index: -1; inset: 6% -8% auto auto; width: 32rem; height: 32rem; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, #d5ef83 55%, transparent), transparent);
  animation: filefit-drift 14s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes filefit-drift { to { translate: -6rem 3rem; scale: 1.15; } }

/* ── 사진 맞추기 (9초) ──
   0~0.5초 큰 사진이 들어온다 · 1.1~1.6초 「500 KB」 조건 · 1.8~4초 사진과 용량 막대가 줄어든다
   · 4.2초 모서리 틀이 딱 맞물린다 · 4.6초 확인 표시 · 8.1초부터 비우고 다음 사진.
   멈춰 있을 때는 맞춰진 사진·조건·확인 표시가 다 서 있다 */
.filefit-fit { --fit: 9s; }
.filefit-fit svg g, .filefit-fit .filefit-frame, .filefit-fit .filefit-gauge { transform-box: fill-box; transform-origin: center; }
.filefit-fit .filefit-gauge { transform-origin: left center; scale: .68 1; }
.motion .filefit-fit { animation: filefit-float 6s ease-in-out infinite alternate; }
@keyframes filefit-float { to { translate: 0 -8px; } }

.motion .filefit-photo { animation: filefit-photo var(--fit) cubic-bezier(.5, 0, .2, 1) infinite; }
@keyframes filefit-photo {
  0% { opacity: 0; scale: 1.34; translate: 0 -10px; }
  6%, 20% { opacity: 1; scale: 1.34; translate: 0 0; }
  45%, 90% { opacity: 1; scale: 1; translate: 0 0; }
  96%, 100% { opacity: 0; scale: 1; translate: 0 0; }
}
.motion .filefit-chip { animation: filefit-chip var(--fit) ease infinite; }
@keyframes filefit-chip {
  0%, 12% { opacity: 0; translate: -14px 0; }
  18%, 90% { opacity: 1; translate: 0 0; }
  96%, 100% { opacity: 0; translate: 0 0; }
}
/* 용량 막대: 가득 찬 진한 막대가 사진과 함께 줄어 상한 아래에서 멈춘다 */
.motion .filefit-gauge { animation: filefit-gauge var(--fit) cubic-bezier(.5, 0, .2, 1) infinite; }
@keyframes filefit-gauge {
  0%, 20% { scale: 1 1; fill: var(--ink); }
  45%, 100% { scale: .68 1; fill: var(--accent); }
}
.motion .filefit-frame { animation: filefit-frame var(--fit) ease infinite; }
@keyframes filefit-frame {
  0%, 44% { scale: 1; stroke: #8fa06f; }
  47.5% { scale: .965; stroke: var(--accent); }
  52%, 88% { scale: 1; stroke: var(--accent); }
  94%, 100% { scale: 1; stroke: #8fa06f; }
}
.motion .filefit-check { animation: filefit-check var(--fit) ease infinite; }
@keyframes filefit-check {
  0%, 50% { opacity: 0; scale: 0; }
  55% { opacity: 1; scale: 1.15; }
  58%, 90% { opacity: 1; scale: 1; }
  96%, 100% { opacity: 0; scale: 1; }
}
.motion .filefit-back { animation: filefit-sway 5s ease-in-out infinite alternate; }
@keyframes filefit-sway { from { rotate: -1.5deg; } to { rotate: 2deg; translate: 3px -2px; } }

/* ── 세 단계: 차례로 불이 들어온다 ── */
.motion #how-it-works .step { --slot: 2.4s; position: relative; overflow: hidden; animation: filefit-step calc(var(--slot) * 3) ease infinite; animation-delay: calc(var(--i) * var(--slot)); }
.motion #how-it-works .step::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent);
  transform-origin: left; transform: scaleX(0); animation: filefit-bar calc(var(--slot) * 3) linear infinite; animation-delay: calc(var(--i) * var(--slot));
}
@keyframes filefit-step { 0%, 33% { border-color: var(--accent); box-shadow: .3rem .35rem 0 var(--wash); } 40%, 100% { border-color: var(--line); box-shadow: none; } }
@keyframes filefit-bar { 0% { transform: scaleX(0); } 33% { transform: scaleX(1); opacity: 1; } 38%, 100% { transform: scaleX(1); opacity: 0; } }

/* ── 아래 구역은 화면에 들어올 때 떠오른다 (스크롤 타임라인을 아는 브라우저만) ── */
@supports (animation-timeline: view()) {
  .motion .section, .motion .local-note { animation: filefit-fade linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
}

@media (max-width: 700px) {
  .motion .hero::before { width: 22rem; height: 22rem; inset: auto -30% 0 auto; }
}

/* 동작 줄이기 — 모두 멈추고 맞춰진 장면이 선다 */
@media (prefers-reduced-motion: reduce) {
  .motion *, .motion *::before, .motion *::after { animation: none !important; }
}
