﻿/* ランキングヘッダー */
.ranking-header {
  text-align: center;
  width: fit-content;
  margin: 0 auto 40px;
  font-family: "Noto Sans JP", sans-serif;
  color: #4c4f51;
  padding-bottom: 14px;
  border-bottom: 1px solid #4c4f51;
}

.ranking-title {
  font-family: "Roboto", sans-serif;
  color: #4c4f51;
  font-weight: 400;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.ranking-subtitle {
  font-weight: 400;
  font-size: 16px;
  line-height: 1;
  margin: 0;
}

/* トップ3ランキング */
.ranking-top3 {
  width: 100%;
  max-width: 1040px;
  height: 400px;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  padding-left: clamp(20px, calc((100vw - 1040px) / 2 + 20px), 20px);
  padding-right: clamp(0px, calc((100vw - 1040px) / 2 + 20px), 20px);
  gap: 32px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ranking-top3::-webkit-scrollbar {
  display: none;
}

/* 1つの商品枠 */
.ranking-top3-item {
  width: 312px;
  height: 397px;
  flex-shrink: 0;
  border-radius: 4px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 4px 4px 0 #87a29e40;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ranking-top3-item__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  gap: 16px;
}

/* 画像とランク表示 */
.ranking-top3-item__image-wrapper {
  position: relative;
  width: 288px;
  height: 288px;
  margin: 0 auto;
  overflow: hidden;
}

.ranking-top3-item__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.ranking-top3-item:hover .ranking-top3-item__img {
  transform: scale(1.1); /* 1.1倍に拡大 */
}

/* 順位表示 */
.ranking-top3-item__rank {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  width: 48px;
  height: 35px;
}

.ranking-top3-item__crown {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 35px;
  object-fit: contain;
  z-index: 1;
}

.ranking-top3-item__rank-number {
  position: absolute;
  top: 15px;
  left: 18px;
  width: 12px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  margin: 0;
  padding: 0;
  z-index: 2;
}

/* 商品情報 */
.ranking-top3-item__info {
  height: 69px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* カテゴリ */
.ranking-top3-item__category-area {
  width: 100%;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ranking-top3-item__category-wrap {
  width: fit-content;
  height: fit-content;
  border: 1px solid #4c4f51;
}

/* カテゴリーがない場合は非表示 */
.ranking-top3-item__category-wrap:empty {
  border: none;
}

.ranking-top3-item__category {
  font-weight: 400;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.05em;
  padding: 8px;
  margin: 0;
}

.ranking-top3-item__name {
  font-weight: 400;
  font-size: 20px;
  line-height: 1.5;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ランキングを見るボタン */
.ranking-view-more {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 120px;
}

.ranking-view-more__link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  transition: color 0.2s ease;
}

.ranking-view-more__link:hover {
  opacity: 0.5;
}

/* arrow */
.ranking-view-arrow {
  position: relative;
  display: inline-block;
  width: 9.7px;
  height: 15.3px;
  margin-left: 16px;
}

.ranking-view-arrow::before,
.ranking-view-arrow::after {
  content: "";
  position: absolute;
  top: calc(50% - 0.5px);
  right: 0;
  width: 12px;
  height: 1px;
  border-radius: 9999px;
  background-color: #4c4f51;
  transform-origin: calc(100% - 0.5px) 50%;
}

.ranking-view-arrow::before {
  transform: rotate(45deg);
}

.ranking-view-arrow::after {
  transform: rotate(-45deg);
}

.ranking-view-more__link:hover .ranking-view-arrow::before,
.ranking-view-more__link:hover .ranking-view-arrow::after {
  background-color: rgba(76, 79, 81, 0.5);
}

/* リキッドレイアウト：1039px～490px */
@media (max-width: 1039px) and (min-width: 490px) {
  .ranking-top3 {
    width: 100%;
    max-width: none;
    height: clamp(184px, 35vw + 4px, 398px);
    padding-left: 2vw;
    padding-right: 2vw;
    gap: 3vw;
  }

  .ranking-top3-item {
    width: clamp(152px, 27vw, 28vw);
    height: clamp(172px, 35vw, 397px);
    padding: 0.8vw;
  }

  .ranking-top3-item__link {
    gap: 1.5vw;
  }

  .ranking-top3-item__image-wrapper {
    width: calc(100% - 2.4vw);
    height: calc(100% - 2.4vw - 6.6vw - 1.5vw);
    aspect-ratio: 1;
  }

  .ranking-top3-item__rank {
    top: clamp(4px, 0.815vw, 1.2vw);
    left: clamp(4px, 0.815vw, 1.2vw);
    width: clamp(30px, 6.11vw, 4.6vw);
    height: clamp(22px, 4.48vw, 3.4vw);
  }

  .ranking-top3-item__crown {
    width: clamp(30px, 6.11vw, 4.6vw);
    height: clamp(22px, 4.48vw, 3.4vw);
  }

  .ranking-top3-item__rank-number {
    top: 68%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(14px, 2.85vw, 1.9vw);
  }

  .ranking-top3-item__info {
    height: 8.15vw;
  }

  .ranking-top3-item__category-area {
    height: 2.6vw;
    margin-bottom: 1.4vw;
  }

  .ranking-top3-item__category-wrap {
    border-width: 0.1vw;
  }

  .ranking-top3-item__category {
    font-size: clamp(12px, 2.4vw, 18px);
    padding: clamp(2px, 1vw, 8px);
  }

  .ranking-top3-item__name {
    font-size: clamp(12px, 1.8vw, 20px);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  /* ランキングを見るボタン */
  .ranking-view-more {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 60px;
  }
}

/* SP版テキストサイズ：767px以下 */
@media (max-width: 767px) {
    
    div.l-container-wrap__body{
        margin: 0;
    }
    
  .p-ranking-content {
    margin-right: -20px;
    margin-left: -20px;
  }

  .ranking-title {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .ranking-subtitle {
    font-size: 14px;
  }

  .ranking-header {
    padding-bottom: 8px;
  }

  .ranking-view-more__link {
    font-size: 12px;
  }

  .ranking-view-arrow {
    width: 4.5px;
    height: 8.1px;
    margin-left: 8px;
  }

  .ranking-view-arrow::before,
  .ranking-view-arrow::after {
    top: calc(50% - 0.25px);
    width: 6px;
    height: 0.5px;
    transform-origin: calc(100% - 0.25px) 50%;
  }
}

/* SP版：490px以下 */
@media (max-width: 490px) {
  .l-container {
    padding: 0 20px;
  }
    
  /* ランキング全体のコンテナ */
  .p-ranking-content {
    color: #4c4f51;
    overflow: hidden;
  }

  /* ランキングヘッダー */
  .ranking-header {
    text-align: center;
    width: fit-content;
    margin: 0 auto 40px;
    font-family: "Noto Sans JP", sans-serif;
    color: #4c4f51;
    padding-bottom: 8px;
    border-bottom: 1px solid #4c4f51;
  }

  .ranking-title {
    font-family: "Roboto", sans-serif;
    color: #4c4f51;
    font-weight: 400;
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0.05em;
    margin: 0;
    margin-bottom: 4px;
  }

  .ranking-subtitle {
    font-weight: 400;
    font-size: 14px;
    line-height: 1;
    margin: 0;
  }

  /* トップ3ランキング  */
  .ranking-top3 {
    width: auto;
    max-width: none;
    height: 180px;
    display: flex;
    justify-content: flex-start;
    margin: 0;
    padding-left: 20px;
    padding-right: 20px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .ranking-top3::-webkit-scrollbar {
    display: none;
  }

  /* 1つの商品枠 */
  .ranking-top3-item {
    width: 167px;
    height: 172px;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 4px;
    margin: 0;
    background: #fff;
    box-shadow: 0px 4px 4px 0px #87a29e40;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .ranking-top3-item__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    gap: 4px;
  }

  /* 画像とランク表示 */
  .ranking-top3-item__image-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    overflow: hidden;
  }

  .ranking-top3-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
  }

  .ranking-top3-item:hover .ranking-top3-item__img {
    transform: scale(1.1); /* 1.1倍に拡大 */
  }

  /* 順位表示 */
  .ranking-top3-item__rank {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 10;
    width: 30px;
    height: 22px;
  }

  .ranking-top3-item__crown {
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 22px;
    object-fit: contain;
    z-index: 1;
  }

  .ranking-top3-item__rank-number {
    position: absolute;
    top: 9px;
    left: 11px;
    width: 9px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: "Roboto", sans-serif;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    margin: 0;
    padding: 0;
    z-index: 2;
  }

  /* 商品情報  */
  .ranking-top3-item__info {
    height: 40px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* カテゴリエリア  */
  .ranking-top3-item__category-area {
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
  }

  .ranking-top3-item__category-wrap {
    width: fit-content;
    height: fit-content;
    border: 0.5px solid #4c4f51;
  }

  /* カテゴリーがない場合は非表示 */
  .ranking-top3-item__category-wrap:empty {
    border: none;
  }

  .ranking-top3-item__category {
    font-weight: 400;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.05em;
    padding: 2px;
    margin: 0;
  }

  .ranking-top3-item__name {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  /* ランキングを見るボタン */
  .ranking-view-more {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 60px;
  }

  .ranking-view-more__link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    transition: color 0.2s ease;
  }

  .ranking-view-more__link:hover {
    opacity: 0.5;
  }

  /*　arrow */
  .ranking-view-arrow {
    position: relative;
    display: inline-block;
    width: 4.5px;
    height: 8.1px;
    margin-left: 8px;
  }
  .ranking-view-arrow::before,
  .ranking-view-arrow::after {
    content: "";
    position: absolute;
    top: calc(50% - 0.25px);
    right: 0;
    width: 6px;
    height: 0.5px;
    border-radius: 9999px;
    background-color: #4c4f51;
    transform-origin: calc(100% - 0.25px) 50%;
  }
  .ranking-view-arrow::before {
    transform: rotate(45deg);
  }
  .ranking-view-arrow::after {
    transform: rotate(-45deg);
  }

  .ranking-view-more__link:hover .ranking-view-arrow::before,
  .ranking-view-more__link:hover .ranking-view-arrow::after {
    background-color: rgba(76, 79, 81, 0.5);
  }
}
