/*
===========================================
Rich Animations - モダン・リッチアニメーション
MASUTO.inc Corporate Theme
===========================================
*/

/* ============================================
   アクセシビリティ優先 (reduced-motion)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .hero-particle,
  .section-line-anim::after,
  .btn-sheen::before,
  .ripple-wave,
  .hero-scroll-indicator {
    animation: none !important;
    transition: none !important;
  }
  .gsap-reveal,
  .gsap-stagger-item {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   ヒーロー: 初期状態（GSAPが上書きする前の隠し状態）
   ============================================ */
.hero-title,
.hero-subtitle,
.hero-buttons,
.hero-badge {
  opacity: 0;
}

/* GSAPロード前に非表示にならないよう、.js-loaded が付いてから隠す */
.js-loaded .hero-title,
.js-loaded .hero-subtitle,
.js-loaded .hero-buttons,
.js-loaded .hero-badge {
  opacity: 0;
}

/* ============================================
   ヒーロー: パーティクル背景
   ============================================ */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.hero-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(78, 205, 196, 0.25);
  animation: particleFloat var(--duration, 12s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform, opacity;
}

@keyframes particleFloat {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  15%  { opacity: 0.7; }
  50%  { transform: translateY(var(--travel-y, -120px)) translateX(var(--travel-x, 30px)) scale(1.15); }
  85%  { opacity: 0.5; }
  100% { transform: translateY(calc(var(--travel-y, -120px) * 2)) translateX(calc(var(--travel-x, 30px) * -0.5)) scale(0.85); opacity: 0; }
}

/* ============================================
   ヒーロー: スクロールインジケーター
   ============================================ */
.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  z-index: 5;
  animation: scrollBounce 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  cursor: pointer;
}

.hero-scroll-indicator span {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  opacity: 0.8;
}

.hero-scroll-arrow {
  width: 22px;
  height: 22px;
  border-right: 2px solid rgba(255,255,255,0.7);
  border-bottom: 2px solid rgba(255,255,255,0.7);
  transform: rotate(45deg);
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
  50%       { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

/* ============================================
   セクションタイトル: 下線が左から右へ伸びる
   ============================================ */
.section-title-anim {
  position: relative;
  display: inline-block;
}

.section-title-anim::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary-color, #4ECDC4), #2ec4b6);
  border-radius: 2px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-title-anim.line-revealed::after {
  transform: translateX(-50%) scaleX(1);
}

/* ============================================
   GSAP スクロール連動用: 初期状態
   ============================================ */
.gsap-reveal {
  opacity: 0;
  transform: translateY(40px);
  will-change: opacity, transform;
}

.gsap-reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  will-change: opacity, transform;
}

.gsap-reveal-right {
  opacity: 0;
  transform: translateX(50px);
  will-change: opacity, transform;
}

.gsap-reveal-scale {
  opacity: 0;
  transform: scale(0.88);
  will-change: opacity, transform;
}

.gsap-stagger-item {
  opacity: 0;
  transform: translateY(30px);
  will-change: opacity, transform;
}

/* ============================================
   ボタン: シーン（光沢）エフェクト
   ============================================ */
.btn {
  isolation: isolate;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255,255,255,0.28) 50%,
    transparent 65%
  );
  transform: translateX(-100%) skewX(-15deg);
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: inherit;
  z-index: 1;
  pointer-events: none;
}

.btn:hover::before {
  transform: translateX(100%) skewX(-15deg);
}

/* ボタンのテキスト・アイコンを前面に保つ */
.btn > * {
  position: relative;
  z-index: 2;
}

/* ============================================
   ボタン: リップルエフェクト（JSで.ripple-wave要素を生成）
   ============================================ */
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.35);
  animation: rippleExpand 0.65s linear forwards;
  pointer-events: none;
  z-index: 0;
}

@keyframes rippleExpand {
  to {
    transform: scale(4.5);
    opacity: 0;
  }
}

/* ============================================
   ヘッダー: スクロール時のスムーズな変化強化
   ============================================ */
.site-header {
  transition: background-color 0.35s ease,
              box-shadow 0.35s ease,
              backdrop-filter 0.35s ease,
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 上に隠れた状態（scroll-upクラスで戻す） */
.site-header.header-hidden {
  transform: translateY(-100%);
}

.site-header.header-visible {
  transform: translateY(0);
}

/* ============================================
   ナビ: メニュー下線の scaleX アニメーション
   ============================================ */
.menu-item a::after {
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.menu-item a:hover::after,
.menu-item.current-menu-item a::after {
  transform: scaleX(1);
}

/* ============================================
   画像: Parallax ラッパー
   ============================================ */
.parallax-section {
  overflow: hidden;
}

.parallax-img {
  will-change: transform;
  transform: scale(1.12); /* parallax分だけ少し大きく */
}

/* ============================================
   数値カウンター
   ============================================ */
.stat-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  will-change: contents;
}

/* ============================================
   CTA セクション: グラデーション背景アニメーション
   ============================================ */
.cta-section,
.section-bg-gradient {
  background-size: 200% 200%;
  animation: ctaGradientShift 8s ease infinite;
}

@keyframes ctaGradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================
   カード: ホバー時の浮き上がり強化
   ============================================ */
.service-card,
.case-study-card,
.testimonial-card,
.news-card {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.service-card:hover,
.case-study-card:hover,
.testimonial-card:hover,
.news-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 50px rgba(26, 58, 90, 0.16),
              0 6px 16px rgba(26, 58, 90, 0.10);
}

/* ============================================
   ページロード時: サイト全体のフェードイン
   ============================================ */
body {
  animation: pageEnter 0.5s ease-out both;
}

@keyframes pageEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================
   ハイライトテキスト（グラデーションアニメ）
   ============================================ */
.text-gradient-anim {
  background: linear-gradient(
    90deg,
    var(--secondary-color, #4ECDC4) 0%,
    #2ec4b6 30%,
    var(--accent-color, #FF6B6B) 60%,
    var(--secondary-color, #4ECDC4) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: textGradientFlow 4s linear infinite;
}

@keyframes textGradientFlow {
  to { background-position: 200% center; }
}

/* ============================================
   スクロールプログレスバー（ページ上部）
   ============================================ */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary-color, #4ECDC4), var(--accent-color, #FF6B6B));
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}
