/* anatomy.css v1 — hero "Anatomía X-ray" T420 (vista planta 2D) */
/* Depende de los tokens de thinkpad.css (--stage, --red-ink, --font-mono,
   --ease-out). Animaciones armadas por la clase html.anat-play que el
   componente añade inline durante el parseo (respetando reduced-motion). */

.hero-stage.anatomy-stage {
  display: grid;
  place-items: center;
}

.anatomy-scene {
  width: min(100%, 1520px);
  height: 100%;
  display: grid;
  place-items: center;
  transform: perspective(1200px) rotateX(var(--py, 0deg)) rotateY(var(--px, 0deg));
  transition: transform 0.18s linear;
  will-change: transform;
}

.anatomy-svg {
  width: 100%;
  height: 100%;
  max-height: 82vh;
  transform: translateY(-6.5%);
  display: block;
}

/* ---------- trazos base ---------- */

.anatomy-svg .s {
  stroke: rgba(242, 240, 236, 0.5);
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
}

.anatomy-svg .s-strong {
  stroke: rgba(242, 240, 236, 0.78);
  stroke-width: 1.7;
}

.anatomy-svg .s-faint {
  stroke: rgba(242, 240, 236, 0.28);
  stroke-width: 1.1;
}

.anatomy-svg .sheet .s {
  stroke: rgba(242, 240, 236, 0.2);
}

/* ---------- plancha técnica: textos ---------- */

.cap {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  fill: rgba(242, 240, 236, 0.45);
}

.cap-red { fill: var(--red-ink); letter-spacing: 0.14em; }
.cap-dim { font-size: 10.5px; fill: rgba(242, 240, 236, 0.28); }

.silk {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  fill: rgba(242, 240, 236, 0.24);
}

.port-l,
.port-r {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  fill: rgba(242, 240, 236, 0.4);
  text-anchor: end;
}

.port-r { text-anchor: start; }

/* ---------- casco / componentes ---------- */

.comp.hot { cursor: crosshair; }
.comp.hot:hover { filter: brightness(1.45); }

.chip { fill: rgba(242, 240, 236, 0.2); }

.blade {
  fill: rgba(242, 240, 236, 0.14);
  stroke: rgba(242, 240, 236, 0.34);
  stroke-width: 0.8;
}

.fan-hub {
  fill: var(--red);
  stroke: rgba(226, 35, 26, 0.55);
  stroke-width: 5;
  opacity: 0.9;
}

.die-glow {
  fill: rgba(226, 35, 26, 0.09);
  opacity: 1;
}

.led {
  fill: #5ed164;
  opacity: 0.85;
  animation: none;
}

/* ---------- teclado fantasma ---------- */

.kb { opacity: 0.2; }

.kbkey {
  stroke: rgba(242, 240, 236, 0.6);
  stroke-width: 1;
  fill: none;
}

/* ---------- trackpoint ---------- */

.tp-dot {
  fill: var(--red);
  filter: drop-shadow(0 0 7px rgba(226, 35, 26, 0.85));
}

.tp-ring {
  stroke: rgba(226, 35, 26, 0.55);
  stroke-width: 1.2;
  fill: none;
  transform-origin: 588px 322px;
}

/* ---------- callouts ---------- */

.lead {
  stroke: rgba(242, 240, 236, 0.3);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 1;
}

.pt { fill: var(--red-ink); }

.lb-t,
.lb-s {
  font-family: var(--font-mono);
  fill: rgba(242, 240, 236, 0.85);
}

.lb-t {
  font-size: 13.5px;
  letter-spacing: 0.1em;
  fill: rgba(242, 240, 236, 0.8);
}

.lb-s {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  fill: rgba(242, 240, 236, 0.38);
}

.lb-red { fill: var(--red-ink); }

/* ---------- estados animados (html.anat-play) ---------- */

/* trazo que se dibuja: shell, frame, cruces, leaders */
.anat-play .anatomy-svg .s[pathLength="1"] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: anat-draw 0.8s var(--ease-out) forwards;
}

