/* Animaciones 3D incrustadas (ver build/animaciones/). Usa las variables de color de cada página. */
.anim {
  position: relative;
  margin: 2rem 0 0.75rem;
  outline: none;
}
.anim__poster {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius, 16px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.anim__aviso {
  display: none;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--color-text-muted, #9a9a90);
}
.anim[data-estado="sin-3d"] .anim__aviso { display: block; }
.anim[data-estado="cargando"] .anim__poster { opacity: 0.75; }

.anim__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius, 16px);
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #26313f 0%, #131922 55%, #08090c 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.55);
}
.anim__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
  border-radius: 0;
}
.anim__stage canvas:active { cursor: grabbing; }
.anim__labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.anim__labels path { fill: none; stroke: rgba(255, 255, 255, 0.65); stroke-width: 1; }
.anim__labels circle { fill: #fff; stroke: #0a0a0a; stroke-width: 1; }
.anim__labels text {
  fill: #f1f5fa;
  font: 500 13px/1 var(--font-sans, system-ui, sans-serif);
  paint-order: stroke;
  stroke: rgba(10, 10, 10, 0.8);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.anim__labels path, .anim__labels circle, .anim__labels text { transition: opacity 0.25s; }
.anim__caption {
  position: absolute;
  left: 16px;
  top: 16px;
  max-width: min(400px, 62%);
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.anim__caption p { margin: 0; }
.anim__title { font-size: 0.98rem; font-weight: 500; color: var(--color-text, #e8e8e0); }
.anim__text { margin-top: 4px !important; font-size: 0.86rem; line-height: 1.45; color: #c3ccd7; }
.anim__hint {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 0.75rem;
  color: #9aa6b4;
}
.anim__controls { display: grid; gap: 10px; padding-top: 12px; }
.anim__bar { display: flex; align-items: center; gap: 12px; }
.anim__play {
  flex: none;
  min-width: 104px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 0;
  background: var(--color-accent, #4a9b8e);
  color: #06120f;
  font: 500 0.88rem/1 var(--font-sans, system-ui, sans-serif);
  cursor: pointer;
}
.anim__time { flex: 1; height: 22px; accent-color: var(--color-accent, #4a9b8e); }
.anim__steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.anim__steps button {
  padding: 8px 4px;
  border-radius: 9px;
  border: 1px solid var(--color-border, #2a2a2a);
  background: var(--color-surface, #121212);
  color: var(--color-text-muted, #9a9a90);
  font: 400 0.76rem/1.2 var(--font-sans, system-ui, sans-serif);
  cursor: pointer;
}
.anim__steps button[data-on] {
  border-color: var(--color-accent, #4a9b8e);
  color: var(--color-text, #e8e8e0);
  background: rgba(74, 155, 142, 0.14);
}
.anim-figure figcaption {
  font-size: 0.88rem;
  color: var(--color-text-muted, #9a9a90);
  margin-bottom: 2rem;
}
.anim--ancha { max-width: 1040px; margin-left: auto; margin-right: auto; }

@media (max-width: 640px) {
  .anim__stage, .anim__poster { aspect-ratio: 4 / 5; }
  .anim__steps { grid-template-columns: repeat(3, 1fr); }
  .anim__caption { max-width: calc(100% - 24px); left: 12px; top: 12px; }
  .anim__hint { display: none; }
  .anim__text { display: none; }
  .anim__caption { padding: 8px 12px; }
  .anim__labels text { font-size: 11.5px; }
}

/* Dentro de un artículo el visor es estrecho: solo el título del paso, sin la frase. */
.anim:not(.anim--ancha) .anim__text { display: none; }
.anim:not(.anim--ancha) .anim__caption { padding: 8px 12px; }

/* Aviso de control con rayos X y opciones elegibles (tipo de instrumento, etc.). */
.anim__badge {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(230, 240, 255, 0.92);
  color: #0b1522;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
}
.anim__options { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 12px; }
.anim__option { display: inline-flex; border: 1px solid var(--color-border, #2a2a2a); border-radius: 999px; overflow: hidden; }
.anim__option button {
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted, #9a9a90);
  font: 400 0.8rem/1.2 var(--font-sans, system-ui, sans-serif);
  cursor: pointer;
}
.anim__option button[data-on] { background: var(--color-accent, #4a9b8e); color: #06120f; }

/* Velocidad de reproducción y viñeta del visor. */
.anim__speed {
  flex: none;
  min-width: 52px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border, #2a2a2a);
  background: var(--color-surface, #121212);
  color: var(--color-text, #e8e8e0);
  font: 500 0.82rem/1 var(--font-sans, system-ui, sans-serif);
  cursor: pointer;
}
.anim__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}
.anim__labels, .anim__caption, .anim__hint, .anim__badge { z-index: 1; }
