/* /clusters tier list + /clusters/:slug detail page */

.clusters-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.clusters-page-header {
  margin-bottom: 1.5rem;
}

.clusters-page-title {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.clusters-page-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 70ch;
}

#clusters-rows {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.clusters-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.clusters-row-label {
  flex: 0 0 90px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.5rem;
}

.clusters-row-cost {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.clusters-row-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.clusters-row-cards {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.clusters-row-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.clusters-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s, transform 0.12s;
  min-width: 200px;
}

.clusters-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.clusters-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 2px solid;
  flex-shrink: 0;
}

.clusters-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.clusters-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clusters-card-star {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.clusters-card-stats {
  display: flex;
  gap: 0.6rem;
  font-size: 0.75rem;
}

.clusters-card-avp {
  font-weight: 700;
  color: var(--accent);
}

.clusters-card-games {
  color: var(--text-muted);
}

/* ------------- Detail page ------------- */

.cluster-detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.cluster-detail-back {
  margin-bottom: 0.5rem;
}

.cluster-detail-back a {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.cluster-detail-back a:hover {
  color: var(--accent);
}

.cluster-detail-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.cluster-detail-icon {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 3px solid;
  flex-shrink: 0;
}

.cluster-detail-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.cluster-detail-title {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cluster-detail-cost {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cluster-detail-star {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.cluster-detail-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.cluster-detail-trait {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cluster-detail-trait-icon {
  width: 14px;
  height: 14px;
}

.cluster-detail-stats {
  display: flex;
  gap: 1.25rem;
}

.cluster-detail-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cluster-detail-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.cluster-detail-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cluster-detail-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Sections */

.cluster-section {
  margin-bottom: 2rem;
}

.cluster-section-title {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

.cluster-section-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  max-width: 70ch;
}

/* Cluster cards */

.cluster-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cluster-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.cluster-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cluster-card-rank {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.cluster-card-tuple {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 auto;
  min-width: 0;
}

.cluster-card-tuple-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.cluster-card-tuple-units {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cluster-card-unit {
  display: block;
  position: relative;
}

.cluster-card-unit img {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  border: 2px solid;
  display: block;
}

.cluster-card-stats {
  display: flex;
  gap: 0.85rem;
  flex-shrink: 0;
}

.cluster-card-stat {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 50px;
}

.cluster-card-stat-value {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.cluster-card-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cluster-card-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cluster-card-trait {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.cluster-card-trait-icon {
  width: 13px;
  height: 13px;
}

.cluster-card-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.cluster-card-row-label {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 200px;
}

.cluster-card-items {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cluster-card-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cluster-card-item img {
  width: 28px;
  height: 28px;
}

.cluster-card-item-stat {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.cluster-card-flex {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cluster-card-flex-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.cluster-card-flex-unit img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 2px solid;
}

.cluster-card-flex-pct {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Best items overall */

.cluster-best-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem;
}

.cluster-best-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cluster-best-item img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.cluster-best-item-body {
  min-width: 0;
}

.cluster-best-item-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-best-item-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.cluster-empty {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.cluster-empty h2 {
  margin-top: 0;
}

.cluster-empty p {
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 auto;
}

/* Cost-bordered images — reuse cost colors from style.css if available;
 * fall back to neutral if not. The tier-list cards put cost-N on the <img>
 * (because the wrapper is an <a>), but the cluster-detail page puts cost-N
 * on the wrapper anchor — so we need both selector forms. */
.clusters-card-icon.cost-1,
.cluster-card-unit.cost-1 img,
.cluster-card-flex-unit.cost-1 img { border-color: #888; }
.clusters-card-icon.cost-2,
.cluster-card-unit.cost-2 img,
.cluster-card-flex-unit.cost-2 img { border-color: #2bbb2b; }
.clusters-card-icon.cost-3,
.cluster-card-unit.cost-3 img,
.cluster-card-flex-unit.cost-3 img { border-color: #2185d0; }
.clusters-card-icon.cost-4,
.cluster-card-unit.cost-4 img,
.cluster-card-flex-unit.cost-4 img { border-color: #b85cd8; }
.clusters-card-icon.cost-5,
.cluster-card-unit.cost-5 img,
.cluster-card-flex-unit.cost-5 img { border-color: #d8b85c; }
.cluster-detail-icon.cost-1 { border-color: #888; }
.cluster-detail-icon.cost-2 { border-color: #2bbb2b; }
.cluster-detail-icon.cost-3 { border-color: #2185d0; }
.cluster-detail-icon.cost-4 { border-color: #b85cd8; }
.cluster-detail-icon.cost-5 { border-color: #d8b85c; }

/* Mobile */
@media (max-width: 768px) {
  .clusters-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .clusters-row-label {
    flex: none;
  }
  .cluster-card-head {
    align-items: flex-start;
  }
  .cluster-card-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .cluster-card-row-label {
    width: auto;
  }
}
