.instrument-gallery {
  position: relative;
  width: 100%;
  margin: 26px 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.instrument-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
}

.instrument-stage[data-aspect="spectrum"] {
  aspect-ratio: 5 / 3;
}

.instrument-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.instrument-track::-webkit-scrollbar {
  display: none;
}

.instrument-track:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
}

.instrument-view {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.instrument-view > img,
.instrument-view picture,
.instrument-view picture img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.instrument-view .fill-frame {
  object-fit: cover;
}

.instrument-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-top: 1px solid var(--hair);
  background: var(--paper);
  color: var(--faint);
  font-family: "Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.instrument-arrow {
  position: absolute;
  z-index: 2;
  top: calc(50% - 20px);
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink);
  font: 400 20px/1 "Plex Mono", monospace;
  cursor: pointer;
  place-items: center;
  transform: translateY(-50%);
}

.instrument-arrow--previous {
  left: 12px;
}

.instrument-arrow--next {
  right: 12px;
}

.instrument-arrow:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.instrument-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.instrument-counter {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  padding: 5px 7px;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--soft);
  font: 500 9px/1 "Plex Mono", monospace;
  letter-spacing: 0.08em;
}

@media (max-width: 700px) {
  .instrument-gallery {
    width: 100%;
    margin-left: 0;
  }

  .instrument-stage[data-aspect="landscape"] {
    aspect-ratio: 4 / 3;
  }

  .instrument-arrow {
    top: calc(50% - 26px);
    width: 38px;
    height: 38px;
    background: color-mix(in srgb, var(--paper) 82%, transparent);
  }

  .instrument-arrow--previous {
    left: 8px;
  }

  .instrument-arrow--next {
    right: 8px;
  }

  .instrument-counter {
    top: 8px;
    right: 8px;
  }

  .instrument-caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 640px) {
  .instrument-stage[data-aspect="spectrum"] {
    aspect-ratio: 390 / 875;
  }
}

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