.diagram.instrument {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
}

.instrument-art {
  position: absolute;
  inset: 0;
  background: #f4e9d3;
  pointer-events: none;
  mask-image: radial-gradient(ellipse farthest-side at 50% 50%, black 96%, transparent 100%);
}

.instrument-works {
  display: block;
  width: 100%;
  height: 100%;
}

.instrument-wheel-outer,
.instrument-wheel-inner,
.instrument-hand {
  transform-origin: 0 0;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}

.instrument-wheel-outer {
  animation-name: instrument-turn;
  animation-duration: 46s;
}

.instrument-wheel-inner {
  animation-name: instrument-turn;
  animation-direction: reverse;
  animation-duration: 23s;
}

.instrument-hand {
  animation-name: instrument-balance;
  animation-duration: 5.4s;
  animation-timing-function: ease-in-out;
  animation-direction: alternate;
}

.instrument-running :is(.instrument-wheel-outer,.instrument-wheel-inner,.instrument-hand) {
  animation-play-state: running;
}

@keyframes instrument-turn { to { transform: rotate(360deg); } }
@keyframes instrument-balance {
  0%, 10% { transform: rotate(-3deg); }
  85%, 100% { transform: rotate(3deg); }
}

.instrument #nodes { pointer-events: none; }
.instrument .node {
  position: absolute;
  translate: -50% -50%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  width: 6.7%;
  min-width: 27px;
  padding: 0;
  pointer-events: auto;
  color: var(--blue-dark);
  border: 1px solid #696e71;
  border-radius: 50%;
  background: radial-gradient(circle at 43% 33%, #fff5dd, #e9d7b7);
  box-shadow: inset 0 0 0 2px #f4e8cf, inset 0 0 0 3px #bea17c, 0 1px 2px #40352644;
  font: 500 clamp(14px, 1.35vw, 23px)/1 Georgia, serif;
  font-variant-numeric: lining-nums;
}
.instrument .node::after {
  content: "";
  position: absolute;
  min-width: 44px;
  min-height: 44px;
  inset: 50% auto auto 50%;
  transform: translate(-50%,-50%);
  border-radius: inherit;
}
.instrument .node:first-child {
  width: 8%;
  font-size: clamp(18px, 1.9vw, 28px);
}
.instrument .node[aria-pressed="true"] {
  color: #fff5dc;
  background: var(--blue);
  border-color: var(--blue-dark);
  box-shadow: inset 0 0 0 2px var(--blue), inset 0 0 0 3px #ceb98e, 0 0 0 1px #f2e7ce;
}
.instrument .node:focus-visible { outline: 2px solid var(--blue-dark); outline-offset: 4px; }
