/* MOTION GRAPHIC DE INICIO · Gráficos vectoriales, sin video ni librerías.
 * Tres escenas de seis segundos. lab-motion.js controla reproducción,
 * visibilidad y capítulos; CSS dibuja y anima células, ADN y tejido.
 * Las escenas son conceptuales, no resultados ni imágenes de pacientes. */
.lab-motion {
  --scene-play: paused;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0;
  border-radius: 64px 22px 22px 22px;
  min-height: 550px;
  padding: 29px 30px 20px;
  color: #fff;
  border: 1px solid #4b477b;
  background:
    radial-gradient(ellipse at 75% 22%, #433261 0, transparent 62%),
    radial-gradient(ellipse at 15% 65%, #2c345b, transparent 65%), #151b44;
  box-shadow:
    0 22px 65px #171d4d15,
    inset 0 1px 0 #ffffff14;
}
.lab-motion[data-playing="true"] {
  --scene-play: running;
}
.lab-motion-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
}
.lab-motion-top > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #d1cce2;
}
.lab-motion-top i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f0a2c5;
  box-shadow: 0 0 10px #ef8abc80;
}
.lab-motion-top > span:last-child {
  color: #f0a2c5;
  font-size: 30px;
  line-height: 1;
}
.motion-stage {
  position: relative;
  height: 325px;
  margin: 5px -10px 4px;
}
.lab-grid {
  position: absolute;
  inset: 25px 5px;
  opacity: 0.13;
  background-image: radial-gradient(#d1c3e6 1px, transparent 1px);
  background-size: 25px 25px;
  mask-image: radial-gradient(ellipse, #000, transparent 72%);
}
.lab-halo {
  position: absolute;
  inset: 25px 10%;
  border-radius: 50%;
  background: radial-gradient(ellipse, #ba8bd924, transparent 70%);
}
.motion-scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94) translateY(10px);
  transition:
    opacity 0.8s ease,
    transform 1s ease,
    visibility 0.8s;
  pointer-events: none;
}
.motion-scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}
.motion-scene svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.scene-tag {
  position: absolute;
  padding: 7px 10px;
  border: 1px solid #cfbee929;
  background: #28274e9c;
  border-radius: 20px;
  color: #e6d7ee;
  font-size: 6px;
  letter-spacing: 1.1px;
  box-shadow: 0 5px 15px #12133214;
}
.tag-a {
  top: 23%;
  left: 0;
}
.tag-b {
  bottom: 17%;
  right: -3px;
}
.film-cell {
  transform-box: fill-box;
  transform-origin: center;
  animation: cell-drift 5s ease-in-out infinite alternate;
}
.cell-b {
  animation-delay: -2s;
  animation-duration: 6s;
}
.cell-c {
  animation-delay: -4s;
  animation-direction: alternate-reverse;
}
.film-orbit {
  transform-origin: 250px 190px;
  animation: cell-orbit 18s linear infinite;
}
.film-scan {
  animation: cell-scan 5.5s ease-in-out infinite;
}
.dna-field {
  height: 100%;
  display: grid;
  place-items: center;
  perspective: 700px;
}
.dna-orbit {
  position: absolute;
  width: 270px;
  height: 270px;
  border: 1px solid #c7b6e72b;
  border-radius: 50%;
  transform: rotateX(60deg) rotateZ(-35deg);
  box-shadow: 0 0 0 22px #a296d504;
}
.dna-helix {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: rotate(-23deg);
  width: 140px;
  transform-style: preserve-3d;
}
.dna-rung {
  display: block;
  position: relative;
  width: 140px;
  height: 4px;
  background: linear-gradient(90deg, #c795ca90, #acb2ef55);
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--rung) * 24deg));
  animation: helix-turn 6s linear infinite;
  animation-delay: calc(var(--rung) * -0.4s);
  border-radius: 9px;
}
.dna-rung i,
.dna-rung b {
  position: absolute;
  top: -5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ffe5f2, #d885b2 60%, #784779);
  box-shadow: 0 0 15px #d58ac636;
}
.dna-rung i {
  left: -7px;
}
.dna-rung b {
  right: -7px;
  background: radial-gradient(circle at 30% 25%, #e5eaff, #989edd 60%, #4c578d);
}
.film-slide {
  transform-origin: 250px 190px;
  animation: slide-drift 6s ease-in-out infinite alternate;
}
.film-focus {
  transform-origin: 224px 183px;
  animation: focus-roam 6s ease-in-out infinite;
}
.film-tissue {
  animation: tissue-light 3s ease-in-out infinite alternate;
}
.film-trace {
  stroke-dasharray: 360;
  animation: trace-draw 6s ease-in-out infinite;
}
.lab-motion-caption {
  position: relative;
  min-height: 91px;
  padding-left: 4px;
}
.motion-copy > span {
  display: block;
  color: #e6a1c4;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 1.7px;
  margin-bottom: 9px;
}
.motion-copy h2 {
  color: #fff;
  font-size: clamp(23px, 2.4vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.8px;
}
.motion-copy p {
  color: #bebad0;
  font-size: 11px;
  margin-top: 9px;
}
.lab-motion-controls {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 24px 4px 0;
}
.motion-chapters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
}
.motion-chapters button {
  min-height: 38px;
  background: none;
  border: 0;
  color: #b1abc5;
  padding: 0;
  text-align: left;
  font-size: 8px;
  letter-spacing: 0.4px;
}
.motion-chapters button > span {
  display: block;
  position: relative;
  height: 2px;
  background: #b6a8d32b;
  margin-bottom: 9px;
  overflow: hidden;
  border-radius: 2px;
}
.motion-chapters i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: #ed9fc7;
}
.motion-chapters button[aria-pressed="true"] {
  color: #fff;
}
.motion-play {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d0bdeb4d;
  border-radius: 50%;
  color: #f0d8eb;
  background: #ffffff06;
  font-size: 16px;
  transition: background 0.3s;
}
.motion-play:hover {
  background: #ffffff17;
}
.motion-play:disabled {
  opacity: 0.5;
  cursor: default;
}
.motion-disclaimer {
  display: block;
  color: #8f8ba8;
  font-size: 7px;
  margin: 14px 4px 0;
}
.lab-motion .motion-scene *,
.lab-motion .dna-rung {
  animation-play-state: var(--scene-play);
}
.lab-motion .motion-scene:not(.is-active) * {
  animation-play-state: paused;
}
.lab-motion button:focus-visible {
  outline: 2px solid #f7bbd7;
  outline-offset: 4px;
  border-radius: 5px;
}
@keyframes cell-drift {
  from {
    transform: translate(-4px, 3px) rotate(-3deg);
  }
  to {
    transform: translate(5px, -7px) rotate(4deg);
  }
}
@keyframes cell-orbit {
  to {
    transform: rotate(360deg);
  }
}
@keyframes cell-scan {
  0%,
  100% {
    transform: translateY(-95px);
    opacity: 0;
  }
  15%,
  75% {
    opacity: 0.75;
  }
  85% {
    transform: translateY(100px);
    opacity: 0;
  }
}
@keyframes helix-turn {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}
@keyframes slide-drift {
  from {
    transform: rotate(-5deg) translateY(0);
  }
  to {
    transform: rotate(1deg) translateY(-5px);
  }
}
@keyframes focus-roam {
  0%,
  100% {
    transform: translate(-8px, -4px);
  }
  50% {
    transform: translate(17px, 9px);
  }
}
@keyframes tissue-light {
  from {
    fill-opacity: 0.2;
  }
  to {
    fill-opacity: 0.4;
  }
}
@keyframes trace-draw {
  0%,
  10% {
    stroke-dashoffset: 360;
    opacity: 0.3;
  }
  65%,
  100% {
    stroke-dashoffset: 0;
    opacity: 0.8;
  }
}
@media (max-width: 1100px) {
  .lab-motion {
    padding-inline: 22px;
    border-top-left-radius: 50px;
  }
  .motion-stage {
    height: 300px;
  }
}
@media (max-width: 760px) {
  .lab-motion {
    max-width: 540px;
    margin-inline: auto;
    min-height: 0;
    padding: 26px 24px 18px;
  }
  .motion-stage {
    height: 310px;
  }
  .motion-copy h2 {
    font-size: 28px;
  }
}
@media (max-width: 420px) {
  .lab-motion {
    padding: 23px 18px 16px;
    border-radius: 42px 20px 20px 20px;
  }
  .lab-motion-top {
    padding-left: 8px;
  }
  .lab-motion-top > span:first-child {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .motion-stage {
    height: 265px;
  }
  .scene-tag {
    font-size: 5px;
    padding: 6px 8px;
  }
  .motion-copy h2 {
    font-size: 25px;
  }
  .motion-copy p {
    font-size: 10px;
  }
  .motion-chapters {
    gap: 9px;
  }
  .lab-motion-controls {
    gap: 15px;
    margin-top: 18px;
  }
  .dna-helix {
    transform: rotate(-23deg) scale(0.82);
  }
  .dna-orbit {
    width: 220px;
    height: 220px;
  }
}
@media (max-width: 350px) {
  .motion-stage {
    height: 230px;
  }
  .motion-copy h2 {
    font-size: 21px;
  }
  .dna-helix {
    transform: rotate(-23deg) scale(0.7);
  }
  .lab-motion-top > span:first-child {
    font-size: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lab-motion *,
  .lab-motion *::before {
    animation: none !important;
    transition: none !important;
  }
  .film-scan {
    display: none;
  }
}
@media print {
  .lab-motion-controls {
    display: none;
  }
  .lab-motion {
    break-inside: avoid;
  }
}

/* Orden de los pares de ADN: sin atributos style inline, compatible con CSP. */
.dna-rung:nth-child(1) {
  --rung: 0;
}
.dna-rung:nth-child(2) {
  --rung: 1;
}
.dna-rung:nth-child(3) {
  --rung: 2;
}
.dna-rung:nth-child(4) {
  --rung: 3;
}
.dna-rung:nth-child(5) {
  --rung: 4;
}
.dna-rung:nth-child(6) {
  --rung: 5;
}
.dna-rung:nth-child(7) {
  --rung: 6;
}
.dna-rung:nth-child(8) {
  --rung: 7;
}
.dna-rung:nth-child(9) {
  --rung: 8;
}
.dna-rung:nth-child(10) {
  --rung: 9;
}
.dna-rung:nth-child(11) {
  --rung: 10;
}
.dna-rung:nth-child(12) {
  --rung: 11;
}
.dna-rung:nth-child(13) {
  --rung: 12;
}
.dna-rung:nth-child(14) {
  --rung: 13;
}
.dna-rung:nth-child(15) {
  --rung: 14;
}
