* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #222;
  background: #fff;
  overflow-x: hidden;
}

#track {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  overflow: visible;
}

/* la capa del carrito: una caja chica que lo sigue por el documento,
   no una capa de página completa — un svg a todo lo ancho taparía el
   texto (y el inspector lo mediría como contenido cubierto) */
#trackTop {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 30;
  width: 110px;
  height: 110px;
  pointer-events: none;
  overflow: visible;
  will-change: transform;
}

#labHit {
  fill: none;
  stroke: transparent;
  stroke-width: 40;
  pointer-events: stroke;
  cursor: grab;
  /* sin esto, en táctil el gesto de arrastrar la cinta se lo lleva el
     scroll de la página (y un tirón hacia abajo refresca la página) */
  touch-action: none;
}
#labHit.rope-drag { cursor: grabbing; }

#trackPath {
  fill: none;
  stroke: #141414;
  stroke-width: 14.4;
  stroke-linecap: round;
  stroke-linejoin: miter;
}

#bot {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 5px 5px rgba(0,0,0,.22));  /* taste-skill-ignore: objeto físico, no control en reposo */
  transition: filter .3s;
}
#bot.drag { cursor: grabbing; }
#bot.lift { filter: drop-shadow(0 22px 16px rgba(0,0,0,.30)); }  /* taste-skill-ignore */

#bot .sen { fill: #222; }
#bot.on .sen.hit { fill: #ff3b30; }

#bot .led { transition: fill .15s; }
#bot.on .led {
  fill: #38d05c;
  filter: drop-shadow(0 0 6px #38d05c);  /* taste-skill-ignore: brillo del LED */
}

#menu {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
}

#menuLinks {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

#menuToggle {
  display: none;
  width: 38px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #f0f0f0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

#menuToggle span {
  width: 18px;
  height: 2px;
  background: #141414;
  border-radius: 1px;
  transition: transform .18s ease, opacity .18s ease;
}

#menu.open #menuToggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
#menu.open #menuToggle span:nth-child(2) { opacity: 0; }
#menu.open #menuToggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* menú compacto: las rallitas quedan en la barra y los enlaces bajan
   como desplegable */
#menu.compact #menuToggle { display: flex; }

#menu.compact #menuLinks {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);   /* taste-skill-ignore: overlay real */
}

#menu.compact.open #menuLinks { display: flex; }

#menu.compact #menuLinks a {
  padding: 10px 12px;
  font-size: 1rem;
}

#menu.compact #openLab {
  margin: 6px 0 0;
  align-self: flex-start;
}

#menu a {
  color: #333;
  text-decoration: none;
  font-size: .85rem;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

#menu a:hover { background: #fff3c4; }

#openLab {
  margin-left: auto;
  border: 0;
  background: #141414;
  color: #fff;
  font-size: .85rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

section, footer, header.hero { scroll-margin-top: 64px; }

#lab {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #fff;
}

#labTrack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#labPath {
  fill: none;
  stroke: #141414;
  stroke-width: 14.4;
  stroke-linecap: round;
  stroke-linejoin: miter;
  pointer-events: none;
}

.lab-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(255,255,255,.92);
}

.lab-title { font-weight: 700; }

.lab-hint {
  color: #555;
  font-size: .85rem;
  flex: 1;
}

#closeLab {
  border: 0;
  background: #141414;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .85rem;
}

main {
  position: relative;
  z-index: 20;                 /* por encima de la cinta (10), debajo de su agarre y el carrito (30) */
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

section, footer {
  background: rgba(255,255,255,.82);
  border-radius: 14px;
  padding: 18px 26px;
  margin: 40px 0;
}

.hero {
  text-align: center;
  padding: 170px 16px 26px;
}

h1, h2, h3, .lede, figcaption { text-wrap: balance; }

h1 {
  font-size: clamp(3rem, 9vw, 5rem);
  margin: .2em 0 .15em;
  letter-spacing: -0.02em;
  line-height: 1;
}

h2 {
  font-size: 1.9rem;
  margin-top: 0;
  border-bottom: 3px solid #f4c91f;
  display: inline-block;
  padding-bottom: 4px;
}

h3 { font-size: 1.15rem; }

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 34em;
  margin: 0 auto 1em;
}

.hint {
  font-size: .85rem;
  color: #555;
  max-width: 32em;
  margin: 0 auto;
}

.track-anchor { height: 70px; }

p, li { line-height: 1.65; }

ul { padding-left: 1.2em; }
li { margin: .4em 0; }

.specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.specs li {
  margin: 0;
  background: #fff6d6;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .85rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.card {
  margin: 0;
  text-align: left;
}

.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}

.card figcaption {
  margin-top: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.card figcaption span {
  display: block;
  font-weight: 400;
  color: #666;
  font-size: .85rem;
}

.card figcaption .rol {
  color: #b78f00;
  font-weight: 600;
}

.podium { align-items: end; }

.podium .card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 246, 214, .55);
}

/* el podio en sí: un escalón coloreado a pie de cada tarjeta, con las
   alturas del podium real (1.º más alto) y las bases alineadas */
.podium .card::after {
  content: '';
  display: block;
  margin: auto -14px -14px;
  border-radius: 0 0 9px 9px;
}
.podium .p1::after { height: 64px; background: #f4c91f; }
.podium .p2::after { height: 42px; background: #d9d9d9; }
.podium .p3::after { height: 26px; background: #d9a86c; }

/* fila de retratos con desnivel editorial en vez de tres cajas iguales */
#equipo .card:nth-child(2) { transform: translateY(16px); }
#equipo .card:nth-child(3) { transform: translateY(32px); }

.prize .lugar {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
}

.prize p {
  margin: .4em 0 0;
  font-size: .85rem;
}

.nota {
  color: #555;
  font-size: .85rem;
}

figure.wide img {
  width: 100%;
  border-radius: 12px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.gallery img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.gallery a {
  display: block;
  cursor: zoom-in;
  border-radius: 10px;
}

.gallery a:focus-visible {
  outline: 3px solid #f4c91f;
  outline-offset: 2px;
}

/* Visor de fotos: cubre todo, por encima del menú (z-40) y del lab (z-60) */
#visor {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .92);
}

#visor[hidden] { display: none; }

.visor-fig {
  margin: 0;
  text-align: center;
  max-width: 92vw;
}

#visorImg {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
  touch-action: pan-y;
  user-select: none;
}

#visorCap {
  margin-top: 10px;
  color: #ddd;
  font-size: .85rem;
}

.visor-flecha {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 2.6rem;
  line-height: 1;
  padding: 18px 18px 22px;
  border-radius: 12px;
  cursor: pointer;
}

.visor-flecha:hover { background: rgba(255, 255, 255, .28); }
.visor-flecha.izq { left: 14px; }
.visor-flecha.der { right: 14px; }

.visor-barra {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
}

.visor-barra button {
  border: 0;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .85rem;
}

.visor-barra button:hover { background: rgba(255, 255, 255, .25); }

@media (max-width: 560px) {
  /* en pantallas angostas las flechas tapan la foto; alcanza la barra */
  .visor-flecha { display: none; }
}

a { color: #0f7fae; }

footer {
  text-align: left;
  color: #666;
  font-size: .85rem;
  margin-bottom: 80px;
}

.credit { font-size: .85rem; }
.credit a { color: #666; }

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .card { max-width: 220px; margin: 0 auto; }
  #equipo .card { transform: none; }
  .podium .card { max-width: 340px; }
  .lab-hint { display: none; }
  .lab-bar { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
