/* ============================================
   EC家計簿 LP - スタイルシート
============================================ */

/* ---------- フォント設定 ---------- */
@font-face {
  font-family: "LINESeedJP";
  src: url("../fonts/LINESeedJP-Thin.woff") format("woff");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LINESeedJP";
  src: url("../fonts/LINESeedJP-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LINESeedJP";
  src: url("../fonts/LINESeedJP-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LINESeedJP";
  src: url("../fonts/LINESeedJP-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- ベース設定 ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* スムーズスクロールのズレ防止 */
}

body {
  font-family: "LINESeedJP", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- スクロールアニメーション (Reveal) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- ナビゲーション (下線アニメーション) ---------- */
/* ベース: Tailwindのクラスを補完 */
nav a {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
  font-weight: 600;
}

/* 下線要素 */
nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #ffffff; /* 白い線 */
  transition: width 0.3s ease;
}

/* アクティブ時 または ホバー時に線を伸ばす */
nav a.active::after,
nav a:hover::after {
  width: 100%;
}

/* アクティブ時は太字にする場合の補助 */
nav a.active {
  font-weight: 800; /* ExtraBold */
  opacity: 1;
}

/* ---------- ハンバーガーアイコン アニメーション ---------- */
#menu-btn span {
  transform-origin: center;
}

#menu-btn.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
#menu-btn.open span:nth-child(2) {
  opacity: 0;
}
#menu-btn.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ---------- 背景・装飾 ---------- */
/* ヒーローエリアの円弧テキストなどを回転させる場合 */
.animate-spin-slow {
  animation: spin-slow 60s linear infinite;
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounceIn {
  0% {
    transform: translateY(-200px) translateX(-150px);
    opacity: 0;
  }
  60% {
    transform: translateY(0) translateX(0);
    opacity: 1;
  }
  75% {
    transform: translateY(-40px) translateX(0);
  }
  85% {
    transform: translateY(0) translateX(0);
  }
  92% {
    transform: translateY(-20px) translateX(0);
  }
  96% {
    transform: translateY(0) translateX(0);
  }
  100% {
    transform: translateY(0) translateX(0);
  }
}

.nobi-bounce {
  animation: bounceIn 1s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.section-title {
  position: relative;
  display: inline-block; /* 文字幅に合わせる */
  padding-bottom: 14px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 110%; /* 100%で文字と同じ、110〜120%で少し長め */
  height: 4px;
  background: #f7931e; /* bg-ec-orange 相当 */
  border-radius: 9999px;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

/* 表示時に伸びる */
.reveal.visible .section-title::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

/* 動きを減らしたい環境向け */
@media (prefers-reduced-motion: reduce) {
  .section-title::after {
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
      opacity 0.3s ease 0.2s;
  }
}

/* このブロックは通常のreveal(下からふわっ)を無効化して、子要素だけアニメーションさせる */
.hero-copy.reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

/* 1行ごとの初期状態 */
.hero-copy-line {
  overflow: hidden;
  opacity: 0;
  clip-path: inset(0 100% 0 0); /* 左から右へ見せる */
  transform: translateX(-24px);
  will-change: clip-path, transform, opacity;
}

/* 表示時 */
.hero-copy.visible .hero-copy-line {
  animation: heroLineReveal 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 2行目を少し遅らせる */
.hero-copy.visible .hero-copy-line:nth-child(2) {
  animation-delay: 0.18s;
}

@keyframes heroLineReveal {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-24px);
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy-line {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
    animation: none !important;
  }
}

/* ============================================
   ローディング＆アニメーション待機制御 (最重要)
============================================ */

/* bodyに「is-loaded」がつくまでは、Animate.cssを強制停止・非表示にしておく */
body:not(.is-loaded) .animate__animated {
  animation-play-state: paused !important;
  opacity: 0;
  visibility: hidden;
}

/* Reveal（スクロール表示）も、ローディング中は発動させない */
body:not(.is-loaded) .reveal {
  opacity: 0 !important;
  transform: translateY(30px) !important;
  visibility: hidden;
}