/* 配送エリア */
.ec-deliveryArea {
  margin: 2em 0 2em;
  width: 100%;
  font-size: 90%;
}
.ec-deliveryArea__list {
  margin: 0 auto;
  padding: 0;
  > li {
    position: relative;
    padding: 4px 8px 4px 100px;
    margin: 0 0 2px;
    list-style: none;
    color: #ccc;
    background: var(--subBgColor2);
    > span {
      position: absolute;
      left: 28px;
      font-weight: bold;
    }
    &:first-child {
      border-top-left-radius: 10px;
      border-top-right-radius: 10px;
    }
    &:last-child {
      border-bottom-left-radius: 10px;
      border-bottom-right-radius: 10px;
    }
  }
  > li::before {
    font-family: bootstrap-icons;
    content: "\F26B";
    font-size: 120%;
    position: absolute;
    left: 9px;
  }
  > li.available {
    color: black;
    &::before {
      content: "\F26A";
    }
  }
}

.masumoto-categories {
  > .nav-tabs {
    --bs-border-color: var(--accentBgColor);
    --bs-nav-tabs-link-hover-border-color: var(--accentBgColor);
    .nav-link {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px;
      font-size: 16px;
      color: inherit;
      &:hover {
        text-decoration: none;
      }
      /* 割菱: 小さな正方形 4 つを 2×2 に並べて 45 度回す */
      &::before {
        content: "";
        flex: none;
        width: 12px;
        height: 12px;
        background:
          linear-gradient(var(--accentBgColor), var(--accentBgColor)) 0 0 / 5px 5px no-repeat,
          linear-gradient(var(--accentBgColor), var(--accentBgColor)) 7px 0 / 5px 5px no-repeat,
          linear-gradient(var(--accentBgColor), var(--accentBgColor)) 0 7px / 5px 5px no-repeat,
          linear-gradient(var(--accentBgColor), var(--accentBgColor)) 7px 7px / 5px 5px no-repeat;
        transform: rotate(45deg) scale(0.75);
      }
      &:not(.active)::before {
        opacity: 0.35;
      }
    }
  }
  /* スマホのカテゴリーの切り替え。見せるのはボタンで、押すのは上に重ねた透明な select */
  > .masumoto-categorySelect {
    display: none;
    position: relative;
    > .btn {
      --bs-btn-color: var(--textColor);
      --bs-btn-border-color: var(--accentBgColor);
      --bs-btn-hover-border-color: var(--accentBgColor);
      --bs-btn-hover-bg: var(--accentBgColor);
      /* ページの字間を受け継がない */
      letter-spacing: normal;
    }
    /* select が上にあるので、触れたときと選択中の見た目はボタンに写す。
       タッチの端末ではタップ後も :hover が残り、select も :focus-visible になるので、
       マウスなどのときだけにする。押している間は、すぐ選択画面が開くので見た目を変えない */
    @media (hover: hover) {
      &:hover > .btn {
        color: var(--bs-btn-hover-color);
        background-color: var(--bs-btn-hover-bg);
        border-color: var(--bs-btn-hover-border-color);
      }
      &:has(> select:focus-visible) > .btn {
        box-shadow: var(--bs-btn-focus-box-shadow);
      }
    }
  }
  & .masumoto-categorySelect__select {
    position: absolute;
    inset: 0;
    width: 100%;
    /* テーマが select の高さを auto !important にしているので、最小の高さで重ねる */
    min-height: 100%;
    appearance: none;
    /* iOS で選ぶときに画面が拡大されないよう 16px 以上にする */
    font-size: 16px;
    opacity: 0;
    cursor: pointer;
    /* Android のタップの強調を出さない */
    -webkit-tap-highlight-color: transparent;
  }
}

/* タブを 1 行に収めるため、割菱を出さずに詰める */
@media (max-width: 900px) {
  .masumoto-categories > .nav-tabs .nav-link {
    padding: 10px 12px;
    &::before {
      display: none;
    }
  }
}

@media (max-width: 768px) {
  .masumoto-categories {
    .nav-tabs {
        display: none;
      }
    > .masumoto-categorySelect {
      display: block;
    }
  }
}

.ec-productRole__freearea {
  .masumoto-oshinagaki {
    font-size: .8em;
    font-weight: bold;
    color: var(--accentBgColor);
    display: flex;
    flex-direction: row;
    gap: .1em;
    &:before,
    &:after {
        content: "";
        flex: 1 1;
        border-bottom: 1px solid var(--accentBgColor);
        margin: auto;
    }
  }
}

/*
 * 商品一覧の上と下のカテゴリーの説明 (管理画面のエディタで書く HTML)。
 * テーマは見出し・段落・箇条書きの余白と印を消しているので、読み物として戻す。
 * 枠の上下には中の要素の余白を出さない (上の説明の下の余白は、お知らせがあるかで mb-5 / mb-3 を枠に付ける)
 */
