/* =====================================================================
   追従CTA
   PC: 400 × 300px前後（縮小版）  /  SP(~767px): ボタン2つのみ
   表示対象：トップページ／ブログ詳細／会社情報・FAQ・プライバシーポリシー（inc/sticky-cta.php で条件分岐）
   ===================================================================== */

/* ---- ブレークポイント出し分け ---- */
.sp-only { display: none; }
.sp-hide { display: inline; }

@media (max-width: 767px) {
  .sp-only { display: inline; }
  .sp-hide { display: none; }
}

/* ---- カラー変数 ---- */
:root {
  --cta-navy:    #0E254D;
  --cta-white:   #FFFFFF;
  --cta-bg:      #e7e9ee;
  --cta-gray:    #F6F6F6;
  --cta-black:   #1A1A1A;
  --cta-shadow:  4px 4px 10px 0px rgba(0, 0, 0, 0.25);
  --cta-grad:    linear-gradient(180deg, #EAA418 0%, #D81E18 100%);
}

/* =====================================================================
   カード本体（PC：縮小版 560px → 400px）
   ===================================================================== */
.sticky-cta {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 400px;
  background-color: var(--cta-bg);
  box-shadow: var(--cta-shadow);
  font-family: 'Noto Sans JP', sans-serif;
  z-index: 9999;

  /* 初期状態：非表示 */
  opacity: 0;
  transform: translateY(32px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.sticky-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/*
 * ブログ詳細ページ（PC）は右サイドバーのCTAボタンに集約するため、追従CTAカードを表示しない
 * .sticky-cta は wp_footer で #body_wrap（single-blog クラスの付与先）の外側に出力されるため、
 * 祖先セレクタではなく要素自身に付与した -blogSingle クラスで判定する
 */
.sticky-cta.-blogSingle.is-visible {
  display: none;
}

/* =====================================================================
   ヘッダー（ブルーストライプ＋リードテキスト＋閉じるボタン）
   ===================================================================== */
.sticky-cta__header {
  position: relative;
  height: 38px;
  overflow: hidden;
}

.sticky-cta__header-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 79.5%;
  background-color: var(--cta-navy);
  clip-path: polygon(0 0, 93% 0, 100% 100%, 0 100%);
}

.sticky-cta__lead {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 9px 56px 0 23px;
  color: var(--cta-white);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.111em;
  white-space: nowrap;
}

.sticky-cta__close {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 23px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.sticky-cta__close:hover {
  opacity: 0.7;
}

.sticky-cta__close svg {
  display: block;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* =====================================================================
   ボディ
   ===================================================================== */
.sticky-cta__body {
  padding: 22px 24px 0;
}

.sticky-cta__title {
  margin: 0 0 9px;
  color: var(--cta-navy);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.067em;
}

.sticky-cta__desc {
  margin: 0 0 24px;
  color: var(--cta-navy);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 1px;
}

/* ---- ボタン共通 ---- */
.sticky-cta__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 9px 15px;
  color: var(--cta-white);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
  transition: opacity 0.2s ease;
}

.sticky-cta__btn:hover {
  opacity: 0.85;
}

.sticky-cta__btn--download {
  height: 38px;
  background-color: var(--cta-navy);
  line-height: 1.4;
  margin-bottom: 15px;
}

.sticky-cta__btn--consult {
  padding: 9px 23px;
  background: var(--cta-grad);
  line-height: 1.6;
}

.sticky-cta__arrow {
  flex-shrink: 0;
}

.sticky-cta__icon {
  flex-shrink: 0;
  width: 16px;
  height: auto;
}

/* =====================================================================
   フッター（グレー帯＋注意書き）
   ===================================================================== */
.sticky-cta__footer {
  margin-top: 24px;
  min-height: 31px;
  background-color: var(--cta-bg);
  display: flex;
  align-items: center;
  padding: 8px 10px;
}

.sticky-cta__note {
  margin: 0;
  color: var(--cta-navy);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* =====================================================================
   SP（max-width: 767px）
   ヘッダー／タイトル／説明文／フッターを非表示にし、
   ボタン2つだけを画面下部に横並び固定表示
   ===================================================================== */
@media (max-width: 767px) {

  .sticky-cta {
    width: 100%;
    right: 0;
    left: 0;
    bottom: 0;
    background-color: transparent;
    box-shadow: none;
  }

  /* SPでは通常どおり表示する（PC限定の非表示を解除） */
  .sticky-cta.-blogSingle.is-visible {
    display: block;
  }

  /* ヘッダー・タイトル・説明文・フッターはSPでは非表示 */
  .sticky-cta__header,
  .sticky-cta__title,
  .sticky-cta__desc,
  .sticky-cta__footer {
    display: none;
  }

  /* ボディ＝ボタン2つの横並びバーとして再構成 */
  .sticky-cta__body {
    display: flex;
    padding: 0;
  }

  .sticky-cta__btn {
    flex: 1;
    height: 56px;
    border-radius: 0;
    font-size: 14px;
    margin-bottom: 0 !important;
    font-weight: 400;
    gap: 5px; /* ここで5pxに縮めているため、374px以下でもこれを引き継ぎます */
  }

  .sticky-cta__btn--download {
    height: 56px;
  }

  .sticky-cta__btn--consult {
    height: 56px;
    padding: 12px 16px;
  }

  .p-fixBtnWrap {
    bottom: 76px !important; /* CTAの高さ(56px) + 余白(20px) */
    z-index: 9998 !important; /* CTAの後ろに隠れるように設定 */
  }
}

/* =====================================================================
   SP小型端末（max-width: 374px）
   320pxなどの狭い画面でボタンテキストが折り返さないための調整
   ===================================================================== */
@media (max-width: 374px) {
  .sticky-cta__btn {
    font-size: 11.5px; /* フォントサイズを縮小 */
    padding: 0 4px;    /* 左右の余白を最小限に */
    white-space: nowrap; /* 強制的に1行にする */
  }

  /* 個別ボタンのpadding上書き解除（共通設定を優先させるため） */
  .sticky-cta__btn--consult {
    padding: 0 4px;
  }

  /* アイコンも少しだけ小さくしてスペースを稼ぐ */
  .sticky-cta__icon {
    width: 14px;
  }
}
