/* components/membership-cta.css — layout for sections/membership-cta.hbs,
   on the homepage or pasted into an article as a snippet.
   Laid out with container queries (the only component that is), because
   its width is not the viewport's: side by side from 40rem of its own
   width, full-size headline from 64rem.
   Re-points the palette tokens on the band so the shared .button needs no
   restyling. The engraving is black ink on transparent, so the admin band
   colour tints it too; the image box has no background of its own.
   The headline always uses the default (sans) voice. */

.membership-cta {
  --color-bg: var(--membership-cta-bg);
  --color-fg: var(--membership-hero-fg);
  --color-border: var(--membership-hero-fg);
  --font-heading: var(--font-heading-default);
  --weight-heading: var(--weight-heading-default);

  container: membership-cta / inline-size;
  margin-block: var(--space-16);
  background-color: var(--color-bg);
  color: var(--color-fg);
}

.membership-cta__inner {
  display: grid;
}

/* Stacked: landscape crop, faces kept in frame. */
.membership-cta__media {
  aspect-ratio: 3 / 2;
  line-height: 0;
}

.membership-cta__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
}

.membership-cta__body {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-6);
}

.membership-cta__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-heading);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
}

.membership-cta__text {
  max-inline-size: 36em;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  text-wrap: pretty;
}

.membership-cta__body .button {
  margin-block-start: var(--space-2);
}

/* HOVER/focus: text goes white, the fill stays. */
.membership-cta__body .button:is(:hover, :focus-visible) {
  color: var(--membership-cta-button-hover-fg);
}

/* Side by side: image a third, text two thirds. The ratio goes on the <img>,
   not its box — on the box it either leaves a gap under the image or
   overflows the column (both were tried). */
@container membership-cta (width >= 40rem) {
  .membership-cta__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  .membership-cta__media {
    aspect-ratio: auto;
  }

  .membership-cta__image {
    aspect-ratio: 1;
  }

  .membership-cta__body {
    padding: var(--space-10);
  }
}

/* The design's forced line breaks only fit at homepage width. */
@container membership-cta (width < 64rem) {
  .membership-cta__break {
    display: none;
  }
}

/* Full-size headline needs homepage width. */
@container membership-cta (width >= 64rem) {
  .membership-cta__title {
    font-size: var(--membership-title-size);
  }

  .membership-cta__body {
    gap: var(--space-8);
  }
}

/* As an article snippet: extra spacing, hidden from paid members (a static
   snippet can't branch on @member). */

.post-content > .membership-cta {
  margin-block: var(--space-12);
}

[data-member="paid"] .post-content > .membership-cta {
  display: none;
}
