/* 3초 여행 — 움직임 효과.
 * Aurora, Shimmer Button, Border Beam, Marquee, Blur Fade, Focus Cards,
 * Bento Grid, Tracing Beam, Stepper, Glare Card 등을 참고해 직접 만들었다.
 *
 * 움직임 원칙 — 난잡해지지 않게 지킨다.
 *  1. 계속 움직이는 것은 홈 대표 영역과 도시 이름 띠, 만드는 중 화면뿐이다.
 *  2. 나머지는 화면이 열리거나 누르거나 스크롤할 때 한 번만 움직인다.
 *  3. 강조색은 흑연색 위 하늘빛(--c-blue) 하나만 쓴다.  (혼잡도 같은 상태 표시는 예외)
 *  4. 움직임을 줄이는 기기 설정에서는 모두 멈춘다.
 */

/* ===== 히어로: 오로라 배경 ===== */
.hero-aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  will-change: transform;
}
.hero-aurora.a1 {
  width: 320px; height: 320px;
  right: -90px; top: -120px;
  background: #3A6EA5;
  opacity: .62;
  animation: aurora-a 14s ease-in-out infinite alternate;
}
.hero-aurora.a2 {
  width: 280px; height: 280px;
  right: 60px; bottom: -170px;
  background: #2A3A4D;
  opacity: .7;
  animation: aurora-b 18s ease-in-out infinite alternate;
}
@keyframes aurora-a { to { transform: translate3d(-70px, 46px, 0) scale(1.14); } }
@keyframes aurora-b { to { transform: translate3d(70px, -40px, 0) scale(.9); } }

