/* Tools › Tuner (roadmap phase 17). Uses the Program Partner tokens from style.css. */

.tuner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.tuner h1,
.tuner-eyebrow {
  margin: 0;
}

.tuner-instrument {
  width: 100%;
  max-width: 24rem;
  text-align: left;
}

.tuner-clef {
  text-align: left;
}

.tuner-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 32rem;
}

.tuner-display.faded .tuner-note,
.tuner-display.faded .tuner-staff,
.tuner-display.faded .tuner-needle {
  opacity: 0.4;
}

.tuner-note {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 4.5rem;
  line-height: 1;
}

.tuner-octave {
  margin-left: 0.1em;
  font-size: 0.4em;
  color: var(--muted-foreground);
}

.tuner-concert,
.tuner-hz {
  margin: 0;
}

.tuner-staff {
  display: flex;
  justify-content: center;
  width: 100%;
}

.tuner-staff svg {
  max-width: 100%;
  height: auto;
}

.tuner-meter {
  width: 100%;
  height: auto;
  overflow: visible;
}

.tuner-track {
  fill: var(--muted);
}

.tuner-close-band {
  fill: color-mix(in oklch, var(--warning) 35%, transparent);
}

.tuner-in-band {
  fill: color-mix(in oklch, var(--success) 55%, transparent);
}

.tuner-tick {
  stroke: var(--muted-foreground);
  stroke-width: 1;
}

.tuner-tick-mid {
  stroke: var(--foreground);
  stroke-width: 1.5;
}

.tuner-meter-box {
  width: 100%;
}

/* The numbers under the meter, placed where their ticks are. */
.tuner-scale {
  position: relative;
  height: 1.1rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.tuner-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.tuner-scale-words {
  display: flex;
  justify-content: space-between;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0 4.6%;
}

.tuner-needle {
  transition: transform 90ms linear;
}

.tuner-needle line {
  stroke: var(--foreground);
  stroke-width: 3;
  stroke-linecap: round;
}

.tuner-needle circle {
  fill: var(--foreground);
}

.tuner-zone {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.75rem;
  margin: 0;
  font-size: 1.125rem;
}

.tuner-zone-shape {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

.tuner-zone-shape .mark {
  fill: none;
  stroke: var(--success-foreground);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zone-in-tune .fill {
  fill: var(--success);
}

.zone-close .fill {
  fill: var(--warning);
}

.zone-flat .fill,
.zone-sharp .fill {
  fill: var(--destructive);
}

.zone-in-tune strong {
  color: var(--success);
}

.tuner-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tuner-actions {
  display: flex;
  justify-content: center;
}

.tuner-start {
  min-width: 10rem;
}

.tuner-status,
.tuner-error {
  margin: 0;
}

.tuner-settings,
.tuner-share {
  width: 100%;
  max-width: 40rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.tuner-settings {
  display: grid;
  gap: 1rem;
}

.tuner-settings .muted.small {
  display: block;
  margin-top: 0.35rem;
  font-weight: 400;
}

/* Four levels fit two to a row on a phone. */
.tuner-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.tuner-levels button {
  padding: 0 0.5rem;
}

@media (max-width: 560px) {
  .tuner-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tuner-note {
    font-size: 3.75rem;
  }
}

.tuner-a4 {
  font: inherit;
  width: 7rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--card);
  color: var(--foreground);
}

.tuner-privacy {
  max-width: 40rem;
  margin: 0;
}

.tuner-share summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
}

.tuner-share[open] > * + * {
  margin-top: 0.75rem;
}

/* A routine's tuner step: the director's settings, as text. */
.tuner-assigned {
  margin: 0;
  font-weight: 500;
}

/* The extras (roadmap phase 19): toggles, the reference tone, open strings and the note trail. */
.tuner-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tuner-extras .check {
  height: auto;
  min-height: 2.25rem;
  padding-block: 0.35rem;
}

.tuner-ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tuner-ref-row select {
  width: auto;
  min-width: 0;
  flex: 1 1 8rem;
}

.tuner-ref-line {
  margin: 0.35rem 0 0;
}

.tuner-strings {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.tuner-string {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.25rem;
  padding: 0.35rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
}

.tuner-string strong {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.1;
}

.tuner-string.near {
  border-color: var(--warning);
}

.tuner-string.on {
  border-color: var(--success);
  background: color-mix(in oklch, var(--success) 18%, transparent);
}

.tuner-trail {
  width: 100%;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.tuner-trail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tuner-trail-head .field-label {
  font-weight: 500;
}

.tuner-trail-staff {
  display: flex;
  justify-content: center;
}

.tuner-trail-staff svg {
  max-width: 100%;
  height: auto;
}
