/* SGキッズ LP の動き
   - 開いたとき：見出し・イラストの子ども・ボタンが順に登場する（CSS だけで動く）
   - ファーストビュー：子どもが手を振る、赤ちゃんがはずむ、星がまたたく、波が流れる
     （画面から外れている間は motion.js が止める）
   - スクロール：各欄が下から現れる、数字が増える（motion.js が .motion と .in を付ける）
   - スクロール連動：上の進み具合バー、イラストの視差、背景の丸（対応ブラウザだけ。CSS の scroll-driven animations）
   端末で「視差効果を減らす」を選んでいる方には、style.css の指定ですべての動きを止める。
   動きは transform 系（translate / scale / rotate）と opacity だけにして、重くならないようにする。 */

/* ---------- 開いたときの登場 ---------- */
.eyebrow { animation: pop-in .6s .1s cubic-bezier(.34, 1.56, .64, 1) both; }
.h1-line { display: inline-block; animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
.h1-line:nth-of-type(1) { animation-delay: .25s; }
.h1-line:nth-of-type(2) { animation-delay: .45s; }
.h1-mark { background: linear-gradient(transparent 66%, rgba(255, 201, 74, .65) 66%) no-repeat 0 0 / 100% 100%; animation: mark-in .7s 1.05s ease-out both; }
.hero-body .lead { animation: rise .7s .6s cubic-bezier(.2, .8, .2, 1) both; }
.hero-points li { animation: pop-in .55s cubic-bezier(.34, 1.56, .64, 1) both; }
.hero-points li:nth-child(1) { animation-delay: .75s; }
.hero-points li:nth-child(2) { animation-delay: .85s; }
.hero-points li:nth-child(3) { animation-delay: .95s; }
.hero-actions { animation: rise .7s 1.05s cubic-bezier(.2, .8, .2, 1) both; }
.hero-note { animation: fade .8s 1.25s both; }

@keyframes rise { from { opacity: 0; translate: 0 24px; } }
@keyframes pop-in { from { opacity: 0; scale: .6; } }
@keyframes fade { from { opacity: 0; } }
@keyframes mark-in { from { background-size: 0% 100%; } }

/* ---------- イラスト ---------- */
.hero-art g { transform-box: fill-box; }
.hero-art .pop { transform-origin: 50% 100%; animation: kid-pop .8s cubic-bezier(.34, 1.56, .64, 1) both; }
.hero-art .pop-1 { animation-delay: .35s; }
.hero-art .pop-2 { animation-delay: .5s; }
.hero-art .pop-3 { animation-delay: .65s; }
@keyframes kid-pop { from { opacity: 0; translate: 0 40px; scale: .6; } }

/* 中学生くらい：ゆらゆら */
.hero-art .sway { transform-origin: 50% 100%; animation: sway 4.5s 1.4s ease-in-out infinite; }
@keyframes sway { 0%, 100% { rotate: 0deg; } 25% { rotate: -1.5deg; } 75% { rotate: 1.5deg; } }
/* 小学生くらい：手を振る */
.hero-art .wave-arm { transform-origin: 12% 88%; animation: wave-hand 1.8s 1.3s ease-in-out infinite; }
@keyframes wave-hand { 0%, 100% { rotate: 0deg; } 20% { rotate: -16deg; } 40% { rotate: 6deg; } 60% { rotate: -12deg; } 80% { rotate: 2deg; } }
/* 赤ちゃん：ぽよんとはずむ */
.hero-art .bounce { transform-origin: 50% 100%; animation: bounce 1.9s 1.5s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { translate: 0 0; scale: 1 1; } 40% { translate: 0 -9px; scale: .98 1.02; } 62% { translate: 0 0; scale: 1.04 .96; } 74% { scale: 1 1; } }
/* カチンコ */
.hero-art .clap-top { transform-origin: 0% 100%; animation: clap 3.4s 1.8s ease-in-out infinite; }
@keyframes clap { 0%, 60%, 100% { rotate: 0deg; } 68% { rotate: -24deg; } 76% { rotate: 0deg; } 82% { rotate: -10deg; } 88% { rotate: 0deg; } }
/* 星・光 */
.hero-art .twinkle { transform-box: fill-box; transform-origin: 50% 50%; animation: twinkle 2.4s ease-in-out infinite; }
.hero-art .twinkle:nth-of-type(2) { animation-delay: .8s; }
.hero-art .twinkle:nth-of-type(3) { animation-delay: 1.6s; }
@keyframes twinkle { 0%, 100% { scale: 1; rotate: 0deg; opacity: 1; } 50% { scale: .55; rotate: 45deg; opacity: .7; } }
.hero-art .spot { transform-origin: 50% 50%; animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { scale: 1.04; } }

/* お仕事の例（CM など）：ぽんと出て、ふわふわ */
.hero-tags li { animation: pop-in .5s cubic-bezier(.34, 1.56, .64, 1) both, bob 3.4s ease-in-out infinite; }
.hero-tags li:nth-child(1) { animation-delay: 1.1s, 2s; }
.hero-tags li:nth-child(2) { animation-delay: 1.2s, 2.5s; }
.hero-tags li:nth-child(3) { animation-delay: 1.3s, 3s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

.spark { animation: spark 2.6s ease-in-out infinite; }
.s2 { animation-delay: .7s; }
.s3 { animation-delay: 1.4s; }
@keyframes spark { 50% { scale: .55; } }

/* 後ろの波がゆっくり流れる */
.wave-back { width: 200%; bottom: 8px; animation: wave-slide 16s linear infinite; }
@keyframes wave-slide { to { translate: -50% 0; } }

/* 応募ボタンに、ときどき光が走る */
.hero-actions .btn-cta, .sticky-cta .btn-cta { position: relative; overflow: hidden; }
.hero-actions .btn-cta::after, .sticky-cta .btn-cta::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg); translate: -160% 0; animation: shine 4.5s 2.2s ease-in-out infinite;
}
@keyframes shine { 0% { translate: -160% 0; } 28%, 100% { translate: 360% 0; } }

