/* ================ ランキング一覧(/ranking/index.html) ==================== */

/* 既存のレイアウトを壊さない範囲で、/ranking/by_category のカードUIに寄せる */

.ranking-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media screen and (min-width: 768px) {
  .ranking-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 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));
}

.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-card-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 40px;
  opacity: 0.8;
}

.ranking-card-wrapper .ranking-position {
  background: linear-gradient(135deg, var(--accent, #0070f3), var(--accent-hover, #0056b3));
  color: var(--accent-contrast, #fff);
  border-radius: 50%;
  border: 0;
  border-top: 0;
  border-right: 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: 2;
}

.ranking-card-wrapper .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;
}

.ranking-card-wrapper.no-data {
  opacity: 0.7;
}
