/* ================ 銘柄別ランキング(/ranking/by_category.html) ==================== */
/* 国別ランキング用のスタイル */
.country-rankings {
  margin-top: 16px;
}
.country-ranking-section {
  margin-bottom: 32px;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2, #fafafa);
}
.country-ranking-header h2 {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--text, #333);
  border-bottom: 2px solid var(--accent, #0070f3);
  padding-bottom: 8px;
}

/* 全件表示用グリッド（増分表示対象） */
.country-all-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

/* ====== ランキングカード（写真メイン） ====== */
.ranking-card-wrapper {
  position: relative;
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-1, #fff);
  box-shadow: 0 2px 8px var(--shadow, rgba(0, 0, 0, 0.08));
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.ranking-card-wrapper:hover,
.ranking-card-wrapper:focus-within {
  transform: translateY(-2px);
  border-color: var(--accent, #0070f3);
  box-shadow: 0 8px 18px var(--shadow, rgba(0, 0, 0, 0.18));
}

/* カード全体クリック用（ボタンはz-indexで上に出す） */
.ranking-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-decoration: none;
  color: inherit;
}

.ranking-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2, #f5f5f5);
}

.ranking-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.2s ease;
}

.ranking-card-wrapper:hover .ranking-card-img,
.ranking-card-wrapper:focus-within .ranking-card-img {
  filter: brightness(0.98);
}

/* カード内の順位バッジ（左上） */
.ranking-position {
  background: linear-gradient(135deg, var(--accent, #0070f3), var(--accent-hover, #0056b3));
  color: var(--accent-contrast, #fff);
  border-radius: 50%;
  border: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
}

.ranking-position span {
  position: static;
  inset: auto;
  line-height: 1;
}

/* 写真領域の右下にアクションを重ねる（♡ 左、比較 右） */
.ranking-card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ranking-card-actions form {
  display: inline-block;
}

.ranking-card-name {
  padding: 10px 10px 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text, #333);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* デバッグ表示（後で削除予定の閲覧数） */
.ranking-card-metric {
  padding: 2px 10px 10px;
  font-size: 11px;
  color: var(--muted, #666);
  font-weight: normal;
}

/* もっと見るボタン */
.country-ranking-footer {
  text-align: center;
  margin-top: 16px;
}
.show-more-btn {
  background: linear-gradient(135deg, var(--accent, #0070f3), var(--accent-hover, #0056b3));
  color: var(--accent-contrast, #fff);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.12));
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.show-more-btn:hover {
  filter: brightness(0.98);
  box-shadow: 0 6px 16px var(--shadow, rgba(0, 0, 0, 0.18));
}
.show-more-btn:active {
  transform: translateY(1px);
}
.show-more-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(0, 112, 243, 0.5));
  outline-offset: 2px;
}

/* タブレット用: 768px以上 */
@media screen and (min-width: 768px) {
  .country-ranking-section {
    padding: 16px;
  }

  .country-top3-grid,
  .country-top9-grid,
  .country-all-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  /* 高さはメディア(4:3) + テキストで自動 */
}

/* デスクトップ用: 1024px以上 */
@media screen and (min-width: 1024px) {
  /* 現状、タブレットと同一レイアウト */
}
