/* Riddim Up lesson sheets: shared styles for every lesson page.
   Layout: tricolour band on top, lesson tabs, logo + title header, big staff chart, then steps, reference, practice drill.
   Colour code by position counted from the bottom of the staff: 1st red, 2nd gold, 3rd green, 4th black, 5th red.
   In mixed lessons, line notes are red and space notes are green. */
:root {
  --paper: #fcfcf9;
  --panel: #f2f2ee;
  --ink: #111111;
  --muted: #55574f;
  --rule: #dcdcd5;
  --red: #c8102e;
  --gold: #f2b705;
  --gold-text: #9a6b00;
  --green: #00843d;
  --red-band: #fbdfe3;
  --gold-band: #fdf0c4;
  --green-band: #d5eedf;
  --ink-band: #e2e2dc;
  --display: "Anton", "Impact", "Haettenschweiler", "Arial Narrow Bold", sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0f0e; --panel: #1a1b19; --ink: #f2f2ee; --muted: #a9aba3; --rule: #33352f;
    --red: #ff5a64; --gold: #ffc93c; --gold-text: #ffc93c; --green: #3ecf7a;
    --red-band: #3a1418; --gold-band: #382c0c; --green-band: #0f3020; --ink-band: #2c2d2a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e0f0e; --panel: #1a1b19; --ink: #f2f2ee; --muted: #a9aba3; --rule: #33352f;
  --red: #ff5a64; --gold: #ffc93c; --gold-text: #ffc93c; --green: #3ecf7a;
  --red-band: #3a1418; --gold-band: #382c0c; --green-band: #0f3020; --ink-band: #2c2d2a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
a { color: inherit; }
.flag { display: grid; grid-template-columns: 1fr 1fr 1fr; height: 10px; padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box; }
.flag span:nth-child(1) { background: var(--red); }
.flag span:nth-child(2) { background: var(--gold); }
.flag span:nth-child(3) { background: var(--green); }
.wrap { max-width: 780px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 48px; display: flex; flex-direction: column; gap: 48px; }

/* lesson tabs */
.lessons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.lessons .label { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin-right: 4px; }
.lessons a { text-decoration: none; padding: 4px 12px; border: 2px solid var(--rule); border-radius: 999px; font-weight: 600; }
.lessons a:hover { border-color: var(--green); }
.lessons a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lessons a:focus-visible, footer a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

header { display: grid; grid-template-columns: 120px 1fr; gap: 24px; align-items: center; margin-top: -16px; }
header img { width: 100%; height: auto; display: block; }
header .text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.eyebrow b { color: var(--red); }
h1, h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(38px, 7.5vw, 60px); line-height: 1; }
h2 { font-size: 28px; line-height: 1.1; }
p { margin: 0; max-width: 62ch; }
.lede { font-size: 18px; color: var(--muted); }

/* text colours: by position, and by line / space */
.k1, .k5 { color: var(--red); } .k2 { color: var(--gold-text); } .k3 { color: var(--green); } .k4 { color: var(--ink); }
.kline { color: var(--red); } .kspace { color: var(--green); } .kmuted { color: var(--muted); }

figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.chart { background: var(--panel); border-radius: 6px; padding: 12px; overflow-x: auto; border-bottom: 4px solid var(--ink); }
.chart svg { display: block; width: 100%; min-width: 440px; height: auto; }
figcaption { font-size: 14px; color: var(--muted); }

svg .line { stroke: var(--ink); stroke-width: 1.6; }
svg .ink { fill: var(--ink); }
svg .clef { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
svg .hole { fill: var(--panel); }
svg .b1, svg .b5 { fill: var(--red-band); } svg .b2 { fill: var(--gold-band); }
svg .b3 { fill: var(--green-band); } svg .b4 { fill: var(--ink-band); }
svg text { font-family: var(--body); }
svg .letter { font-family: var(--display); font-size: 30px; }
svg .tag { font-family: var(--display); font-size: 17px; }
svg .word { font-size: 15px; font-weight: 600; fill: var(--muted); }
svg .f1, svg .f5 { fill: var(--red); } svg .f2 { fill: var(--gold-text); } svg .f3 { fill: var(--green); } svg .f4 { fill: var(--ink); }
svg .fline { fill: var(--red); } svg .fspace { fill: var(--green); } svg .fmuted { fill: var(--muted); }
svg .ledger { stroke: var(--ink); stroke-width: 1.6; }
svg .bledger { fill: var(--gold-band); }
svg .bracket { fill: none; stroke: var(--muted); stroke-width: 1.4; }
svg .small { font-size: 12px; font-weight: 600; fill: var(--muted); letter-spacing: .08em; }

section { display: flex; flex-direction: column; gap: 16px; }
.mnemonic { font-family: var(--display); text-transform: uppercase; font-size: clamp(34px, 7vw, 54px); line-height: 1.05; display: flex; flex-wrap: wrap; gap: 0 .35em; margin: 0; }
.mnemonic span { color: var(--muted); }
.mnemonic b { font-weight: 400; }

ol.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: s; }
ol.steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: baseline; }
ol.steps li::before { content: counter(s); font-family: var(--display); font-size: 26px; line-height: 1; color: var(--red); text-align: right; }
ol.steps li > div { min-width: 0; }

