/*
 * Lessons (roadmap phase 50, docs/plans/lessons-plan.md): the cards in the
 * panel over an activity (js/lesson-page.js, in the shared dialog.sheet) and
 * on a lesson's own page. Staffs and the hand staff draw in the theme's
 * colors, like every staff in Woodshed.
 */

/* The panel is wider than Settings so a lesson's staffs keep their size. */
@media (min-width: 720px) {
  dialog.sheet.sheet-lesson {
    width: min(40rem, 100%);
  }
}

.lesson {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lesson-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lesson-switch [aria-pressed='true'] {
  background: var(--neutral);
  border-color: var(--neutral);
  color: var(--neutral-foreground);
}

/* The steps: one bar per card, the current one in the primary color. Each is a full-height button so it's easy to tap. */
.lesson-steps {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lesson-steps ol {
  display: flex;
  flex: 1;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-steps li {
  flex: 1;
  max-width: 3rem;
}

.lesson-step {
  position: relative;
  display: block;
  width: 100%;
  height: 1.75rem;
  padding: 0;
  border: 0;
  background: transparent;
}

.lesson-step::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 0.4rem;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--border);
}

.lesson-step.seen::before {
  background: color-mix(in oklch, var(--primary) 40%, var(--border));
}

.lesson-step.current::before {
  background: var(--primary);
}

.lesson-count {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.lesson-heading {
  margin: 0;
  font-size: 1.4rem;
  text-wrap: balance;
}

.lesson-text {
  max-width: 36rem;
  margin: 0;
}

.lesson-saying {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0.1rem 0 0.1rem 0.8rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

.lesson-saying-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lesson-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.lesson-example {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

.lesson-example figcaption {
  max-width: 28rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.lesson-figure {
  max-width: 100%;
  overflow-x: auto;
}

.lesson-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.lesson-staff .staff-note-current .staff-text {
  fill: var(--primary);
  font-weight: 600;
}

/* The hand staff (js/lesson-pictures.js): fingers are the lines, gaps the spaces. */
.hand-skin {
  fill: var(--accent);
  stroke: var(--accent-foreground);
  stroke-width: 1.2;
}

.hand-line {
  stroke: var(--foreground);
  stroke-width: 1.4;
}

.hand-label {
  fill: var(--foreground);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
}

.hand-label-space {
  fill: var(--muted-foreground);
  font-style: italic;
  font-weight: 400;
}

.lesson-table-scroll {
  overflow-x: auto;
}

.lesson-table {
  min-width: 16rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.lesson-table th,
.lesson-table td {
  padding: 0.38rem 0.9rem 0.38rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.lesson-table thead th {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lesson-table tbody th {
  font-weight: 500;
}

/* Quick checks: never scored or saved. */
.lesson-check {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--muted);
}

.lesson-check p {
  margin: 0;
}

.lesson-check-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lesson-check-note {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.lesson-check-prompt {
  font-weight: 500;
}

.lesson-choices {
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.5rem;
}

.lesson-choices .choice.name {
  justify-content: center;
  padding: 0.6rem;
  font-size: 1rem;
  text-align: center;
  white-space: normal;
}

.lesson-choices .choice:disabled {
  cursor: default;
  opacity: 0.6;
}

.lesson-choices .choice.correct,
.lesson-choices .choice.wrong {
  opacity: 1;
}

.lesson-why-tone.ok {
  color: var(--success);
}

.lesson-why-tone.bad {
  color: var(--destructive);
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

/* A lesson's own page (#lesson?…). */
.lesson-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 44rem;
}

.lesson-page .lesson-nav {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.lesson-page-actions {
  margin-top: 0.75rem;
}

/* Why? (roadmap phase 51): under a missed question's feedback, and on the results for each card behind a miss. */
.why-link {
  height: auto;
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: normal;
}

.why-link:hover {
  opacity: 1;
  text-decoration-thickness: 2px;
}

.lesson-review {
  margin-top: 0.75rem;
}

.lesson-review .row {
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.why-line {
  display: flex;
  justify-content: center;
  min-height: 0;
}

.why-line:empty {
  display: none;
}

/* Play under an ear training example (roadmap phase 52). */
.lesson-play {
  align-self: flex-start;
}

/* Why an example is silent, when the browser can't play sound. */
.lesson-sound {
  margin: 0;
  color: var(--muted-foreground);
}

.lesson-sound:empty {
  display: none;
}
