/*
 * Golfer team card (SPEC §2.11) and the card list in the TOP team band
 * (§3.1 #3). Values from tokens.css only.
 *
 * HTML contract
 *   <ul class="team-cards grid grid--quarters">
 *     <li class="team-card">
 *       <a class="team-card__link" href="/golfers/takahashi-kohaku/">
 *         <span class="team-card__media">
 *           <img class="team-card__image" src="…" alt="" width height
 *                loading="lazy">
 *         </span>
 *         <span class="team-card__label">
 *           <span class="team-card__name">高橋 こはく</span>
 *         </span>
 *       </a>
 *     </li>
 *   </ul>
 *   The whole card is one link to the golfer page; its name is the golfer's
 *   name, so the photo is alt="". Design v2 (no golfer pages yet): a
 *   <div class="team-card__link">, same look, no states (they are scoped to
 *   :any-link). The list sits in .container--top inside
 *   the grass band (§3.1), so the focus ring is white.
 *   2 columns, 4 from 768 (.grid--quarters, SPEC §4.1 #6).
 *
 * XD (TOP PC グループ 2059–2062, SP グループ 2071–2074):
 *   the photo is a circle as wide as the card (358 PC, 171 SP); the white
 *   label (radius-lg) is centred on the circle's bottom edge, half over the
 *   photo. Below 1200: label 34 tall, 16 in from each side, name 16/32.
 *   From 1200: label 58 tall, 35 in, name 24/32 (h3). The name is green-700,
 *   centred. The label grows past the insets to fit the name (at 320 the
 *   cards are 136, so 16 insets would wrap 高橋 こはく) and wraps the name
 *   only when the card itself is too narrow.
 *
 * States (ASSUMPTION, SPEC §2.11): hover = the photo zooms to 1.04 inside
 * the circle and the label turns green-50; active = the same (no 1px shift,
 * like the news card); focus = the white ring around the whole card.
 */

/* ---- List: 2 columns, 4 from 768 (.grid--quarters) ---- */

.team-cards {
  row-gap: var(--team-cards-row-gap);
}

/* ---- Card ---- */

.team-card__link {
  --focus-ring-color: var(--focus-ring-color-on-dark);
  --team-card-label-h: var(--team-card-label-height);

  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-green-700);
  text-decoration: none;
}

@media (width >= 1200px) {
  .team-card__link {
    --team-card-label-h: var(--team-card-label-height-pc);
  }
}

/* ---- Photo: a circle as wide as the card ---- */

.team-card__media {
  display: block;
  inline-size: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-circle);
  isolation: isolate;
}

.team-card__image {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: var(--team-card-image-position);
  transition: transform var(--duration-hover);
}

/* ---- Name label: centred on the circle's bottom edge ---- */

.team-card__label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: fit-content;
  min-inline-size: calc(100% - 2 * var(--team-card-label-inset));
  max-inline-size: 100%;
  min-block-size: var(--team-card-label-h);
  padding-inline: var(--team-card-label-padding-inline);
  margin-block-start: calc(var(--team-card-label-h) / -2);
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  transition: background-color var(--duration-hover);
}

.team-card__name {
  min-inline-size: 0;
  font-size: var(--text-team-card-name-size);
  font-weight: var(--font-weight-bold);
  line-height: var(--text-team-card-name-lh);
  text-align: center;
}

@media (width >= 1200px) {
  .team-card__label {
    min-inline-size: calc(100% - 2 * var(--team-card-label-inset-pc));
    padding-inline: var(--team-card-label-padding-inline-pc);
  }

  .team-card__name {
    font-size: var(--text-h3-size);
    line-height: var(--text-h3-lh);
  }
}

/* ---- States ---- */

@media (hover: hover) {
  .team-card__link:any-link:hover .team-card__image {
    transform: scale(var(--team-card-zoom));
  }

  .team-card__link:any-link:hover .team-card__label {
    background-color: var(--color-green-50);
  }
}

.team-card__link:any-link:active .team-card__image {
  transform: scale(var(--team-card-zoom));
}

.team-card__link:any-link:active .team-card__label {
  background-color: var(--color-green-50);
}
