/**
 * Person card: one row of a staff list (style guide, "Contact lists and
 * bios"). Rows are separated by a hairline. Bold: large role, name below,
 * buttons stacked in the last third. Slim: smaller role, buttons side by
 * side in the second half. A photo, when there is one, is a 125px square at
 * the start of the row.
 *
 * The root is the size container; .person-card__inner responds to it.
 */
.person-card {
  container-type: inline-size;
  padding-block: var(--space-m);
  border-block-start: 1px solid var(--rule-color);
}

/* In a listing the row around the card draws the line. */
.views-row > .person-card {
  padding-block: 0;
  border: 0;
}

.person-card__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-s) var(--space-m);
  align-items: start;
}

.person-card__media {
  width: 7.8125rem;
}

.person-card__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
}

.person-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  min-width: 0;
}

.person-card__role {
  font-size: var(--font-size-m);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  overflow-wrap: anywhere;
}

.person-card--slim .person-card__role {
  font-size: var(--font-size-xs);
}

.person-card__name {
  margin: 0;
  font-size: var(--font-size-lead);
  line-height: var(--line-height-snug);
}

.person-card--slim .person-card__name {
  font-size: var(--font-size-body);
}

.person-card__link {
  text-underline-offset: 0.15em;
}

.person-card__bio {
  font-size: var(--font-size-body);
}

.person-card__contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs);
  min-width: 0;
}

/* Long addresses wrap inside their button. */
.person-card__contact .button__label {
  overflow-wrap: anywhere;
}

@container (min-width: 40rem) {
  .person-card__inner {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .person-card--has-image .person-card__inner {
    grid-template-columns: 7.8125rem minmax(0, 2fr) minmax(0, 1fr);
  }

  .person-card--slim .person-card__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .person-card--slim.person-card--has-image .person-card__inner {
    grid-template-columns: 7.8125rem minmax(0, 1fr) minmax(0, 1fr);
  }

  /* Without buttons the text takes the whole row. */
  .person-card__body:last-child {
    grid-column: 1 / -1;
  }

  .person-card--has-image .person-card__body:last-child {
    grid-column: 2 / -1;
  }

}

/* Slim buttons go side by side once each has room for an address. */
@container (min-width: 56rem) {
  .person-card--slim .person-card__contact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* An odd button out (a third number) takes the full width. */
  .person-card--slim .person-card__contact > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/*
 * Striped rows (the style guide's zebra lists): no hairlines; every second
 * row takes the neighbouring background (see [data-stripe] in surface.css),
 * and its buttons follow. Directly in a Section the stripe runs across the
 * page: the background is extended sideways by a shadow, clipped to the
 * row's own height.
 */
.person-card--striped {
  padding: var(--space-m);
  border: 0;
}

.section__inner > .person-card--striped {
  /* dal.ca's bands: 48px above and below the row. */
  padding-block: var(--space-xl);
  padding-inline: 0;
  box-shadow: 0 0 0 100vmax var(--surface-bg);
  clip-path: inset(0 -100vmax);
}

/* Stripes touch: take back the Section's gap between them. */
.section__inner > .person-card--striped + .person-card--striped {
  margin-block-start: calc(-1 * var(--gap-medium));
}

/*
 * Profile: a card for a two-column Grid. Photo beside the role and name, and
 * a "Learn more" accordion below that holds the bio and the buttons.
 */
.person-card--profile {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding-block: 0;
  border: 0;
}

.person-card--profile .person-card__inner {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.person-card--profile.person-card--has-image .person-card__inner {
  grid-template-columns: 7.8125rem minmax(0, 1fr);
}

.person-card--profile .person-card__body:last-child {
  grid-column: auto;
}

.person-card--profile .accordion-item__content .person-card__contact {
  max-width: 24rem;
}

/* A list of cards printed by a listing, under its heading. */
.person-list {
  margin-block-start: var(--space-m);
}
