/* Orpheus · css/theory.css. Owner: agent T (the theory lesson page and its inputs: staff input, note-name buttons, fretboard).
   Only what the previews did not need: app states and overrides, each with a comment that says why. Tokens only. */

/* ---- The staff in the stage ----
   The theory staff is drawn by components/staff_input.rs. States the previews do not show: the ghost note of the
   input (faint), context notes (muted), the ring around a selected note (find the wrong note). */
.staff .is-ghost { fill: var(--faint); }
.staff .is-faint { fill: var(--muted); }
.staff .sel { fill: none; stroke: var(--fg); stroke-width: 0.16; }
/* The staff is the grid item of the stage: its wrappers have no box of their own. The input wrapper keeps the
   pointer events (they bubble up from the SVG) and shows a pointer while the question is open. */
.staff-wrap, .staff-input { display: contents; }
.staff-input.is-active .staff { cursor: pointer; }
/* A name instead of a staff (press the named key, find the note on the fretboard): the answer type size. */
.stage__name { font-size: var(--fs-answer); line-height: var(--lh-answer); font-weight: var(--w-light); letter-spacing: 0.01em; }
/* The piano as the stage drawing (name the marked key): the preview puts the piano under the answers, this
   question shows it first, inside the stage. */
.stage .piano-wrap { margin-top: 0; }

/* ---- Entry row ----
   The tools row of a staff input or of the note names holds one segmented control at the left. Undo and the
   Staff / Piano control follow at the right as in the key lesson. */
.entry--tools { justify-content: flex-start; }
/* An accidental glyph as the 16 px icon of a segmented option: the wrapper has no box of its own. */
.glyph { display: contents; }
/* Slot states the previews do not show: the given tonic of a scale (muted), a wrong part after the answer (red). */
.slot { padding: 0 var(--s-1); }
.slot.is-given { color: var(--muted); }
.slot.is-wrong { color: var(--bad); border-bottom-color: var(--bad); }

/* ---- Answer grids ----
   Stacked grids (quality and number, root and quality) sit closer than the first one. A grid of words (scale
   kinds, inversions) uses the heading size so that the names fit a cell. A partly given answer (the number before
   the quality, the count before sharps or flats) is pressed. */
.answers + .answers { margin-top: var(--s-4); }
.answers--words .answer__name { font-size: var(--fs-h2); line-height: var(--lh-h2); white-space: normal; text-align: center; padding: 0 var(--s-2); }
.answer[aria-pressed="true"] { background: var(--surface); }
/* Chord symbols with long names under them (the seventh chords). The page gives such a grid fewer columns, so that
   a symbol and its name fit a cell. Where a name is still wider than its cell, it takes two lines: on a phone
   "half-diminished seventh" is 125 px wide and a cell of three columns is 109 px. A cell grows with its name, and
   every row is as tall as the tallest row. */
.lesson--theory .answers--names { grid-auto-rows: 1fr; }
.lesson--theory .answers--names .answer { height: auto; min-height: var(--answer-h); padding: var(--s-1); }
.lesson--theory .answers--names .answer__sub { white-space: normal; text-align: center; }

/* ---- Keys list (opened from the Keys tool of the head) ---- */
.keys-panel { margin-top: var(--s-5); padding-top: var(--s-4); border-top: var(--hair) solid var(--rule); }
.keys-panel .kbd { min-width: 28px; }
.lesson__tools .tool[aria-pressed="true"] { background: var(--surface); }

/* ---- Fretboard ----
   Thin ink lines, a thicker nut, faint inlays. A marked position is a filled ink dot, the right position a tick in
   it, a wrong one a red ring with a cross, a missed right position an ink ring, a prompt position the home red
   dot. Labels are 12 px. The drawing keeps its pixel size and scrolls sideways on a phone. */
.fret-wrap { margin-top: var(--s-5); display: flex; justify-content: center; }
.fretboard { display: block; flex: none; color: var(--fg); font-family: var(--font-text); }
.fb__string { stroke: var(--fg); stroke-width: 1; }
.fb__string.is-muted { stroke: var(--faint); }
.fb__fret { stroke: var(--line); stroke-width: 1; }
.fb__nut { stroke-width: 3; }
.fb__inlay { fill: var(--faint); }
.fb__name, .fb__num { fill: var(--muted); font-size: 12px; font-weight: var(--w-label); text-anchor: middle; }
.fb__name { text-anchor: end; }
.fb__hit { fill: transparent; }
.fb__pos.is-on { cursor: pointer; }
.fb__pos.is-on:hover .fb__hit { fill: var(--surface); }
.fb__note { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.fb__mark circle { fill: var(--fg); }
.fb__mark.is-home circle { fill: var(--home); }
.fb__mark.is-wrong circle { fill: var(--bg); stroke: var(--bad); stroke-width: 2; }
.fb__mark.is-answer circle { fill: var(--bg); stroke: var(--fg); stroke-width: 1.5; }
.fb__mark .mk { fill: none; stroke: var(--on-ink); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.fb__mark.is-wrong .mk { stroke: var(--bad); }
.fb__label { fill: var(--on-ink); font-size: 12px; font-weight: var(--w-label); text-anchor: middle; }
.fb__cursor { fill: none; stroke: var(--fg); stroke-width: 2; }

/* ---- Result ----
   The facts of a finished set under the card: a wrapping row of small notes, each with a tick or a cross. */
.result-facts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-3); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.result-facts li { display: inline-flex; align-items: center; gap: var(--s-2); }
.result-facts .ic { width: 16px; height: 16px; color: var(--fg); }
.result-facts .is-bad .ic { color: var(--bad); }
.summary .table { margin-top: var(--s-3); }
.summary .field__note { margin-top: var(--s-3); }

/* ---- Start of a planned block or a custom exercise (no introduction card) ----
   The notes of a custom exercise under the prompt. */
.start-notes { display: grid; gap: var(--s-1); justify-items: center; margin-top: var(--s-2); }

@media (max-width: 599px) {
  /* The fretboard scrolls sideways in its box, like the piano. */
  .fret-wrap { justify-content: flex-start; overflow-x: auto; margin-left: calc(-1 * var(--page-pad)); margin-right: calc(-1 * var(--page-pad)); padding: 0 var(--page-pad); }
  .keys-panel { margin-top: var(--s-4); }
  /* More than eight scale names: the words are set in the body size, so that three columns hold them and the grid
     has four rows at most. "pentatonic" is 77 px wide in this size, and a cell of three columns is 109 px. */
  .lesson--theory .answers--small .answer__name { font-size: var(--fs-body); line-height: var(--lh-body); }
}
