/* The interactive keyboard (/keyboard/). The page hero, practice card and option buttons come from page.css, the keys
   from piano.css. */

/* Base (phones) */

.kb-options {
  margin-bottom: 18px;
}

.kb-options .option[hidden] {
  display: none;
}

/* phones: each label above its buttons, which share the full width */
.kb-options .option {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.kb-options .seg {
  display: flex;
}

.kb-options .seg button {
  flex: 1;
  padding: 0 8px;
}

/* the key picker, styled like the option buttons */
.kb-select {
  -webkit-appearance: none;
  appearance: none;
  height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2375706a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.kb-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The keys in their ebony case (piano.css), as on the homepage: what is played or shown above them, the buttons
   under them */
.kb-case {
  padding: 20px 14px 14px;
}

.kb-readout {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 72px;
  margin: 8px 0 16px;
}

.kb-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.6vw, 2.1rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.kb-detail {
  font-size: 0.9rem;
  color: var(--ebony-muted);
}

.kb-case .piano-scroll {
  margin-bottom: 0;
}

.kb-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 14px;
}

/* the quiet buttons, used by the Practice page */
.kb-btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.kb-btn:hover:not(:disabled) {
  background: var(--bg-alt);
}

.kb-btn.is-primary {
  background: var(--strong);
  border-color: var(--strong);
  color: var(--on-strong);
}

.kb-btn.is-primary:hover:not(:disabled) {
  background: var(--strong);
  opacity: 0.88;
}

.kb-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.kb-btn[aria-pressed="true"] {
  color: var(--muted);
}

.kb-tool .go-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.88rem;
}

.kb-tool .go-link[hidden] {
  display: none;
}

.kb-help {
  margin: 14px 0 0;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--muted);
}

.kb-help kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text);
}

/* no computer keys on a phone or tablet */
@media (hover: none) {
  .kb-help {
    display: none;
  }
}

/* Tablet */
@media (min-width: 768px) {
  .kb-options .option {
    align-items: flex-start;
  }

  .kb-options .seg button {
    flex: none;
    padding: 0 14px;
  }

  .kb-options {
    grid-template-columns: repeat(auto-fit, minmax(0, max-content));
    justify-content: start;
    gap: 18px 28px;
  }

  .kb-case {
    padding: 24px 22px 18px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  /* the card is as wide as the keyboard (880px) plus its padding, so the options, keys and readout line up */
  .kb-tool {
    max-width: 952px;
  }
}
