/* ─────────────────────────────────────────────────────────────
   Alpine — Team Grid
   Prefix: .am-team-grid / .am-card / .am-pcard / .am-modal
   Colour tokens are scoped to the block so it is self-contained.
   ───────────────────────────────────────────────────────────── */
.am-team-grid {
  --am-navy: #003469;
  --am-navy-deep: #001c38;
  --am-sky: #00addc;
  --am-muted: #f4f7fa;
  --am-border: #dce4ef;
  --am-text-mid: #4a5568;
  --am-cols: 4;
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
  color: #1a2332;
  position: relative;
}
.am-team-grid.is-empty { display: none; }
.am-team-grid [hidden] { display: none !important; }
/* Two independent hide reasons so filter + pagination never conflict. */
.js-filter-item.am-hide-filter,
.js-filter-item.am-hide-page { display: none !important; }

/* ── Loading overlay + spinner ── */
.am-team-grid__loader {
  position: absolute; inset: 0; z-index: 6; display: none;
  align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .62); border-radius: 12px;
}
.am-team-grid.is-loading { min-height: 160px; }
.am-team-grid.is-loading .am-team-grid__loader { display: flex; }
.am-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(0, 52, 105, .15); border-top-color: var(--am-sky);
  animation: am-spin .7s linear infinite;
}
@keyframes am-spin { to { transform: rotate(360deg); } }