/* ファーストビューが画面の外にあるときは止める（motion.js が .is-away を付ける） */
.hero.is-away *, .hero.is-away *::after { animation-play-state: paused !important; }

/* ---------- 見出しの下の線 ---------- */
.section h2::after { content: ""; display: block; width: 48px; height: 5px; margin: 14px auto 0; border-radius: 99px; background: var(--sun); }

/* ---------- スクロールで現れる（motion.js が html に .motion、見えたら .in を付ける） ---------- */
.motion .reveal:not(.in) { opacity: 0; }
.motion .reveal.in { animation: reveal-up .75s calc(var(--i, 0) * 70ms) cubic-bezier(.2, .8, .2, 1) backwards; }
.motion .reveal-pop.in { animation-name: reveal-pop; animation-timing-function: cubic-bezier(.34, 1.56, .64, 1); }
.motion .reveal-side.in { animation-name: reveal-side; }
.motion .section h2.reveal.in::after { animation: bar-grow .6s .35s cubic-bezier(.2, .8, .2, 1) backwards; }
.motion .fee-table .hl.in b { display: inline-block; animation: zero-pop .9s .35s cubic-bezier(.34, 1.56, .64, 1) backwards; }
@keyframes reveal-up { from { opacity: 0; translate: 0 32px; } }
@keyframes reveal-pop { from { opacity: 0; scale: .7; } }
@keyframes reveal-side { from { opacity: 0; translate: -32px 0; } }
@keyframes bar-grow { from { scale: 0 1; } }
@keyframes zero-pop { from { opacity: 0; scale: .3; } }

/* ---------- さわったときの動き（マウスのある端末だけ） ---------- */
@media (hover: hover) {
  .feature, .support-steps li, .talk-list li, .stats li, .work-list li { transition: translate .25s ease, box-shadow .25s ease; }
  .feature:hover, .support-steps li:hover, .talk-list li:hover, .stats li:hover { translate: 0 -5px; box-shadow: 0 16px 32px rgba(11, 79, 74, .14); }
  .work-list li:hover { translate: 0 -3px; box-shadow: 0 8px 18px rgba(11, 79, 74, .12); }
  .hero-points li { transition: rotate .3s cubic-bezier(.34, 1.56, .64, 1); }
  .hero-points li:hover { rotate: -8deg; }
}

/* ---------- 背景の丸（出演作品・面接について） ---------- */
.works, .interview { position: relative; overflow: hidden; }
.works > .wrap, .interview > .wrap { position: relative; z-index: 1; }
.works::before, .works::after, .interview::before, .interview::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.works::before { width: 240px; height: 240px; left: -90px; top: 30px; background: rgba(0, 172, 151, .09); }
.works::after { width: 150px; height: 150px; right: -40px; bottom: 24px; background: rgba(255, 201, 74, .22); }
.interview::before { width: 200px; height: 200px; right: -70px; top: 60px; background: rgba(0, 172, 151, .07); }
.interview::after { width: 120px; height: 120px; left: -30px; bottom: 120px; background: rgba(255, 201, 74, .2); }

/* ---------- スクロール連動（対応ブラウザだけ） ---------- */
@supports (animation-timeline: scroll()) {
  /* 上の進み具合バー */
  .site-header::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, var(--sea), var(--sun), var(--coral)); transform-origin: 0 50%;
    animation: progress linear both; animation-timeline: scroll(root);
  }
  @keyframes progress { from { scale: 0 1; } to { scale: 1 1; } }

  /* 星がスクロールに合わせて回る */
  .spark { animation: spark 2.6s ease-in-out infinite, spin linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0 1200px; }
  .s2 { animation-delay: .7s, 0s; }
  .s3 { animation-delay: 1.4s, 0s; }
  @keyframes spin { to { rotate: 540deg; } }

  /* PC：イラストがゆっくり遅れて動く（視差） */
  @media (min-width: 900px) {
    .hero-photo { animation: drift linear both; animation-timeline: scroll(root); animation-range: 0 900px; }
    @keyframes drift { to { translate: 0 110px; } }
  }

  /* 背景の丸がスクロールで上下する */
  .works { view-timeline: --works block; }
  .interview { view-timeline: --interview block; }
  .works::before, .interview::after { animation: float-up linear both; }
  .works::after, .interview::before { animation: float-down linear both; }
  .works::before, .works::after { animation-timeline: --works; }
  .interview::before, .interview::after { animation-timeline: --interview; }
  @keyframes float-up { from { translate: 0 80px; } to { translate: 0 -80px; } }
  @keyframes float-down { from { translate: 0 -60px; } to { translate: 0 60px; } }
}

@media (prefers-reduced-motion: reduce) {
  .site-header::after { display: none; }
}
