/* ==========================================================================
   Implant Dental · Vitrina de especialistas (team-show) COMPARTIDA
   Inicio y especialistas.html. Usa los tokens de site.css.
   Variante compacta: .team-show--home
   ========================================================================== */

.team-show {
  margin-top: var(--s-7);
  --ts-interval: 6s;
}

/* Reserva de espacio mientras el JSON carga (CLS 0) */
.team-show[data-team-src]:not(.is-ready) {
  min-height: 640px;
  margin-top: var(--s-7);
  border-radius: var(--r-lg, 24px);
  background: linear-gradient(100deg, hsl(210 30% 96% / .55) 30%, hsl(210 30% 99% / .9) 50%, hsl(210 30% 96% / .55) 70%) 0 0 / 220% 100%;
  animation: ts-skeleton 1.6s ease-in-out infinite;
}
@keyframes ts-skeleton { to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) {
  .team-show[data-team-src]:not(.is-ready) { animation: none; }
}
@media (min-width: 900px) {
  .team-show[data-team-src]:not(.is-ready) { min-height: 700px; }
}

.team-show__stage {
  position: relative;
  margin-top: clamp(56px, 8vw, 110px);
  touch-action: pan-y;
  display: grid;
}

.team-show__panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  overflow: visible;
  isolation: isolate;
}

.team-show__panel {
  grid-area: 1 / 1;   /* todos los paneles comparten celda: altura = panel más alto (CLS 0) */
}

.team-show__panel:not(.is-active) {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.team-show__copy {
  padding: clamp(24px, 4vw, 56px);
  position: relative;
  z-index: 1;
}

.team-show__name {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: var(--s-2);
}

.team-show__role {
  color: var(--ink-3);
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
}

.team-show__bio {
  margin-top: var(--s-5);
  display: grid;
  gap: var(--s-3);
}

.team-show__bio p {
  color: var(--ink-2);
  max-width: 46ch;
  margin: 0;
}

.team-show__actions {
  margin-top: var(--s-6);
  display: flex;
  gap: var(--s-5);
  align-items: center;
  flex-wrap: wrap;
}

.team-show__photo {
  order: -1;
  height: 340px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: 0;
  margin-top: -48px;
  position: relative;
}

.team-show__photo img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(15, 23, 32, 0.18));
}

.team-show__photo::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: 80%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

@media (min-width: 900px) {
  .team-show__panel {
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 460px;
  }

  .team-show__photo {
    order: 0;
    position: relative;
    height: auto;
    margin: 0;
    display: block;
  }

  .team-show__photo img {
    position: absolute;
    bottom: 0;
    right: 6%;
    height: calc(100% + clamp(56px, 8vw, 110px));
    width: auto;
    max-width: none;
  }

  .team-show__photo::before {
    left: auto;
    right: 6%;
    margin-inline: 0;
    width: 80%;
    max-width: 380px;
  }
}

/* ---------- Navegación: miniaturas + flechas ---------- */
.team-show__nav {
  margin-top: var(--s-6);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.team-show__list {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-block: var(--s-2);
}

.team-show__list::-webkit-scrollbar {
  display: none;
}

@media (min-width: 900px) {
  .team-show__list {
    justify-content: space-between;
    overflow: visible;
  }
}

.team-show__tab {
  flex: 0 0 132px;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
  border-radius: var(--r-lg);
  text-align: center;
  font-family: inherit;
  transition: transform 0.3s var(--ease);
}

.team-show__tab:hover {
  transform: translateY(-3px);
}

.team-show__tab:active {
  transform: translateY(-1px);
}

.team-show__tab:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

.team-show__thumb {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--white), 0 0 0 4px var(--line);
  transition: box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
  filter: grayscale(0.55);
}

.team-show__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.team-show__tab[aria-selected="true"] .team-show__thumb {
  filter: none;
  box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--accent);
}

.team-show__tab-name {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.team-show__tab[aria-selected="true"] .team-show__tab-name {
  color: var(--accent-ink);
}

.team-show__tab-role {
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.3;
}

/* Indicador de progreso del autoplay (barra fina bajo la miniatura activa) */
.team-show__bar {
  position: relative;
  display: block;
  width: 44px;
  height: 3px;
  margin-top: calc(var(--s-1) * -1);
  border-radius: var(--r-pill);
  background: transparent;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s;
}

.team-show.is-running .team-show__tab[aria-selected="true"] .team-show__bar {
  background: var(--line);
  opacity: 1;
}

.team-show__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.team-show.is-running .team-show__tab[aria-selected="true"] .team-show__bar::after {
  animation: teamBar var(--ts-interval) linear forwards;
}

.team-show.is-holding .team-show__tab[aria-selected="true"] .team-show__bar::after {
  animation-play-state: paused;
}

@keyframes teamBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.team-show__arrow,
.team-show__toggle {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s;
}

.team-show__arrow {
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--shadow-soft);
}