/* Heading row */
.am-team-grid__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 30px; }
.am-team-grid__title { font-size: clamp(22px, 2.6vw, 34px); font-weight: 500; color: var(--am-navy); line-height: 1.2; margin: 0; }
.am-team-grid__meta { font-size: 13px; color: #6b7a8d; }

/* ── Photo-card grid ── */
.am-team-grid--photo .am-team-grid__items {
  display: grid;
  grid-template-columns: repeat(var(--am-cols), 1fr);
  gap: 26px;
}
.am-card {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  cursor: pointer; box-shadow: 0 12px 30px rgba(0, 52, 105, .12);
  transition: transform .25s ease, box-shadow .25s ease;
}
.am-card:hover { transform: translateY(-6px); box-shadow: 0 22px 48px rgba(0, 52, 105, .2); }
.am-card:focus-visible { outline: 3px solid var(--am-sky); outline-offset: 3px; }
.am-card__photo {
  position: absolute; inset: 0; background: linear-gradient(160deg, #e3eaf3, #cfdae7);
  background-size: cover; background-position: center top;
  display: flex; align-items: center; justify-content: center; color: #8496a9;
}
.am-card__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0, 20, 45, .9) 0%, rgba(0, 20, 45, .28) 46%, rgba(0, 20, 45, 0) 72%);
  transition: background .25s;
}
.am-card:hover .am-card__scrim {
  background: linear-gradient(0deg, rgba(0, 20, 45, .94) 0%, rgba(0, 20, 45, .4) 52%, rgba(0, 20, 45, .05) 80%);
}
.am-card__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px; z-index: 2; transition: transform .25s; }
.am-card:hover .am-card__cap { transform: translateY(-22px); }
.am-card__role { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--am-sky); margin-bottom: 5px; }
.am-card__name { font-size: 19px; font-weight: 600; color: #fff; line-height: 1.2; }
.am-card__li {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center;
  text-decoration: none; z-index: 3; transition: background .2s, transform .2s;
}
.am-card__li:hover { background: var(--am-sky); transform: translateY(-2px); }
.am-card__hint {
  position: absolute; left: 20px; bottom: 20px; z-index: 2; font-size: 11.5px; font-weight: 600;
  color: rgba(255, 255, 255, .75); display: inline-flex; align-items: center; gap: 6px;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s;
}
.am-card:hover .am-card__hint { opacity: 1; transform: none; }

/* ── Compact list (no image) ── */
.am-team-grid--list .am-team-grid__items {
  display: grid;
  grid-template-columns: repeat(min(var(--am-cols), 3), 1fr);
  gap: 16px;
}
.am-pcard {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff; border: 1px solid var(--am-border); border-radius: 10px; padding: 18px 20px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.am-pcard:hover { border-color: rgba(0, 173, 220, .4); box-shadow: 0 8px 20px rgba(0, 52, 105, .07); transform: translateY(-2px); }
.am-pcard__name { font-size: 15.5px; font-weight: 600; color: var(--am-navy); }
.am-pcard__role { font-size: 12.5px; color: var(--am-text-mid); margin-top: 2px; }
.am-pcard__li {
  width: 32px; height: 32px; border-radius: 50%; background: var(--am-muted);
  display: flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0;
  transition: background .2s;
}
.am-pcard__li svg path { transition: fill .2s; }
.am-pcard__li:hover { background: var(--am-sky); }
.am-pcard__li:hover svg path { fill: #fff; }

/* ── Bio modal ── */
.am-modal {
  position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0, 20, 45, .6); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .25s ease;
}
.am-modal.is-open { opacity: 1; }
.am-modal__box {
  background: #fff; border-radius: 16px; max-width: 720px; width: 100%; max-height: 88vh; overflow: auto;
  display: grid; grid-template-columns: 260px 1fr;
  transform: translateY(16px) scale(.98); transition: transform .25s ease;
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
}
.am-modal.is-open .am-modal__box { transform: none; }
.am-modal__photo {
  background: linear-gradient(160deg, #e3eaf3, #cfdae7); background-size: cover; background-position: center top;
  display: flex; align-items: center; justify-content: center; color: #8496a9; min-height: 280px;
}
.am-modal__photo.has-image svg { display: none; }
.am-modal__body { padding: 34px 34px 36px; position: relative; }
.am-modal__close {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--am-muted); color: var(--am-navy); font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .2s;
}
.am-modal__close:hover { background: var(--am-border); }
.am-modal__role { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--am-sky); margin-bottom: 8px; }
.am-modal__name { font-size: 26px; font-weight: 600; color: var(--am-navy); margin: 0 0 14px; }
.am-modal__bio p { font-size: 14.5px; color: var(--am-text-mid); line-height: 1.75; margin: 0 0 14px; }
.am-modal__li {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 10px; font-size: 14px; font-weight: 600;
  color: #fff; text-decoration: none; background: #0a66c2; border-radius: 6px; padding: 10px 18px;
  transition: background .2s, transform .2s;
}
.am-modal__li:hover { background: #004182; transform: translateY(-2px); }

/* ── Pagination ── */
.am-team-grid__pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 40px; }
.am-pager__btn {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--am-border); background: #fff; color: var(--am-navy);
  font-family: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .18s, border-color .18s, color .18s;
}
.am-pager__btn:hover:not(:disabled) { border-color: var(--am-sky); }
.am-pager__btn.is-active { background: var(--am-navy); border-color: var(--am-navy); color: #fff; }
.am-pager__btn:disabled { opacity: .4; cursor: default; }
.am-pager__nav { font-size: 20px; line-height: 1; }
.am-pager__more {
  cursor: pointer; border: 1.5px solid var(--am-navy); background: var(--am-navy); color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; padding: 12px 26px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 8px; transition: background .18s, transform .15s;
}
.am-pager__more:hover { background: #0a4a86; transform: translateY(-2px); }
.am-pager__more span { font-weight: 500; opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  .am-card, .am-card__cap, .am-card__scrim, .am-card__hint, .am-modal, .am-modal__box, .am-pager__btn, .am-pager__more { transition: none; }
  .am-spinner { animation-duration: 1.4s; }
}

/* ── Responsive ── */
@media (max-width: 1080px) {
  .am-team-grid--photo .am-team-grid__items { grid-template-columns: repeat(3, 1fr); }
  .am-team-grid--list .am-team-grid__items { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .am-team-grid--photo .am-team-grid__items { grid-template-columns: repeat(2, 1fr); }
  .am-modal__box { grid-template-columns: 1fr; }
  .am-modal__photo { min-height: 220px; }
}
@media (max-width: 520px) {
  .am-team-grid--photo .am-team-grid__items { grid-template-columns: 1fr; }
  .am-team-grid--list .am-team-grid__items { grid-template-columns: 1fr; }
  .am-card { aspect-ratio: 16 / 9; }
}

/* Readability on small screens: cards are much larger here, so the caption can
   rise over the bright part of the photo. Use a stronger, taller scrim + a
   text-shadow so the position/name stay legible. Desktop is left unchanged. */
@media (max-width: 768px) {
  .am-card__scrim,
  .am-card:hover .am-card__scrim {
    background: linear-gradient(0deg,
      rgba(0, 20, 45, .94) 0%,
      rgba(0, 20, 45, .70) 40%,
      rgba(0, 20, 45, .32) 70%,
      rgba(0, 20, 45, 0) 100%);
  }
  .am-card__role,
  .am-card__name { text-shadow: 0 1px 8px rgba(0, 10, 30, .55); }
  /* No hover on touch — keep the caption in its resting position. */
  .am-card:hover .am-card__cap { transform: none; }
}
