/**
 * まとめ買い割引の入場時 POPUP（template-parts/bulk-discount-modal.php）。
 *
 * 2026-09 のプレビュー案A に合わせる。
 *   SP：幅 314px の白いダイアログ。大きな「20% OFF」と 1→2→3 の段を縦に積む
 *   PC：幅 760px。左 300px を緑のパネルにして数字を出し、右に本文
 * ブランド緑は #138808（coupon-modal と同じ）。
 */

.nb-bulk-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  isolation: isolate;
  font-family: var(--font-body-family);
  animation: nbBulkFade 0.3s ease;
}

.nb-bulk-modal[hidden] {
  display: none;
}

/* POPUP 中はスクロールを止め、固定ヘッダーを背面に回す（coupon-modal と同じ対策）。 */
html.nb-bulk-modal-open {
  overflow: hidden;
}
html.nb-bulk-modal-open .site-header,
html.nb-bulk-modal-open .nicobay-header,
html.nb-bulk-modal-open .header-wrapper,
html.nb-bulk-modal-open sticky-header,
html.nb-bulk-modal-open header.header,
html.nb-bulk-modal-open .nicobay-campaign-bar,
html.nb-bulk-modal-open nicobay-campaign-bar {
  z-index: 0 !important;
}

@keyframes nbBulkFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nbBulkUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.nb-bulk-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

/* 中身の無い div なので、base.css の `div:empty { display: none }` に消される。
   消えると暗幕が出ず、背景が透けて下の要素（公式LINEのバナー等）が手前に見える
   （2026-10-02 の公開直後の確認で発覚）。:empty も付けて詳細度で勝つ。 */
.nb-bulk-modal__overlay,
.nb-bulk-modal__overlay:empty {
  display: block;
}

.nb-bulk-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 314px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  color: #111;
  border-radius: 4px;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.38);
  animation: nbBulkUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nb-bulk-modal__close {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #767676;
  cursor: pointer;
}

.nb-bulk-modal__close:hover {
  background: #f2f2f2;
}

/* ---------- 本文（SP 基準） ---------- */

.nb-bulk-modal__panel {
  display: none; /* PC だけ */
}

.nb-bulk-modal__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  text-align: center;
}

.nb-bulk-modal__pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: #eef7ec;
  color: #0f6e06;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.nb-bulk-modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: 0;
  color: #111;
  white-space: nowrap;
}

/* SP は見出しを1行にする（2026-10-05）。空いた高さは下の「20%OFF」を大きくして使う。 */
.nb-bulk-modal__title-br {
  display: none;
}

.nb-bulk-modal__hero {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  color: #138808;
  font-family: Poppins, var(--font-body-family), sans-serif;
  line-height: 0.9;
}

