/* ==========================================================================
   MindMarket 인터랙션 애니메이션 연습 — 디자인 토큰
   ========================================================================== */
:root {
  --color-beige-300: #f6f1e5;
  --color-beige-400: #efe6d3;
  --color-ink: #1e1a16;
  --color-accent: #e8501e;
  --color-yellow: #f0b429;
  --color-green: #7aa05c;
  --radius-lg: 32px;
  --reveal-delay: 0s;
  --reveal-translate-x: 0px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; } /* 스무스 스크롤은 Lenis가 담당 */

body {
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", sans-serif;
  background: var(--color-beige-300);
  color: var(--color-ink);
  overflow-x: hidden;
}

/* ==========================================================================
   1. 프리로더 — JS(GSAP)가 페이드/드로잉을 모두 제어
   ========================================================================== */
.c-preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--color-beige-300);
}
.c-preloader_svg-wrap { opacity: 0; }
.c-preloader_svg { width: 200px; }
/* 프리로더 종료 후(html.is-first-loaded) 오버레이 제거 */
.is-first-loaded .c-preloader { display: none; }

/* ==========================================================================
   2. 등장(reveal) 시스템 — 원본의 data-reveal / --reveal-delay 패턴
   IntersectionObserver가 .is-revealed를 붙이면 CSS 전환으로 등장
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translate(var(--reveal-translate-x), 30px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: translate(0, 0);
}

/* ==========================================================================
   3. 헤더 + 히어로
   ========================================================================== */
.c-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(20px, 5vw, 64px);
}
.c-header_logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-ink);
  text-decoration: none;
}
.c-header_nav { display: flex; gap: 28px; }
.c-header_nav a {
  color: var(--color-ink);
  text-decoration: none;
  font-weight: 600;
  position: relative;
}
.c-header_nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -4px;
  height: 2px;
  background: var(--color-accent);
  transition: right 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.c-header_nav a:hover::after { right: 0; }

.c-button {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--color-ink);
  color: var(--color-beige-300);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s;
}
.c-button:hover { transform: scale(1.06) rotate(-1.5deg); background: var(--color-accent); }
.c-button--lg { padding: 16px 32px; font-size: 18px; }

.c-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 32px;
  min-height: 78vh;
  padding: 24px clamp(20px, 5vw, 64px) 80px;
}
.c-hero_title {
  font-size: clamp(48px, 8vw, 104px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.c-hero_title_line { display: block; }
.c-hero_title_dot { color: var(--color-accent); }
.c-hero_sub {
  margin: 24px 0 32px;
  font-size: 18px;
  line-height: 1.6;
  max-width: 46ch;
  color: #5b5248;
}
.c-hero_illustration { position: relative; }
.c-hero_canvas { width: 100%; aspect-ratio: 4 / 3; }
.c-hero_fallback { display: none; width: 100%; }
.c-hero_illustration.is-rive-failed .c-hero_canvas { display: none; }
.c-hero_illustration.is-rive-failed .c-hero_fallback { display: block; }

/* ==========================================================================
   4. 스크롤 타임라인 — 원본 c-homepage-timeline 오마주
   ========================================================================== */
.c-timeline {
  position: relative;
  background: var(--color-beige-400);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 96px 0 0;
  overflow: hidden;
}
.c-timeline_intro {
  text-align: center;
  padding: 0 24px 48px;
  position: relative;
  z-index: 5;
}
.c-timeline_kicker {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  margin-bottom: 12px;
}
.c-timeline_title {
  font-size: clamp(32px, 5vw, 56px);
  letter-spacing: -0.02em;
}

/* 경로 SVG: 정거장 목록 전체 높이를 덮도록 절대 배치 */
.c-timeline_path {
  position: absolute;
  top: 240px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 1100px);
  height: calc(100% - 560px);
  z-index: 1;
  pointer-events: none;
}

.c-timeline_plane {
  position: absolute;
  top: 0; left: 0;
  z-index: 4;
  pointer-events: none;
  will-change: transform;
}

/* 떠다니는 장식 — 원본의 --progress 보간 공식을 그대로 재현:
   진행도 0→1에 따라 start 값과 end 값 사이를 선형 보간 */
.c-floater {
  --progress: 0;
  position: absolute;
  z-index: 2;
  pointer-events: none;
  transform:
    translate(
      calc(var(--tx-start) + (var(--tx-end) - var(--tx-start)) * var(--progress)),
      calc(var(--ty-start) + (var(--ty-end) - var(--ty-start)) * var(--progress))
    )
    rotate(calc(var(--rot-start) + (var(--rot-end) - var(--rot-start)) * var(--progress)));
}

.c-timeline_stops {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: clamp(280px, 45vh, 480px);
  padding: 120px clamp(20px, 8vw, 120px) 320px;
  max-width: 1100px;
  margin: 0 auto;
}
.c-stop {
  max-width: 380px;
  background: var(--color-beige-300);
  border-radius: 24px;
  padding: 24px 28px 28px;
  box-shadow: 0 12px 40px #00000012;
}
.c-stop--right { align-self: flex-end; }
.c-stop_figure { margin: -70px 0 8px; }
.c-stop h3 { font-size: 22px; margin-bottom: 8px; }
.c-stop p { line-height: 1.6; color: #5b5248; }

/* 타임라인 엔딩: 언덕 + 해 + 구름 */
.c-timeline_end {
  position: relative;
  z-index: 3;
  margin-top: -80px;
}
.c-timeline_end_svg { display: block; width: 100%; height: 340px; }
.c-timeline_end_caption {
  position: absolute;
  bottom: 40px;
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-beige-300);
}

.c-footer {
  background: var(--color-ink);
  color: var(--color-beige-300);
  text-align: center;
  padding: 32px 24px;
  font-size: 14px;
}

/* ==========================================================================
   반응형 + 접근성
   ========================================================================== */
@media (max-width: 900px) {
  .c-header_nav { display: none; }
  .c-hero { grid-template-columns: 1fr; min-height: auto; }
  .c-stop { max-width: 100%; }
  .c-stop--right { align-self: stretch; }
}

/* 원본과 동일하게 prefers-reduced-motion이면 모든 연출을 정적 상태로 */
@media (prefers-reduced-motion: reduce) {
  .c-preloader { display: none; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .c-floater { transform: none; }
}
