/* ========================================
   worry-ranking.css — 悩み記事用ランキングカード
   全悩み別記事（離れ乳・脇肉・垂れ・苦しい・肩こり）で共通使用
   ======================================== */

html { scroll-behavior: smooth; }

/* ===== ラッパー ===== */
.nt-worry-ranking {
  margin: 28px 0 36px;
}

.nt-worry-ranking__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ===== カード本体 ===== */
.nt-worry-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px 16px 18px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== 順位バッジ（金/銀/銅） ===== */
.nt-worry-card__rank-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  z-index: 1;
}

.nt-worry-card--rank-1 .nt-worry-card__rank-badge { background: #D4AF37; }
.nt-worry-card--rank-2 .nt-worry-card__rank-badge { background: #B8B8B8; }
.nt-worry-card--rank-3 .nt-worry-card__rank-badge { background: #CD7F32; }
.nt-worry-card--rank-4 .nt-worry-card__rank-badge { background: #8B6914; }

/* ===== 商品画像 ===== */
.nt-worry-card__image {
  width: 100%;
  margin: 4px 0 12px;
}

.nt-worry-card__image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* ===== 商品名 ===== */
.nt-worry-card__name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-brown-dark);
  margin: 0 0 8px;
  min-height: 2.9em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 一言推奨理由 ===== */
.nt-worry-card__reason {
  font-size: 12px;
  color: var(--color-text-light);
  margin: 0 0 14px;
  line-height: 1.5;
  flex: 1;
}

/* ===== 詳細を見るボタン ===== */
.nt-worry-card__btn {
  display: inline-block;
  background: var(--color-brown);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.nt-worry-card__btn:hover {
  background: #c46a4d;
  text-decoration: none;
}

/* ===== スマホ（767px以下）：縦積み ===== */
@media (max-width: 767px) {
  .nt-worry-ranking__inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .nt-worry-card {
    flex-direction: row;
    text-align: left;
    padding: 20px 14px 16px;
    gap: 14px;
    align-items: center;
  }

  .nt-worry-card__rank-badge {
    top: -11px;
    left: 16px;
    transform: none;
  }

  .nt-worry-card__image {
    width: 76px;
    flex-shrink: 0;
    margin: 0;
  }

  .nt-worry-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .nt-worry-card__name {
    min-height: auto;
    text-align: left;
    font-size: 13px;
    margin-bottom: 4px;
    justify-content: flex-start;
  }

  .nt-worry-card__reason {
    text-align: left;
    margin-bottom: 10px;
    font-size: 11px;
  }

  .nt-worry-card__btn {
    font-size: 12px;
    padding: 7px 18px;
  }
}

/* ===== 2商品カード（厳選2選・PC2列／スマホ縦積み） ===== */
.nt-worry-ranking--2 .nt-worry-ranking__inner {
  grid-template-columns: repeat(2, 1fr);
}

.nt-worry-ranking--2 .nt-worry-card__image {
  width: 209px;
  max-width: 100%;
}

/* TYPE A / TYPE B バッジ：両方同色（順位感を消す・ブラウン系） */
.nt-worry-ranking--2 .nt-worry-card .nt-worry-card__rank-badge {
  background: #B8895C;
  color: #fff;
}

@media (max-width: 767px) {
  .nt-worry-ranking--2 .nt-worry-ranking__inner {
    grid-template-columns: 1fr;
  }
  /* CSS詳細度の罠回避：モバイル用も同じ詳細度 */
  .nt-worry-ranking--2 .nt-worry-card__image {
    width: 76px;
    max-width: none;
  }
}

/* ===== 4商品カード（2×2グリッド） ===== */
.nt-worry-ranking--4 .nt-worry-ranking__inner {
  grid-template-columns: repeat(2, 1fr);
}

.nt-worry-ranking--4 .nt-worry-card__image {
  width: 150px;
  max-width: 100%;
}

@media (max-width: 767px) {
  .nt-worry-ranking--4 .nt-worry-ranking__inner {
    grid-template-columns: 1fr;
  }

  /* モバイルでは209px指定を上書きして通常の76pxに戻す */
  .nt-worry-ranking--4 .nt-worry-card__image {
    width: 76px;
    max-width: none;
  }
}

/* ===== アンカージャンプ：stickyヘッダー分オフセット ===== */
#product-1,
#product-2,
#product-3,
#product-4 {
  scroll-margin-top: 80px; /* PC：ヘッダー66px + 余白14px */
}

@media (max-width: 680px) {
  #product-1,
  #product-2,
  #product-3,
  #product-4 {
    scroll-margin-top: 165px; /* スマホ：ヘッダー149px（375px幅縦積み）+ 余白16px */
  }
}

/* ===== 悩み記事テーブルスタイル統一（page-worryクラスでスコープ限定） ===== */

/* ゼブラストライプを無効化 */
.page-worry .post-body tr:nth-child(odd) td,
.page-worry .post-body tr:nth-child(even) td {
  background: #ffffff !important;
}

/* th（左セル）の背景をサイトカラーに統一（インラインstyle上書き） */
.page-worry .post-body th {
  background: #fdeae0 !important;
  font-weight: 700;
}