.masumoto-categoryLead,
.masumoto-categoryDescription {
  overflow-wrap: anywhere;
  /* 古い Safari のネストは & で始まらないセレクタを無視するので、すべて & を付ける */
  & > :first-child {
    margin-top: 0;
  }
  & > :last-child {
    margin-bottom: 0;
  }
  & h1, & h2, & h3, & h4, & h5, & h6 {
    margin: 1.6em 0 .6em;
    line-height: 1.5;
    font-weight: bold;
  }
  & h1, & h2 {
    font-size: 20px;
  }
  & h3 {
    font-size: 18px;
  }
  & h4, & h5, & h6 {
    font-size: 16px;
  }
  & p, & ul, & ol, & blockquote, & table {
    margin: 0 0 1em;
  }
  & ul, & ol {
    padding-left: 1.5em;
  }
  & ul {
    list-style: disc;
  }
  & ol {
    list-style: decimal;
  }
  & img {
    height: auto;
    vertical-align: middle;
  }
  & blockquote {
    padding-left: 1em;
    border-left: 3px solid var(--subBgColor2);
  }
}
@media (max-width: 768px) {
  .masumoto-categoryLead,
  .masumoto-categoryDescription {
    & h1, & h2 {
      font-size: 18px;
    }
    & h3 {
      font-size: 16px;
    }
  }
}

/*
 * 下の説明だけ: 一覧と線で分け、読み物として行を広げ、リンクをアクセント色にする。
 * 上の説明は、テンプレートに直に書いていたころの見た目 (行の高さ・リンクの色) のままにする
 */
.masumoto-categoryDescription {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--subBgColor2);
  line-height: 1.8;
  & a {
    color: var(--accentBgColor);
  }
}
@media (max-width: 768px) {
  .masumoto-categoryDescription {
    margin-top: 32px;
    padding-top: 24px;
  }
}

