/* Sidebar layout for desktop: a sticky left column (.post-aside) holds
   the CTA button and TOC, vertically aligned with the start of the
   article body. The TOC column auto-sizes to its longest item so titles
   never wrap. On mobile, .post-layout is a no-op block container, so
   .post-aside (CTA + TOC) and .post-main (article) flow vertically. */
@media (min-width: 1100px) {
  .container { max-width: 1280px; }
  .post-layout {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 48px;
    align-items: start;
  }
  .post-aside {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin: 0;
    scrollbar-width: none;          /* Firefox: hide scrollbar */
  }
  .post-aside::-webkit-scrollbar { display: none; }  /* Chrome / Safari / Edge */
  .post-aside .cta-inline {
    display: block;
    margin: 0 0 16px;
    text-align: center;
    white-space: nowrap;            /* Keep CTA on a single line so column auto-sizes to fit it */
  }
  .post-aside .toc { margin: 0; font-size: 0.9rem; }
  .post-layout > .post-main { min-width: 0; }
  .post-layout > .post-main > h2:first-of-type { margin-top: 0; }
}
/* Split hero on post pages: feature image (left) + tier-list screenshot (right) */
.hero.is-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  aspect-ratio: 16 / 9;
  background: var(--bg);
}
.hero.is-split > a,
.hero.is-split > .hero-feature { display: block; height: 100%; overflow: hidden; }
.hero.is-split img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-feature { position: relative; margin: 0; }
.hero-feature-caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 16px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 35%, transparent 65%);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.hero-feature:hover .hero-feature-caption { opacity: 1; }
@media (hover: none) { .hero-feature-caption { opacity: 1; } }
@media (max-width: 700px) {
  .hero.is-split { grid-template-columns: 1fr; aspect-ratio: auto; }
  .hero.is-split > a,
  .hero.is-split > .hero-feature { aspect-ratio: 16 / 9; }
}
/* Keep TOC entries on a single line each */
.toc-section > a, .toc-meta > a, .toc-items li, .toc-items a, .toc-sub-list li, .toc-sub-list a { white-space: nowrap; }
/* Static site nav (matches landing page visually; no React required) */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-nav .nav-brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.site-nav .nav-brand:hover { color: var(--accent); }
.site-nav .nav-links { display: flex; gap: 24px; list-style: none; padding: 0; margin: 0; }
.site-nav .nav-links a { color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.15s ease; }
.site-nav .nav-links a:hover { color: var(--accent); }
.site-nav .nav-links a.is-current { color: var(--accent); }
@media (max-width: 600px) {
  .site-nav { padding: 10px 16px; }
  .site-nav .nav-links { gap: 14px; }
  .site-nav .nav-links a { font-size: 0.82rem; }
}
/* Related articles as a 3-up image grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card-image {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0d0d0d;
  overflow: hidden;
}
.related-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-card-body { padding: 12px 16px; }
.related-card-title { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.related-card-meta { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 700px) { .related-grid { grid-template-columns: 1fr; } }
.toc-list, .toc-list ul { list-style: none; padding: 0; margin: 0; }
.toc-section > a { font-weight: 600; color: var(--text); display: inline-block; padding: 6px 0; text-decoration: none; }
.toc-section > a:hover { color: var(--accent); }
.toc-section > ul { margin: 0 0 14px; padding-left: 0; }
.toc-tier-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.toc-tier-row .tier-pill {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  color: #111;
  margin-top: 2px;
  min-width: 18px;
  text-align: center;
}
.tier-pill.tier-s { background: var(--s); }
.tier-pill.tier-a { background: var(--a); }
.tier-pill.tier-b { background: var(--b); }
.tier-pill.tier-c { background: var(--c); }
.toc-tier-row .toc-items { flex: 1; }
.toc-items li { margin-bottom: 3px; font-size: 0.82rem; line-height: 1.4; }
.toc-items a { color: #ccc; text-decoration: none; }
.toc-items a:hover { color: var(--accent); }
.toc-meta { margin-top: 8px; font-size: 0.85rem; }
.toc-meta a { color: var(--muted); text-decoration: none; }
.toc-meta a:hover { color: var(--accent); }
.toc-sub-list { padding-left: 12px; margin-top: 4px; }
.toc-sub-list li { margin-bottom: 2px; font-size: 0.78rem; }
.toc-sub-list a { color: var(--muted); text-decoration: none; }
.toc-sub-list a:hover { color: var(--accent); }
.favorite-star { display: inline-block; color: var(--accent); margin-left: 4px; font-size: 0.9em; }
.toc-items .favorite-star { font-size: 0.85em; margin-left: 3px; }
/* Hero image is a link to the interactive demo */
.hero a { display: block; height: 100%; text-decoration: none; }
.hero img { transition: transform 0.4s ease, opacity 0.2s ease; }
.hero a:hover img { transform: scale(1.005); opacity: 0.96; }
/* Inline CTA button — sits right above the TOC */
.cta-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 1.05rem;
  margin: 0 0 32px;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.cta-inline:hover { opacity: 0.92; transform: translateY(-1px); }
@media (max-width: 700px) {
  .cta-inline { font-size: 0.92rem; padding: 11px 18px; }
}
html { scroll-behavior: smooth; }
h2[id], [id^="item-"] { scroll-margin-top: 24px; }
