/* --- single post ---
 * `.post` stays at the site-main width so its full-bleed children (the
 * featured-image band) can use the `100vw + negative inline margin` trick.
 * Every inner element that holds reading content — header, body, tags,
 * and the featured image itself — is constrained to `--max-w-prose` so
 * one variable controls the column width consistently.
 */
.post {
  max-width: var(--max-w);
  margin: var(--sp-sm) auto 0;

  & .post__header {
    max-width: var(--max-w-prose);
    margin: 0 auto var(--sp-md);
    padding-inline: 0;
  }
  & .post__back {
    display: inline-block;
    font-size: var(--fs-xxs);
    color: var(--color-muted);
    margin-bottom: var(--sp-sm);

    &:hover { color: var(--color-accent); }
  }
  & .post__title {
    font-family: var(--font-display);
    font-size: clamp(48px, 28px + 5vi, 88px);
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
  }
  & .post__meta {
    margin-top: var(--sp-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-sm);
    font-size: var(--fs-xxs);
    color: var(--color-muted);
  }
  & .post__chips { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }

  /* Full-bleed dark band with a blurred copy of the image as backdrop;
     the inner <img> stays at --max-w-prose so it lines up with the
     title, body, and tags. */
  & .post__featured {
    position: relative;
    isolation: isolate;
    /* Break out of the prose column up to (but not past) the page wrapper.
       `min()` caps the breakout at --max-w-page so the band doesn't spill
       into the dark page frame on wide viewports. */
    margin: 0 calc(50% - min(50vw, var(--max-w-page) / 2)) var(--sp-lg);
    width: min(100vw, var(--max-w-page));
    padding: 0 1.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--color-surface-dark);

    &::before {
      content: "";
      position: absolute;
      inset: -10%;
      background-image: var(--post-featured-img);
      background-size: cover;
      background-position: center;
      filter: blur(40px) brightness(0.55) saturate(3);
      transform: scale(1.15);
      z-index: -1;
    }
    & img {
      position: relative;
      display: block;
      width: 100%;
      max-width: var(--max-w-prose);
      height: auto;
      /* Reserve a 16:9 area before the image's intrinsic ratio is known
         so content below doesn't shift when the hero loads. `object-fit:
         cover` crops to fit if the actual image differs from 16:9; the
         dark band behind absorbs any visual delta. */
      aspect-ratio: 16 / 9;
      object-fit: cover;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    }
  }

  & .post__body {
    max-width: var(--max-w-prose);
    margin-inline: auto;
  }

  & .post__tags {
    max-width: var(--max-w-prose);
    margin: var(--sp-lg) auto 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-sm);
  }
  & .post__tags-label {
    font-size: var(--fs-xxs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
  }
  & .post__tags-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
  }
}

/* --- related posts (under single post) — light section, default cards.
   Sibling of `.site-main` inside `<main>`, so no breakout trick. */
.related {
  padding: var(--sp-mega) 1.25rem;
  background: var(--color-bg);

  & > * {
    max-width: var(--max-w);
    margin-inline: auto;
  }
  & .related__heading {
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: var(--sp-md);
    text-align: center;
    color: var(--color-fg);
  }
}

.card-grid--related {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--sp-lg);

  @media (max-width: 720px) { grid-template-columns: 1fr; }
  /* No card-color overrides — inherits the default `.card` styling. */
}