/* 商品名の上のタグライン。区切りのない長い文字列でも枠からはみ出さないようにする */
.masumoto-tagline {
  color: #7d5a42;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
/* 商品説明・カテゴリーの一覧の下の説明の赤字 (管理画面のエディタの「赤字」)。テーマの赤で、白地とのコントラスト比は 5.7:1 */
.masumoto-red {
  color: #b0413e;
}
/* 商品一覧。商品ごとに 写真 (タグを重ねる)・タグライン・商品名・金額・数量とボタン の 5 行に並べ、
   横に並ぶ商品どうしで行の高さをそろえる (subgrid)。行の間は空けず、商品の段の間は最後の行の下で空ける */
.ec-shelfGrid.masumoto-shelfGrid {
  row-gap: 0;
  .ec-shelfGrid__item {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    row-gap: 0;
    min-width: 0;
  }
  .ec-shelfGrid__item > a {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: 0;
    min-width: 0;
    color: var(--textColor);
    text-decoration: none;
  }
  /* 写真とタグを重ねる入れ物 */
  .masumoto-shelfGrid__photo {
    position: relative;
    align-self: start;
    margin-bottom: 15px;
  }
  /* 写真に薄い枠を付け、角丸は上を大きく、下を小さくする。テーマの写真の角丸は外す。
     写真の下の余白は入れ物に持たせ、入れ物の高さ = 写真の高さにする (タグの max-height の基準) */
  .ec-shelfGrid__item p.ec-shelfGrid__item-image {
    margin: 0;
    border: 1px solid #e3dcd6;
    border-radius: 10px 10px var(--inputBorderRadius) var(--inputBorderRadius);
    img {
      display: block;
      border-radius: 0;
    }
  }
  /* タグとお届けできる期間。写真の左上に縦に積み、一番上の札の左上は写真の角に沿わせる。
     札が多くても写真の外には出さず、入りきらない札は隠す */
  .masumoto-shelfGrid__tags {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  /* 札の幅は写真の幅までにし、長いお届けできる期間の札も写真の中で折り返す */
  .masumoto-shelfGrid__tag {
    flex: none;
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    color: #fff;
    background: #7d5a42;
    border-radius: 0 0 6px 0;
    &:first-child {
      border-top-left-radius: 10px;
    }
    /* 期間の札は日付の途中で折り返さないが (.masumoto-deliveryPeriodTag)、写真に重ねた中では折り返してよい */
    &.masumoto-deliveryPeriodTag {
      white-space: normal;
    }
  }
  /* テーマの .ec-shelfGrid__item p の余白より強くする */
  .ec-shelfGrid__item p.masumoto-tagline {
    margin: 0 0 2px;
    min-height: 1.5em;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ec-shelfGrid__item p.masumoto-shelfGrid__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: bold;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .ec-shelfGrid__item p.masumoto-shelfGrid__price {
    margin: 6px 0 14px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
  }
  .masumoto-shelfGrid__tax {
    margin-right: 4px;
    font-size: 11px;
  }
  .masumoto-shelfGrid__cart {
    display: flex;
    gap: 8px;
    align-self: end;
    /* ボタンの下から次の段の写真までは、スマホでも 50px にする */
    margin: 0 0 50px;
  }
  /* カゴへ。テーマの .ec-blockBtn--action (ピル形・余白) より強くする */
  .ec-blockBtn--action.masumoto-shelfGrid__cartBtn {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    height: 48px;
    margin: 0;
    padding: 0 4px;
    /* 右下だけ写真の上の角と同じく大きく丸める */
    border-radius: var(--inputBorderRadius) var(--inputBorderRadius) 10px var(--inputBorderRadius);
    white-space: nowrap;
    /* 数量の欄がないとき (在庫なしなど) は、左下も大きく丸める */
    &:only-child {
      border-bottom-left-radius: 10px;
    }
    /* Zen Kaku Gothic New の文字と高さをそろえるため 1.5px 上げる */
    .bi {
      position: relative;
      top: -1.5px;
      font-size: 16px;
    }
  }
}

/* 一覧の数量の欄 [ 1 個 ]。カゴへのボタンと同じ高さ・角丸にする */
.masumoto-listQty {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
  width: 80px;
  height: 48px;
  margin: 0;
  border: 1px solid var(--textColor);
  /* 左下だけ大きく丸める (規格のある商品のグレーの欄も同じ) */
  border-radius: var(--inputBorderRadius) var(--inputBorderRadius) var(--inputBorderRadius) 10px;
  background: var(--bgColor);
  color: var(--textColor);
  font-size: 13px;
  font-weight: 500;
  cursor: text;
  /* テーマが outline を消しているので、欄を選んでいる間は枠を 2px に見せる */
  &:focus-within {
    box-shadow: inset 0 0 0 1px var(--textColor);
  }
  /* テーマの .ec-layoutRole__main input[type="text"] (枠・幅 100%・余白) より強くする */
  .masumoto-listQty__input,
  .ec-layoutRole__main & input.masumoto-listQty__input,
  .ec-layoutRole__main & input.masumoto-listQty__input:focus {
    flex: none;
    box-sizing: border-box;
    width: 36px;
    height: 44px;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--textColor);
    font: inherit;
    font-size: 16px;
    text-align: right;
    box-shadow: none;
    appearance: none;
  }
}
/* 規格のある商品の数量の欄。入力できないので、枠と文字を薄くする */
.masumoto-listQty.masumoto-listQty--disabled {
  border-color: #c4c4c4;
  background: #f2f2f2;
  color: #9a9a9a;
  cursor: not-allowed;
  .masumoto-listQty__input,
  .ec-layoutRole__main & input.masumoto-listQty__input,
  .ec-layoutRole__main & input.masumoto-listQty__input:focus {
    color: #9a9a9a;
    -webkit-text-fill-color: #9a9a9a;
    opacity: 1;
    cursor: not-allowed;
  }
}

@media (max-width: 768px) {
  .ec-shelfGrid.masumoto-shelfGrid {
    .masumoto-shelfGrid__photo {
      margin-bottom: 12px;
    }
    /* 文字を札の上下の真ん中に見せるため、上を 1px 多く、下を 1px 少なくする (札の高さは変わらない) */
    .masumoto-shelfGrid__tag {
      padding: 7px 8px 5px;
    }
    .ec-shelfGrid__item p.masumoto-shelfGrid__name {
      font-size: 15px;
    }
    .ec-shelfGrid__item p.masumoto-shelfGrid__price {
      margin: 4px 0 10px;
      font-size: 14px;
    }
    .masumoto-shelfGrid__cart {
      gap: 6px;
    }
  }
  .masumoto-listQty {
    width: 60px;
    font-size: 12px;
    .masumoto-listQty__input,
    .ec-layoutRole__main & input.masumoto-listQty__input,
    .ec-layoutRole__main & input.masumoto-listQty__input:focus {
      width: 28px;
    }
  }
}
.ec-productRole .masumoto-tagline {
  margin: 0 0 8px;
  font-size: 16px;
}
@media (max-width: 768px) {
  .ec-productRole .masumoto-tagline {
    margin-bottom: 6px;
    font-size: 14px;
  }
}

/* お届け期間のタグ (商品詳細・商品一覧)。並びが折り返すときも、日付の途中では折り返さない */
.masumoto-deliveryPeriodTag {
  white-space: nowrap;
}

/* ページヘッダーが冗長なので、特定のページでは非表示にする */
body#page_shopping,
body#page_shopping_confirm {
  .ec-pageHeader {
    display: none;
  }
}

#news_toast .toast-body > p:not(:first-child) {
  border-top: 2px dashed rgba(255, 255, 255, 0.5);
  margin-top: .7em;
  padding-top: .7em;
}

.concept-content .image {
  margin-bottom: 1em;
}

