/* ==========================================================================
   M.I.H. Group — team-gallery.css
   3D Hover Team Gallery — cinematic film-strip card deck (About page).

   Ported 1:1 in structure from the provided reference implementation.
   Colors/fonts remapped to the M.I.H. design system:
     - Dark navy       (page: #111A24, section recess: #0D1520)
     - Gold accent     #C5A059  (matches --c-gold)
     - Gold soft       #D9BC85  (matches --c-gold-soft)
     - Montserrat      (inherited from base.css --font-sans)

   ---- Easily customize the look below — all tokens are scoped to the
        section so nothing leaks into the rest of the site. ---- */
.team-3d-gallery {
  --gallery-bg: #0D1520;          /* recessed cinematic background */
  --card-radius: 18px;
  --accent: #C5A059;              /* brand gold */
  --accent-soft: #D9BC85;         /* brand gold-soft */
  --text-light: #FFFFFF;
  --text-dim: #B7B7C2;
  --card-collapsed-w: 70px;       /* collapsed sliver width */
  --card-expanded-w: 420px;       /* expanded card width */
  --card-height: 460px;           /* deck height */
  --transition-speed: 0.9s;       /* card expand/collapse duration */
  --ease: cubic-bezier(0.65, 0, 0.35, 1);   /* buttery ease */

  position: relative;
  background: var(--gallery-bg);
  padding: 90px 20px;
  overflow: hidden;
}

/* ---------------------------------------------------- gallery header ----- */
.gallery-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 50px;
}

.gallery-tag {
  display: inline-block;
  color: var(--accent-soft);
  letter-spacing: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.gallery-title {
  color: var(--text-light);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.gallery-title .gold { color: var(--accent); }

.gallery-subtitle {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
}

/* ------------------------------------------------------- gallery track --- */
.gallery-track {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 14px;
  max-width: 1200px;
  margin: 0 auto;
  perspective: 1800px;            /* 3D depth for the fanned-out deck */
  height: var(--card-height);
}

/* ----------------------------------------------------------- card base --- */
.gallery-card {
  position: relative;
  flex: 0 0 var(--card-collapsed-w);
  width: var(--card-collapsed-w);
  height: 100%;
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
  transform: rotateY(28deg);      /* fan tilt (odd cards lean one way…) */
  transition:
    flex-basis var(--transition-speed) var(--ease),
    width var(--transition-speed) var(--ease),
    transform var(--transition-speed) var(--ease),
    box-shadow var(--transition-speed) var(--ease);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  outline: none;
}
.gallery-card:nth-child(odd)  { transform: rotateY(28deg); }   /* …and even */
.gallery-card:nth-child(even) { transform: rotateY(-28deg); }   /* lean the other */

/* Expanded / active state — straightens the card and lifts it forward */
.gallery-card.active {
  flex: 0 0 var(--card-expanded-w);
  width: var(--card-expanded-w);
  transform: rotateY(0deg) translateZ(40px);
  box-shadow: 0 25px 60px rgba(197, 160, 89, 0.35);
  z-index: 5;
}

/* Keyboard focus — gold ring (overrides the global outline to avoid doubling) */
.gallery-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent), 0 25px 60px rgba(197, 160, 89, 0.35);
}

/* ------------------------------------------------------- card media ----- */
.card-media {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.55);
  transition:
    filter var(--transition-speed) var(--ease),
    transform 1.2s var(--ease);
  transform: scale(1.08);
}

.gallery-card.active .card-media img {
  filter: grayscale(0) brightness(0.85);
  transform: scale(1);
}

/* Bottom gradient — reveals the image top, darkens the bottom for text.
   Starts at 40% (instead of 30%) so more of the portrait is visible. */
.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 40%,
    rgba(13, 21, 32, 0.78) 100%
  );
  pointer-events: none;
}

/* Vertical name label shown on collapsed slivers */
.card-collapsed-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
  color: var(--text-light);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1px;
  z-index: 2;
  opacity: 1;
  transition: opacity 0.4s var(--ease);
}

.gallery-card.active .card-collapsed-label {
  opacity: 0;
  pointer-events: none;
}

/* -------------------------------------------------------- info panel -----
   Frosted glass strip at the card bottom; constrained so the photo remains
   the hero — never exceeds ~42% of the card height. */
.card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 42%;
  padding: 18px 20px 20px;
  z-index: 3;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s var(--ease) 0.2s,
    transform 0.45s var(--ease) 0.2s;
  background: linear-gradient(
    180deg,
    rgba(13, 21, 32, 0) 0%,
    rgba(13, 21, 32, 0.52) 40%,
    rgba(13, 21, 32, 0.88) 100%
  );
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.gallery-card.active .card-info {
  opacity: 1;
  transform: translateY(0);
}

.card-name {
  color: var(--text-light);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px;
}

.card-role {
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: 0.5px;
}

.card-bio {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 16px;
}

/* ------------------------------------------------------- social links --- */
.card-socials {
  display: flex;
  gap: 10px;
}

.social-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  transition:
    transform 0.3s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
  text-decoration: none;
}

.social-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* Lift + gold glow on hover */
.social-btn:hover {
  transform: translateY(-4px);
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(197, 160, 89, 0.5);
}

.social-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------- responsive: tablet / -- */
/* Mobile fallback: horizontal snap-scroll, 3D tilt disabled. */
@media (max-width: 900px) {
  .team-3d-gallery {
    --card-expanded-w: 300px;
    --card-height: 380px;
  }

  .gallery-track {
    overflow-x: auto;
    justify-content: flex-start;
    perspective: none;              /* no 3D tilt on touch devices */
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* hide track scrollbar (WebKit below) */
  }
  .gallery-track::-webkit-scrollbar { display: none; }

  .gallery-card {
    transform: none !important;     /* flat cards — every sliver fully visible */
    scroll-snap-align: center;
  }
}