/* learn-theory-pages.css — the music theory lessons S04–S08 (plan C, task C7): the note inspector, interval player,
   scale explorer, chord builder and progression player (static/learn-w-{note,interval,scale,chord,progression}.js).
   Loaded after studio.css (frozen kit) and learn-course.css (C1). Look: each widget is a kit chassis (.st-panel,
   charcoal in both themes) built around one readout well: a recessed dark glass with the name in wide Archivo
   (C♯4 / D♭4, C → E♭, A natural minor, Am9) over degree tiles colored like the keyboard's marks, root in 808 red
   and the other tones in the part accent. The keyboard (learn-keyboard.js, its own CSS) is the instrument below.
   No animation: lit states only answer a tap or the playhead, so reduced motion has nothing to turn off. */

/* ── chassis ─────────────────────────────────────────────────────────── */
.learn .lt-tool {
    --lt-root: var(--st-808-red);
    --lt-tile: #2E3236;
    display: grid;
    gap: 1rem;
    font-size: 0.97rem;
    line-height: 1.5;
}
.lt-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1.2rem;
}
.learn-body .lt-head .lt-title {
    margin: 0;
    font-family: var(--st-font);
    font-size: 1.3rem;
    font-weight: 780;
    font-stretch: 112%;
    letter-spacing: -0.01em;
    color: var(--st-ink);
}
.learn-body .lt-sub {
    margin: 0;
    max-width: none;
    font-size: 0.88rem;
    color: var(--st-muted);
}
.lt-placeholder { color: var(--st-muted); }

.lt-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}
.lt-controls > .learn-field,
.lt-controls > div { flex: 1 1 10rem; }
.lt-controls > .lt-narrow { flex: 0 1 11rem; }
.lt-controls > .lt-wide { flex: 2 1 16rem; }
.lt-tool .learn-select { width: 100%; }
.lt-chip-field .learn-chips { gap: 6px; }
.lt-chip-meta {
    margin-inline-start: 0.1rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.62;
}
.lt-chord-chip b { font-weight: 800; font-stretch: 100%; }
.lt-chord-chip span { font-weight: 560; opacity: 0.68; }
.lt-chord-chip[aria-pressed="true"] span { opacity: 0.85; }

.lt-actions,
.lt-transport {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}
.lt-tool .st-btn:not(.st-btn--play)[aria-pressed="true"] {
    border-color: var(--st-accent);
    background: var(--st-accent);
    color: var(--st-on-accent);
}