.team-show__arrow:hover {
  transform: scale(1.06);
}

.team-show__arrow:active {
  transform: scale(0.97);
}

.team-show__toggle {
  background: var(--white);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.team-show__toggle:hover {
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.team-show__toggle:active {
  transform: scale(0.95);
}

.team-show__toggle[hidden] {
  display: none;
}

.team-show__toggle[aria-pressed="false"] .team-show__ic-play,
.team-show__toggle[aria-pressed="true"] .team-show__ic-pause {
  display: none;
}

.team-show__arrow:focus-visible,
.team-show__toggle:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

@media (max-width: 639px) {
  .team-show__arrow {
    display: none;
  }
}

/* ---------- Transición entre doctores (entrada con fade + desplazamiento, <= 450 ms) ---------- */
@keyframes teamFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes teamPhotoIn {
  from { opacity: 0; transform: translateX(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes teamGlow {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: none; }
}

.team-show__panel.is-active .team-show__sede { animation: teamFadeUp 0.36s var(--ease) both; }
.team-show__panel.is-active .team-show__name { animation: teamFadeUp 0.36s var(--ease) 0.04s both; }
.team-show__panel.is-active .team-show__role { animation: teamFadeUp 0.36s var(--ease) 0.08s both; }
.team-show__panel.is-active .team-show__bio { animation: teamFadeUp 0.36s var(--ease) 0.12s both; }
.team-show__panel.is-active .team-show__actions { animation: teamFadeUp 0.36s var(--ease) 0.16s both; }
.team-show__panel.is-active .team-show__photo img { animation: teamPhotoIn 0.42s var(--ease) both; }
.team-show__panel.is-active .team-show__photo::before { animation: teamGlow 0.45s var(--ease) both; }

/* ---------- Variante compacta para el Inicio ---------- */
.team-show--home {
  margin-top: var(--s-6);
}

.team-show--home .team-show__stage {
  margin-top: clamp(44px, 6vw, 80px);
}

.team-show--home .team-show__copy {
  padding: clamp(20px, 3vw, 40px);
}

.team-show--home .team-show__name {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.team-show--home .team-show__bio {
  margin-top: var(--s-4);
  gap: var(--s-2);
}

.team-show--home .team-show__bio p {
  font-size: var(--fs-sm);
}

.team-show--home .team-show__bio p:nth-child(n+2) {
  display: none;
}

.team-show--home .team-show__actions {
  margin-top: var(--s-5);
}

.team-show--home .team-show__nav {
  margin-top: var(--s-5);
}

.team-show--home .team-show__thumb {
  width: 64px;
  height: 64px;
}

.team-show--home .team-show__tab {
  flex-basis: 116px;
}

.team-show--home .team-show__tab-role {
  display: none;
}

@media (max-width: 899px) {
  .team-show--home .team-show__photo {
    height: 280px;
  }
}

@media (min-width: 900px) {
  .team-show--home .team-show__panel {
    min-height: 380px;
  }
  .team-show--home .team-show__photo img {
    height: calc(100% + clamp(44px, 6vw, 80px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-show * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Balance (v3.1): sin flechas ni pausa; contenido centrado ---------- */
.team-show__nav { justify-content: center; }
@media (min-width: 900px) {
  .team-show__list {
    flex: 0 1 auto;
    justify-content: center;
    gap: clamp(16px, 3vw, 48px);
  }
  .team-show__panel { grid-template-columns: 1.15fr 0.85fr; }
  .team-show__copy {
    align-self: center;
    max-width: 600px;
    padding-inline-start: clamp(40px, 5vw, 72px);
  }
}
@media (min-width: 900px) {
  .team-show__name { font-size: clamp(2rem, 2.8vw, 2.75rem); }
  .team-show__role { font-size: 1.02rem; }
  .team-show__bio { max-width: 52ch; font-size: 1.04rem; }
}
@media (min-width: 900px) {
  .team-show__bio p { max-width: 52ch; font-size: 1.04rem; }
}
