/* ===== The Language of Music — interactive primer (shared, scoped .lm-*) ===== */
.lm-wide { max-width: 940px; }
.lm-lead { color: var(--muted); font-size: 16.5px; max-width: 680px; margin: -4px 0 18px; }
.lm-hint { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 13px; }
.lm-hint .spk { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: background .3s; }
.lm-hint.live .spk { background: #34d17d; box-shadow: 0 0 8px #34d17d; }

/* section chip nav (sticky) */
.lm-chips { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 7px;
  padding: 12px 0; margin: 6px 0 8px;
  background: linear-gradient(180deg, var(--bg-top) 62%, transparent);
  backdrop-filter: blur(4px); }
.lm-chips a { font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--border);
  background: var(--card); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.lm-chips a:hover { color: var(--ink); border-color: rgba(91,134,236,.5); }

.lm-sec { margin: 34px 0 8px; scroll-margin-top: 62px; }
.lm-sec > h2 { font-size: 25px; letter-spacing: -.02em; margin-bottom: 4px; }
.lm-sec > h2 .n { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 10px; font-size: 20px; }
.lm-sec > p { color: var(--muted); max-width: 700px; margin: 8px 0; }
.lm-sec b, .lm-sec strong { color: var(--ink); font-weight: 650; }
.lm-term { color: var(--ink); font-weight: 650; border-bottom: 1.5px dotted rgba(91,134,236,.6); }

/* widget cards */
.lm-card { border: 1px solid var(--border); background: var(--card); border-radius: 16px;
  padding: 18px 18px 20px; margin: 16px 0; }
.lm-card h3 { font-size: 15px; margin-bottom: 4px; }
.lm-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.lm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 680px) { .lm-grid2 { grid-template-columns: 1fr; } }

/* cream "paper" for engraved notation */
.lm-paper { background: #f7f5ef; border-radius: 12px; padding: 6px 8px; overflow-x: auto; }
.lm-paper svg { display: block; }
.lm-paper svg text { fill: #1a1a1a; }

/* buttons */
.lm-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 4px; }
.lm-btn { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lm-btn:hover { background: rgba(255,255,255,.08); }
.lm-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lm-btn.play { background: var(--accent); border-color: var(--accent); color: #fff; }
.lm-btn.play:hover { background: #4f7ce6; }
.lm-btn.play.busy { opacity: .6; }
.lm-btn.sm { padding: 6px 12px; font-size: 13px; }
.lm-readout { font-size: 14px; color: var(--muted); margin-top: 10px; min-height: 20px; }
.lm-readout b { color: var(--ink); }
.lm-tag { display: inline-block; font-size: 12px; color: var(--accent); background: var(--accent-soft);
  border-radius: 6px; padding: 2px 7px; margin-right: 6px; }
.lm-code { display: inline; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; color: #cdd8f5; }

/* piano keyboard */
.lm-piano { display: flex; position: relative; height: 128px; margin: 12px 0 2px; user-select: none;
  width: max-content; }
.lm-wk { width: 42px; height: 128px; background: linear-gradient(#fffdf7,#ece7d8);
  border: 1px solid #b9b09a; border-top: none; border-radius: 0 0 6px 6px; position: relative;
  cursor: pointer; box-shadow: inset 0 -4px 6px rgba(0,0,0,.08); }
.lm-wk:active, .lm-wk.lit { background: linear-gradient(#dbe6ff,#b9cdff); }
.lm-wk .lbl { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center;
  font-size: 11px; color: #7a715a; font-weight: 600; }
.lm-bk { width: 28px; height: 80px; background: linear-gradient(#333,#0c0c0c);
  border-radius: 0 0 5px 5px; position: absolute; top: 0; cursor: pointer; z-index: 2;
  box-shadow: 0 3px 4px rgba(0,0,0,.4); }
.lm-bk:active, .lm-bk.lit { background: linear-gradient(#5b79c9,#2b3d7a); }

/* circle of fifths */
.lm-cof { position: relative; width: 300px; height: 300px; margin: 6px auto; max-width: 100%; }
.lm-cof .k { position: absolute; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card); color: var(--ink); cursor: pointer;
  font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.lm-cof .k:hover { border-color: rgba(91,134,236,.6); }
.lm-cof .k.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lm-cof-mid { position: absolute; top: 50%; left: 50%; width: 132px; height: 132px; margin: -66px 0 0 -66px;
  border-radius: 50%; border: 1px dashed var(--border); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 8px; }
.lm-cof-mid .kn { font-size: 20px; font-weight: 800; }
.lm-cof-mid .de { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.35; }

/* metronome */
.lm-beats { display: flex; gap: 10px; margin: 10px 0; }
.lm-beat { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); transition: transform .05s, background .05s; }
.lm-beat.b1 { border-color: rgba(255,93,143,.6); }
.lm-beat.hit { background: var(--accent); transform: scale(1.25); }
.lm-beat.b1.hit { background: var(--heart); }
.lm-slider { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.lm-slider input[type=range] { flex: 1; accent-color: var(--accent); max-width: 340px; }
.lm-slider .val { color: var(--ink); font-weight: 700; min-width: 74px; font-variant-numeric: tabular-nums; }

/* duration bar */
.lm-bar { display: flex; height: 46px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 10px 0; }
.lm-bar .cell { flex: 1; border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); transition: background .06s; }
.lm-bar .cell:last-child { border-right: none; }
.lm-bar .cell.hit { background: var(--accent); color: #fff; }

/* beat-division ticks */
.lm-div { display: flex; gap: 6px; margin: 8px 0; }
.lm-div .t { flex: 1; height: 40px; border-radius: 6px; background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); transition: background .06s; }
.lm-div .t.hit { background: var(--accent); color: #fff; }

/* forms + eras + code cards */
.lm-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 10px; margin: 12px 0; }
.lm-forms .f { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 12px 14px; }
.lm-forms .f .t { font-weight: 700; font-size: 14.5px; }
.lm-forms .f .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.lm-era { border-left: 2px solid var(--border); margin: 14px 0 4px; padding-left: 0; }
.lm-era .e { position: relative; padding: 4px 0 16px 20px; }
.lm-era .e::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); }
.lm-era .e .h { font-weight: 700; }
.lm-era .e .h span { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 8px; }
.lm-era .e .d { font-size: 13px; color: var(--muted); }

.lm-pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.lm-pipe .box { border: 1px solid var(--border); background: var(--card); border-radius: 10px; padding: 9px 13px; font-size: 13px; }
.lm-pipe .box b { display: block; color: var(--ink); }
.lm-pipe .box small { color: var(--muted); }
.lm-pipe .arrow { color: var(--accent); font-weight: 700; }
.lm-fan { display: flex; gap: 6px; flex-wrap: wrap; }

.lm-data { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin-top: 6px; }
.lm-data .k { color: var(--muted); }
.lm-data .v { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* clickable notes on a staff */
.lm-note { cursor: pointer; }
.lm-note:hover .nh { fill: var(--accent); }
.lm-note.lit .nh { fill: #d6336c; }
.lm-note.lit .nh.open { fill: #f7f5ef; stroke: #d6336c; }

.lm-foot { color: var(--muted); font-size: 13px; margin: 26px 0 6px; }
.lm-foot a { color: var(--accent); }
kbd { font-family: ui-monospace, monospace; font-size: 12px; background: rgba(255,255,255,.08);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
