/* ========================================
   RECHANCE Corporate Site - Motion Layer
   (トップページ専用 / カラー・コンテンツは既存のまま)
   ======================================== */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----------------------------------------
   Hero: 動く背景(ブロブ + グリッド)
   ---------------------------------------- */
.hero {
  background-size: auto, 200% 200%;
  animation: hero-gradient 14s ease-in-out infinite;
}

@keyframes hero-gradient {
  0%, 100% { background-position: 0 0, 0% 50%; }
  50% { background-position: 0 0, 100% 50%; }
}

.hero-blobs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  will-change: transform;
}

.hero-blob--1 {
  width: 480px;
  height: 480px;
  top: -10%;
  right: -5%;
  background: radial-gradient(circle, rgba(107, 163, 163, 0.9), transparent 65%);
  animation: blob-float-1 18s ease-in-out infinite;
}

.hero-blob--2 {
  width: 380px;
  height: 380px;
  bottom: -15%;
  left: 8%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
  animation: blob-float-2 22s ease-in-out infinite;
}

.hero-blob--3 {
  width: 260px;
  height: 260px;
  top: 30%;
  left: 45%;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.25), transparent 65%);
  animation: blob-float-3 26s ease-in-out infinite;
}

@keyframes blob-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, 50px) scale(1.12); }
  66% { transform: translate(30px, -30px) scale(0.94); }
}

@keyframes blob-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(70px, -40px) scale(1.08); }
  66% { transform: translate(-40px, 25px) scale(0.92); }
}

@keyframes blob-float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, 60px) scale(1.15); }
}

/* 浮遊するライン装飾 */
.hero-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.hero-line {
  position: absolute;
  width: 1px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: line-rise 8s linear infinite;
  opacity: 0;
}

.hero-line:nth-child(1) { left: 15%; animation-delay: 0s; }
.hero-line:nth-child(2) { left: 35%; animation-delay: 2.5s; }
.hero-line:nth-child(3) { left: 65%; animation-delay: 1.2s; }
.hero-line:nth-child(4) { left: 85%; animation-delay: 4s; }
.hero-line:nth-child(5) { left: 50%; animation-delay: 5.5s; }

@keyframes line-rise {
  0% { transform: translateY(110vh); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(-140px); opacity: 0; }
}

/* ----------------------------------------
   Hero: 文字の順次表示
   ---------------------------------------- */
.hero-content.fade-in {
  opacity: 1;
  transform: none;
  transition: none;
}

.hero-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(1.1em) rotate(6deg);
  animation: char-in 0.9s var(--ease-out-expo) forwards;
}

@keyframes char-in {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.hero-title {
  overflow: hidden;
}

.hero-subtitle {
  opacity: 0;
  animation: rise-in 1s var(--ease-out-expo) 0.7s forwards;
}

.hero-buttons {
  opacity: 0;
  animation: rise-in 1s var(--ease-out-expo) 1s forwards;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* スクロールキュー */
.hero-scroll-cue {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  opacity: 0;
  animation: rise-in 1s ease 1.6s forwards;
}

.hero-scroll-cue::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  animation: scroll-dot 2s ease-in-out infinite;
}

@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ----------------------------------------
   スクロールリビール強化(既存 .fade-in を上書き)
   ---------------------------------------- */
.fade-in {
  opacity: 0;
  transform: none;
  filter: none;
  transition: none;
}

.fade-in.active {
  opacity: 1;
  transform: none;
  animation: reveal-up 0.9s var(--ease-out-expo) var(--stagger, 0s) backwards;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(48px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* セクションタイトルの下線が伸びる */
.section-title::after {
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.8s var(--ease-out-expo) 0.35s;
}

.section-title.active::after {
  transform: scaleX(1);
}

/* ----------------------------------------
   カード: ホバー強化
   ---------------------------------------- */
.card,
.service-card {
  position: relative;
  transition:
    transform 0.5s var(--ease-out-expo),
    box-shadow 0.5s var(--ease-out-expo);
  will-change: transform;
}

/* 上端のアクセントバーが伸びる */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out-expo);
}

.card:hover::before {
  transform: scaleX(1);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(89, 145, 145, 0.18);
}

/* サービスカード: 3Dチルト(JS) + シーン */
.service-card {
  transform-style: preserve-3d;
  overflow: hidden;
}

.service-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s ease;
  pointer-events: none;
}

.service-card:hover::after {
  left: 130%;
}

.service-card .service-icon {
  transition: transform 0.5s var(--ease-spring);
}

.service-card:hover .service-icon {
  transform: translateY(-6px) scale(1.1) rotate(-4deg);
}

.service-card .service-card-link {
  transition: transform 0.35s var(--ease-out-expo), color 0.35s ease;
  display: inline-block;
}

.service-card:hover .service-card-link {
  transform: translateX(6px);
  color: var(--primary);
}

/* メディアカードの画像ズーム */
.card img {
  transition: transform 0.7s var(--ease-out-expo);
}

article.card {
  overflow: hidden;
}

article.card:hover img {
  transform: scale(1.06);
}

/* ----------------------------------------
   ボタン: シーン(光の帯)
   ---------------------------------------- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.btn:hover::after {
  left: 160%;
}

/* ----------------------------------------
   CTA: 動くグラデーション
   ---------------------------------------- */
.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary) 100%);
  background-size: 200% 200%;
  animation: cta-gradient 10s ease-in-out infinite;
}

@keyframes cta-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.cta-section::before {
  animation: cta-sweep 12s ease-in-out infinite;
}

@keyframes cta-sweep {
  0%, 100% { transform: rotate(15deg) translateX(0); }
  50% { transform: rotate(15deg) translateX(-8%); }
}

/* ----------------------------------------
   ヘッダー: スクロール時にガラス効果
   ---------------------------------------- */
.header.header-transparent.scrolled {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ロゴマーキーは滑らかに */
.carousel-track {
  animation-duration: 28s;
}

.client-logo {
  transition: transform 0.4s var(--ease-out-expo);
}

.client-logo:hover {
  transform: scale(1.08);
}

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

  .fade-in,
  .hero-title .char,
  .hero-subtitle,
  .hero-buttons {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
