/* グラデーション */
.has-gradient-purple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.has-gradient-orange {
  background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.has-gradient-blue {
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* カスタムグラデーション：開始・終了色はブロック属性からCSS変数で渡される */
.has-gradient-custom {
  background: linear-gradient(135deg, var(--fuwari-grad-start, #667eea) 0%, var(--fuwari-grad-end, #764ba2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* アニメーション（初期状態）
   JSが有効（html.js）の場合のみ非表示にする。
   JS無効・読み込み失敗時はそのまま表示され、コンテンツが消えない */
html.js .animate-fade-up,
html.js .animate-fade-down,
html.js .animate-fade-in {
  opacity: 0;
}

html.js .animate-fade-up {
  transform: translateY(30px);
}

html.js .animate-fade-down {
  transform: translateY(-30px);
}

/* 見える時点でアクティブ */
.animate-fade-up.in-view {
  animation: fade-up 0.6s ease-out forwards;
}

.animate-fade-down.in-view {
  animation: fade-down 0.6s ease-out forwards;
}

.animate-fade-in.in-view {
  animation: fade-in 0.6s ease-out forwards;
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-down {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

/* ボックスリビール
   色付きボックスが要素を覆った状態から、画面に入ると右へスライドアウトして中身が現れる。
   ボックスの色は --fuwari-reveal-color で変更可能（テーマの追加CSSなどで上書き） */
html.js .animate-box-reveal {
  position: relative;
  visibility: hidden;
}

html.js .animate-box-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  visibility: visible;
  background: var(--fuwari-reveal-color, #667eea);
  transform: scaleX(1);
  transform-origin: right;
}

html.js .animate-box-reveal.in-view {
  visibility: visible;
}

html.js .animate-box-reveal.in-view::after {
  animation: box-reveal-out 0.7s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes box-reveal-out {
  to {
    transform: scaleX(0);
  }
}

/* ボックスリビール：スライドアウト方向（デフォルトは右） */
html.js .animate-box-reveal.reveal-dir-left::after {
  transform-origin: left;
}

html.js .animate-box-reveal.reveal-dir-up::after,
html.js .animate-box-reveal.reveal-dir-down::after {
  transform: scaleY(1);
}

html.js .animate-box-reveal.reveal-dir-up::after {
  transform-origin: top;
}

html.js .animate-box-reveal.reveal-dir-down::after {
  transform-origin: bottom;
}

html.js .animate-box-reveal.reveal-dir-up.in-view::after,
html.js .animate-box-reveal.reveal-dir-down.in-view::after {
  animation-name: box-reveal-out-y;
}

@keyframes box-reveal-out-y {
  to {
    transform: scaleY(0);
  }
}

/* ボックスリビール：色プリセット（デフォルトはPurple #667eea） */
.animate-box-reveal.reveal-color-orange {
  --fuwari-reveal-color: #f7971e;
}

.animate-box-reveal.reveal-color-blue {
  --fuwari-reveal-color: #4facfe;
}

.animate-box-reveal.reveal-color-dark {
  --fuwari-reveal-color: #1a1a1a;
}

/* テキスト・画像交互レイアウト
   デスクトップ幅で列の並び順を反転。モバイルは通常の縦積みのまま */
@media (min-width: 782px) {
  .wp-block-columns.columns-alternating {
    flex-direction: row-reverse;
  }
}

/* アクセシビリティ：動きを減らす設定のユーザーにはアニメーション無効 */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-up,
  .animate-fade-down,
  .animate-fade-in,
  .animate-box-reveal {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    animation: none !important;
  }

  .animate-box-reveal::after {
    content: none !important;
  }
}