/* ===== 히어로: 비행 경로 ===== */
.hero-route { position: absolute; right: 0; bottom: 0; width: 150px; height: 210px; }
.hero-route-line {
  stroke: rgba(220,232,245,.4);
  stroke-width: 1.5;
  stroke-dasharray: 3 7;
  stroke-linecap: round;
}
.hero-route-pin { fill: #DCE8F5; }
.hero-route-start { fill: none; stroke: #DCE8F5; stroke-width: 1.8; }
.hero-route-dot {
  fill: #DCE8F5;
  offset-path: path("M10 188 C80 188 136 130 124 16");
  animation: route-fly 7s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes route-fly {
  0%   { offset-distance: 0%;   opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

@media (min-width: 768px) {
  .hero-route { right: 4%; width: 240px; height: 336px; bottom: -24px; }
  .hero-aurora.a1 { width: 460px; height: 460px; }
  .hero-aurora.a2 { width: 400px; height: 400px; right: 220px; }
}

/* ===== 히어로: 제목이 또렷해지며 등장 ===== */
.hero-title span {
  display: inline-block;
  animation: blur-rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
.hero-title span:nth-of-type(2) { animation-delay: .12s; }
.hero-sub { animation: blur-rise .7s .24s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes blur-rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ===== 히어로 버튼: 빛이 지나가는 효과 ===== */
.hero-cta::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(58,110,165,.24), transparent);
  transform: skewX(-16deg);
  animation: cta-shine 1.2s .9s ease-in-out both;
}
@keyframes cta-shine { to { left: 130%; } }

/* ===== 검색창: 입력 중 테두리를 도는 빛 ===== */
@property --beam-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.search-card { position: relative; }
.search-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--beam-angle), transparent 60%, var(--c-blue) 88%, var(--c-mint) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.search-card:focus-within { border-color: var(--c-blue); }
.search-card:focus-within::after {
  opacity: 1;
  animation: beam-turn 3s linear infinite;
}
@keyframes beam-turn { to { --beam-angle: 360deg; } }

/* ===== 도시 이름 띠 ===== */
.city-marquee {
  margin: 28px calc(var(--app-side-padding) * -1);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.city-marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}
.city-marquee:hover .city-marquee-track,
.city-marquee:focus-within .city-marquee-track { animation-play-state: paused; }
.city-marquee-group { display: flex; flex: 0 0 auto; }
.city-marquee-item {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--c-text-mute);
  transition: color .15s ease;
}
.city-marquee-item:hover,
.city-marquee-item:focus-visible { color: var(--c-text); }
.city-marquee-item::after {
  content: '';
  width: 5px; height: 5px;
  margin-left: 28px;
  border-radius: 50%;
  background: var(--c-blue);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== 카드: 스크롤하면 또렷해지며 등장 ===== */
@supports (animation-timeline: view()) {
  .roadmap-grid .roadmap-card {
    animation: card-rise linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 42%;
  }
}
@keyframes card-rise {
  from { opacity: .2; transform: translateY(18px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ===== 카드: 마우스를 올린 카드만 강조 (터치 기기 제외) ===== */
@media (hover: hover) and (pointer: fine) {
  .hero-cta:hover { transform: translateY(-1px); }
  .roadmap-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .roadmap-card:hover::after { animation: card-glare .7s ease-out; }
  .roadmap-grid:hover .roadmap-card:not(:hover) { opacity: .62; filter: saturate(.75); }
  .dest-quick button:hover { transform: translateY(-2px); }
}

.roadmap-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.22) 50%, transparent 60%);
  transform: translateX(-100%);
  pointer-events: none;
}
@keyframes card-glare { to { transform: translateX(100%); } }

/* ===== 화면 전환 ===== */
.app-page.is-active > .page-scroll { animation: page-in .26s ease-out backwards; }
.step-pane.is-active { animation: page-in .26s ease-out backwards; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ===== 탐색: 정렬 탭 — 흰 바탕 조각이 미끄러지며 이동(탭 자체는 투명) ===== */
.sort-tabs { position: relative; }
.sort-tabs::before {
  content: '';
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px - 2px) / 2);          /* 안쪽 여백 3px×2, 탭 사이 2px */
  background: var(--r-surface, #fff);
  border: 1px solid var(--r-border, #E1E6ED);
  border-radius: 9px;
  box-sizing: border-box;
  transition: transform .22s cubic-bezier(.3, .7, .3, 1);
}
.sort-tabs:has(.sort-tab:nth-of-type(2).is-active)::before { transform: translateX(calc(100% + 2px)); }
.sort-tab { position: relative; z-index: 1; transition: color .18s ease; }
.sort-tabs .sort-tab.is-active,
.sort-tabs .sort-tab[aria-pressed="true"] { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
@media (prefers-reduced-motion: reduce) { .sort-tabs::before { transition: none; } }

/* ===== 탐색: 큰 카드로 리듬 주기 ===== */
#exploreGrid .roadmap-card:nth-child(5n+1) {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}
#exploreGrid .roadmap-card:nth-child(5n+1) .rc-city { font-size: 24px; }
@media (min-width: 768px) {
  #exploreGrid .roadmap-card:nth-child(5n+1) { aspect-ratio: auto; height: 100%; }
}

/* ===== 여행 만들기: 단계 표시 ===== */
.step-dot { transition: background .2s ease, border-color .2s ease; }
.step-dot.is-active { animation: step-pop .3s ease-out; }
.step-dot.is-done { font-size: 0; }
.step-dot.is-done::before { content: '✓'; font-size: 14px; }
.step-dot.is-done span { font-size: 10.5px; }
@keyframes step-pop { from { transform: scale(.82); } }
.choice-card:active, .my-tile:active { transform: scale(.97); }

/* ===== 일정: 스크롤한 만큼 차오르는 선 ===== */
@supports (animation-timeline: view()) {
  .timeline::after {
    content: '';
    position: absolute;
    left: 8px; top: 12px; bottom: 12px;
    width: 2px;
    background: var(--c-blue);
    border-radius: 4px;
    transform-origin: top;
    animation: beam-fill linear both;
    animation-timeline: view();
    animation-range: entry 20% exit 60%;
  }
  .schedule-card {
    animation: card-rise linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 42%;
  }
}
@keyframes beam-fill { from { transform: scaleY(0); } }
.timeline.is-edit::after { display: none; }
.timeline.is-edit .schedule-card:not(.just-moved) { animation: none; }

/* ===== 일정이 없을 때: 경로가 그려진다 ===== */
.empty-route path {
  stroke-dasharray: 1;
  animation: route-draw 1.1s .15s ease-out backwards;
}
@keyframes route-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ===== 일정 만드는 중 ===== */
#genLoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: radial-gradient(70% 50% at 70% 20%, rgba(58,110,165,.45), transparent),
              radial-gradient(60% 45% at 30% 85%, rgba(42,58,77,.6), transparent),
              #111418;
  color: #fff;
  text-align: center;
}
.gl-route { width: 150px; margin-bottom: 10px; }
.gl-route path {
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  animation: gl-draw 1.8s ease-in-out infinite;
}
@keyframes gl-draw {
  0%   { stroke-dashoffset: 1; }
  60%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
.gl-msg {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, #fff 40%, #A9C4E2 50%, #fff 60%) 0 0 / 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gl-shine 2.4s linear infinite;
}
@keyframes gl-shine { to { background-position: -220% 0; } }
.gl-sub { font-size: 14px; color: rgba(255,255,255,.7); }

/* ===== 움직임 줄이기 ===== */
@media (prefers-reduced-motion: reduce) {
  .hero-aurora, .hero-route-dot, .hero-cta::after,
  .hero-title span, .hero-sub, .roadmap-grid .roadmap-card,
  .app-page.is-active > .page-scroll, .step-pane.is-active, .step-dot.is-active,
  .schedule-card, .timeline::after, .empty-route path { animation: none !important; }
  .timeline::after { display: none; }
  .gl-route path { animation: none !important; stroke-dashoffset: 0; }
  .hero-route-dot { display: none; }
  .city-marquee { overflow-x: auto; }
  .city-marquee-track { animation: none !important; }
  .city-marquee-group[aria-hidden="true"] { display: none; }
}

@media print {
  .hero-illust, .city-marquee, .timeline::after { display: none !important; }
}

/* 일정 만드는 중 — 단계 목록과 실패 시 버튼 */
.gl-steps { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; font-size: 14px; color: rgba(255,255,255,.55); }
.gl-steps li { padding-left: 22px; position: relative; }
.gl-steps li::before { content: ''; position: absolute; left: 0; top: .35em; width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.gl-steps li.is-current { color: #fff; font-weight: 700; }
.gl-steps li.is-current::before { border-color: #A9C4E2; background: #A9C4E2; }
.gl-steps li.is-done { color: rgba(255,255,255,.8); }
.gl-steps li.is-done::before { border-color: #A9C4E2; background: transparent; }
.gl-actions { display: flex; gap: 10px; margin-top: 14px; }
.gl-actions:empty { display: none; }
.gl-actions .gl-close { color: #fff; border-color: rgba(255,255,255,.4); }
#genLoadingOverlay.is-failed .gl-route, #genLoadingOverlay.is-failed .gl-steps { display: none; }
#genLoadingOverlay.is-failed .gl-msg { animation: none; color: #fff; background: none; }
#genLoadingOverlay.is-failed .gl-sub { max-width: 320px; line-height: 1.5; }
