/* "Best ___ for high cholesterol" product guides: sortable ranking table and
   band chips. Loaded only by those pages, after styles.css. */

.article-body table.pg-table {
  min-width: 0;
  font-size: 0.9375rem;
}

.article-body table.pg-table th,
.article-body table.pg-table td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

/* Number and band columns shrink to their content; the product name takes
   the rest of the width. */
.article-body table.pg-table th:last-child,
.article-body table.pg-table td:last-child,
.article-body table.pg-table th:not(:nth-child(2)),
.article-body table.pg-table td:not(:nth-child(2)) {
  width: 1%;
}

.article-body table.pg-table td:not(:nth-child(2)) {
  white-space: nowrap;
}

.pg-table caption {
  caption-side: bottom;
  text-align: left;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding-top: var(--space-2);
}

.pg-table th button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  color: inherit;
  line-height: 1.3;
}

.pg-table th button:focus-visible {
  outline: 2px solid var(--vitality-green);
  outline-offset: 2px;
  border-radius: 2px;
}

.pg-table th button::after {
  content: "↕";
  font-size: 0.75em;
  opacity: 0.4;
}

.pg-table th[aria-sort="ascending"] button::after {
  content: "↑";
  opacity: 1;
}

.pg-table th[aria-sort="descending"] button::after {
  content: "↓";
  opacity: 1;
}

.pg-table td a {
  color: var(--text-primary);
  text-decoration: none;
}

.pg-table td a:hover {
  text-decoration: underline;
}

.pg-table td strong {
  color: var(--text-primary);
}

.pg-meta {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.pg-band {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.pg-band--better {
  background: #e3f5e8;
  color: #1b6b2f;
}

.pg-band--occasional {
  background: #fff3d6;
  color: #7a5200;
}

.pg-band--treat {
  background: #fde4e1;
  color: #9b2c1f;
}

.pg-picks {
  margin: var(--space-4) 0 var(--space-2);
  padding-left: 1.25rem;
}

/* On phones keep the four columns that matter: product, sat fat, the
   guide's key metric (% of the daily limit, fibre, wholegrain or added sugar)
   and band. Columns marked pg-hide-sm by scripts/productGuides.js return on
   wider screens. */
@media (max-width: 640px) {
  .article-body table.pg-table {
    font-size: 0.875rem;
  }

  .article-body table.pg-table th,
  .article-body table.pg-table td {
    padding: 6px 5px;
  }

  .pg-table .pg-hide-sm {
    display: none;
  }

  .pg-band {
    padding: 1px 6px;
    font-size: 0.75rem;
  }
}
