/* ==========================================================================
   Aurem — Team section (deal → fan → spread card deck with 3D flip).
   Uses brand tokens from hero.css (:root --ah-*) and shared components.
   ========================================================================== */

.ah-team {
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
  padding-top: clamp(80px, 12vh, 150px);
}
.ah-team__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.ah-team__glow {
  position: absolute; left: 50%; bottom: -10%;
  width: 80vw; height: 60vw; max-width: 1300px; max-height: 900px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(200, 16, 46, .22), transparent);
  filter: blur(30px);
}
.ah-team > .ah-grain { z-index: 0; opacity: .06; }
.ah-team__inner { position: relative; z-index: 1; max-width: 1680px; margin: 0 auto; padding: 0 var(--ah-gutter); }

.ah-team__intro {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 120px); align-items: end;
  margin-top: clamp(40px, 8vh, 90px);
}
.ah-team__title {
  max-width: 13ch;
  font-family: var(--ah-display); font-variation-settings: "opsz" 96;
  font-weight: 600; font-size: clamp(2.6rem, 6.4vw, 7rem);
  line-height: .96; letter-spacing: -.055em;
}
.ah-team__title em { font-family: var(--ah-serif); font-style: italic; font-weight: 400; font-size: 1.06em; color: var(--ah-blush); letter-spacing: -.02em; }
.ah-team__lead { max-width: 26rem; padding-bottom: .8em; font-size: 16px; line-height: 1.65; color: var(--ah-muted); }

/* ---------- Deck ---------- */
.ah-deck {
  --gap: 18px;
  --n: 7; /* card count, set by the Team widget */
  --cw: min(250px, calc((100vw - 2 * var(--ah-gutter) - (var(--n) - 1) * var(--gap)) / var(--n)));
  --ch: calc(var(--cw) * 1.38);
  position: relative; z-index: 1;
  height: 100vh; height: 100svh;
}
.ah-deck__hint {
  position: absolute; left: 50%; bottom: 7vh; z-index: 0;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--ah-muted);
  white-space: nowrap;
}
.ah-deck__hint span { width: 1px; height: 36px; background: linear-gradient(var(--ah-ember), transparent); }
.ah-deck__cards { position: absolute; inset: 0; list-style: none; margin: 0; padding: 0; perspective: 1600px; }

.ah-member {
  --z: 1;
  position: absolute; left: 50%; top: 50%;
  width: var(--cw); height: var(--ch);
  margin: calc(var(--ch) / -2) 0 0 calc(var(--cw) / -2);
  z-index: var(--z);
}
.ah-member:focus-within { z-index: 50; }
.ah-member__deal { width: 100%; height: 100%; perspective: 1200px; transition: transform .7s var(--ah-ease); }
/* Hover lift only once the cards are spread out. While the deck is piled or fanned
   (.is-stacked, set by ah-team.js) the cards overlap, and lifting one above the others
   would cover its neighbours' flip buttons and links. */
@media (hover: hover) {
  .ah-deck:not(.is-stacked) .ah-member:hover { z-index: 50; }
  .ah-deck:not(.is-stacked) .ah-member:hover .ah-member__deal { transform: translateY(-16px) scale(1.04); }
}
.ah-member__inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 1s var(--ah-ease);
}
.ah-member.is-flipped .ah-member__inner { transform: rotateY(180deg); }

.ah-member__face {
  position: absolute; inset: 0;
  border-radius: var(--ah-radius-md);
  overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: 1px solid var(--ah-line);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
}

