/* Álbumes de los proyectos (js/album.js): una foto cada vez, contador y miniaturas que aparecen al pasar el ratón.
   En escritorio el álbum se queda fijo mientras se lee el texto de al lado. */
.album {
  position: sticky;
  top: 24px;
  width: 100%;
  max-width: 660px;
  margin-inline: auto;
}
.a-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
  scrollbar-width: none;
  aspect-ratio: 16/10;
  max-height: min(60vh, 480px);
  overscroll-behavior-x: contain;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

/* mientras el JS anima o se arrastra, el imán del navegador (scroll-snap) se apaga */
.a-track.animating {
  scroll-snap-type: none;
}
.a-track.dragging {
  scroll-snap-type: none;
  scroll-behavior: auto;
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}
.a-track::-webkit-scrollbar {
  display: none;
}
.a-track figure {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.a-track.dragging figure {
  cursor: grabbing;
}

/* la foto tal cual: sin fundirla con el fondo ni atenuar las que no son la actual */
.a-track img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.a-track figcaption {
  display: none;
}
.a-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.a-bar .a-count {
  margin-left: auto;
}
.a-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-height: 0;
  padding-top: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height .28s ease, padding-top .28s ease, opacity .2s ease;
}
.album:hover .a-thumbs, .album:focus-within .a-thumbs {
  max-height: 64px;
  padding-top: 10px;
  opacity: 1;
  pointer-events: auto;
}

/* en Gráfico las miniaturas ocupan su sitio siempre, para que el campo de la tipografía no salte */
#grafico .album .a-thumbs {
  max-height: 64px;
  padding-top: 10px;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .28s ease, opacity .2s ease;
}
#grafico .album:hover .a-thumbs, #grafico .album:focus-within .a-thumbs {
  clip-path: inset(0);
}
.a-thumbs::-webkit-scrollbar {
  display: none;
}
.a-thumbs button {
  flex: 0 0 52px;
  height: 52px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  opacity: .4;
  transition: opacity .2s;
  outline-offset: 2px;
}
.a-thumbs button.on {
  opacity: 1;
  outline: 1px solid var(--ink);
}
.a-thumbs img {
  height: 100%;
  object-fit: cover;
}

/* en pantallas táctiles no hay hover: miniaturas siempre visibles */
@media (hover: none) {
  .a-thumbs {
    max-height: 64px;
    padding-top: 10px;
    opacity: 1;
    pointer-events: auto;
  }
  #grafico .album .a-thumbs {
    clip-path: inset(0);
  }
}

@media (max-width: 980px) {
  .album {
    position: relative;
    top: 0;
    order: -1;
    max-width: none;
  }
  .a-track {
    aspect-ratio: 4/3;
    max-height: 60vh;
  }
}
