/* Person card (portrait 7:8 at every width, two columns on mobile) and the person profile. */
@layer components {
  .card-grid.card-grid--people {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-24) var(--space-16);
  }

  @media (min-width: 1024px) {
    .card-grid.card-grid--people {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: var(--space-32) var(--space-24);
    }
  }

  .person-card {
    display: flex;
    flex-direction: column;
    color: var(--color-text-default);
    text-decoration: none;
  }

  .person-card .image {
    margin-block-end: var(--space-16);
    transition: var(--transition-hover-media);
  }

  .person-card:hover .image,
  .person-card:focus-visible .image {
    transition: var(--transition-hover-media-in);
    box-shadow: var(--shadow-hover-media);
    transform: var(--transform-hover-media);
  }

  .person-card__name {
    font-family: var(--font-family-heading), Georgia, serif;
    font-weight: var(--font-weight-bold);
    font-size: var(--type-heading-s-size);
    line-height: var(--type-heading-s-line-height);
    overflow-wrap: anywhere;
  }

  .person-card__role {
    margin-block-start: var(--space-4);
    color: var(--color-text-subtle);
    font-size: var(--type-text-small-size);
    line-height: var(--type-text-small-line-height);
  }

  /* Profile: photo left, short text and contact right; stacked on mobile. */
  .profile {
    display: grid;
    gap: var(--space-24);
    align-items: center;
  }

  .profile__media {
    max-inline-size: 400px;
  }

  .profile__body {
    max-inline-size: var(--layout-container-text);
  }

  @media (min-width: 1024px) {
    .profile {
      /* The text column keeps its width; the photo gives up the rest so the gap is the gutter plus one column. */
      --tc: calc((100% - 11 * var(--layout-grid-gap)) / 12);
      grid-template-columns: calc(400px + var(--layout-grid-gap) - var(--tc)) minmax(0, 1fr);
      column-gap: calc(var(--layout-grid-gap) + var(--tc));
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .person-card .image {
      transition: none;
    }
  }
}

/* Tip points to the text when the photo sits left of it. Stacked (mobile): tip bottom-left. */
@layer utilities {
  @media (max-width: 1023.98px) {
    .profile__media .bubble {
      --bubble-tip-bl: var(--component-bubble-radius-tip);
      --bubble-tip-br: var(--bubble-radius);
      --bubble-tl: var(--bubble-radius);
      --bubble-tr: var(--bubble-opposite);
      --bubble-radius: var(--component-bubble-radius-m);
      --bubble-opposite: var(--component-bubble-radius-opposite-m);
    }
  }
}
