/* The knowledge index: the newest article featured, then cards for more articles,
   comparisons, rankings and tools. A whole card is one link. */

@layer components {
.kb-featured { margin: var(--space-5) 0 var(--space-6); }
.kb-feature {
  display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 70%);
  border-left: 4px solid var(--orange);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  &:has(.kb-feature__image) { @media (min-width: 48rem) { grid-template-columns: 2fr 3fr; } }
  &:hover { box-shadow: 0 8px 22px rgb(20 33 61 / 0.1); }
  &:hover .kb-feature__cta [aria-hidden] { transform: translateX(4px); }
  &:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
}
.kb-feature__image { width: 100%; height: 100%; max-height: 18rem; object-fit: cover; }
.kb-feature__body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5) var(--space-5) var(--space-5); max-width: 44rem; }
.kb-feature__title { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 800; line-height: 1.15; font-stretch: var(--narrow); text-wrap: balance; }
.kb-feature__summary { color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.kb-feature__cta {
  margin-top: var(--space-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.85rem;
  & [aria-hidden] { display: inline-block; color: var(--accent-text); transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
}

.kb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: 0.8rem; color: var(--muted); }
.kb-tag {
  /* Quiet labels (owner, 2026-12-04: the orange pills were too strong); orange is kept
     for actions. */
  padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}

.kb-cards {
  list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-6);
  display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.kb-card {
  display: flex; flex-direction: column; gap: var(--space-2); height: 100%; box-sizing: border-box;
  padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  &:hover { border-color: var(--orange); box-shadow: 0 8px 22px rgb(20 33 61 / 0.1); transform: translateY(-2px); }
  &:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
}
.kb-card__title { font-weight: 800; font-size: 1.1rem; line-height: 1.25; }
.kb-card__summary { color: var(--muted); font-size: 0.92rem; line-height: 1.45; & strong { color: var(--text); } }
}

/* Rankings index: wider cards with the top three. */
@layer components {
.kb-cards--wide { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.podium {
  list-style: none; margin: var(--space-2) 0 0; padding: var(--space-2) 0 0; border-top: 1px solid var(--line);
  display: grid; gap: var(--space-2);
  /* Every row two lines: name, then value under it, so rows keep one rhythm whatever
     the value's width ("126–250 mg"). */
  & li { display: grid; grid-template-columns: 1.4rem 1fr; grid-template-areas: "rank name" "rank value"; column-gap: var(--space-2); row-gap: 0; font-size: 0.92rem; }
  & li:nth-child(1) .podium__rank { color: var(--gold); }
  & li:nth-child(2) .podium__rank { color: var(--silver); }
  & li:nth-child(3) .podium__rank { color: var(--bronze); }
}
.podium__rank { grid-area: rank; font-weight: 800; font-size: 1.1rem; font-stretch: var(--narrow); line-height: 1.3; }
.podium__name { grid-area: name; min-width: 0; }
.podium__value { grid-area: value; font-weight: 800; white-space: nowrap; }
.kb-card .kb-feature__cta { margin-top: auto; padding-top: var(--space-2); }
}

/* Ranking cards share rows (subgrid): tag, title, intro, podium and link line up across
   cards whatever the intro's length. */
@layer components {
@supports (grid-template-rows: subgrid) {
  .kb-cards--wide > li { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; }
  .kb-cards--wide .kb-card--ranking { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: var(--space-2); align-content: start; }
  .kb-cards--wide .podium { align-self: start; }
}
}

/* Ranking cards (review, 2026-12-04): the first places as rows with a thumbnail, the
   value on the right and a bar under each row; one card structure everywhere. */
@layer components {
.rank-card { gap: var(--space-2); }
.rank-card__head { display: flex; flex-direction: column; gap: 0.15rem; }
.rank-card__sub { color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.rank-card__note { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.rank-rows { list-style: none; margin: var(--space-2) 0 var(--space-1); padding: var(--space-2) 0 0; border-top: 1px solid var(--line); display: grid; gap: var(--space-3); }
.rank-row {
  display: grid; grid-template-columns: 1.1rem 2rem minmax(0, 1fr) auto; grid-template-areas: "place thumb name value" "place thumb bar bar";
  column-gap: var(--space-2); row-gap: 0.3rem; align-items: center;
}
.rank-row__place { grid-area: place; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank-row__place.rank--1 { color: var(--gold); } .rank-row__place.rank--2 { color: var(--silver); } .rank-row__place.rank--3 { color: var(--bronze); }
.rank-row__thumb { grid-area: thumb; width: 2rem; height: 2.5rem; object-fit: contain; border-radius: 4px; background: var(--surface); }
.rank-row__name { grid-area: name; font-size: 0.88rem; line-height: 1.3; min-width: 0; color: var(--text); }
.rank-row__brand { font-weight: 700; }
.rank-row__value { grid-area: value; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.rank-row__bar { grid-area: bar; height: 0.3rem; border-radius: 999px; background: var(--surface); overflow: hidden;
  & i { display: block; height: 100%; width: var(--share); background: var(--navy); opacity: 0.55; border-radius: inherit; } }
.rank-card .kb-feature__cta { margin-top: auto; color: var(--accent-text); text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
}