/* お届け日のカレンダー */
.masumoto-calendar {
  position: relative;
  display: inline-block;
  width: 170px;
  vertical-align: middle;
  .masumoto-calendar__select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
  }
}
.masumoto-calendar__trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: #1d2826 1px solid;
  border-radius: 3px;
  background: #fff;
  color: #1d2826;
  font-size: 14px;
  font-weight: 500;
  .bi {
    font-size: 16px;
  }
  /* 未選択の「日付を選択」は入力欄の見本と同じ役なので、theme.css の ::placeholder と同じ色にする */
  &.is-empty > span {
    color: #8e9492;
  }
  &:disabled {
    opacity: .5;
  }
}
.masumoto-calendar__backdrop {
  display: none;
}
.masumoto-calendar__panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  box-sizing: border-box;
  width: 336px;
  padding: 12px 14px;
  border: #1d2826 1px solid;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(29, 40, 38, .16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transition: opacity .2s, transform .2s, visibility 0s .2s;
}
.masumoto-calendar.is-open .masumoto-calendar__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s, transform .2s;
}
.masumoto-calendar__header {
  display: none;
}
.masumoto-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.masumoto-calendar__weekday {
  color: #5b6563;
  font-size: 12px;
  font-weight: bold;
  line-height: 34px;
  &:nth-child(1) {
    color: #b0413e;
  }
  &:nth-child(7) {
    color: #2e6a9e;
  }
}
.masumoto-calendar__day {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 5px 0;
  border: 0;
  background: #fff;
  color: #1d2826;
  font-weight: 500;
  &:disabled {
    color: #c4c8c7;
    cursor: default;
  }
}
.masumoto-calendar__day--even-month {
  background: #f7f2ec;
}
/* 毎月 1 日とカレンダーの先頭の日に出す月。丸より前に出す */
.masumoto-calendar__mark {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 50%;
  color: #7d5a42;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
  small {
    font-size: 10px;
  }
}
.masumoto-calendar__date {
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  width: min(38px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 15px;
}
/* 月の印の分だけ数字を下げる */
.masumoto-calendar__mark + .masumoto-calendar__date {
  padding-top: 10px;
}
/* 選んだ日の丸は 4px 大きくし、マスの高さは変えずに上下にはみ出させる */
.masumoto-calendar__day[aria-pressed="true"] {
  .masumoto-calendar__mark {
    color: #fff;
  }
  .masumoto-calendar__date {
    width: min(42px, 100%);
    margin: -2px 0;
    background: #7d5a42;
    color: #fff;
    font-weight: bold;
  }
}

/* 欄の始まる位置を揃えるため、ラベルの幅を一番長い「お届け時間」に合わせる */
.ec-orderDelivery__actions .ec-select label {
  display: inline-block;
  min-width: 74px;
}
/* 横の間 24px・縦の間 8px で、幅が足りなければ折り返す。インライン要素の間の空きが入らないよう flex で並べる */
@media (min-width: 769px) {
  .ec-orderDelivery__actions .ec-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    .ec-select:first-child {
      flex-basis: 100%;
    }
    .ec-select {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
    }
    /* 入力エラーは欄の下に出す */
    .ec-select > :not(label, select, .masumoto-calendar) {
      flex-basis: 100%;
    }
    /* テーマの select の下マージンが残ると、欄の高さと縦の間が揃わない */
    .ec-select select {
      margin-bottom: 0 !important;
    }
  }
}

/* スマホでは画面中央のダイアログにする */
@media (max-width: 768px) {
  /* お届け時間は次の行に回るので、横ではなく下に余白を取る */
  .masumoto-calendar {
    margin: 0 0 8px;
  }
  .masumoto-calendar__backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: block;
    background: rgba(29, 40, 38, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility 0s .2s;
  }
  .masumoto-calendar.is-open .masumoto-calendar__backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity .2s;
  }
  .masumoto-calendar__panel {
    position: fixed;
    z-index: 1001;
    top: 50%;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: 480px;
    margin-inline: auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    /* 中身があふれないときや端まで動かしたときも、後ろのページのスクロールや引っぱって再読み込みに渡さない */
    overscroll-behavior: contain;
    padding: 6px 6px 14px;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(29, 40, 38, .3);
    transform: translateY(calc(-50% + 12px)) scale(.98);
  }
  .masumoto-calendar.is-open .masumoto-calendar__panel {
    transform: translateY(-50%);
  }
  .masumoto-calendar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 10px;
  }
  .masumoto-calendar__title {
    font-size: 16px;
    font-weight: bold;
  }
  .masumoto-calendar__close {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: #1d2826;
  }
  .masumoto-calendar__date {
    width: min(46px, 100%);
    font-size: 17px;
  }
  .masumoto-calendar__day[aria-pressed="true"] .masumoto-calendar__date {
    width: min(50px, 100%);
  }
}

