/* Blog: the handle index and a post.
 *
 * The grid reuses the collection grid's mechanics on purpose — a flex list with negative margins
 * and columns that narrow by breakpoint — because a row of articles and a row of products are the
 * same layout problem, and this project already solved it once. The names are separate so the two
 * can diverge without one silently restyling the other.
 *
 * The post's *body* has no rules here at all. It renders through the `rich_text` section, so the
 * theme's own `.rte` typography applies — the whole reason the body is stored as that section type.
 */

/* ------------------------------------------------------------------ handle index */

.blog-index {
  padding: var(--section-spacing-mobile) 0;
}

@media (min-width: 48em) {
  .blog-index {
    padding: var(--section-spacing-desktop) 0;
  }
}

.blog-index__header {
  margin: 0 0 30px;
}

.blog-index__title {
  margin: 0;
  color: var(--color-heading);
}

/* The count is a label, not a control: live's collection page shows "16 products" in the same
 * place, and it is the one thing on either page that tells a reader how much there is. */
.blog-index__count {
  margin: 6px 0 0;
  color: var(--color-body);
  font-size: var(--type-small);
}

.blog-index__list {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
  padding: 0;
  list-style: none;
}

.blog-index__column {
  flex: 0 0 100%;
  max-width: 100%;
  padding: 0 10px;
  margin: 0 0 30px;
  list-style: none;
}

@media (min-width: 48em) {
  .blog-index__column {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* Three across on desktop rather than the collection's four: an article title is a sentence, and
 * at a quarter of the row it wraps to five lines. */
@media (min-width: 1068px) {
  .blog-index__column {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
  }
}

/* ------------------------------------------------------------------ the card */

.blog-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-product-card-bg);
  border-radius: var(--block-border-radius);
  overflow: hidden;
}

.blog-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-ground-dark);
}

.blog-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
}

.blog-card__date {
  margin: 0;
  color: var(--color-body);
  font-size: var(--type-caption);
}

.blog-card__title {
  margin: 0;
  color: var(--color-heading);
  font-size: var(--type-h6);
}

.blog-card__title a {
  color: inherit;
}

@media (hover: hover) and (pointer: fine) {
  .blog-card__title a:hover {
    color: var(--color-accent);
  }
}

.blog-card__excerpt {
  margin: 0;
  color: var(--color-body);
  font-size: var(--type-small);
}

/* ------------------------------------------------------------------ a post */

.blog-post__crumbs {
  padding: 20px 0 0;
  font-size: var(--type-small);
}

.blog-post__crumbs a {
  color: var(--color-body);
}

@media (hover: hover) and (pointer: fine) {
  .blog-post__crumbs a:hover {
    color: var(--color-accent);
  }
}

.blog-post__header {
  padding: 10px 0 30px;
  max-width: 46rem;
}

.blog-post__title {
  margin: 0;
  color: var(--color-heading);
}

.blog-post__meta {
  margin: 10px 0 0;
  color: var(--color-body);
  font-size: var(--type-small);
}

/* The client's own `og:description`, set as a standfirst. It is their sentence, so it is shown
 * rather than rewritten — and it is what a search result or a share card shows, so a reader who
 * arrived from one recognises where they landed. */
.blog-post__standfirst {
  margin: 16px 0 0;
  color: var(--color-body);
  font-size: var(--type-body-lg, 1.125rem);
}

.blog-post__hero {
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--color-ground-dark);
}

.blog-post__hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
