/* =========================================================
   메인 모션 (참고: numi.framer.website 스타일의 스크롤 연동 효과)
   - JS(motion.js)가 html에 .has-motion 을 붙였을 때만 적용
   - prefers-reduced-motion 사용자는 적용 안 됨
   ========================================================= */

/* ---------- 1. 히어로: 로딩 시 줄 단위 마스크 등장 + 스크롤 시 밀려나며 어두워짐 ---------- */
.has-motion .hero__slides { will-change: transform; }
.hero__dim { position: absolute; inset: 0; background: #001426; opacity: 0; pointer-events: none; }
.line-mask { display: block; overflow: hidden; padding-bottom: .06em; }
.line-mask > span { display: block; transform: translateY(105%); transition: transform 1.1s cubic-bezier(.19,1,.22,1); }
.is-loaded .line-mask > span { transform: none; }
.is-loaded .line-mask:nth-child(2) > span { transition-delay: .12s; }
/* 히어로에서 움직이는 것은 배경 이미지 · 영문 소제목 · 제목만 (설명·버튼·컨트롤은 고정) */
.has-motion .hero__eyebrow { opacity: 0; transform: translateY(24px); transition: opacity 1s ease, transform 1s cubic-bezier(.19,1,.22,1); }
.is-loaded .hero__eyebrow { opacity: 1; transform: none; transition-delay: .1s; }
.has-motion .hero__eyebrow.is-scrolling, .has-motion .hero__title.is-scrolling { transition: none; }

/* ---------- 2. 단어가 차오르는 제목 (스크롤 진행에 따라 단어별 색 채움) ---------- */
.word-fill .w { color: #c9cccd; transition: color .25s linear; }
.word-fill .w.is-on { color: inherit; }
.word-fill { color: var(--text); }

/* ---------- 3. 수치: 줄 단위 순차 등장 ---------- */
.has-motion .facts__list li { opacity: 0; transform: translateX(-24px); transition: opacity .8s ease, transform .8s cubic-bezier(.19,1,.22,1); }
.has-motion .facts__list.is-in li { opacity: 1; transform: none; }
.facts__list.is-in li:nth-child(2) { transition-delay: .08s; }
.facts__list.is-in li:nth-child(3) { transition-delay: .16s; }
.facts__list.is-in li:nth-child(4) { transition-delay: .24s; }
.facts__list.is-in li:nth-child(5) { transition-delay: .32s; }

/* ---------- 4. 사진 슬라이더: 왼쪽부터 열리는 이미지 ---------- */
.has-motion .photo-slider__slide { clip-path: inset(0 100% 0 0); transition: clip-path 1.2s cubic-bezier(.77,0,.18,1); }
.has-motion .photo-slider.is-in .photo-slider__slide { clip-path: inset(0 0 0 0); }
.photo-slider.is-in .photo-slider__slide:nth-child(2) { transition-delay: .12s; }
.photo-slider.is-in .photo-slider__slide:nth-child(3) { transition-delay: .24s; }
.photo-slider.is-in .photo-slider__slide:nth-child(4) { transition-delay: .36s; }

/* ---------- 5. 공간 이미지: 스크롤 패럴랙스 (이미지가 프레임 안에서 천천히 이동) ---------- */
/* 공간감: 사진마다 깊이(data-depth)가 달라 스크롤 속도·그림자 크기가 다르고,
   마우스를 올리면 3D로 기울며 빛이 따라 움직임 */
.has-motion .space-img {
  --d: 1;
  position: relative;
  transform: perspective(1400px) translateY(var(--ly, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--sc, 1));
  box-shadow:
    0 calc(var(--d) * 50px + var(--lift, 0px)) calc(var(--d) * 90px + var(--lift, 0px) * 2) calc(var(--d) * -24px) rgba(0, 26, 46, .38),
    0 calc(var(--d) * 12px) calc(var(--d) * 28px) rgba(0, 26, 46, .12);
  transition: transform .9s cubic-bezier(.19,1,.22,1), box-shadow .6s ease, opacity .8s ease;
  will-change: transform;
}
.has-motion .space-img[data-depth=".55"] { --d: .55; }
.has-motion .space-img[data-depth=".8"] { --d: .8; }
.has-motion .space-img:not(.is-in) { --sc: .92; }
.has-motion .space-img.is-hover { --lift: 24px; --sc: 1.02; transition: transform .25s ease-out, box-shadow .4s ease; }
.has-motion .space-img::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.22), transparent 45%); opacity: 0; transition: opacity .4s; mix-blend-mode: soft-light; }
.has-motion .space-img.is-hover::after { opacity: 1; }
.has-motion .space-img img { transform: translateY(var(--py, 0px)) scale(var(--ps, 1.16)); transition: transform .9s cubic-bezier(.19,1,.22,1); }
.has-motion .space-img.is-hover img { --ps: 1.2; }
/* 글 블록은 사진보다 느리게 움직여 앞뒤 층이 생김 */
.has-motion .space-text { transform: translateY(var(--ty, 0px)); transition: transform .9s cubic-bezier(.19,1,.22,1), opacity .8s ease; }
@media (max-width: 767px) { .has-motion .space-img { --d: .5 !important; } }

