/* ===================================
   Advanced Animations & Effects
   Care Theme V3 - 先進的デザイン
   =================================== */

/* ===================================
   1. CSS Variables for Animations
   介護ホームページにふさわしい穏やかな速度設定
   =================================== */
:root {
  /* アニメーション用変数（落ち着いた速度に調整） */
  --anim-duration-fast: 0.5s;
  --anim-duration-normal: 0.9s;
  --anim-duration-slow: 1.5s;
  --anim-duration-very-slow: 3s;

  /* イージング（より滑らかに） */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.2, 0.64, 1);
  --ease-in-out-circ: cubic-bezier(0.65, 0, 0.35, 1);

  /* グラデーション */
  --gradient-primary: linear-gradient(135deg, #f37021 0%, #ff8a3d 50%, #ffb366 100%);
  --gradient-secondary: linear-gradient(135deg, #ff6b35 0%, #f37021 100%);
  --gradient-glow: linear-gradient(135deg, rgba(243, 112, 33, 0.3) 0%, rgba(255, 138, 61, 0.1) 100%);

  /* ブロブカラー */
  --blob-color-1: rgba(243, 112, 33, 0.08);
  --blob-color-2: rgba(255, 138, 61, 0.06);
  --blob-color-3: rgba(255, 179, 102, 0.05);
}

/* ===================================
   2. Keyframe Animations
   =================================== */

/* フェードイン系 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 浮遊アニメーション */
@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(2deg);
  }
  50% {
    transform: translateY(-5px) rotate(0deg);
  }
  75% {
    transform: translateY(-15px) rotate(-2deg);
  }
}

@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  33% {
    transform: translateY(-20px) translateX(10px);
  }
  66% {
    transform: translateY(-10px) translateX(-5px);
  }
}

/* ブロブアニメーション */
@keyframes blobMove {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    transform: rotate(0deg) scale(1);
  }
  25% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }
  50% {
    border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    transform: rotate(180deg) scale(1.05);
  }
  75% {
    border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
  }
}

@keyframes blobPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* パルスアニメーション */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(243, 112, 33, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 20px 10px rgba(243, 112, 33, 0);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(243, 112, 33, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(243, 112, 33, 0.5);
  }
}

/* スライドアニメーション */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes underlineExpand {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* 回転・スピン */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateReverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

/* シマー効果 */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* グラデーション移動 */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* パーティクル */
@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0.6;
  }
  25% {
    transform: translateY(-30px) translateX(15px) rotate(90deg);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-50px) translateX(-10px) rotate(180deg);
    opacity: 0.4;
  }
  75% {
    transform: translateY(-20px) translateX(20px) rotate(270deg);
    opacity: 0.7;
  }
}

/* スクロールインジケーター */
@keyframes scrollBounce {
  0%, 100% {
    transform: translateY(0) rotate(-45deg);
  }
  50% {
    transform: translateY(10px) rotate(-45deg);
  }
}

/* タイプライター */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* リップル効果 */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===================================
   3. Scroll Animation Classes
   =================================== */

/* 基本のスクロールアニメーション要素 */
.scroll-animate {
  opacity: 0;
  transition: opacity var(--anim-duration-normal) var(--ease-out-expo),
              transform var(--anim-duration-normal) var(--ease-out-expo);
}

.scroll-animate.animate-up {
  transform: translateY(60px);
}

.scroll-animate.animate-down {
  transform: translateY(-60px);
}

.scroll-animate.animate-left {
  transform: translateX(-60px);
}

.scroll-animate.animate-right {
  transform: translateX(60px);
}

.scroll-animate.animate-scale {
  transform: scale(0.8);
}

.scroll-animate.animate-rotate {
  transform: rotate(-10deg) scale(0.9);
}

/* アニメーション発火状態 */
.scroll-animate.is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1) rotate(0deg);
}

/* スタッガードアニメーション（遅延） */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* ===================================
   4. Hero Section Enhancements
   =================================== */

/* ヒーローセクションのパララックスコンテナ */
.hero-parallax {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}

.hero-parallax .hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  background-size: cover;
  background-position: center;
  will-change: transform;
  z-index: -1;
}

/* ヒーローのオーバーレイ（アニメーション付き） */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(243, 112, 33, 0.1) 0%,
    rgba(255, 138, 61, 0.05) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  pointer-events: none;
}

/* ヒーローテキストアニメーション */
.hero-title-animate {
  overflow: hidden;
}

.hero-title-animate .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  animation: fadeInUp 1s var(--ease-out-expo) forwards;
}

/* 文字ごとの遅延（JSで動的に設定） */
.hero-title-animate .char:nth-child(1) { animation-delay: 0.05s; }
.hero-title-animate .char:nth-child(2) { animation-delay: 0.1s; }
.hero-title-animate .char:nth-child(3) { animation-delay: 0.15s; }
.hero-title-animate .char:nth-child(4) { animation-delay: 0.2s; }
.hero-title-animate .char:nth-child(5) { animation-delay: 0.25s; }
.hero-title-animate .char:nth-child(6) { animation-delay: 0.3s; }
.hero-title-animate .char:nth-child(7) { animation-delay: 0.35s; }
.hero-title-animate .char:nth-child(8) { animation-delay: 0.4s; }
.hero-title-animate .char:nth-child(9) { animation-delay: 0.45s; }
.hero-title-animate .char:nth-child(10) { animation-delay: 0.5s; }