/* ── the readout well: the one bold element ──────────────────────────── */
.lt-readout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem 1.6rem;
    padding: clamp(14px, 2.2vw, 22px);
    border-radius: 12px;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--st-accent) 13%, transparent), transparent 60%),
        var(--st-well);
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
}
@media (min-width: 760px) {
    .lt-readout { grid-template-columns: minmax(14rem, 0.9fr) minmax(0, 1.1fr); align-items: start; }
    .lt-readout--prog { grid-template-columns: minmax(0, 1fr); }
}
.lt-readout-main,
.lt-readout-side { min-width: 0; display: grid; gap: 0.55rem; align-content: start; }
.learn-body .lt-name {
    --st-display-size: clamp(2.5rem, 6.2vw, 4.1rem);
    max-width: none;
    margin: 0;
    color: #F5F1E6;
    text-shadow: 0 0 22px color-mix(in srgb, var(--st-accent) 55%, transparent);
    overflow-wrap: anywhere;
}
.learn-body .lt-name.is-idle { --st-display-size: clamp(1.9rem, 4vw, 2.6rem); }
.lt-name-root,
.lt-name-rest { display: block; }
.lt-name-rest {
    margin-top: 0.22em;
    font-size: 0.4em;
    font-weight: 780;
    letter-spacing: -0.01em;
    line-height: 1;
}
.learn-body .lt-count,
.learn-body .lt-fullname,
.learn-body .lt-roman {
    margin: 0;
    font-family: var(--st-font);
    font-size: 1.05rem;
    font-weight: 700;
    font-stretch: 96%;
    color: var(--st-muted);
    font-variant-numeric: tabular-nums;
}
.learn-body .lt-roman { color: color-mix(in srgb, var(--st-accent) 60%, #F5F1E6); font-size: 1.25rem; font-weight: 800; }
.lt-detail p { margin: 0 0 0.35em; color: var(--st-muted); }
.lt-detail strong { color: var(--st-ink); font-weight: 720; }

.lt-keyrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
}
.lt-key-label {
    font-size: 0.85rem;
    font-weight: 650;
    font-stretch: 92%;
    color: var(--st-muted);
}
.learn-body .lt-key {
    margin: 0;
    font-family: var(--st-font);
    font-size: 1.2rem;
    font-weight: 780;
    font-stretch: 108%;
    color: var(--st-ink);
    font-variant-numeric: tabular-nums;
}
.learn-body .lt-enh {
    margin: 0;
    max-width: 44ch;
    font-size: 0.86rem;
    color: var(--st-muted);
}

/* degree tiles: keycaps colored like the keyboard's marks */
.lt-tiles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
}
.lt-tile,
.lt-octave {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 2.9rem;
    min-height: 3.1rem;
    padding: 0.3rem 0.45rem 0.4rem;
    border-radius: 7px;
    font-family: var(--st-font);
    line-height: 1.1;
}
.lt-tile {
    background: color-mix(in srgb, var(--st-accent) 34%, var(--lt-tile));
    color: #F7F4EC;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.lt-tile.is-root { background: var(--lt-root); }
.lt-tile b {
    font-size: 1.12rem;
    font-weight: 800;
    font-stretch: 104%;
}
.lt-tile small {
    margin-top: 2px;
    font-size: 0.74rem;
    font-weight: 650;
    font-stretch: 86%;
    opacity: 0.82;
    font-variant-numeric: tabular-nums;
}
.lt-octave {
    min-height: 2.6rem;
    border: 1px dashed var(--st-panel-line);
    color: var(--st-muted);
    font-weight: 750;
}
.lt-step {
    min-width: 1.1rem;
    font-family: var(--st-font);
    font-size: 0.72rem;
    font-weight: 700;
    font-stretch: 86%;
    text-align: center;
    color: var(--st-muted);
}

/* the semitone ruler (interval player): one LED per semitone, root in red */
.lt-ruler { margin: 0.15rem 0 0.2rem; }
.lt-ruler .st-led { min-height: 14px; }

/* ── progression player ──────────────────────────────────────────────── */
.learn-body .lt-block-label { margin: 0 0 -0.45rem; max-width: none; }
.lt-dia {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr));
    gap: 8px;
}
.lt-dia-chord {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    border-radius: 10px;
    background: var(--st-panel-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 0 rgba(0, 0, 0, 0.4);
}
.lt-dia-play {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: var(--st-target);
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 7px;
    background: var(--st-well);
    color: var(--st-ink);
    font: inherit;
    font-family: var(--st-font);
    text-align: start;
    cursor: pointer;
}
.lt-dia-play:hover { background: #1B1E21; }
.lt-dia-play:active { box-shadow: inset 0 0 0 2px var(--st-accent); }
.lt-dia-play .lt-rn {
    max-width: 100%;
    font-size: 1.25rem;
    font-weight: 820;
    font-stretch: 84%;
    line-height: 1.1;
    overflow-wrap: anywhere;
    color: color-mix(in srgb, var(--st-accent) 55%, #F5F1E6);
}
.lt-dia-play .lt-sym { font-size: 0.9rem; font-weight: 650; color: var(--st-muted); }
.lt-add { min-height: 2.75rem; font-size: 0.88rem; }

.lt-slots {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    min-height: 4.6rem;
    padding: 8px;
    border-radius: 10px;
    border: 1px dashed var(--st-panel-line);
}
.learn-body .lt-empty { align-self: center; margin: 0 0.4rem; color: var(--st-muted); font-size: 0.92rem; }
.lt-slot {
    position: relative;
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas: "bar remove" "rn remove" "sym remove";
    column-gap: 0.25rem;
    align-items: center;
    min-width: 6.4rem;
    padding: 0.4rem 0.2rem 0.45rem 0.65rem;
    border-radius: 9px;
    background: var(--lt-tile);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--st-ink);
    font-family: var(--st-font);
}
.lt-slot-bar {
    grid-area: bar;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-stretch: 86%;
    color: var(--st-muted);
    font-variant-numeric: tabular-nums;
}
.lt-slot-bar .st-led { min-width: 8px; min-height: 8px; width: 8px; height: 8px; }
.lt-slot .lt-rn { grid-area: rn; font-size: 1.2rem; font-weight: 820; font-stretch: 106%; line-height: 1.15; }
.lt-slot .lt-sym { grid-area: sym; font-size: 0.86rem; font-weight: 650; color: var(--st-muted); }
.lt-remove {
    grid-area: remove;
    align-self: stretch;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
.lt-remove:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); }
.lt-slot.is-now {
    background: var(--st-accent);
    color: var(--st-on-accent);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 0 18px -2px var(--st-accent);
}
.lt-slot.is-now .lt-slot-bar,
.lt-slot.is-now .lt-sym { color: var(--st-on-accent); opacity: 0.85; }
.lt-slot.is-now .st-led.is-on { background: var(--st-led); box-shadow: 0 0 8px 1px var(--st-led); }

.lt-transport .st-btn--play { flex: none; }
.lt-tempo { flex: 1 1 13rem; min-width: 0; }

/* ── small screens ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .learn .lt-tool { gap: 0.85rem; }
    .lt-controls > .lt-narrow,
    .lt-controls > div { flex: 1 1 100%; }
    .learn-body .lt-name { --st-display-size: clamp(2.1rem, 11vw, 2.8rem); }
    .lt-dia { grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); }
    .lt-slot { min-width: 5.8rem; }
    .lt-chord-chip { padding: 0 0.85rem; }
    .lt-chord-chip span { display: none; }      /* symbol only: 25 chips in half the height; the name is the label */
}

@media (forced-colors: active) {
    .lt-tile, .lt-slot.is-now { forced-color-adjust: none; background: Highlight; color: HighlightText; }
    .lt-readout { border: 1px solid CanvasText; }
}