.anat-play .anatomy-svg .frame { animation-delay: 0.05s; }
.anat-play .anatomy-svg .cross path { animation-delay: 0.2s; }
.anat-play .anatomy-svg .shell .s { animation-delay: 0.32s; }
.anat-play .anatomy-svg .shell .s-faint { animation-delay: 0.5s; }

/* componentes internos: fade + leve subida, escalera por --d */
.anat-play .anatomy-svg .comp {
  opacity: 0;
  animation: anat-in 0.55s var(--ease-out) forwards;
  animation-delay: var(--d, 0.5s);
}

/* teclado fantasma: aparece después del casco */
.anat-play .anatomy-svg .kb {
  animation: anat-fade 0.9s var(--ease-out) 0.95s forwards;
  opacity: 0;
}

/* trackpoint: pulso de vida */
.anat-play .anatomy-svg .tp {
  animation: anat-in 0.5s var(--ease-out) 1.15s forwards;
  opacity: 0;
}

.anat-play .anatomy-svg .tp-ring {
  animation: anat-ring 2.6s ease-in-out 1.7s infinite;
}
.anat-play .anatomy-svg .die-glow {
  animation: anat-pulse 3.4s ease-in-out 1.6s infinite;
}
.anat-play .anatomy-svg .fan-hub {
  animation: anat-pulse 2.8s ease-in-out 1.9s infinite;
}
.anat-play .anatomy-svg .led {
  animation: anat-pulse 2.4s ease-in-out var(--ld, 0s) infinite;
}

/* fan girando */
.anat-play .anatomy-svg .fan-spin {
  transform-origin: 962px 246px;
  animation: anat-rot 18s linear infinite;
}

/* scanline: barrido único al cargar */
.anat-play .anatomy-svg .scan {
  animation: anat-scan 1.7s var(--ease-out) 0.3s 1 forwards;
  opacity: 0;
}

/* callouts: guía dibujada + puntos y textos en escalera */
.anat-play .anatomy-svg .callout .lead {
  stroke-dashoffset: 1;
  animation: anat-draw 0.5s var(--ease-out) forwards;
  animation-delay: var(--d, 1.6s);
}
.anat-play .anatomy-svg .callout .pt {
  opacity: 0;
  animation: anat-in 0.4s var(--ease-out) forwards;
  animation-delay: calc(var(--d, 1.6s) + 0.15s);
}
.anat-play .anatomy-svg .callout .lb-t,
.anat-play .anatomy-svg .callout .lb-s {
  opacity: 0;
  animation: anat-in 0.45s var(--ease-out) forwards;
  animation-delay: calc(var(--d, 1.6s) + 0.25s);
}

/* flotación general de la máquina */
.anat-play .anatomy-svg .mac {
  animation: anat-bob 7.5s ease-in-out 2.2s infinite alternate;
}

/* ---------- keyframes ---------- */

@keyframes anat-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes anat-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes anat-fade {
  from { opacity: 0; }
  to { opacity: 0.2; }
}

@keyframes anat-rot {
  to { transform: rotate(360deg); }
}

@keyframes anat-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes anat-ring {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.55); opacity: 0.15; }
}

@keyframes anat-scan {
  0% { opacity: 0; transform: translateY(0); }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateY(452px); }
}

@keyframes anat-bob {
  from { transform: translateY(-7px); }
  to { transform: translateY(7px); }
}

/* ---------- móvil ---------- */

@media (max-width: 640px) {
  .anatomy-svg {
    max-height: none;
    transform: none;
  }
  .lb-t,
  .lb-s,
  .port-l,
  .port-r,
  .silk,
  .cap,
  .leds {
    display: none;
  }
}

/* ---------- hero: plancha centrada (texto tipo museo) ---------- */

.hero:has(.anatomy-stage) .hero-wrap {
  align-items: center;
  text-align: center;
  padding-bottom: 9vh;
}

.hero:has(.anatomy-stage) .hero-sub {
  margin-left: auto;
  margin-right: auto;
}