/* ===== Lang Directory — Rating Pages =====
 * Requires ld-primitives.css (loaded as a dependency by LD_Assets).
 * =========================================== */

/* ===== Page wrapper ===== */
.ld-rating-wrap {
  padding: var(--ld-space-4) 0 var(--ld-space-6);
}

@media (min-width: 640px) {
  .ld-rating-wrap { padding: var(--ld-space-6) 0 var(--ld-space-8); }
}

/* ===== Page head ===== */
.ld-rating-page__head {
  margin-bottom: var(--ld-space-4);
}

@media (min-width: 640px) {
  .ld-rating-page__head { margin-bottom: var(--ld-space-6); }
}

.ld-rating-title {
  margin: var(--ld-space-2) 0;
  font-size: clamp(20px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ld-text);
}

.ld-rating-city-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ld-muted);
  margin: 0 0 var(--ld-space-3);
}

.ld-rating-city-subtitle a {
  color: var(--ld-primary);
  text-decoration: none;
}
.ld-rating-city-subtitle a:hover { text-decoration: underline; }

.ld-rating-intro {
  font-size: 14px;
  color: var(--ld-muted);
  line-height: 1.6;
  margin: 0 0 var(--ld-space-4);
}

@media (min-width: 640px) {
  .ld-rating-intro {
    font-size: 15px;
    max-width: 720px;
  }
}

/* ===== Methodology accordion ===== */
.ld-rating-page__methodology {
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius-sm);
  margin-bottom: var(--ld-space-4);
  overflow: hidden;
}

.ld-rating-page__methodology-toggle {
  padding: 12px var(--ld-space-3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ld-muted);
  user-select: none;
  min-height: 44px; /* touch target */
}
.ld-rating-page__methodology-toggle::-webkit-details-marker { display: none; }
.ld-rating-page__methodology-toggle::before {
  content: "ℹ";
  font-size: 16px;
  color: var(--ld-primary);
  font-style: normal;
  flex-shrink: 0;
}
.ld-rating-page__methodology-toggle::after {
  content: "▾";
  margin-left: auto;
  font-size: 12px;
  flex-shrink: 0;
}
.ld-rating-page__methodology[open] .ld-rating-page__methodology-toggle::after { content: "▴"; }

.ld-rating-page__methodology-body {
  padding: 0 var(--ld-space-3) var(--ld-space-3);
  font-size: 13px;
  color: var(--ld-muted);
  line-height: 1.6;
}
.ld-rating-page__methodology-body p:first-child { margin-top: 0; }
.ld-rating-page__methodology-body p:last-child  { margin-bottom: 0; }

/* ===== City filter chips ===== */
.ld-rating-city-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--ld-space-4);
}

.ld-city-chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 2em;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--ld-border);
  color: var(--ld-muted);
  background: var(--ld-surface);
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  /* touch-friendly height */
  line-height: 1.4;
}
.ld-city-chip:hover {
  border-color: var(--ld-primary);
  color: var(--ld-primary);
  background: rgba(30,100,255,.04);
}
.ld-city-chip--active {
  background: var(--ld-primary);
  border-color: var(--ld-primary);
  color: #fff;
}
.ld-city-chip--active:hover {
  background: var(--ld-primary-700);
  border-color: var(--ld-primary-700);
  color: #fff;
}

/* ===== Rating list ===== */
.ld-rating-list {
  list-style: none;
  margin: 0 0 var(--ld-space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ld-space-2);
}

@media (min-width: 640px) {
  .ld-rating-list { margin-bottom: var(--ld-space-6); }
}

/* ===== Rating row: mobile-first ===== */
/* Mobile: rank + [info / score stacked] */
.ld-rating-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  align-items: start;
  gap: var(--ld-space-2) var(--ld-space-2);
  padding: var(--ld-space-3);
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius-md);
  background: var(--ld-surface);
}

.ld-rating-info {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ld-rating-score {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.ld-rating-rank {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  background: var(--ld-border);
  color: var(--ld-muted);
  flex-shrink: 0;
  align-self: start;
  margin-top: 2px;
}

/* Desktop: 4-column single row */
@media (min-width: 640px) {
  .ld-rating-item {
    grid-template-columns: 48px 1fr auto auto;
    grid-template-rows: auto;
    align-items: center;
    gap: var(--ld-space-3);
    padding: var(--ld-space-3) var(--ld-space-4);
    transition: box-shadow .2s, transform .15s;
  }
  .ld-rating-item:hover {
    box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
  }
  .ld-rating-rank {
    grid-column: 1;
    grid-row: 1;
    width: 40px;
    height: 40px;
    font-size: 14px;
    align-self: center;
    margin-top: 0;
  }
  .ld-rating-info {
    grid-column: 2;
    grid-row: 1;
  }
  .ld-rating-score {
    grid-column: 3;
    grid-row: 1;
    flex-wrap: nowrap;
  }
}

/* ===== Medal (top 3) ===== */
.ld-rating-item--rank-1 .ld-rating-rank {
  background: linear-gradient(135deg, #fef08a, #fbbf24);
  color: #78350f;
  box-shadow: 0 2px 8px rgba(251,191,36,.4);
}
.ld-rating-item--rank-2 .ld-rating-rank {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #334155;
}
.ld-rating-item--rank-3 .ld-rating-rank {
  background: linear-gradient(135deg, #fed7aa, #fb923c);
  color: #7c2d12;
}

/* ===== Bureau info ===== */
.ld-rating-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ld-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ld-rating-name:hover {
  color: var(--ld-primary);
  text-decoration: underline;
}

.ld-rating-city {
  font-size: 12px;
  color: var(--ld-muted);
}

/* ===== Score column ===== */
.ld-stars {
  color: var(--ld-star);
  font-size: 13px;
  letter-spacing: -.05em;
  line-height: 1;
}

.ld-avg-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--ld-text);
}

.ld-review-count {
  font-size: 12px;
  color: var(--ld-muted);
}

.ld-no-rating {
  font-size: 12px;
  color: var(--ld-muted);
  font-style: italic;
}

/* ===== Source badges: hidden on mobile, shown at 640px+ ===== */
.ld-rating-sources {
  display: none;
}

@media (min-width: 640px) {
  .ld-rating-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    grid-column: 4;
    grid-row: 1;
  }
}

.ld-src {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 2em;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ld-src small { font-size: 10px; font-weight: 400; opacity: .75; }
.ld-src--google { background: #e8f0fe; color: #1a73e8; }
.ld-src--yandex { background: #fff0ee; color: #d93025; }
.ld-src--2gis   { background: #e8f5e9; color: #1b5e20; }

/* ===== Pagination ===== */
.ld-rating-pagination {
  margin-top: var(--ld-space-4);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ld-rating-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: var(--ld-radius-sm);
  border: 1px solid var(--ld-border);
  font-size: 14px;
  color: var(--ld-text);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.ld-rating-pagination .page-numbers:hover { background: var(--ld-border); }
.ld-rating-pagination .page-numbers.current {
  background: var(--ld-primary);
  border-color: var(--ld-primary);
  color: #fff;
  font-weight: 600;
}

/* ===== Empty state ===== */
.ld-rating-empty {
  padding: var(--ld-space-6);
  text-align: center;
  color: var(--ld-muted);
  background: var(--ld-border);
  border-radius: var(--ld-radius-md);
  font-size: 15px;
}
