/* staff.css — the Virtual Keys staff (staff.js) and its key signature buttons. */

#superstaff-layout {
  position: relative;
  width: 326px;
  margin: 20px auto;
  height: 350px;
  opacity: 1;
  transform: translateY(0) scale(1);
  /* Smooth transition for layout expansion and fade */
  transition: height 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              margin 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.4s ease 0.1s,
              transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

#superstaff-layout.hidden {
  height: 0px;
  margin: 0px auto;
  opacity: 0;
  transform: translateY(15px) scale(0.98);
  pointer-events: none;
  /* Snappier fade out, same smooth collapse */
  transition: height 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              margin 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.25s ease,
              transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* === Key signature buttons === */
#key-sig-controls {
  position: absolute;
  left: -50px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#key-sig-controls button {
  background: none;
  border: none;
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0px 10px;
  margin: 0;
  transition: all 0.2s ease, color 0.6s ease;
}

#key-sig-controls button:hover {
  color: #fff;
  transform: scale(1.1);
}

#key-display {
  font-family: 'Alumni Sans Pinstripe', sans-serif;
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
  margin: 0;
  width: 40px;
  height: 60px;
  position: relative;
  overflow: hidden;
  transition: color 0.6s ease;
}

/* The key name slides out and the new one slides in. */
.key-text-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
}

.key-text-wrapper.out-up,
.key-text-wrapper.in-from-top {
  transform: translateY(-100%);
  opacity: 0;
}

.key-text-wrapper.out-down,
.key-text-wrapper.in-from-bottom {
  transform: translateY(100%);
  opacity: 0;
}

.key-text-wrapper.active {
  transform: translateY(0);
  opacity: 1;
}

.key-accidental {
  font-family: sans-serif;
  font-size: 0.6em;
  margin-left: -4px;
  vertical-align: 15%;
  font-weight: normal;
}

body.day-mode #key-display {
  color: #000000;
}

body.day-mode #key-sig-controls button {
  color: #666;
}

body.day-mode #key-sig-controls button:hover {
  color: #000;
}

/* === Staff === */
/* 27 x 29 staff spaces, drawn 350px tall (about 12px to the space). */
#staff-svg {
  display: block;
  width: 326px;
  height: 350px;
  color: #ffffff;
  transition: color 0.6s ease;
}

body.day-mode #staff-svg {
  color: #000000;
}

.staff-line {
  stroke: currentColor;
}

.staff-glyph {
  fill: currentColor;
}

/* Notes pop in when a key goes down and shrink away when it comes up. */
.staff-note {
  transform-box: view-box;
  animation: staff-pop-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.staff-note.is-leaving {
  animation: staff-pop-out 0.14s ease-in both;
}

@keyframes staff-pop-in {
  0% { opacity: 0; transform: scale(0.3); }
  60% { opacity: 1; transform: scale(1.18); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes staff-pop-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3); }
}

@media (prefers-reduced-motion: reduce) {
  .staff-note,
  .staff-note.is-leaving { animation-duration: 0.01s; }
}
