/* Laboratorio: "Lo que rodea".
   Toda la experiencia es un único SVG a pantalla completa. Los colores salen
   de la escala de variables.css; .is-light invierte la paleta a crema. */

@property --lab-bg {
  syntax: '<color>';
  inherits: true;
  initial-value: #2d313f;
}

@property --lab-fg {
  syntax: '<color>';
  inherits: true;
  initial-value: #e8dfd6;
}

@property --lab-faint {
  syntax: '<color>';
  inherits: true;
  initial-value: #646c90;
}

@property --lab-soft {
  syntax: '<color>';
  inherits: true;
  initial-value: #b8afa6;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy-600);
}

.lab-stage {
  --lab-bg: var(--navy-600);
  --lab-fg: var(--crema-300);
  --lab-faint: var(--navy-100);
  --lab-soft: var(--crema-500);
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  color: var(--lab-fg);
  font-family: var(--font-display);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: --lab-bg 1.2s ease, --lab-fg 1.2s ease, --lab-faint 1.2s ease, --lab-soft 1.2s ease;
}

.lab-stage.is-light {
  --lab-bg: var(--crema-300);
  --lab-fg: var(--navy-600);
  --lab-faint: var(--navy-100);
  --lab-soft: var(--navy-200);
}

.lab-backdrop {
  fill: var(--lab-bg);
}

.lab-veil {
  fill: var(--lab-bg);
  opacity: 0.82;
  filter: url(#lab-veil-blur);
  pointer-events: none;
}

.lab-fg {
  color: var(--lab-fg);
}

.lab-faint {
  color: var(--lab-faint);
}

/* Texto */

.lab-title,
.lab-text,
.lab-choice-label,
.lab-hud-label,
.lab-legend-label,
.lab-map-label {
  fill: var(--lab-fg);
  /* Halo del color de fondo: las formas de la escena pasan por detrás sin
     ensuciar la lectura. */
  paint-order: stroke;
  stroke: var(--lab-bg);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.lab-title {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.lab-text {
  font-weight: 500;
}

.lab-text--soft,
.lab-hud-label--soft,
.lab-legend-label {
  fill: var(--lab-soft);
}

.lab-choice-label {
  font-weight: 600;
}

.lab-hud-label {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lab-legend-label {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lab-probe {
  visibility: hidden;
}

/* Decisiones */

.lab-choice,
.lab-hud-link {
  cursor: pointer;
  outline: none;
}

.lab-choice-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  transition: stroke 200ms ease;
}

.lab-choice-ring {
  fill: none;
  stroke: var(--lab-faint);
  stroke-width: 1.6;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1), stroke 250ms ease;
}

.lab-choice-glow {
  fill: var(--lab-fg);
  opacity: 0;
  transition: opacity 250ms ease;
}

.lab-choice-icon {
  color: var(--lab-fg);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), color 250ms ease;
}

.lab-choice:hover .lab-choice-ring,
.lab-choice:focus-visible .lab-choice-ring {
  stroke: var(--lab-fg);
  transform: rotate(60deg) scale(1.14);
}

.lab-choice:hover .lab-choice-glow,
.lab-choice:focus-visible .lab-choice-glow {
  opacity: 1;
}

.lab-choice:hover .lab-choice-icon,
.lab-choice:focus-visible .lab-choice-icon {
  color: var(--lab-bg);
  transform: scale(1.12);
}

.lab-choice:focus-visible .lab-choice-hit,
.lab-hud-link:focus-visible .lab-choice-hit {
  stroke: var(--lab-faint);
}

.lab-choice:active .lab-choice-ring {
  transform: rotate(90deg) scale(0.92);
}

.lab-hud-link .lab-hud-label {
  transition: fill 200ms ease;
}

.lab-hud-link:hover .lab-hud-label {
  fill: var(--lab-soft);
}

/* Mapa de caminos */

.lab-map-edge {
  stroke: var(--lab-faint);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.lab-map-edge.is-unknown {
  stroke-dasharray: 2 6;
  opacity: 0.7;
}

.lab-map-edge.is-known {
  stroke-width: 1.6;
}

.lab-map-edge.is-path {
  stroke: var(--lab-fg);
  stroke-width: 2.6;
  stroke-dasharray: var(--length) var(--length);
  stroke-dashoffset: var(--length);
  animation: lab-draw 900ms 300ms ease forwards;
}

.lab-map-mark {
  color: var(--lab-bg);
  fill: var(--lab-bg);
  stroke: var(--lab-faint);
  stroke-width: 1.5;
}

.lab-map-node.is-known .lab-map-mark {
  color: var(--lab-faint);
  fill: var(--lab-faint);
}

.lab-map-node.is-path .lab-map-mark {
  color: var(--lab-fg);
  fill: var(--lab-fg);
  stroke: var(--lab-fg);
}

.lab-map-node.is-unknown .lab-map-label {
  fill: var(--lab-faint);
}

.lab-map-here {
  fill: none;
  stroke: var(--lab-fg);
  stroke-width: 1.4;
  stroke-dasharray: 2 4;
  transform-box: fill-box;
  transform-origin: center;
  animation: lab-spin 8s linear infinite;
}

.lab-map-label {
  font-weight: 600;
}

@keyframes lab-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes lab-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Accesibilidad y alternativas */

.lab-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lab-noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  color: var(--crema-300);
  font-family: var(--font-body);
  text-align: center;
}

.lab-noscript a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .lab-stage,
  .lab-choice-ring,
  .lab-choice-icon,
  .lab-choice-glow {
    transition: none;
  }

  .lab-map-edge.is-path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .lab-map-here {
    animation: none;
  }
}