.nb-bulk-modal__hero-num {
  font-size: 76px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.nb-bulk-modal__hero-pct {
  font-size: 32px;
  font-weight: 700;
}

.nb-bulk-modal__hero-off {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* 1 → 2 → 3 の段。絵はサブスクLPと同じベイプ（template-parts/bulk-discount-modal.php）。
   --nb-vape-h はグレーの絵（1点・2点）の高さ。つなぎ線の高さ計算にも使う。 */
.nb-bulk-modal__steps {
  --nb-vape-h: 36px;
  --nb-vape-goal-h: 52px;
  --nb-step-label-h: 15px; /* ラベル 10px × 行高 1.5 */
  display: flex;
  align-items: flex-end;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nb-bulk-modal__step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* 絵の並び。LP（.nbs-plan-card__icons）と同じく、絵の幅の約43%（56px に対して 24px）ずつ重ねる。 */
.nb-bulk-modal__step-vapes {
  display: flex;
  align-items: flex-end;
}

.nb-bulk-modal__step-vape {
  display: block;
  width: auto;
  height: var(--nb-vape-h);
}

.nb-bulk-modal__step-vape + .nb-bulk-modal__step-vape {
  margin-left: calc(var(--nb-vape-h) * -0.3);
}

.nb-bulk-modal__step.is-goal .nb-bulk-modal__step-vape + .nb-bulk-modal__step-vape {
  margin-left: calc(var(--nb-vape-goal-h) * -0.3);
}

.nb-bulk-modal__step:not(.is-goal) .nb-bulk-modal__step-vape {
  filter: grayscale(1);
  opacity: 0.55;
}

.nb-bulk-modal__step.is-goal .nb-bulk-modal__step-vape {
  height: var(--nb-vape-goal-h);
}

/* 段と段をつなぐ線。絵の足元ではなく縦中央に引いて ○-○-○ の形にする
   （足元に引くと ◯_◯_◯ に見える。2026-10-05）。高さ＝ラベル＋間隔＋グレーの絵の半分。
   最後の段（目標）に向かう線だけ緑。 */
/* 絵のかたまりの幅（絵1本の幅は高さ×0.7、2本目以降は高さ×0.3 ずつ重なる）。
   つなぎ線の端をこの幅に合わせる。 */
.nb-bulk-modal__step:nth-child(1) { --nb-grp-w: calc(var(--nb-vape-h) * 0.7); }
.nb-bulk-modal__step:nth-child(2) { --nb-grp-w: calc(var(--nb-vape-h) * 1.1);  --nb-prev-w: calc(var(--nb-vape-h) * 0.7); }
.nb-bulk-modal__step:nth-child(3) { --nb-grp-w: calc(var(--nb-vape-goal-h) * 1.5); --nb-prev-w: calc(var(--nb-vape-h) * 1.1); }

.nb-bulk-modal__step + .nb-bulk-modal__step::before {
  content: "";
  position: absolute;
  bottom: calc(var(--nb-step-label-h) + 4px + var(--nb-vape-h) / 2);
  left: calc(-50% + var(--nb-prev-w) / 2 + 4px);
  right: calc(50% + var(--nb-grp-w) / 2 + 4px);
  height: 1.5px;
  background: #d8d8d8;
  z-index: 0;
}
.nb-bulk-modal__step.is-goal::before {
  background: #138808;
}

.nb-bulk-modal__step-label {
  font-size: 10px;
  line-height: 1.5;
  color: #6b6b6b;
  white-space: nowrap;
}

.nb-bulk-modal__step.is-goal .nb-bulk-modal__step-label {
  font-weight: 700;
  color: #0f6e06;
}

.nb-bulk-modal__text {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #4d4d4d;
}

.nb-bulk-modal__text strong {
  color: #111;
  font-weight: 700;
}

.nb-bulk-modal__ship {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border-radius: 3px;
  background: #eef7ec;
  color: #16460c;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  /* SP・PC とも中央揃え（2026-10-05） */
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.nb-bulk-modal__ship svg {
  flex: none;
  color: #0f6e06;
}

.nb-bulk-modal__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
}

.nb-bulk-modal__cta {
  display: block;
  width: 100%;
  padding: 13px 8px;
  border-radius: 3px;
  background: #138808;
  color: #fff !important;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none !important;
  box-sizing: border-box;
}

.nb-bulk-modal__cta:hover {
  background: #0f6e06;
}

.nb-bulk-modal__later {
  padding: 0;
  border: none;
  background: transparent;
  color: #6b6b6b;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.nb-bulk-modal__note {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
  color: #767676;
  /* かたまりは中央、中の行は左揃え。中央揃えのままだと行ごとに書き出しがずれ、
     2行目の全角スペースで「※」の後ろに揃える意味がなくなる。 */
  align-self: center;
  text-align: left;
}

/* ---------- PC：左に緑のパネル ---------- */

@media (min-width: 768px) {
  /* 上辺に緑の線は引かない（白い本文の上に緑が乗って見えるため。2026-10-05） */
  .nb-bulk-modal__dialog {
    display: flex;
    max-width: 880px;
  }

  .nb-bulk-modal__close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    color: #111;
  }

  .nb-bulk-modal__panel {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 52px 36px;
    background: #138808;
    color: #fff;
    box-sizing: border-box;
  }

  .nb-bulk-modal__panel-eyebrow {
    font-family: Poppins, var(--font-body-family), sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    opacity: 0.9;
  }

  /* 「20」を大きく、その右に「%」（上）と「OFF」（下）を縦に積む。
     % の上端を 20 の上端に、OFF の下端を 20 の下端に揃える。 */
  .nb-bulk-modal__panel-lockup {
    display: flex;
    align-items: stretch;
    gap: 6px;
    font-family: Poppins, var(--font-body-family), sans-serif;
    font-weight: 800;
    line-height: 1;
  }

  .nb-bulk-modal__panel-num {
    font-size: 132px;
    line-height: 0.74;
    letter-spacing: -0.05em;
  }

  .nb-bulk-modal__panel-unit {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0 0;
  }

  .nb-bulk-modal__panel-pct {
    font-size: 52px;
    line-height: 0.8;
  }

  .nb-bulk-modal__panel-off {
    font-size: 46px;
    line-height: 0.74;
    letter-spacing: -0.01em;
  }

  .nb-bulk-modal__panel-rule {
    height: 1px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.35);
  }

  .nb-bulk-modal__panel-text {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
  }

  /* PC も本文は中央揃え（2026-10-05） */
  .nb-bulk-modal__body {
    flex: 1 1 auto;
    align-items: center;
    gap: 20px;
    padding: 52px 48px 36px;
    text-align: center;
  }

  .nb-bulk-modal__ship {
    justify-content: center;
  }

  .nb-bulk-modal__title {
    font-size: 28px;
    letter-spacing: 0.01em;
    white-space: normal;
  }

  .nb-bulk-modal__title-br {
    display: inline;
  }

  /* 大きな数字は左パネルが担う */
  .nb-bulk-modal__hero {
    display: none;
  }

  .nb-bulk-modal__steps {
    --nb-vape-h: 50px;
    --nb-vape-goal-h: 72px;
    --nb-step-label-h: 18px; /* ラベル 12px × 行高 1.5 */
  }
  .nb-bulk-modal__step-label {
    font-size: 12px;
  }

  .nb-bulk-modal__text {
    font-size: 15px;
    line-height: 1.8;
  }

  .nb-bulk-modal__ship {
    padding: 14px 16px;
    font-size: 14px;
  }

  .nb-bulk-modal__actions {
    flex-direction: row;
    justify-content: center;
    gap: 18px;
  }

  .nb-bulk-modal__cta {
    width: auto;
    padding: 17px 40px;
    font-size: 16px;
  }

  .nb-bulk-modal__later {
    font-size: 13px;
  }

  .nb-bulk-modal__note {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nb-bulk-modal,
  .nb-bulk-modal__dialog {
    animation: none;
  }
}
