/* JamLand Learn: the guitar tuner's own styles (/learn/guitar/tools/tuner/).
   Linked from the tool panel, so only the tuner page loads them; the parts
   (.tool, .seg, .btn, .play, .select) come from learn.css.

   The screen reads from arm's length: one big note, a wide needle, and an
   "In tune" state that turns the screen green with the words and a check
   mark, so it never rests on color alone. The needle sits at --c, the
   cents from -50 to +50, which is also its offset in percent of the
   track's width. */

#tuner { --tn-good: #9ee08c; --tn-good-wash: rgba(158, 224, 140, 0.13); }
#tuner .tool-screen { gap: 6px; align-content: center; transition: box-shadow .25s var(--ease), background-color .25s var(--ease); }
.tn-note { display: flex; align-items: baseline; justify-content: center; gap: 4px; height: 81px; line-height: 81px; transition: color .2s var(--ease); }
.tn-note sub { position: static; font-size: 0.36em; line-height: 1; color: var(--ink-3); }
.tn-note.is-idle { font-size: clamp(30px, 8.5vw, 54px); word-spacing: 0.1em; color: var(--ink-2); }

.tn-meter { width: min(100%, 460px); padding: 8px 10px 0; overflow: hidden; }
.tn-track { position: relative; height: 54px; border-radius: 14px; background: rgba(196, 214, 240, 0.06); box-shadow: inset 0 0 0 1px var(--line); }
.tn-zone { position: absolute; top: 0; bottom: 0; left: 46%; width: 8%; background: var(--tn-good-wash); box-shadow: inset 1px 0 0 rgba(158, 224, 140, 0.35), inset -1px 0 0 rgba(158, 224, 140, 0.35); }
.tn-tick { position: absolute; top: 50%; left: calc(50% + var(--at) * 1%); width: 2px; height: 12px; margin-left: -1px; transform: translateY(-50%); border-radius: 1px; background: var(--line-2); }
.tn-tick.major { height: 26px; background: rgba(196, 214, 240, 0.4); }
.tn-needle { position: absolute; inset: -5px 0; transform: translateX(calc(var(--c, 0) * 1%)); transition: transform .12s linear, opacity .3s var(--ease); pointer-events: none; }
.tn-needle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 122, 0.45); }
.tn-needle.is-off { opacity: 0.28; }
.tn-scale { display: flex; justify-content: space-between; padding: 6px 2px 0; font: 400 16.875px/1 var(--pixel); color: var(--ink-3); }

.tn-cents { font: 400 40.5px/1.05 var(--pixel); color: var(--ink); font-variant-numeric: tabular-nums; }
.tn-note.is-idle ~ .tn-cents { font: 400 17px/1.4 var(--read); color: var(--ink-2); }
.tn-hint { min-height: 1.5em; }
#tuner .tool-status:empty { display: none; }

#tuner .is-far .tn-needle::before { background: var(--ember-text); box-shadow: none; }
#tuner .is-in { background: radial-gradient(ellipse at 50% 30%, var(--tn-good-wash), transparent 70%), var(--inset); box-shadow: inset 0 0 0 3px var(--tn-good), inset 0 10px 30px -10px rgba(0, 0, 0, 0.6); }
#tuner .is-in .tn-note, #tuner .is-in .tn-cents { color: var(--tn-good); }
#tuner .is-in .tn-zone { background: rgba(158, 224, 140, 0.3); }
#tuner .is-in .tn-needle::before { background: var(--tn-good); box-shadow: 0 0 14px rgba(158, 224, 140, 0.6); }
#tuner .is-in .tn-cents::before { content: ""; display: inline-block; width: 0.3em; height: 0.6em; margin: 0 0.4em 0.12em 0; border: solid currentColor; border-width: 0 0.13em 0.13em 0; transform: rotate(45deg); }

/* Controls */
.tn-go { align-items: center; }
.tn-private { flex: 1 1 220px; margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.tn-tuning { flex: 1 1 260px; }
.tn-tuning .select { width: 100%; }

/* Strings: Auto across the top and the six strings under it (three and
   three on the narrowest phones), all in one row where there is room. */
.seg.tn-strings { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; border-radius: 24px; }
.seg.tn-strings .tn-auto { grid-column: 1 / -1; }
.seg.tn-strings button { flex-direction: column; gap: 3px; min-width: 0; min-height: 54px; padding: 0 4px; border-radius: 20px; }
.tn-s-note { font-size: 24px; line-height: 1; }
.tn-s-num { font-size: 13.5px; line-height: 1; color: var(--ink-3); }
.seg.tn-strings [aria-checked="true"] .tn-s-num { color: inherit; }
.seg.tn-strings button.is-heard { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.tn-tones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tn-tones .play { min-width: 0; padding: 0 10px; gap: 8px; }

@media (min-width: 560px) {
  .seg.tn-strings { grid-template-columns: 1.3fr repeat(6, minmax(0, 1fr)); }
  .seg.tn-strings .tn-auto { grid-column: auto; }
  .tn-tones { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 359px) {
  .seg.tn-strings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Phones: a shorter screen, so Start tuning is near the first screen. */
@media (max-width: 640px) {
  #tuner .tool-screen { min-height: 0; padding: 14px 12px 16px; }
  .tn-note { height: 70px; line-height: 70px; font-size: 70px; }
  .tn-cents { font-size: 33.75px; }
}
@media (forced-colors: active) {
  .tn-needle::before, #tuner .is-in .tn-needle::before { forced-color-adjust: none; background: Highlight; }
  .tn-tick, .tn-tick.major { forced-color-adjust: none; background: CanvasText; }
  #tuner .is-in { outline: 3px solid Highlight; }
}
@media print {
  .tn-meter, .tn-hint { display: none; }
}
