/* ランキングの順位リボン（画像右上の斜め帯「No.1」〜）
   トップ「売れ筋ランキング」（Block/top_sales_ranking_items.twig）と
   商品一覧「人気商品ランキングBEST5」（Product/list.twig）で共用する。
   寸法は参考画像（2026-09-28 奥田さん支給）の実測比率:
   帯の外側の辺＝角から画像幅の約5.7%、内側の辺＝約19%（＝.rank-ribbon の一辺）。
   帯の色: 1位=金 / 2位=銀 / 3位=銅 / 4位以降=赤。 */

.rank-ribbon-host {
  position: relative;
  /* inline の <a> には container-type が効かない（cqw がページ幅基準になる）ためブロック化する */
  display: block;
  container-type: inline-size;
}

.rank-ribbon {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  width: 19%;
  /* スマホの小さな画像でも文字が読める大きさを保つ（画像幅190px未満で最小36px） */
  width: max(19%, 36px);
  aspect-ratio: 1 / 1;
  background: #943232;
  /* 角の小さな三角（約30%）を抜き、内側は対角線で切って斜めの帯にする */
  -webkit-clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%);
  clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%);
  pointer-events: none;
}

.rank-ribbon--1 {
  background: #c0a657;
}

.rank-ribbon--2 {
  background: #a9b5b3;
}

.rank-ribbon--3 {
  background: #9d6640;
}

.rank-ribbon__text {
  position: absolute;
  top: 32.5%;
  left: 67.5%;
  -webkit-transform: translate(-50%, -50%) rotate(45deg);
  transform: translate(-50%, -50%) rotate(45deg);
  color: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Noto Sans JP", sans-serif;
  /* container query 単位に未対応のブラウザ向けの固定値を先に置く */
  font-size: 12px;
  font-size: 5.4cqw;
  font-size: max(5.4cqw, 10px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* 商品一覧「人気商品ランキングBEST5」: 旧来の順位アイコン（各商品の上の rank0N.png）を
   リボンへ置き換えるため消し、アイコン分として空けていた上の余白を詰める。
   アイコンの指定（common.css）はご利用シーン各ページと共用のため、
   商品一覧（.ranking-box）に限って上書きする＝シーンページの表示は変えない。 */
.page-product .section-productbox.ranking-box .section-inner .rank .ranking ul li::before {
  content: none;
}

.page-product .section-productbox.ranking-box .section-inner .rank .ranking ul {
  padding-top: 9rem;
}

@media (max-width: 1100px) {
  .page-product .section-productbox.ranking-box .section-inner .rank .ranking ul {
    padding-top: 3rem;
  }

  .page-product .section-productbox.ranking-box .section-inner .rank .ranking ul li {
    margin-top: 3rem;
  }
}