.table { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; }
.cell { border-top: 6px solid; padding-top: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell .n { font-family: var(--display); font-size: 40px; line-height: 1; }
.cell .w { font-weight: 700; }
.cell .s { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell.p1, .cell.p5 { border-color: var(--red); } .cell.p1 .n, .cell.p5 .n { color: var(--red); }
.cell.p2 { border-color: var(--gold); } .cell.p2 .n { color: var(--gold-text); }
.cell.p3 { border-color: var(--green); } .cell.p3 .n { color: var(--green); }
.cell.p4 { border-color: var(--ink); } .cell.p4 .n { color: var(--ink); }
.cell.pline { border-color: var(--red); } .cell.pline .n { color: var(--red); }
.cell.pspace { border-color: var(--green); } .cell.pspace .n { color: var(--green); }

/* lines vs spaces summary (lesson 3) */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pair > div { background: var(--panel); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; border-top: 6px solid; }
.pair .lines { border-color: var(--red); }
.pair .spaces { border-color: var(--green); }
.pair .letters { font-family: var(--display); font-size: 34px; line-height: 1.1; letter-spacing: .08em; }
.pair .say { font-weight: 700; }
.pair .s { font-size: 14px; color: var(--muted); }

.tips { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

.drill { background: var(--panel); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 16px; border-bottom: 4px solid var(--ink); }
.drill svg { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.answers { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.answers button {
  font-family: var(--display); font-size: 26px; width: 64px; height: 58px;
  border: 2px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 6px; cursor: pointer;
}
.answers button:hover { border-color: var(--green); }
.answers button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.feedback { text-align: center; min-height: 1.6em; font-weight: 600; margin: 0 auto; }
.score { text-align: center; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 auto; }
.right { color: var(--green); } .wrong { color: var(--red); }

footer { border-top: 1px solid var(--rule); padding-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
footer .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
footer .brand img { width: 30px; height: auto; display: block; }
footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
footer nav a { font-weight: 600; color: var(--ink); text-underline-offset: 3px; }

@media (max-width: 560px) {
  header { grid-template-columns: 84px 1fr; gap: 16px; margin-top: 0; }
  .table { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .pair { grid-template-columns: 1fr; }
  .answers button { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: no-preference) {
  .answers button, .lessons a { transition: border-color .15s; }
}

/* rhythm lessons (5 and 6): rhythm rows, value tables, beats quiz */
.rhythm { background: var(--panel); border-radius: 6px; border-bottom: 4px solid var(--ink); display: flex; flex-direction: column; }
.rrow { padding: 16px 16px 4px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rrow + .rrow { border-top: 1px solid var(--rule); }
.rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.rhead h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 24px; line-height: 1.1; margin: 0; }
.rhead .facts { font-size: 14px; font-weight: 700; }
.rhead .play { margin-left: auto; }
.play {
  font-family: var(--body); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
}
.play:hover { border-color: var(--green); }
.play:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.play[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.play svg { width: 10px; height: 12px; fill: currentColor; }
.rsvg { overflow-x: auto; }
.rsvg svg { display: block; width: 100%; min-width: 400px; height: auto; }

svg .rline { stroke: var(--ink); stroke-width: 1.6; }
svg .bar { stroke: var(--ink); stroke-width: 2; }
svg .count { font-size: 15px; fill: var(--ink); }
svg .count.beat { font-weight: 700; }
svg .count.held { fill: var(--muted); font-weight: 400; }
svg .count.now { fill: var(--red); }
svg .note.now .ink { fill: var(--green); }
svg .dur { opacity: .9; }

.tablewrap { overflow-x: auto; }
table.values { border-collapse: collapse; width: 100%; min-width: 560px; font-variant-numeric: tabular-nums; }
table.values th, table.values td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.values th { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
table.values td.name { font-weight: 700; }
table.values td.big { font-family: var(--display); font-size: 24px; }
.glyph { display: block; width: 28px; height: 40px; }
.glyph .hole { fill: var(--paper); }

.quiz-note { display: flex; justify-content: center; }
.quiz-note .glyph { width: 72px; height: 104px; }
.quiz-note .glyph .hole { fill: var(--panel); }
.answers-label { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: -8px auto 0; }
svg .rthin { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg .rstroke { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
svg .rthick { fill: none; stroke: var(--ink); stroke-width: 5.2; }
svg .restbar { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
svg .count.rest { fill: var(--muted); font-style: italic; font-weight: 400; }
svg .rest.now .ink { fill: var(--green); }
svg .rest.now .rthin, svg .rest.now .rstroke, svg .rest.now .rthick { stroke: var(--green); }
.glyph .gline { stroke: var(--muted); stroke-width: 1.2; }
.glyph.rglyph { width: 42px; height: 62px; }
.quiz-note .glyph.rglyph { width: 84px; height: 124px; }
