/* Widget 5 — the article's body grid, the "On this page" rail and the "Read next" aside,
   blog design system v2 (v2_article.toc_rail / read_next / toc_mobile).
     220 rail + 48 + 744 prose + 48 + 260 aside = 1320
   Ladder: 3 zones >=1416 · 2 zones 1128-1415 (the aside folds below) · one column <1128
   (the rail is removed, never compressed; the Contents card replaces it). */
.hc-body-grid {
  display: grid;
  grid-template-columns: var(--hc-rail-l) minmax(0, var(--hc-prose)) var(--hc-rail-r);
  column-gap: var(--hc-rail-gap);
  align-items: start;
  margin-top: 64px;
}
.hc-prose { min-width: 0; max-width: var(--hc-prose); }

/* ---- On this page (left rail, sticky) ---- */
.hc-toc {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hc-toc__title,
.hc-aside__label,
.hc-share__rail-label {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--hc-muted);
}
.hc-toc__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 0 -12px;
  padding: 0;
  list-style: none;
}
.hc-toc__item { margin: 0; }
.hc-toc__link {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--hc-body);
  text-decoration: none;
}
.hc-toc__link:hover { color: var(--hc-text); opacity: 1; }
.hc-toc__dot { display: none; }
/* Current section, set by assets/js/toc.js as you read. */
.hc-toc__link.is-current {
  background: var(--hc-chip-on-bg);
  color: var(--hc-chip-on-fg);
  font-weight: 600;
}

/* ---- Read next (right rail) ---- */
.hc-aside {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.hc-rn { display: flex; flex-direction: column; gap: 26px; }
.hc-rn__list { display: flex; flex-direction: column; gap: 28px; }
.hc-body-grid a.hc-rn__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--hc-text);
  text-decoration: none;
}
.hc-rn__thumb {
  display: block;
  aspect-ratio: 260 / 146;
  overflow: hidden;
  border-radius: 14px;
  background: var(--hc-card-on-band);
  box-shadow: inset 0 0 0 1px var(--hc-hair);
}
.hc-rn__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hc-rn__kicker {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--hc-accent);
}
.hc-rn__title { display: block; margin-top: 8px; font-size: 16px; line-height: 1.35; font-weight: 500; color: var(--hc-text); }
.hc-rn__read { display: block; margin-top: 8px; font-size: 13px; color: var(--hc-muted); }
.hc-body-grid a.hc-rn__all {
  display: inline-block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--hc-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---- Contents card (phones and narrow windows) ---- */
.hc-toc-mobile {
  display: none;
  margin: 0 0 32px;
  border-radius: 16px;
  background: var(--hc-card-on-band);
  box-shadow: inset 0 0 0 1px var(--hc-hair);
}
.hc-toc-mobile__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 18px;
  list-style: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--hc-text);
  cursor: pointer;
}
.hc-toc-mobile__summary::-webkit-details-marker { display: none; }
.hc-toc-mobile__count { font-weight: 400; color: var(--hc-muted); }
.hc-toc-mobile__summary svg { flex: none; width: 18px; height: 18px; stroke: var(--hc-muted); transition: transform 0.15s ease; }
.hc-toc-mobile[open] .hc-toc-mobile__summary svg { transform: rotate(180deg); }
.hc-toc-mobile__list { display: flex; flex-direction: column; padding: 0 18px 12px; }
.hc-toc-mobile__list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--hc-body);
  text-decoration: none;
  box-shadow: inset 0 1px 0 var(--hc-hair);
}

/* ---- 1128-1415: two zones; Read next folds below, three across ---- */
@media (max-width: 1415px) {
  .hc-body-grid {
    grid-template-columns: var(--hc-rail-l) minmax(0, var(--hc-prose));
    row-gap: 64px;
  }
  .hc-aside { grid-column: 1 / -1; grid-row: 2; position: static; max-height: none; overflow: visible; }
  .hc-rn__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
}

/* ---- <1128: one column; the rail becomes the Contents card ---- */
@media (max-width: 1127px) {
  .hc-body-grid { display: flex; flex-direction: column; align-items: stretch; row-gap: 48px; margin-top: 30px; }
  .hc-toc { display: none; }
  .hc-toc-mobile { display: block; }
  .hc-prose { width: 100%; max-width: var(--hc-prose); margin-inline: auto; }
  .hc-aside { order: 2; width: 100%; max-width: var(--hc-prose); margin-inline: auto; }
  .hc-rn__list { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Phone: Read next as rows with a small thumb (v2_article.read_next phone) ---- */
@media (max-width: 900px) {
  .hc-rn { gap: 6px; }
  .hc-rn__list { display: flex; flex-direction: column; gap: 0; }
  .hc-body-grid a.hc-rn__card {
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    box-shadow: inset 0 1px 0 var(--hc-hair);
  }
  .hc-rn__thumb { flex: 0 0 112px; width: 112px; height: 63px; aspect-ratio: auto; border-radius: 10px; }
  .hc-rn__kicker { margin-top: 0; }
  .hc-rn__title { margin-top: 4px; }
  .hc-rn__read { margin-top: 4px; }
}

/* Featured-image placeholder (hc_card_thumb): fills any card media box. */
.hc-thumb-ph { display: block; width: 100%; height: 100%; min-height: 100%; }
