/* -------------------------------------
 * グラデーション背景スライドイン見出し（リッチ＆中央揃え版）
 * ------------------------------------- */

/* SWELLの強力な初期CSSに負けないよう、指定を強くしています */
.post_content h2.bg-animate-target {
  position: relative;
  
  /* 要望②：センターにしたい */
  display: block; /* 中央揃えのためにinline-blockを解除 */
  text-align: center !important; /* 文字を中央揃え */
  width: fit-content; /* 背景幅は文字の長さに合わせるプロの技 */
  margin-left: auto !important; /* 左余白を自動にして中央へ */
  margin-right: auto !important; /* 右余白を自動にして中央へ */
  margin-top: 10px; /* 以前の5pxから少し広げてゆとりを持たせる */
  
  /* ▼ 運用・保守用変数 ▼ */
  --bg-gradient: linear-gradient(to right, #362ae0 0%, #3b79cc 50%, #42d3ed 100%);
  --anim-speed: 2.6s;
  
  /* ▼ 文字のデザイン ▼ */
  color: #fff !important; /* 文字色を強制的に白にする */
  font-weight: bold;
  z-index: 1;

  /* 要望①：フォントサイズを大きくしたい */
  font-size: 2.25rem !important; /* SWELLの標準より少し大きく設定 (約36px) */

  /* 要望③：padding（余白）を持たせたい */
  padding: 12px 30px !important; /* 以前の 5px 15px から拡大して高級感を出す */

  /* ブラウザごとの見栄えのブレを修正（ letter-spacing を少し広げてモダンに ） */
  letter-spacing: 0.05em !important; 

  /* SWELLの元々の装飾（線や背景）を強制的に消去 */
  border: none !important;
  background: transparent !important;
}

/* JSの合図（is-active）に合わせて背景アニメーションを発動 */
.post_content h2.bg-animate-target.is-active::before {
  animation: slide-bg var(--anim-speed) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  background: var(--bg-gradient);
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  z-index: -1;
  border-radius: 4px; /* 背景の角を少し丸くして柔らかさを出すオプション */
}

/* 独自のキーフレーム名に変更して競合を防止（オリジナルをそのまま使用） */
@keyframes slide-bg {
  0% {
    opacity: 0;
    transform: scaleX(0) translateX(-5%);
  }
  30% {
    transform: scaleX(1) translateX(0);
  }
  100% {
    transform: scaleX(1) translateX(0);
  }
  30%, 100% {
    opacity: 1;
  }
}