/*
 * KeyboardHero shell styles.
 *
 * Score rendering gets its own stylesheet in phase 3; this is only the chrome
 * around it. Tokens live here so the renderer can build on the same palette.
 */

:root {
  --ink: #e8e6e3;
  --ink-dim: #9a958e;
  --ground: #16151a;
  --ground-raised: #1e1d24;
  --line: #302e38;
  --accent: #7cc4a4;

  --staff-space: 10px;

  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--ground-raised);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* Chrome ------------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.5rem;
}

.masthead__link {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.masthead__title {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.masthead__title:hover {
  color: var(--accent);
  text-decoration: none;
}

.shell {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
}

.crumbs {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Song list --------------------------------------------------------------- */

.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.song-list__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.song-list__link {
  flex: 1;
  padding: 0.75rem 0;
  color: var(--ink);
}

.song-list__link:hover {
  color: var(--accent);
  text-decoration: none;
}

.song-list__meta {
  color: var(--ink-dim);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* Empty / status ---------------------------------------------------------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
}

.empty p {
  margin: 0 0 0.5rem;
}

.empty__hint {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

/* Player ------------------------------------------------------------------ */

.player__status {
  color: var(--ink-dim);
  font-size: 0.875rem;
  font-family: var(--font-mono);
}

.player__input {
  color: var(--ink-dim);
  font-size: 0.8125rem;
  margin: 0.25rem 0 0;
}

.player__notice {
  color: #e8c46a;
  font-size: 0.8125rem;
  margin: 0.5rem 0 0;
}

.player__notice[hidden] {
  display: none;
}

.player__stage {
  position: relative;
}

.player__score {
  margin: 2rem 0 1.5rem;
}

/* The count-in number, over the score rather than beside it: the player is
   looking at the music, not at the controls. */
.count-in {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;

  font-size: clamp(6rem, 22vw, 14rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 2rem rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;

  animation: count-in-pulse 220ms ease-out;
}

.count-in[hidden] {
  display: none;
}

@keyframes count-in-pulse {
  from {
    transform: scale(1.35);
    opacity: 0.35;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.controls__modes,
.controls__transport {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.controls__transport[hidden] {
  display: none;
}

.controls__tempo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-dim);
  font-size: 0.8125rem;
}

.controls__tempo output {
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
}

.score-board {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  margin-left: auto;
}

.score-board[hidden] {
  display: none;
}

.score-board__label {
  color: var(--ink-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-board__value {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.button {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--ground-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button--on {
  border-color: var(--accent);
  color: var(--ground);
  background: var(--accent);
}

.button--on:hover {
  color: var(--ground);
}

/* Flash -------------------------------------------------------------------- */

.flash {
  margin-bottom: 1.5rem;
}

.flash__message {
  margin: 0 0 0.5rem;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
}

.flash__message--notice {
  border-left-color: var(--accent);
}

.flash__message--alert {
  border-left-color: #e8c46a;
  color: #e8c46a;
}

/* Settings ----------------------------------------------------------------- */

.settings__intro {
  max-width: 44rem;
  color: var(--ink-dim);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.settings__intro--aside {
  margin-bottom: 1.5rem;
}

/*
 * The preview carries .score as well, so it inherits the paper background and
 * the note colours — including whatever /palette.css has overridden. Only the
 * layout needs undoing: .score is a grid of bars, and this is a row of keys.
 * Both classes, because score.css is linked after this file and a single class
 * would lose the tie.
 */
.score.palette-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1rem;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding: 1.5rem 1rem;
}

.palette-preview__key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 3.5rem;
}

.palette-preview__glyph {
  font-family: "Bravura";
  font-size: calc(var(--staff-space) * 5);
  line-height: 1;
}

/* Silence is not a pitch, so it gets its own line under a hairline rather than
   sitting in the row of notes as if it were one of them. */
.palette-preview__key--rest {
  flex-basis: 100%;
  padding-top: 1rem;
  border-top: 1px solid rgba(34, 32, 29, 0.12);
}

.palette-preview__name {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.palette {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.25rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}

.palette__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0;
}

/* A black key is a variation on the white one above it in the list, and reads
   as one. */
.palette__row--black .palette__name {
  color: var(--ink-dim);
}

.palette__label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

/*
 * The picker is the swatch: no separate square to keep in step with it.
 * Browsers give the control their own chrome, so the padding and border are
 * stripped back to leave just the colour.
 */
.palette__picker {
  width: 2.5rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

.palette__picker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.palette__picker::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.palette__picker::-moz-color-swatch {
  border: none;
  border-radius: 2px;
}

.palette__name {
  font-size: 0.875rem;
}

.palette__hex {
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.settings__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.settings__hint {
  color: var(--ink-dim);
  font-size: 0.8125rem;
}

.settings__reset {
  margin-top: 1rem;
}