/* front */
.ah-member__front { background: var(--ah-wine); }
.ah-member__photo { position: absolute; inset: 0; margin: 0; }
.ah-member__photo img { transition: filter .8s var(--ah-ease), transform 1.2s var(--ah-ease); }
.ah-member__photo::before { transition: opacity .8s var(--ah-ease); }
@media (hover: hover) {
  .ah-member:hover .ah-member__photo::before { opacity: 0; }
  .ah-member:hover .ah-member__photo img { filter: none; transform: scale(1.06); }
}
.ah-member__front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(7, 6, 10, .92), rgba(7, 6, 10, .2) 45%, transparent 65%);
}
.ah-member__num {
  position: absolute; left: 14px; top: 12px; z-index: 2;
  font-family: var(--ah-display); font-size: 14px; font-weight: 700; letter-spacing: -.01em;
}
.ah-member__info { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 2; }
.ah-member__name {
  font-family: var(--ah-display); font-weight: 600;
  font-size: clamp(16px, 1.25vw, 21px); line-height: 1.1; letter-spacing: -.03em;
}
.ah-member__role { margin-top: 4px; font-size: 12px; color: var(--ah-gold); }

/* back */
.ah-member__back {
  transform: rotateY(180deg);
  display: flex; flex-direction: column;
  padding: 44px 16px 16px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(255, 90, 42, .35), transparent 60%),
    linear-gradient(170deg, #2a0a11, var(--ah-ink-2));
  border-color: rgba(255, 90, 42, .35);
}
.ah-member__back .ah-member__role { color: var(--ah-ember); font-weight: 600; }
.ah-member__bio { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--ah-text); }
.ah-member__fact {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--ah-line);
  font-size: 12px; line-height: 1.45; color: var(--ah-muted);
}
.ah-member__fact span { display: block; margin-bottom: 3px; font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ah-gold); }
.ah-member__social { display: flex; gap: 6px; margin-top: 12px; }
.ah-member__social a {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--ah-line);
  font-size: 11px; font-weight: 700;
  transition: background-color .3s, border-color .3s;
}
.ah-member__social a:hover { background: var(--ah-ember); border-color: var(--ah-ember); }

/* flip button */
.ah-member__flip {
  position: absolute; right: 10px; top: 10px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(7, 6, 10, .45); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background-color .4s, transform .8s var(--ah-ease);
}
.ah-member__flip i { position: absolute; left: 50%; top: 50%; width: 12px; height: 1.6px; margin: -.8px 0 0 -6px; background: currentColor; border-radius: 2px; transition: transform .6s var(--ah-ease); }
.ah-member__flip i:last-child { transform: rotate(90deg); }
.ah-member:hover .ah-member__flip { background: var(--ah-ember); border-color: var(--ah-ember); }
.ah-member.is-flipped .ah-member__flip { transform: rotate(135deg); background: var(--ah-ember); border-color: var(--ah-ember); }

/* join card */
.ah-member__join {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  padding: 16px;
  background: var(--ah-ink-2);
  border: 1px dashed rgba(255, 197, 143, .4);
}
.ah-member__join .ah-orb { width: 180px; height: 180px; right: -50px; top: -40px; opacity: .7; }
.ah-member__join-big {
  position: relative;
  font-family: var(--ah-display); font-weight: 700;
  font-size: clamp(3rem, 4.4vw, 4.6rem); line-height: .9; letter-spacing: -.06em;
}
.ah-member__join-big em { font-family: var(--ah-serif); font-style: italic; font-weight: 400; color: var(--ah-ember); }
.ah-member__join-pill {
  position: relative; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--ah-line);
  font-size: 12px; font-weight: 600;
}
.ah-member__join-link { position: relative; font-size: 13px; font-weight: 700; color: var(--ah-ember); }

/* ---------- Smaller screens: simple grid, no pinning ---------- */
@media (max-width: 1023px) {
  .ah-team__intro { grid-template-columns: 1fr; }
  .ah-deck { height: auto; padding: clamp(40px, 8vh, 80px) var(--ah-gutter) clamp(90px, 14vh, 150px); }
  .ah-deck__hint { display: none; }
  .ah-deck__cards {
    position: static;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  }
  .ah-member { position: relative; left: auto; top: auto; margin: 0; width: auto; height: auto; aspect-ratio: 1 / 1.38; }
  .ah-member__name { font-size: 18px; }
}
@media (max-width: 640px) {
  .ah-team__head .ah-label:last-child { display: none; }
  .ah-deck__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ah-member__bio { font-size: 12px; }
  .ah-member__back { padding: 40px 12px 12px; }
}
