/* Main feed: JS shortest-column masonry (bites-feed-masonry.js). Max 4 cols ≥900px. */
.bites-feed.feed:not(.bites-feed--few) {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-4) var(--space-3) var(--space-5);
}

.bites-feed.feed .feed-card {
  margin-bottom: 0;
}

.bites-feed.bites-feed--few {
  --bites-feed-few-max: 1200px;
  --bites-feed-few-card-max: 380px;
  display: grid;
  -webkit-column-count: initial;
  -moz-column-count: initial;
  column-count: initial;
  width: 100%;
  max-width: var(--bites-feed-few-max);
  margin-inline: auto;
  justify-content: center;
  grid-template-columns: repeat(2, minmax(0, min(100%, var(--bites-feed-few-card-max))));
  gap: var(--space-3);
  align-items: start;
}

.bites-feed.bites-feed--few.bites-feed--count-1 {
  grid-template-columns: minmax(0, min(100%, 420px));
}

@media (min-width: 768px) {
  .bites-feed.bites-feed--few {
    gap: var(--space-4);
  }

  .bites-feed.bites-feed--few.bites-feed--count-1 {
    grid-template-columns: minmax(0, min(100%, 440px));
  }

  .bites-feed.bites-feed--few.bites-feed--count-2 {
    grid-template-columns: repeat(2, minmax(0, min(100%, var(--bites-feed-few-card-max))));
  }

  .bites-feed.bites-feed--few.bites-feed--count-3 {
    grid-template-columns: repeat(3, minmax(0, min(100%, 340px)));
  }

  .bites-feed.feed:not(.bites-feed--few) {
    padding: var(--space-4) var(--space-4) var(--space-6);
    max-width: 1200px;
    margin-inline: auto;
  }
}

@media (min-width: 900px) {
  .bites-feed.feed:not(.bites-feed--few) {
    padding: var(--space-5) var(--space-5) var(--space-6);
    max-width: 1200px;
    margin-inline: auto;
  }
}

.post-page {
  background: var(--color-bg);
}

.post-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (min-width: 1024px) {
  .post-stack {
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    gap: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .post-stack__media {
    --post-media-width: min(60vw, calc(100dvh * 4 / 5));
    flex: 0 0 var(--post-media-width);
    width: var(--post-media-width);
    max-width: var(--post-media-width);
    aspect-ratio: 4 / 5;
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
  }

  .post-stack__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: var(--space-4) var(--space-5) var(--space-5);
  }

  .post-stack__content .article {
    max-width: 42rem;
    padding-left: 0;
    padding-right: 0;
  }

  .post-stack__content .byline {
    max-width: 42rem;
    padding-left: 0;
    padding-right: 0;
  }

  .post-stack__content .stats-row {
    max-width: 42rem;
    padding-left: 0;
    padding-right: 0;
  }

  .post-stack__content .comments {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: var(--space-4);
    border-top: none;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
  }

  .post-stack__content .comments__list {
    flex: 1;
    overflow-y: auto;
    max-height: min(52vh, 520px);
    padding-bottom: var(--space-6);
  }
}

.shell--post .post-page {
  flex: 1;
  min-width: 0;
}

.shell--post .main {
  padding-bottom: 0;
}

/* Make the single post page background-free. */
.shell--post,
.shell--post .post-topbar,
.shell--post .post-page,
.shell--post .post-stack__media,
.shell--post .carousel,
.shell--post .carousel__dots,
.shell--post .byline,
.shell--post .article,
.shell--post .stats-row,
.shell--post .comments {
  background: transparent;
}

.shell--post .post-stack__content {
  background: #fff;
}

.shell--post .icon-btn:hover,
.shell--post .post-topbar__back:hover {
  background: transparent;
}

/* JS mounts .carousel inside host; fill sticky media column like static markup */
.post-stack__media .bites-carousel-host {
  display: block;
  height: 100%;
  min-height: 0;
}

/* Suggested bites (single): align with article column, reuse feed cards */
.bite-suggested {
  margin-top: var(--space-6);
  width: 100%;
}

.bite-suggested__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}

@media (min-width: 768px) {
  .bite-suggested__title {
    font-size: var(--text-lg);
  }
}

.bite-suggested .bite-suggested__grid.feed {
  padding: 0 0 var(--space-4);
  max-width: none;
}
