/* =========================================================================
   商品ページ 購入まわり（2026-11-26）
   -------------------------------------------------------------------------
   functions.php で is_product() のときだけ読み込む。
     1. 送料・お届けの案内（.mcl-ship-note。カートボタンの直前に出力）
     2. お支払い方法の一覧（.mcl-pay-note。カートボタンの下に出力）
     3. 追従カートバー（js/single-product-sticky-cart.js と対）
     4. スマホの最初の画面を詰める（パンくず・サムネイル・商品名）
   ========================================================================= */

/* ---- 0. この商品の特長（.mcl-reasons。送料案内の上に出力。文言は商品のカスタムフィールド mcl_reasons） ---- */
.single-product .mcl-reasons {
  margin: 0.75rem 0 1rem;
  padding: 0;
  list-style: none;
  color: #333;
  font-size: 0.9rem;
  line-height: 1.6;
}

.single-product .mcl-reasons li {
  position: relative;
  margin: 0 0 0.35rem;
  padding-left: 1.4em;
}

/* 「ブレンドするなら：」の精油名リンク。本文と同じ色のまま、下線でリンクと分かるようにする */
.single-product .mcl-reasons a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #b98a4e; /* 精油の琥珀色 */
  text-underline-offset: 0.25em;
}

/* 行頭の小さな葉色の丸 */
.single-product .mcl-reasons li::before {
  content: "";
  position: absolute;
  left: 0.3em;
  top: 0.62em;
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: #7a8f6a; /* 植物の緑 */
}

/* ---- 1. 送料・お届けの案内 ---- */
.single-product .mcl-ship-note {
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 0.9rem;
  background: #fef5ee; /* サイトの背景ベージュ */
  border-left: 3px solid #b98a4e; /* 精油の琥珀色 */
  color: #333;
  font-size: 0.85rem;
  line-height: 1.6;
}

.single-product .mcl-ship-note p {
  margin: 0;
}

.single-product .mcl-ship-note__main {
  font-size: 0.95rem;
  font-weight: 600;
}

/* 「◯円以上で送料無料」は折り返しても読みやすいよう1かたまりにする */
.single-product .mcl-ship-note__free {
  display: inline-block;
  font-weight: 400;
}

.single-product .mcl-ship-note__sub {
  color: #555;
  font-size: 0.8rem;
}

.single-product .mcl-ship-note a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ---- 2. お支払い方法の一覧（.mcl-pay-note。カートボタンの下に出力） ---- */
.single-product .mcl-pay-note {
  margin: 1.25rem 0 0;
  color: #333;
}

.single-product .mcl-pay-note__title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: #555;
}

.single-product .mcl-pay-note__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* どの項目も高さ 28px にそろえる（アイコンは img/pay/ の SVG。2026-11-27 に文字からアイコンへ変更） */
.single-product .mcl-pay-note__item {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 28px;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}

.single-product .mcl-pay-note__item img {
  display: block;
  max-width: 100%;
  margin: 0;
}

/* logo：画像そのものがカード型の枠を持っているので、枠は足さない */
.single-product .mcl-pay-note__item--logo img {
  height: 28px;
  width: auto;
}

/* frame / label：枠の無い絵を、白いカード型の枠に入れて高さをそろえる */
.single-product .mcl-pay-note__item--frame,
.single-product .mcl-pay-note__item--label {
  gap: 5px;
  padding: 0 8px;
  border: 1px solid #d9d2c9;
  border-radius: 4px;
  background: #fff;
}

.single-product .mcl-pay-note__item--frame img,
.single-product .mcl-pay-note__item--label img {
  height: 16px;
  width: auto;
}

/* ---- 3. 追従カートバー ----
   js/single-product-sticky-cart.js がバーの id を付け替えて .mcl-sticky-cart を付ける。
   旧コードの #sticky-cart-bar 用スタイルは効かなくなるので、枠の見た目はここで定義する
   （中の .sticky-price / .sticky-add-btn は旧コードのスタイルがそのまま効く）。
   出し入れは display ではなく位置と透明度で行う（旧コードと書き込み先を分ける）。 */
.mcl-sticky-cart {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 15px;
  /* iPhone のホームバーにボタンが重ならないようにする */
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);

  /* 既定は画面の下に隠しておく */
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0s linear 0.35s;
}

.mcl-sticky-cart.is-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
  .mcl-sticky-cart,
  .mcl-sticky-cart.is-visible {
    transition: none;
  }
}

/* バーがページ最下部（フッター）を隠さないための余白 */
body.single-product.mcl-sticky-ready {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* ---- 4. スマホの最初の画面を詰める（2026-11-27） ----
   目的：商品画像・商品名・価格をできるだけ1画面に収める。
   画像の左右スワイプは WooCommerce 標準（flexslider）で元から効いている。
   ここで変えるのは「縦の場所を取っている要素」だけ。breakpoint は custom.css と同じ 782px。 */
@media (max-width: 782px) {
  /* パンくず：商品名が長く2〜3行になるので1行に収め、はみ出しは「…」にする */
  .single-product .woocommerce-breadcrumb {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* サムネイル：4列×2段をやめ、小さな横1列（はみ出しは横スクロール）にする */
  .single-product .woocommerce-product-gallery .flex-control-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0 0 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox のスクロールバーを隠す */
  }

  .single-product .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
    display: none; /* Safari / Chrome のスクロールバーを隠す */
  }

  /* WooCommerce 標準の「幅25%・float・4列ごとの改行」を打ち消す */
  .single-product .woocommerce-product-gallery .flex-control-thumbs li,
  .single-product .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) {
    flex: 0 0 52px;
    width: 52px !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
  }

  .single-product .woocommerce-product-gallery .flex-control-thumbs li img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: cover;
  }

  /* 商品名：約50文字あり 1.6rem だと4行前後になる。文言は変えず、文字だけ小さくする */
  body.single-product h1.wp-block-post-title {
    margin-block: 0.6em 0.4em;
    padding-bottom: 0.4em;
    font-size: 1.15rem;
    line-height: 1.45;
  }
}
