/**
 * 서울비디치과 Treatment Page Animations
 * 프리미엄 동적 애니메이션 시스템
 * ============================================
 */

/* ============================================
   🎬 기본 애니메이션 Keyframes
============================================ */

/* Fade In Up - 아래에서 위로 등장 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down - 위에서 아래로 등장 */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left - 왼쪽에서 등장 */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right - 오른쪽에서 등장 */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In - 작아졌다가 커지며 등장 */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Shimmer - 금빛 반짝임 효과 */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Pulse Glow - 은은한 빛 펄스 */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(201, 169, 98, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(201, 169, 98, 0.6);
  }
}

/* Float - 부유 효과 */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Bounce - 바운스 효과 */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-8px);
  }
}

/* Rotate - 회전 효과 */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Draw Line - 선 그리기 효과 */
@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Progress Fill - 프로그레스 바 채우기 */
@keyframes progressFill {
  from {
    width: 0;
  }
  to {
    width: var(--progress-width, 100%);
  }
}

/* Slide In Stagger - 순차적 슬라이드 */
@keyframes slideInStagger {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Gradient Shift - 그라데이션 이동 */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ============================================
   🎨 애니메이션 유틸리티 클래스
============================================ */

/* 기본 애니메이션 적용 */
.animate-fadeInUp {
  animation: fadeInUp 0.8s ease forwards;
}

.animate-fadeInDown {
  animation: fadeInDown 0.8s ease forwards;
}

.animate-fadeInLeft {
  animation: fadeInLeft 0.8s ease forwards;
}

.animate-fadeInRight {
  animation: fadeInRight 0.8s ease forwards;
}

.animate-scaleIn {
  animation: scaleIn 0.6s ease forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-bounce {
  animation: bounce 2s ease infinite;
}

.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* 지연 시간 유틸리티 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* 애니메이션 초기 상태 (JS로 트리거 전) */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   ✨ 히어로 섹션 애니메이션
============================================ */

.treatment-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 배경 파티클 효과 */
.hero-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.hero-particles::before,
.hero-particles::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  animation: float 8s ease-in-out infinite;
}

.hero-particles::before {
  top: 10%;
  left: 20%;
  background: rgba(201, 169, 98, 0.15);
  animation-delay: 0s;
}

.hero-particles::after {
  bottom: 20%;
  right: 15%;
  background: rgba(139, 90, 43, 0.12);
  animation-delay: 4s;
}

/* 히어로 그라데이션 배경 */
.hero-gradient-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(201, 169, 98, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 90, 43, 0.1) 0%, transparent 40%),
    linear-gradient(135deg, #0a0a0a 0%, #1a1512 30%, #12100e 60%, #0a0a0a 100%);
  z-index: -1;
}

/* 히어로 텍스트 쉬머 효과 */
.text-shimmer {
  background: linear-gradient(
    135deg,
    #8B5A2B 0%,
    #C9A962 25%,
    #D4B896 50%,
    #C9A962 75%,
    #8B5A2B 100%
  );
  background-size: 400% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease-in-out infinite;
}

/* 히어로 배지 애니메이션 */
.hero-badge-animated {
  animation: fadeInDown 0.8s ease forwards, pulseGlow 3s ease-in-out infinite 1s;
}

/* ============================================
   🃏 카드 호버 애니메이션
============================================ */

/* 기본 카드 호버 */
.card-hover {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease,
              border-color 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-12px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  border-color: rgba(201, 169, 98, 0.4);
}

/* 3D 틸트 카드 */
.card-3d-tilt {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.card-3d-tilt:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateZ(20px);
}

/* 글로우 카드 */
.card-glow {
  position: relative;
  transition: all 0.4s ease;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, #8B5A2B, #C9A962, #8B5A2B);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card-glow:hover::before {
  opacity: 1;
}

/* 아이콘 스핀 호버 */
.icon-spin-hover {
  transition: transform 0.4s ease;
}

.icon-spin-hover:hover {
  transform: rotate(360deg);
}

/* 아이콘 스케일 호버 */
.icon-scale-hover {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-scale-hover:hover {
  transform: scale(1.15);
}

/* ============================================
   📊 프로세스 타임라인 애니메이션
============================================ */

.process-timeline-animated {
  position: relative;
}

.process-timeline-animated::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(180deg, 
    rgba(139, 90, 43, 0) 0%,
    #8B5A2B 10%,
    #C9A962 50%,
    #8B5A2B 90%,
    rgba(139, 90, 43, 0) 100%
  );
  background-size: 100% 200%;
  animation: gradientShift 4s ease infinite;
}

