/* ── HERO ── */
.hero {
  width: 100%;
  aspect-ratio: 12 / 5;
  min-height: 320px;
  overflow: hidden;
  position: relative;
  background: var(--ink);
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── LAYOUT ── */
.review-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 5rem;
}
.review-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0 2.5rem;
  align-items: start;
}

/* ── SIDEBAR ── */
.review-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-right: 2rem;
  border-right: 0.5px solid var(--rule);
}

/* Desktop: unwrap sidebar-top-row/left-col so items are direct flex children */
.sidebar-top-row { display: contents; }
.sidebar-left-col { display: contents; }

/* Desktop element order: poster → pills → [hr] → meta → share */
.sidebar-poster { order: -10; width: 100%; border-radius: 3px; overflow: hidden; }
.sidebar-poster img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.sidebar-pills  { order: -5; display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-share  { order: 5; padding-top: 1.25rem; border-top: 0.5px solid var(--rule); }

/* Mobile-only title hidden on desktop */
.sidebar-mobile-title { display: none; }

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sidebar-share .meta-label {
  margin-bottom: 0.4rem;
}
.share-icons {
  display: flex;
  gap: 10px;
  align-items: center;
}
.share-icons a svg { transition: fill 0.2s; }
.share-icons a:hover svg { fill: var(--ink) !important; }

/* ── REVIEW BODY ── */
.review-body {
  min-width: 0;
}
.review-title {
  margin-bottom: 0.5rem;
}
.review-byline {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
  padding-bottom: 1.5rem;
  border-bottom: 0.5px solid var(--rule);
  margin-bottom: 1.75rem;
}

/* ── RELATED ── */
.related {
  border-top: 0.5px solid var(--rule);
  padding-top: 2rem;
  margin-top: 3rem;
}
.related-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.related-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.related-grid .poster-card {
  width: 160px;
  flex-shrink: 0;
}
.related-grid .poster-card-img img {
  width: 160px;
  height: 240px;
  object-fit: cover;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .hero { aspect-ratio: 16 / 9; }

  .review-main {
    padding: 1.25rem var(--gutter) 3rem;
  }
  .review-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* sidebar becomes a stacked block above the prose */
  .review-sidebar {
    position: static;
    border-right: none;
    padding-right: 0;
    padding-bottom: 1.5rem;
    margin-bottom: 1.75rem;
    border-bottom: 0.5px solid var(--rule);
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* TOP ROW: left-col (title+pills+share) on left, poster on right */
  .sidebar-top-row {
    display: flex;
    flex-direction: row-reverse;
    gap: 1rem;
    align-items: flex-start;
    order: 0; /* reset from display:contents desktop */
  }
  .sidebar-left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
  }

  /* Mobile title: visible, replaces hidden .review-title */
  .sidebar-mobile-title {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.15;
  }

  /* Poster: fixed width on right */
  .sidebar-poster {
    order: 0;
    width: 100px;
    flex-shrink: 0;
    border-radius: 3px;
    overflow: hidden;
  }
  .sidebar-poster img {
    width: 100px;
    height: 150px;
    aspect-ratio: unset;
    object-fit: cover;
    border-radius: 3px;
    display: block;
  }

  /* Pills reset */
  .sidebar-pills { order: 0; }

  /* Share: visible on mobile (appears at top, mobile-share-bottom at bottom) */
  .sidebar-share {
    order: 0;
    padding-top: 0;
    border-top: none;
  }

  /* HR between top-row and meta */
  .sidebar-rule { display: block; }

  /* Meta: 2-column grid */
  .sidebar-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
  }

  /* Hide the main review title on mobile — shown in sidebar-mobile-title instead */
  .review-title { display: none; }

  .related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
  .related-grid .poster-card { width: auto; flex-shrink: unset; }
  .related-grid .poster-card-img img { width: 100%; height: auto; aspect-ratio: 2/3; }
}

/* ── MOBILE SHARE (below prose on small screens) ── */
.mobile-share-bottom {
  display: none;
  padding: 1.5rem 0;
  border-top: 0.5px solid var(--rule);
  margin-top: 1rem;
}
.mobile-share-bottom .meta-label { margin-bottom: 0.5rem; }
.mobile-share-bottom .share-icons { gap: 14px; }
@media (max-width: 768px) {
  .mobile-share-bottom { display: block; }
}

@media (max-width: 480px) {
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}
