/* Shared by rankings.html (hub) and the individual stock-ranking content
   pages (top-gainers.html, top-losers.html, most-active-stocks.html,
   largest-companies.html, low-pe-stocks.html, dividend-yield-stocks.html,
   growth-stocks.html). All read data/homepage_snapshot.json -- see
   js/rankings.js -- so coverage matches screener.html/index.html's
   dashboard. Reuses the site's white-card / var(--color-border)-border /
   8px-radius table language from css/screener.css rather than introducing
   new visual language, but kept as its own file since these pages are a
   distinct feature (content pages, not a filter tool). */

body {
  background: var(--color-bg);
  color: var(--color-text);
}

.rk-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.2em 1.2em 5em 1.2em;
}

.rk-breadcrumb {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0 0 0.8em 0;
}

.rk-breadcrumb a {
  color: var(--brand-blue);
  text-decoration: none;
}

.rk-breadcrumb a:hover {
  text-decoration: underline;
}

.rk-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 0.6em;
}

.rk-page-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--brand-ink);
  letter-spacing: -0.01em;
  margin: 0 0 0.25em 0;
}

.rk-page-count {
  flex: 0 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 0.45em 1em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-blue);
  white-space: nowrap;
}

.rk-intro {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 68ch;
  margin: 0 0 1.6em 0;
}

.rk-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-ink);
  margin: 1.8em 0 0.7em 0;
}

.rk-section-title:first-of-type {
  margin-top: 0;
}

.rk-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .04);
  overflow-x: auto;
}

.rk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rk-table thead th {
  text-align: left;
  padding: 0.85em 1em;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-surface-soft);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.rk-table td {
  padding: 0.85em 1em;
  border-bottom: 1px solid var(--color-surface-tint);
  vertical-align: middle;
  white-space: nowrap;
}

.rk-table tbody tr:hover {
  background: var(--color-surface-soft);
}

.rk-table tbody tr:last-of-type td {
  border-bottom: none;
}

.rk-col-rank {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.rk-col-right {
  text-align: right;
}

.rk-col-ticker a {
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.rk-col-ticker a:hover {
  text-decoration: underline;
}

.rk-col-name,
.rk-col-industry {
  color: var(--color-text-secondary);
  white-space: normal;
}

.rk-table .rk-positive { color: var(--color-positive); }
.rk-table .rk-negative { color: var(--color-negative); }

.rk-empty-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .04);
  padding: 3em 1.5em;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.rk-related {
  margin-top: 2.4em;
  padding-top: 1.6em;
  border-top: 1px solid var(--color-border);
}

.rk-related h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-ink);
  margin: 0 0 0.8em 0;
}

.rk-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
}

.rk-related-links a {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-radius: 20px;
  padding: 0.5em 1.1em;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.rk-related-links a:hover {
  background: var(--color-surface-tint);
}

/* ===== Hub page (rankings.html) ===== */

.rk-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1em;
  margin-top: 1.6em;
}

.rk-hub-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .04);
  padding: 1.2em 1.3em;
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.rk-hub-card:hover {
  box-shadow: 0 4px 14px rgba(20, 30, 50, .08);
  transform: translateY(-1px);
}

.rk-hub-card-icon {
  font-size: 1.3rem;
  display: block;
  margin-bottom: 0.5em;
}

.rk-hub-card-title {
  display: block;
  font-weight: 700;
  color: var(--brand-ink);
  font-size: 1rem;
  margin-bottom: 0.3em;
}

.rk-hub-card-desc {
  display: block;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .rk-hub-grid {
    grid-template-columns: 1fr;
  }
}