/* 選んだお届け日がカテゴリーの不可日の商品の、カートに入れるボタン。テーマの色が !important なので合わせる */
.ec-blockBtn--action.masumoto-undeliverableBtn,
.ec-blockBtn--action.masumoto-undeliverableBtn:hover,
.ec-productRole .ec-productRole__btn .ec-blockBtn--action.masumoto-undeliverableBtn {
  background: #eeeeee !important;
  border-color: #eeeeee !important;
  color: #5b6563 !important;
  opacity: 1;
  cursor: not-allowed;
}

/* カテゴリーのお届け不可日のお知らせ。商品詳細のテーマの文字サイズと中央揃えを受けないようにする */
.masumoto-undeliverableNotice {
  font-size: 14px;
  text-align: left;
}
.masumoto-categories .masumoto-undeliverableNotice {
  margin-bottom: 24px;
}
.ec-productRole .masumoto-undeliverableNotice {
  margin: 12px 0 28px;
}
.masumoto-undeliverableNotice__selected {
  color: #b0413e;
  font-weight: bold;
  white-space: nowrap;
}
.masumoto-undeliverableNotice__pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 100px;
  background: #b0413e;
  color: #fff3cd;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .masumoto-categories .masumoto-undeliverableNotice {
    margin-bottom: 32px;
  }
  .ec-productRole .masumoto-undeliverableNotice {
    margin-bottom: 36px;
  }
}

/* お届け日と郵便番号のシート */
.masumoto-deliverySheet,
.masumoto-deliveryFooter {
  color: #1d2826;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .05em;
}
.masumoto-deliverySheet {
  position: fixed;
  z-index: 1100;
  right: 0;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  padding: 20px 60px 24px;
  border-radius: 12px 12px 0 0;
  background: #fff;
  box-shadow: 0 -8px 24px rgba(29, 40, 38, .16);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .3s ease, visibility .3s;
  /* スマホのカレンダーは position: fixed で画面の中央に出すので、開いたら transform を残さない */
  &.is-open {
    transform: none;
    visibility: visible;
  }
  h2 {
    margin: 0 0 4px;
    font-family: 'Zen Old Mincho', 'Hiragino Mincho ProN', serif;
    font-size: 18px;
    font-weight: bold;
  }
  p {
    margin: 0;
    color: #5b6563;
  }
  .masumoto-calendar__trigger.is-empty > span {
    color: #8e9492;
  }
  /* シートの中では欄の幅いっぱいに広げる */
  .masumoto-calendar {
    display: block;
    width: 100%;
    margin: 0;
  }
}
/* PC のカレンダーは欄の上に開く (スマホは画面中央のダイアログのまま) */
@media (min-width: 769px) {
  .masumoto-deliverySheet .masumoto-calendar__panel {
    top: auto;
    bottom: calc(100% + 6px);
    transform: translateY(6px) scale(.98);
  }
}
.masumoto-deliverySheet__form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-right: 36px;
}
.masumoto-deliverySheet__intro {
  flex: 1;
  min-width: 0;
  align-self: center;
}
.masumoto-deliverySheet__fields {
  display: flex;
  flex: none;
  gap: 16px;
}
.masumoto-deliverySheet__field {
  position: relative;
  display: block;
  margin: 0;
  input {
    display: block;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 10px;
    border: 1px solid #1d2826;
    border-radius: 3px;
    background: #fff;
    color: #1d2826;
    font: inherit;
    font-size: 14px;
  }
  &.is-invalid input {
    border-color: #b0413e;
  }
}
.masumoto-deliverySheet__field--date {
  width: 170px;
}
.masumoto-deliverySheet__field--postal {
  width: 150px;
}
.masumoto-deliverySheet__label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}
/* 「〒」は値に含めず、欄の中の左に重ねる */
.masumoto-deliverySheet__postalInput {
  position: relative;
  display: block;
  input {
    padding-left: 30px;
  }
}
.masumoto-deliverySheet__postalMark {
  position: absolute;
  top: 50%;
  left: 10px;
  color: #1d2826;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}
.masumoto-deliverySheet__error {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 3px;
  color: #b0413e;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  &:empty {
    display: none;
  }
}
/* 横線と「閉じる」はスマホだけ出す */
.masumoto-deliverySheet__grabber,
.masumoto-deliverySheet__dismiss {
  display: none;
}
.masumoto-deliverySheet__actions {
  flex: none;
}
.masumoto-deliverySheet__decide {
  flex: none;
  width: 150px;
  height: 42px;
  border: 0;
  border-radius: 100px;
  background: #7d5a42;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  letter-spacing: .05em;
}
.masumoto-deliverySheet__close {
  position: absolute;
  top: 8px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #1d2826;
}