/* ---------- 6. 영상 밴드: 화면에 들어오며 작은 카드에서 화면 가득 확장 ---------- */
.has-motion .video-band { clip-path: inset(var(--vb-y, 0%) var(--vb-x, 0%)); }
.has-motion .video-band .play-btn { transform: scale(var(--vb-s, 1)); }

/* ---------- 7. 갤러리: 기울어진 카드가 펼쳐지며 제자리로 ---------- */
.has-motion .g-card { transform: translateY(var(--gy, 0px)) rotate(var(--gr, 0deg)); transform-origin: 50% 100%; }
.has-motion .gallery__watermark { transform: translateX(var(--wx, 0px)); }

/* ---------- 8. 퀵메뉴: 순차 등장 ---------- */
.has-motion .quick__item { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s cubic-bezier(.19,1,.22,1); }
.has-motion .quick__list.is-in .quick__item { opacity: 1; transform: none; }
.quick__list.is-in .quick__item:nth-child(2) { transition-delay: .06s; }
.quick__list.is-in .quick__item:nth-child(3) { transition-delay: .12s; }
.quick__list.is-in .quick__item:nth-child(4) { transition-delay: .18s; }
.quick__list.is-in .quick__item:nth-child(5) { transition-delay: .24s; }
.quick__list.is-in .quick__item:nth-child(6) { transition-delay: .3s; }


@media (prefers-reduced-motion: reduce) {
  .line-mask > span { transform: none !important; }
}

/* ---------- 10. 히어로 핀 장면 (참고: hwacheon.com) ---------- */
.has-motion .hero-pin { position: relative; height: 260vh; height: 260svh; background: radial-gradient(ellipse at center, #fff 0%, #f2f1ed 55%, #e6e4de 100%); }
.has-motion .hero-pin__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.has-motion .hero-pin .hero { position: absolute; inset: 0; height: 100%; transform-origin: 50% 50%; will-change: transform; box-shadow: 0 40px 80px -30px rgba(0, 26, 46, .45); }
.hero-pin__scatter { position: absolute; inset: 0; pointer-events: none; }
.scatter {
  --t: 0;
  position: absolute; left: 50%; top: 50%; width: var(--w); aspect-ratio: 1 / var(--ar); overflow: hidden;
  transform: translate(-50%, -50%) translate(calc(var(--x) * 1vw * var(--t)), calc(var(--y) * 1vh * var(--t))) scale(calc(.35 + var(--t) * .65));
  opacity: var(--t);
  box-shadow: 0 24px 48px -16px rgba(0, 26, 46, .35);
}
.scatter img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 767px) {
  .has-motion .hero-pin { height: 220vh; height: 220svh; }
  .scatter { width: calc(var(--w) * 2.2); }
}

/* ---------- 11. 관성 스크롤 (Lenis) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* 장면 중앙 타이틀 (카드 아래) */
.hero-pin__title {
  --tt: 0;
  position: absolute; left: 50%; top: calc(50% + 13vh); z-index: 2; width: min(90vw, 900px);
  transform: translateX(-50%);
  text-align: center; font-size: 38px; font-weight: 500; line-height: 1.4; letter-spacing: -.02em; color: var(--text);
  opacity: 0; pointer-events: none;
}
.hero-pin__title .line-mask > span { transform: translateY(calc((1 - var(--tt)) * 105%)); transition: none; }
.hero-pin__title .line-mask:nth-child(2) > span { transform: translateY(calc((1 - var(--tt)) * 140%)); }
@media (max-width: 1023px) { .hero-pin__title { font-size: 28px; } }
@media (max-width: 767px) { .hero-pin__title { font-size: 20px; top: calc(50% + 17vh); } }
/* 장면 타이틀 위 영문 소제목 */
.hero-pin__eyebrow { margin-bottom: 10px; font-family: var(--font-en); font-weight: 600; font-size: 20px; letter-spacing: .06em; color: var(--blue); }
.hero-pin__title .line-mask:nth-child(3) > span { transform: translateY(calc((1 - var(--tt)) * 175%)); }
@media (max-width: 767px) { .hero-pin__eyebrow { font-size: 14px; margin-bottom: 6px; } }

/* ---------- 12. 장면 배경 (화천 참고): 물결 링 캔버스 · 거대 배경 글자(흰색) ---------- */
.hero-pin__ripple { position: absolute; inset: 0; width: 100%; height: 100%; filter: grayscale(1); }
.hero-pin__bgtext {
  --bx: 40vw;
  position: absolute; left: 0; top: 50%; white-space: nowrap; pointer-events: none;
  transform: translate(var(--bx), -50%);
  font-family: var(--font-en); font-weight: 600; font-size: 18vw; line-height: 1; letter-spacing: -.02em;
  color: #fff;
  opacity: 0;
}
@media (max-width: 767px) { .hero-pin__bgtext { font-size: 30vw; } }
