/* Use the same crop in each committee portrait, profile and welcome. */
:where(.committee-card, .reader-story[data-member], .president-welcome-portrait, .president-letter-portrait) {
  --portrait-field: #ecdfef;
  --portrait-rim: #b696bd;
  --portrait-width: 100%;
  --portrait-top: 0%;
  --portrait-x: 0%;
  --portrait-direction: 1;
}

[data-member="britah"],
.president-welcome-portrait,
.president-letter-portrait {
  --portrait-field: #ffd393;
  --portrait-rim: #c36c14;
  --portrait-width: 96%;
  --portrait-top: -3.5%;
  --portrait-direction: -1;
}

[data-member="judith"] {
  --portrait-width: 98%;
  --portrait-top: -1.4%;
  --portrait-x: -2%;
}

[data-member="bernard"] {
  --portrait-width: 105%;
  --portrait-top: 7.5%;
  --portrait-direction: -1;
}

[data-member="emmanuel"] {
  --portrait-width: 105%;
  --portrait-top: 7.2%;
}

[data-member="secret"] {
  --portrait-top: 6.4%;
  --portrait-x: -1.5%;
}

#support #committee-grid {
  grid-auto-columns: calc((100% - 4 * var(--committee-gap)) / 5);
  --committee-gap: clamp(0.65rem, 1.5vw, 1.4rem);
  gap: var(--committee-gap);
  padding: 0.6rem 0.25rem 0.9rem;
  scroll-padding-inline: 0.25rem;
}

.committee-card {
  align-items: center;
  text-align: center;
}

.committee-image.is-polished-portrait,
.committee-card.is-president .committee-image.is-polished-portrait,
.reader-story[data-member] .reader-photo.is-polished-portrait,
.president-welcome-portrait,
.president-letter-portrait {
  position: relative;
  isolation: isolate;
  display: block;
  height: auto;
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--paper);
  border-radius: 50%;
  padding: 0;
  background: var(--portrait-field);
  box-shadow: 0 0 0 1px var(--portrait-rim);
}

.committee-image.is-polished-portrait {
  width: min(86%, 11rem);
  flex: none;
}

.committee-image.is-polished-portrait img,
.reader-story[data-member] .reader-photo.is-polished-portrait > img,
.president-welcome-portrait img,
.president-letter-portrait img {
  position: absolute;
  max-width: none;
  max-height: none;
  width: var(--portrait-width);
  height: auto;
  top: var(--portrait-top);
  left: calc(50% + var(--portrait-x));
  transform: translateX(-50%) scaleX(var(--portrait-direction));
}

.committee-card h3 {
  margin: 1.15rem 0 0.35rem;
  min-height: 0;
  font-size: clamp(1.12rem, 1.6vw, 1.45rem);
  line-height: 1.16;
}

.committee-card .committee-role {
  margin: 0 0 0.3rem;
  min-height: 0;
  color: #5a4c60;
  line-height: 1.38;
}

.committee-card .text-link {
  justify-content: center;
  min-height: 44px;
  line-height: 1.3;
  color: var(--purple);
}

#support .committee-gallery-buttons button {
  min-height: 44px;
}

#support .committee-image:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}

.reader-story[data-member] .reader-photo.is-polished-portrait {
  width: min(76%, 18rem);
  max-height: none;
  place-self: center;
  margin: 1.25rem auto;
}

.reader-story[data-member] .reader-photo.is-polished-portrait::before {
  content: none;
}

.reader-story[data-member] {
  background: linear-gradient(110deg, #f8f3f8, var(--paper) 60%);
}

.president-welcome-portrait {
  align-self: center;
  justify-self: center;
  width: min(100%, 10.5rem);
}

.president-letter-portrait {
  width: 100%;
  align-self: center;
}

@media (min-width: 701px) and (max-width: 1000px) {
  #support #committee-grid {
    grid-auto-columns: calc((100% - 2 * var(--committee-gap)) / 3);
  }
}

@media (max-width: 700px) {
  #support #committee-grid {
    --committee-gap: 0.875rem;
    grid-auto-columns: calc((100% - var(--committee-gap)) / 2);
  }

  .reader-story[data-member] .reader-photo.is-polished-portrait {
    width: min(53%, 12rem);
    margin: 1.8rem auto 0;
  }
}

@media (max-width: 400px) {
  .president-welcome-portrait {
    justify-self: start;
    width: 6rem;
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .committee-image.is-polished-portrait {
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  }

  .committee-card:focus-within .committee-image.is-polished-portrait,
  .committee-card:hover .committee-image.is-polished-portrait {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px var(--portrait-rim), 0 7px 14px rgb(61 23 91 / 12%);
  }
}