/* お届けの条件のフッター */
.masumoto-deliveryFooter {
  position: fixed;
  z-index: 1080;
  bottom: 16px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  padding: 12px 14px 12px 18px;
  border: 1px solid #1d2826;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(29, 40, 38, .16);
  transition: opacity .2s ease, visibility .2s;
  dl {
    display: flex;
    margin: 0;
    > div {
      padding: 0 16px;
      border-left: 1px solid #e3dcd6;
      &:first-child {
        padding-left: 0;
        border-left: 0;
      }
    }
  }
  dt {
    margin-bottom: 3px;
    color: #5b6563;
    font-size: 12px;
    font-weight: 500;
  }
  dd {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    &.is-empty {
      color: #5b6563;
    }
    &.is-out {
      color: #b0413e;
    }
  }
}
.masumoto-deliveryFooter__edit {
  flex: none;
  width: 72px;
  height: 40px;
  border: 1px solid #1d2826;
  border-radius: 100px;
  background: #fff;
  color: #1d2826;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  letter-spacing: .05em;
}

/* フッターがページの一番下のリンクに重ならないようにする */
body.has-delivery-condition {
  padding-bottom: 96px;
}

/* 赤いお知らせ。シートが開いている間はフッターと一緒に隠す */
body.has-delivery-condition #news_toast {
  right: 24px;
  bottom: 16px !important;
  left: auto !important;
  padding: 0 !important;
  transform: none !important;
  transition: opacity .2s ease, visibility .2s;
}
body.is-delivery-sheet-open {
  #news_toast,
  .masumoto-deliveryFooter {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-width: 768px) {
  /* シートを開いている間は引っぱって再読み込みを起こさない。あふれていないカレンダーのパネルは
     overscroll-behavior: contain が効かず、なぞるとページの端まで伝わるため */
  html:has(> body.is-delivery-sheet-open) {
    overscroll-behavior-y: none;
  }
  .masumoto-deliverySheet {
    padding: 32px 22px 24px;
    box-shadow: 0 -8px 24px rgba(29, 40, 38, .2);
    /* シートの上で始めた 1 本指のタッチでは、後ろのページのスクロールや引っぱって再読み込みを起こさない。2 本指のズームは残す */
    touch-action: pinch-zoom;
    /* 閉じ始めたら (visibility が切り替わるまでの 0.3 秒も、スワイプで下げて返事を待つ間も)
       シートと帯はタッチを取らず、後ろのページに渡す */
    &:not(.is-open),
    &.is-closing {
      pointer-events: none;
    }
    /* 上端の上 24px からもスワイプを始められるようにする透明な帯。触れるとシートに触れたことになる */
    &::before {
      content: '';
      position: absolute;
      top: -24px;
      right: 0;
      left: 0;
      height: 24px;
    }
    /* 指で下げている間は指に付いてくる (delivery_condition.js) */
    &.is-dragging {
      transition: none;
    }
    .masumoto-calendar__trigger {
      height: 44px;
      font-size: 16px;
    }
  }
  .masumoto-deliverySheet__form {
    display: block;
    padding-right: 0;
  }
  /* 見出しと説明、右上の ✕ は出さない。閉じるのは「閉じる」か下向きのスワイプ */
  .masumoto-deliverySheet__intro,
  .masumoto-deliverySheet__close {
    display: none;
  }
  .masumoto-deliverySheet__grabber {
    position: absolute;
    top: 10px;
    left: 50%;
    display: block;
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: #d6cec7;
    transform: translateX(-50%);
  }
  .masumoto-deliverySheet__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
  }
  .masumoto-deliverySheet__actions {
    display: flex;
    gap: 12px;
  }
  .masumoto-deliverySheet__field {
    width: auto;
    input {
      height: 44px;
      font-size: 16px;
    }
  }
  .masumoto-deliverySheet__postalInput input {
    padding-left: 32px;
  }
  .masumoto-deliverySheet__postalMark {
    font-size: 16px;
  }
  .masumoto-deliverySheet__error {
    position: static;
    display: block;
    margin-top: 4px;
    font-size: 13px;
  }
  .masumoto-deliverySheet__decide {
    display: block;
    width: 65%;
    height: 48px;
  }
  .masumoto-deliverySheet__dismiss {
    display: block;
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0;
    border: 1px solid #7d5a42;
    border-radius: 100px;
    background: #f3ede8;
    color: #7d5a42;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    letter-spacing: .05em;
  }
  .masumoto-deliveryFooter {
    right: 0;
    bottom: 0;
    left: 0;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 10px 16px;
    border: 0;
    border-radius: 0;
    box-shadow: 0 -4px 16px rgba(29, 40, 38, .16);
    letter-spacing: 0;
    dl {
      flex: 1;
      min-width: 0;
      > div {
        padding: 0 10px;
      }
    }
    dt {
      font-size: 11px;
      white-space: nowrap;
    }
  }
  .masumoto-deliveryFooter__edit {
    width: 56px;
    height: 44px;
    font-size: 13px;
    letter-spacing: 0;
  }
  body.has-delivery-condition {
    padding-bottom: 64px;
    #news_toast {
      right: auto;
      bottom: 76px !important;
      left: 50% !important;
      max-width: calc(100% - 24px);
      transform: translateX(-50%) !important;
    }
  }
}