/* スクロールインジケーター */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeInUp 1.5s var(--ease-out-expo) 2s both;
}

.scroll-indicator-text {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.scroll-indicator-arrow {
  width: 24px;
  height: 24px;
  border-left: 2px solid var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  transform: rotate(-45deg);
  animation: scrollBounce 2.5s ease-in-out infinite;
}

/* ===================================
   5. Background Decorations
   =================================== */

/* ブロブ装飾 */
.blob-decoration {
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--blob-color-1);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  animation: blobMove 20s ease-in-out infinite, floatSlow 15s ease-in-out infinite;
  top: -100px;
  right: -100px;
}

.blob-2 {
  width: 300px;
  height: 300px;
  background: var(--blob-color-2);
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  animation: blobMove 25s ease-in-out infinite reverse, floatSlow 18s ease-in-out infinite reverse;
  bottom: -50px;
  left: -80px;
}

.blob-3 {
  width: 200px;
  height: 200px;
  background: var(--blob-color-3);
  border-radius: 50% 60% 40% 60% / 60% 40% 60% 40%;
  animation: blobMove 18s ease-in-out infinite, blobPulse 8s ease-in-out infinite;
  top: 40%;
  right: 5%;
}

/* パーティクル装飾 */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  opacity: 0.3;
  animation: particleFloat 10s ease-in-out infinite;
}

.particle:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.particle:nth-child(2) { top: 20%; left: 80%; animation-delay: 2s; width: 6px; height: 6px; }
.particle:nth-child(3) { top: 60%; left: 10%; animation-delay: 4s; width: 10px; height: 10px; }
.particle:nth-child(4) { top: 70%; left: 70%; animation-delay: 1s; }
.particle:nth-child(5) { top: 40%; left: 50%; animation-delay: 3s; width: 5px; height: 5px; }
.particle:nth-child(6) { top: 85%; left: 30%; animation-delay: 5s; width: 7px; height: 7px; }

/* 幾何学装飾 */
.geometric-decoration {
  position: absolute;
  pointer-events: none;
  opacity: 0.1;
  z-index: -1;
}

.geo-circle {
  width: 100px;
  height: 100px;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: rotate 30s linear infinite;
}

.geo-square {
  width: 60px;
  height: 60px;
  border: 2px solid var(--color-accent);
  animation: rotateReverse 25s linear infinite;
}

.geo-triangle {
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid rgba(243, 112, 33, 0.1);
  animation: float 8s ease-in-out infinite;
}

/* ===================================
   6. Enhanced Cards
   =================================== */

/* グラスモーフィズムカード */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all var(--anim-duration-normal) var(--ease-out-expo);
}

.glass-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: rgba(243, 112, 33, 0.3);
}

/* 3Dチルトカード */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform var(--anim-duration-fast) ease;
}

.tilt-card-inner {
  transition: transform var(--anim-duration-fast) ease;
}

/* グロー効果付きカード */
.glow-card {
  position: relative;
  overflow: hidden;
}

.glow-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--anim-duration-normal) ease;
}

.glow-card:hover::before {
  opacity: 1;
  animation: pulseGlow 3s ease-in-out infinite;
}

/* ===================================
   7. Section Titles
   =================================== */

/* アニメーション付きセクションタイトル */
.section-title-animated {
  position: relative;
  display: inline-block;
}

.section-title-animated::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s var(--ease-out-expo);
}

/* .section-title-animated.is-visible::after 削除済み */

/* ===================================
   8. Buttons
   =================================== */

/* リップル効果付きボタン */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  animation: ripple 0.9s linear;
  pointer-events: none;
}

/* グラデーションボタン */
.btn-gradient {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  border: none;
  color: white;
  transition: all var(--anim-duration-normal) ease;
}

.btn-gradient:hover {
  background-position: right center;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(243, 112, 33, 0.4);
}

/* シマー効果ボタン */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

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

.btn-shimmer:hover::after {
  left: 100%;
}

/* ===================================
   9. Section Dividers
   =================================== */

/* 二重波形 */
.wave-divider-double {
  position: relative;
  height: 150px;
}

.wave-divider-double svg {
  position: absolute;
  width: 100%;
  height: 100%;
}

.wave-divider-double .wave-back {
  opacity: 0.5;
  transform: translateY(10px);
}

/* 斜めカット */
.diagonal-divider {
  position: relative;
  height: 100px;
  overflow: hidden;
}

.diagonal-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  transform: skewY(-3deg);
  transform-origin: top left;
}

/* ===================================
   10. Text Effects
   =================================== */

/* グラデーションテキスト */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* シマーテキスト */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--color-text-primary) 0%,
    var(--color-primary) 50%,
    var(--color-text-primary) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ===================================
   11. Loading States
   =================================== */

/* スケルトンローダー */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ===================================
   12. Reduced Motion
   =================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scroll-animate {
    opacity: 1;
    transform: none;
  }
}

/* ===================================
   13. Responsive Adjustments
   =================================== */

@media (max-width: 768px) {
  .blob-1 {
    width: 250px;
    height: 250px;
  }

  .blob-2 {
    width: 180px;
    height: 180px;
  }

  .blob-3 {
    width: 120px;
    height: 120px;
  }

  .scroll-indicator {
    bottom: 20px;
  }

  .particle {
    display: none;
  }
}