/* 프로세스 스텝 등장 */
.process-step-animated {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.process-step-animated.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.process-step-animated:nth-child(1) { transition-delay: 0.1s; }
.process-step-animated:nth-child(2) { transition-delay: 0.2s; }
.process-step-animated:nth-child(3) { transition-delay: 0.3s; }
.process-step-animated:nth-child(4) { transition-delay: 0.4s; }
.process-step-animated:nth-child(5) { transition-delay: 0.5s; }
.process-step-animated:nth-child(6) { transition-delay: 0.6s; }

/* 스텝 번호 펄스 */
.step-number-pulse {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ============================================
   ❓ FAQ 아코디언 애니메이션
============================================ */

.faq-item-animated {
  transition: all 0.3s ease;
}

.faq-item-animated:hover {
  transform: translateX(8px);
  border-color: rgba(201, 169, 98, 0.4);
}

.faq-answer-animated {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s ease;
}

.faq-item-animated.open .faq-answer-animated {
  max-height: 500px;
}

.faq-chevron {
  transition: transform 0.3s ease;
}

.faq-item-animated.open .faq-chevron {
  transform: rotate(180deg);
}

/* ============================================
   🔢 숫자 카운터 애니메이션
============================================ */

.counter-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.counter-wrapper {
  position: relative;
  overflow: hidden;
}

.counter-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8B5A2B, #C9A962);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s ease;
}

.counter-wrapper.counted::after {
  transform: scaleX(1);
}

/* ============================================
   📍 스크롤 인디케이터
============================================ */

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

.scroll-indicator-line {
  width: 2px;
  height: 60px;
  background: linear-gradient(180deg, #C9A962 0%, transparent 100%);
  margin: 0 auto;
}

.scroll-indicator-dot {
  width: 10px;
  height: 10px;
  background: #C9A962;
  border-radius: 50%;
  margin: 8px auto 0;
  animation: bounce 1.5s infinite;
}

/* ============================================
   🌟 CTA 섹션 애니메이션
============================================ */

.cta-animated {
  position: relative;
  overflow: hidden;
}

.cta-animated::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(201, 169, 98, 0.1) 0%, transparent 50%);
  animation: rotate 20s linear infinite;
}

/* CTA 버튼 호버 */
.btn-animated {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-animated:hover::before {
  left: 100%;
}

.btn-animated:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(201, 169, 98, 0.4);
}

/* ============================================
   🎭 특별 효과
============================================ */

/* 마퀴 효과 (무한 스크롤) */
.marquee-wrapper {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-flex;
  animation: marquee 30s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* 타이핑 효과 */
.typing-effect {
  overflow: hidden;
  border-right: 3px solid #C9A962;
  white-space: nowrap;
  animation: typing 3s steps(30, end), blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* 리플 효과 */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(201, 169, 98, 0.3);
  border-radius: 50%;
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.ripple-effect:active::after {
  transform: translate(-50%, -50%) scale(4);
  opacity: 1;
  transition: 0s;
}

/* ============================================
   📱 반응형 애니메이션 조정
============================================ */

/* 모션 감소 선호 사용자 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 모바일에서 애니메이션 간소화 */
@media (max-width: 768px) {
  .hero-particles::before,
  .hero-particles::after {
    width: 200px;
    height: 200px;
  }
  
  .card-hover:hover {
    transform: translateY(-6px);
  }
  
  .card-3d-tilt:hover {
    transform: none;
  }
  
  .animate-fadeInLeft,
  .animate-fadeInRight {
    animation-name: fadeInUp;
  }
}

/* ============================================
   🔧 JavaScript 트리거용 클래스
============================================ */

/* Intersection Observer 트리거 */
[data-animate] {
  opacity: 0;
}

[data-animate="fadeInUp"] {
  transform: translateY(40px);
}

[data-animate="fadeInLeft"] {
  transform: translateX(-40px);
}

[data-animate="fadeInRight"] {
  transform: translateX(40px);
}

[data-animate="scaleIn"] {
  transform: scale(0.8);
}

[data-animate].animated {
  opacity: 1;
  transform: translate(0) scale(1);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Stagger 애니메이션 (순차적 등장) */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(30px);
}

[data-stagger].animated > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-stagger].animated > *:nth-child(1) { transition-delay: 0.1s; }
[data-stagger].animated > *:nth-child(2) { transition-delay: 0.2s; }
[data-stagger].animated > *:nth-child(3) { transition-delay: 0.3s; }
[data-stagger].animated > *:nth-child(4) { transition-delay: 0.4s; }
[data-stagger].animated > *:nth-child(5) { transition-delay: 0.5s; }
[data-stagger].animated > *:nth-child(6) { transition-delay: 0.6s; }
[data-stagger].animated > *:nth-child(7) { transition-delay: 0.7s; }
[data-stagger].animated > *:nth-child(8) { transition-delay: 0.8s; }