/* 数量の欄 [−][数字][＋]。商品詳細 (.number-area) とカートで同じ枠にする */
.masumoto-qty {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 122px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--textColor);
  border-radius: var(--inputBorderRadius);
  background: var(--bgColor);
  &.is-error {
    border-color: #b0413e;
  }
  /* テーマが outline を消しているので、欄を選んでいる間は枠を 2px に見せる */
  &:focus-within {
    box-shadow: inset 0 0 0 1px var(--textColor);
  }
  &.is-error:focus-within {
    box-shadow: inset 0 0 0 1px #b0413e;
  }
  .masumoto-qty__down,
  .masumoto-qty__up {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--textColor);
    cursor: pointer;
    &:disabled {
      color: #cccccc;
      cursor: default;
    }
    &:focus-visible {
      outline: 2px solid var(--textColor);
      outline-offset: -4px;
      border-radius: var(--inputBorderRadius);
    }
  }
  /* テーマの .ec-layoutRole__main input[type="text"] (枠・幅 100%・余白) より強くする */
  .ec-layoutRole__main & input.masumoto-qty__input:focus {
    border: 0;
  }
  .masumoto-qty__input,
  .ec-layoutRole__main & input.masumoto-qty__input {
    flex: none;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--textColor);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: none;
    appearance: none;
  }
}
@media (hover: hover) {
  .masumoto-qty .masumoto-qty__down:not(:disabled):hover,
  .masumoto-qty .masumoto-qty__up:hover {
    opacity: 0.7;
  }
}
.masumoto-qty__error {
  margin: 6px 0 0;
  color: #b0413e;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.4;
}

/* 商品詳細はカートに入れるボタンと同じ高さにする */
.ec-productRole__btn .masumoto-qty {
  height: auto;
  min-height: 56px;
  align-self: stretch;
}

/* カート。PC は数量の列の中央に欄を置き、エラーはその下に出す */
.ec-cartRow .ec-cartRow__amountColumn {
  .masumoto-cartQty {
    display: flex;
    justify-content: center;
  }
  .masumoto-cartQty__subtotal {
    display: none;
  }
  .masumoto-qty__error {
    text-align: center;
  }
}

@media (max-width: 767px) {
  .masumoto-qty {
    width: 110px;
    .masumoto-qty__down,
    .masumoto-qty__up {
      width: 36px;
    }
    .masumoto-qty__input,
    .ec-layoutRole__main & input.masumoto-qty__input {
      width: 36px;
      /* iOS で欄を選んだときに画面が拡大されないよう 16px にする */
      font-size: 16px;
    }
  }
  .ec-layoutRole__main .ec-productRole__btn .masumoto-qty {
    .masumoto-qty__down,
    .masumoto-qty__up {
      width: 38px;
    }
    input.masumoto-qty__input {
      width: 34px;
    }
  }

  /* カートのスマホ。数量の欄と小計を、商品名の下の 1 行に並べる */
  .ec-cartTable {
    display: block;
  }
  .ec-cartRow {
    display: grid;
    grid-template-columns: 36px 90px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: var(--subBorderColor) 1px solid;
    .ec-cartRow__delColumn {
      grid-row: 1 / span 2;
      grid-column: 1;
      width: auto;
      border: 0;
      .ec-icon {
        width: 36px;
        height: 44px;
      }
    }
    .ec-cartRow__contentColumn {
      display: contents;
    }
    .ec-cartRow__img {
      grid-row: 1 / span 2;
      grid-column: 2;
      width: auto;
      min-width: 0;
      max-width: none;
      padding: 0;
      img {
        display: block;
        width: 100%;
      }
    }
    .ec-cartRow__summary {
      grid-row: 1;
      grid-column: 3;
      align-self: end;
      display: block;
      width: auto;
      margin: 0;
      .ec-cartRow__name {
        margin-bottom: 0;
      }
    }
    .ec-cartRow__amountColumn {
      grid-row: 2;
      grid-column: 3;
      align-self: start;
      display: block;
      width: auto;
      margin-top: 10px;
      border: 0;
      text-align: left;
      /* 幅が足りないときは小計を次の行に回す */
      .masumoto-cartQty {
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
      }
      .masumoto-cartQty__subtotal {
        display: block;
        font-weight: normal;
        letter-spacing: 0;
        white-space: nowrap;
      }
      .masumoto-qty__error {
        text-align: left;
      }
    }
  }
}

/* カゴへ・カゴから先へ・注文手続から先へ進むボタンのアイコン (白い丸) */
/* ボタンの letter-spacing を受けると幅が 22px より広がり、Bootstrap Icons の vertical-align では高さが広がるので外す */
.masumoto-arrowBtn .bi {
  color: #fff;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  &::before {
    display: block;
  }
}
/* 幅いっぱいのボタンは、文言を真ん中のままにして、アイコンを右端から 13px・縦の真ん中に重ねる。高さは変えない。
   right は枠線 1px の内側から測るので 12px */
