/* The same instrument materials in the trainer, lessons and note explorer. */
:root { --fretboard-wood: url('./maple.svg'); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --fretboard-wood: url('./rosewood.svg'); }
}
:root[data-theme="dark"] { --fretboard-wood: url('./rosewood.svg'); }

.neck-scroll,
.learning-neck {
  --neck-label: light-dark(#35291d, #fff2d9);
  --neck-steel: linear-gradient(90deg, #59636a, #b8c3c9 17%, #f8fdff 35%, #dbe4e9 47%, #7e8b93 73%, #e3eaed 91%, #67747c);
  color: var(--neck-label);
  background: linear-gradient(180deg, light-dark(#fffbed24, #120b080d), light-dark(#9d6b2010, #130b0833)), var(--fretboard-wood) center / 1200px 100% light-dark(#e7c791, #43291f);
  border: 1px solid light-dark(#977345, #2e1b14);
  border-radius: 9px;
  box-shadow: inset 0 2px 1px light-dark(#fff8dba6, #d2a57e4d), inset 0 -3px 2px light-dark(#89603570, #180d0ba8), inset 2px 0 3px light-dark(#8f622140, #140c0859), 0 2px 4px #20140e26;
  scrollbar-color: light-dark(#886b46, #a99986) light-dark(#e5c790, #332219);
}

.neck-scroll .fret-numbers,
.neck-scroll .string-name,
.learning-neck .learn-frets,
.learning-neck .string-label {
  color: var(--neck-label);
  text-shadow: 0 1px 2px light-dark(#fff7db80, #170c08);
}

/* Quiet unused strings without breaking the continuous metal frets. */
.learning-neck .learn-string.unused { opacity: 1; }
.neck-scroll .string-row.inactive .string-name,
.learning-neck .learn-string.unused .string-label { color: light-dark(#66513a, #cfbaa6); }
.neck-scroll .string-row.inactive .fret-button::before,
.learning-neck .learn-string.unused .learn-fret::before { opacity: .42; }
.neck-scroll .fret-button:disabled { opacity: 1; }

.neck-scroll .fret-button,
.learning-neck .learn-fret {
  --string-gauge: 1px;
  --string-winding: linear-gradient(transparent, transparent);
  border: 0;
  overflow: visible;
}

/* Flush pearloid dots sit between strings, separate from the playable notes.
   The position pattern repeats in the second octave; open strings have no dot. */
.fret-inlay {
  display: none;
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border: 1px solid light-dark(#796b53, #b4b3a7);
  border-radius: 50%;
  background: radial-gradient(ellipse at 20% 22%, #fffffff2 10%, transparent 40%), radial-gradient(ellipse at 72% 30%, #c5d1d699 12%, transparent 42%), radial-gradient(ellipse at 32% 75%, #e1d2e29c 8%, transparent 36%), radial-gradient(ellipse at 65% 80%, #c3d4ca99 12%, transparent 45%), linear-gradient(125deg, #e3e6d8 10%, #fffff3 26%, #d0dad4 33%, #f9f3e8 48%, #dbe4e4 59%, #fffbed 72%, #e6e4d7);
  box-shadow: inset 0 0 1px #fff, 0 0 0 .5px #352b2259;
  pointer-events: none;
}
:is(.fret-button, .learn-fret)[data-string="3"]:is([data-fret="3"], [data-fret="5"], [data-fret="7"], [data-fret="9"], [data-fret="15"], [data-fret="17"], [data-fret="19"], [data-fret="21"]) > .fret-inlay,
:is(.fret-button, .learn-fret):is([data-string="2"], [data-string="4"]):is([data-fret="12"], [data-fret="24"]) > .fret-inlay { display: block; }
@media (max-width: 760px) { .fret-inlay { width: 12px; height: 12px; } }

:is(.fret-button, .learn-fret)[data-string="2"] { --string-gauge: 1.4px; }
:is(.fret-button, .learn-fret)[data-string="3"] { --string-gauge: 1.8px; }
:is(.fret-button, .learn-fret)[data-string="4"] { --string-gauge: 2.7px; }
:is(.fret-button, .learn-fret)[data-string="5"] { --string-gauge: 3.5px; }
:is(.fret-button, .learn-fret)[data-string="6"] { --string-gauge: 4.3px; }
:is(.fret-button, .learn-fret):is([data-string="4"], [data-string="5"], [data-string="6"]) {
  --string-winding: repeating-linear-gradient(108deg, #263139c9 0 .6px, #f5f9fbc2 .8px 1.25px, #87939980 1.5px 2.3px, #dce3e680 2.5px 2.9px);
}

/* Strings sit above the fret crowns; note markers remain above both. */
.neck-scroll .fret-button::before,
.learning-neck .learn-fret::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--string-gauge);
  transform: translateY(-50%);
  background: var(--string-winding), linear-gradient(180deg, #4c5961, #eff5f7 28%, #b6c2c9 48%, #718087 80%, #e4ecef);
  box-shadow: 0 2px 2px #0e0909b3;
  pointer-events: none;
}

.neck-scroll .fret-button::after,
.learning-neck .learn-fret::after {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  right: 0;
  width: 5px;
  border-radius: 0;
  background: var(--neck-steel);
  box-shadow: 1px 0 2px #100c0bd9, -1px 0 1px #180f0b80;
  clip-path: inset(0 -4px);
  pointer-events: none;
}

:is(.string-row, .learn-string):nth-child(2) :is(.fret-button, .learn-fret)::after { border-radius: 2px 2px 0 0; }
:is(.string-row, .learn-string):last-child :is(.fret-button, .learn-fret)::after { border-radius: 0 0 2px 2px; }

:is(.neck-scroll, .learning-neck) [data-fret="0"]::after {
  width: 7px;
  background: linear-gradient(90deg, #918978, #fff8e5 30%, #ddd4bf 75%, #a69c87);
}
/* An open-string column at the right is a mirrored neck: put its nut inward. */
:is(.neck-scroll, .learning-neck):has(:is(.fret-button, .learn-fret)[data-fret="0"]:last-child) :is(.fret-button, .learn-fret)::after {
  left: 0;
  right: auto;
}

.neck-scroll .fret-button:hover:not(:disabled),
.learning-neck .learn-fret:hover:not(:disabled) { background: light-dark(#513a2214, #fff2d918); }
.neck-scroll .fret-button:focus-visible,
.learning-neck .learn-fret:focus-visible {
  outline: 2px solid var(--neck-label);
  outline-offset: -5px;
}

.neck-scroll .note-dot,
.learning-neck .learn-fret b { z-index: 3; text-shadow: none; }
.neck-scroll .note-dot:not(:empty),
.note-neck.labels-shown .learn-string:not(.unused) .learn-fret b {
  color: #30251d;
  background: #f6e9d0;
  box-shadow: 0 1px 4px #160d0ba8;
}
.neck-scroll .fret-button.selected .note-dot,
.learning-neck .learn-fret[aria-pressed="true"] b,
.learning-neck .learn-fret.example b,
.note-neck.labels-shown .learn-string:not(.unused) .learn-fret[aria-pressed="true"] b {
  color: #fff8e9;
  background: #304f43;
  box-shadow: 0 0 0 2px #e6d7b6, 0 2px 5px #100b09bf;
}
.neck-scroll .fret-button.previous:not(.selected) .note-dot {
  border: 2px dashed #e6d7b6;
  color: #fff2d9;
  background: #432d25;
}
.neck-scroll .fret-button.focus-hint .note-dot { border: 2px solid #304f43; }
.neck-scroll .fret-button.wrong .note-dot { background: #8c3027; color: #fff8e9; }
.note-neck .learn-fret[aria-pressed="true"] b { outline: none; }
.note-neck .note-match { background: #f2cf7630; }
.note-neck .note-match b:empty { box-shadow: inset 0 0 0 2px #efcd87; }

@media (forced-colors: active) {
  .neck-scroll, .learning-neck { background: Canvas; border: 1px solid CanvasText; }
  .neck-scroll .fret-numbers, .neck-scroll .string-name,
  .learning-neck .learn-frets, .learning-neck .string-label { color: CanvasText; text-shadow: none; }
  .neck-scroll .fret-button::before, .learning-neck .learn-fret::before,
  .neck-scroll .fret-button::after, .learning-neck .learn-fret::after { background: CanvasText; }
  .neck-scroll .fret-button.selected .note-dot,
  .learning-neck .learn-fret[aria-pressed="true"] b,
  .learning-neck .learn-fret.example b { outline: 2px solid Highlight; }
  .neck-scroll .fret-button:focus-visible, .learning-neck .learn-fret:focus-visible { outline-color: Highlight; }
  .fret-inlay { background: Canvas; border-color: CanvasText; forced-color-adjust: none; }
}
