/* Guitar Imp — tuner
   The dial, the readout under it and the six string keys. Everything else on
   the page comes from the shared tool furniture in style.css. */

.gauge {
    margin: 0 auto clamp(12px, 3vw, 18px);
    max-width: 340px;
}

.gauge__face {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.gauge__arc {
    fill: none;
    stroke: rgba(236, 226, 207, .24);
    stroke-width: 2;
}

.tick {
    stroke: rgba(236, 226, 207, .30);
    stroke-width: 1.4;
}

.tick--major {
    stroke: rgba(236, 226, 207, .62);
    stroke-width: 2;
}

.gauge__index { fill: var(--bone-dim); }

.gauge__edge {
    fill: var(--nickel);
    font-size: 16px;
    text-anchor: middle;
}

.gauge__needle {
    transition: transform .11s ease-out;
}

.gauge__needle line {
    stroke: var(--glow);
    stroke-width: 3.2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 5px rgba(245, 163, 60, .45));
}

/* The whole dial turns green the moment the string lands, so it reads from
   across the room without looking at the numbers. */
.tuner.is-tuned .gauge__needle line {
    stroke: var(--imp);
    filter: drop-shadow(0 0 9px rgba(125, 201, 95, .55));
}

.tuner.is-tuned .gauge__index { fill: var(--imp); }

.readout {
    margin-top: -6px;
    text-align: center;
}

.readout__note {
    margin: 0;
    font-family: 'Syne', system-ui, sans-serif;
    font-weight: 800;
    font-size: clamp(46px, 15vw, 66px);
    line-height: 1;
    letter-spacing: -.02em;
}

.tuner.is-tuned .readout__note { color: var(--imp); }

.readout__cents {
    margin: 6px 0 0;
    font-size: 13px;
    letter-spacing: .10em;
    text-transform: uppercase;
    color: var(--bone-dim);
}

.tuner.is-tuned .readout__cents { color: var(--imp); }

.readout__freq {
    margin: 4px 0 0;
    min-height: 1.3em;
    font-size: 11.5px;
    color: var(--nickel);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   String keys
   -------------------------------------------------------------------------- */

/* One equal column per string, however many the tuning has: six for a guitar,
   four for the violin. */
.strings {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: clamp(5px, 1.6vw, 8px);
    margin: clamp(16px, 4vw, 22px) 0;
}

.string-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 6px 2px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #241a16;
    color: var(--bone);
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.string-btn__note {
    font-family: 'Syne', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(15px, 4.4vw, 19px);
    line-height: 1;
}

.string-btn__octave {
    margin-top: 2px;
    font-size: 10px;
    line-height: 1;
    color: var(--nickel);
}

.string-btn.is-target {
    border-color: rgba(245, 163, 60, .55);
    color: var(--glow);
}

.tuner.is-tuned .string-btn.is-target {
    border-color: rgba(125, 201, 95, .6);
    color: var(--imp);
}

.string-btn.is-pinned {
    background: rgba(245, 163, 60, .13);
    border-color: var(--glow);
}

.string-btn.is-ringing {
    animation: string-ring .45s ease-out;
}

@keyframes string-ring {
    0%   { background: rgba(245, 163, 60, .35); }
    100% { background: #241a16; }
}

/* --------------------------------------------------------------------------
   Modes
   -------------------------------------------------------------------------- */

.tuner.is-ear .gauge,
.tuner.is-ear #mic-toggle { display: none; }

.tuner.is-mic .check { display: none; }

.tuner.no-mic .modes { opacity: .9; }

/* --------------------------------------------------------------------------
   Idle
   Nothing is being heard: the dial drops back to bone so the lit needle always
   means a real reading.
   -------------------------------------------------------------------------- */

.tuner.is-idle .gauge__needle line {
    stroke: var(--nickel);
    filter: none;
}

.tuner.is-idle .readout__note {
    color: var(--nickel);
    opacity: .45;
}