.ec-blockBtn--action.masumoto-arrowBtn {
  position: relative;
  .bi {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
  }
}
/* 文言の幅のボタンは、文言のすぐ後ろに並べる。上下の負の margin で、ボタンの高さを変えない */
.ec-inlineBtn--action.masumoto-arrowBtn .bi {
  display: inline-block;
  margin: -4px 0 -4px 10px;
  vertical-align: middle;
}

/* 注文手続の領収証のお宛名: 空欄のときに決まる宛名を見本に出すので、色は入力した文字と同じにする */
/* theme.css の ::placeholder (#8e9492 !important) に、詳細度で勝つ */
.ec-input input[data-receipt-name]::placeholder {
  color: inherit !important;
  opacity: 1 !important;
}
/* マウスを載せたとき・フォーカスがあるときは、サイト全体の見本 (theme.css の ::placeholder) と同じ色にする */
.ec-input input[data-receipt-name]:hover::placeholder,
.ec-input input[data-receipt-name]:focus::placeholder {
  color: #8e9492 !important;
  opacity: 1 !important;
}

/* お客様情報の入口 (/shopping/login) */
/* 「会員の方はこちらから」: 灰色の囲みの一言 (theme の .ec-guest__inner p) と同じ見た目 */
.masumoto-shopLogin__lead {
  margin-bottom: 16px;
}
/* 囲みの新規会員登録とゲスト購入の間の水平線 */
.masumoto-shopLogin__rule {
  height: 0;
  margin: 30px 0;
  border: 0;
  border-top: 1px solid #cccccc;
  /* style.min.css (Bootstrap) の hr { opacity: .25 } で薄くなるので戻す */
  opacity: 1;
}
@media (min-width: 769px) {
  /* 囲みの幅を列から決める。display: table の囲みは、中身 (説明文) が短いと列いっぱいに広がらないため */
  #page_shopping_login .ec-guest {
    width: calc(100% - 40px);
  }
  /* ログインのボタンの上限を、囲みのボタンの幅にする。囲みのボタンの幅は
     列の幅 − 囲みの左の margin 40px − 左右の padding (列の幅の 13% ずつ) = 列の幅 × 0.74 − 40px */
  #page_shopping_login .ec-grid3 {
    container-type: inline-size;
    --masumoto-guest-col: calc(100cqw / 3);
  }
  #page_shopping_login .ec-login__actions .ec-blockBtn--cancel {
    max-width: calc(var(--masumoto-guest-col) * 0.74 - 40px);
    /* theme.css の margin: 0 auto では真ん中に寄るので、入力欄の左端に寄せる */
    margin-left: 0;
  }
  /* 「ログイン情報をお忘れですか？」を、ログインのボタンの縦の真ん中にそろえる */
  #page_shopping_login .ec-login .ec-grid2 {
    align-items: center;
  }
  #page_shopping_login .ec-login .ec-login__link {
    margin-top: 0;
    margin-bottom: 0;
  }
}
/* 1023px までは、ログインの列と囲みの列を半分ずつにする (1/3 では囲みのボタンが細く、矢印が文言に重なる) */
@media (min-width: 769px) and (max-width: 1023px) {
  #page_shopping_login .ec-grid3 {
    --masumoto-guest-col: calc(100cqw / 2);
  }
  #page_shopping_login .ec-grid3__cell,
  #page_shopping_login .ec-grid3__cell2 {
    width: 50%;
  }
}
@media (max-width: 768px) {
  #page_shopping_login .ec-grid3 {
    display: flex;
    flex-direction: column;
  }
  /* 768px ちょうどでは style.min.css の列の幅 (1/3・2/3) が効くので、幅いっぱいに戻す */
  #page_shopping_login .ec-grid3__cell,
  #page_shopping_login .ec-grid3__cell2 {
    width: auto;
  }
  /* 灰色の囲みをログインより上に置く。ステップ表示との間はフォームと同じ (0)、ログインの一言との間は 40px。
     ログインに失敗したとき (エラーを見落とさないよう) は、ログインのフォームを先のままにする */
  #page_shopping_login .ec-grid3:not(.masumoto-shopLogin--error) .ec-grid3__cell {
    order: -1;
  }
  #page_shopping_login .ec-grid3:not(.masumoto-shopLogin--error) .ec-guest {
    margin: 0 0 40px;
  }
}

/* 注文手続のお客様情報の「変更」: 入力欄は JS が span (.customer-form) の中に作るので、
   theme.css の .ec-halfInput input (50%) が span の中でさらに半分になる。span を半分の幅にして、入力欄は span いっぱいにする */
.ec-halfInput > .customer-form {
  width: calc(50% - 4px);
}
.ec-halfInput > .customer-form input[type=text] {
  width: 100% !important;
  margin-left: 0;
}
