/**
 * 基本送料が無料になるまでの進み具合。
 * inc/shipping-progress.php がカートと商品ページの両方に出す。
 *
 * バーは進んだぶんだけ緑、残りはグレー。達成すると全部緑になる。
 * 枠と背景は達成しても変えない。緑にするのはチェックマークと1行目の文字だけで、
 * ブロック全体を塗ると主張が強すぎるため（MyMoods で社長確認済みの方針）。
 *
 * 緑は本サイトのブランド色 rgb(21,136,8) ではなく #34a853 系を使う。
 * ブランド色は告知バーとボタンが占有しており、同じ色で塗ると
 * 「進捗」ではなく「もう一つのボタン」に見えてしまうため。
 */

.nb-ship-progress {
  padding: 14px 18px;
  background: #f7f7f5;
  border: 1px solid #e6e4e0;
  border-radius: 10px;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "lead cost"
    "note cost"
    "bar  cost";
  column-gap: 24px;
  align-items: center;
  box-sizing: border-box;
}

.nb-ship-progress__lead { grid-area: lead; }
.nb-ship-progress__note { grid-area: note; }
.nb-ship-progress__bar  { grid-area: bar; }
.nb-ship-progress__cost { grid-area: cost; }

/* --- 置き場所ごとの外余白 --- */

/* カート: 商品一覧の直前。表との間隔は他ブロックと同じ 36px に合わせる。 */
.nb-ship-progress--cart {
  margin: 0 0 36px;
}

/* 商品ページ: 価格・LINE訴求とカートボタンの間。
   幅は右カラム（.product-redesign__purchase-wrapper）と揃うので指定しない。 */
.nb-ship-progress--product {
  margin: 0 0 20px;
}

/* 0点（デバイスだけ／カートが空）のときは送料の内訳が無い。
   右列が空のまま余白だけ残るのを避け、文言とバーを横いっぱいに使う。 */
.nb-ship-progress:not(:has(.nb-ship-progress__cost)) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "lead"
    "note"
    "bar";
  column-gap: 0;
}

/* 商品ページは横幅が狭い（カラムの中）ので、最初から縦積みにする。
   横に並べると送料の内訳が2〜3行に折り返して読みづらい。 */
.nb-ship-progress--product {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "lead"
    "note"
    "bar"
    "cost";
}

/* --- セット商品の注記（商品ページ）---
   バーとは別部品。バーが「いまのカート」を出すのに対し、
   こちらは「この商品そのもの」の話なので、見た目でも区別できるよう
   枠を持たせず、緑の文字と細い左線だけにする。 */

.nb-ship-setnote {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: -8px 0 20px;
  padding-left: 10px;
  border-left: 3px solid #34a853;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  color: #1a7f4b;
}

/* 文言は1つの塊。中の金額（wc_price の span）が単独で折り返さないよう、
   inline のまま素直に流す。 */
.nb-ship-setnote__text {
  flex: 1 1 auto;
  min-width: 0;
}

.nb-ship-setnote__check {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border-radius: 50%;
  background: #34a853;
  position: relative;
}

.nb-ship-setnote__check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4.5px;
  width: 7px;
  height: 3.5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

@media screen and (max-width: 768px) {
  .nb-ship-setnote {
    font-size: 12px;
  }
}

/* --- 1行目: あと何点 / 達成 --- */

.nb-ship-progress__lead {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nb-ship-progress.is-reached .nb-ship-progress__lead {
  color: #1a7f4b;
}

/* 達成時のチェックマーク。画像を足さずに描く。 */
.nb-ship-progress__check {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #34a853;
  position: relative;
}

.nb-ship-progress__check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4.5px;
  width: 7px;
  height: 3.5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

/* --- 2行目: 対象外の注記。小さく落として圧迫感を出さない --- */

.nb-ship-progress__note {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #8a8078;
}

/* --- バー: 目標の点数だけ升目を並べる --- */

.nb-ship-progress__bar {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.nb-ship-progress__seg {
  flex: 1 1 0;
  height: 6px;
  border-radius: 999px;
  background: #dcdad6;
  transition: background-color 0.25s ease;
}

.nb-ship-progress__seg.is-on {
  background: #34a853;
}

/* --- 送料の内訳 --- */

.nb-ship-progress__cost {
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid #e6e4e0;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  max-width: 320px;
}

.nb-ship-progress__cost-label {
  font-weight: 700;
}

/* 免除が効いたときの二重価格。
   「送料 $40（取り消し線・黒） $30（緑）」で、いくら安くなったかを金額で示す。
   緑は 1行目の「基本送料$10が無料になりました」と同じ #1a7f4b。 */
.nb-ship-progress__cost-was {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  text-decoration: line-through;
  /* 取り消し線が数字に埋もれないよう少しだけ太く見せる */
  text-decoration-thickness: 1.5px;
}

.nb-ship-progress__cost-value {
  font-size: 16px;
  font-weight: 700;
}

/* 二重価格のときだけ実額を緑にする。単価表示のときは黒のまま。 */
.nb-ship-progress__cost-was + .nb-ship-progress__cost-value {
  color: #1a7f4b;
}

.nb-ship-progress__cost-parts {
  font-size: 12px;
  color: #6b6360;
}

/* 商品ページは縦積みなので、区切りを左の縦線から上の横線に変える。 */
.nb-ship-progress--product .nb-ship-progress__cost {
  margin-top: 12px;
  padding-left: 0;
  padding-top: 10px;
  border-left: 0;
  border-top: 1px solid #e6e4e0;
  max-width: none;
}

/* 内訳は達成しても色を変えない。「基本送料$10が無料」という文言そのもので伝える。 */

/* 横に並べる余地が無くなったら縦積みに戻す。
   送料は下に回して、区切りを左の縦線から上の横線に変える。 */
@media screen and (max-width: 900px) {
  .nb-ship-progress {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "lead"
      "note"
      "bar"
      "cost";
  }

  .nb-ship-progress__cost {
    margin-top: 12px;
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid #e6e4e0;
    max-width: none;
  }
}

@media screen and (max-width: 768px) {
  .nb-ship-progress {
    padding: 12px 14px;
  }

  .nb-ship-progress__lead {
    font-size: 13px;
  }

  .nb-ship-progress__cost {
    font-size: 12px;
  }

  .nb-ship-progress__cost-value {
    font-size: 15px;
  }

  .nb-ship-progress__cost-parts {
    font-size: 11px;
    /* 長いので単独行に落とす。折り返しで金額と混ざらないようにする */
    flex-basis: 100%;
  }
}
