/* Piano & Theory — shared course stylesheet.
   Every lesson and reference doc links this file. Tufte-inspired:
   one readable column, generous margins, sidenotes for citations. */
@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;1,6..72,400&family=Inter:wght@400;500;600&display=swap");

:root {
  --paper: #fffff8;
  --ink: #1d1d1b;
  --muted: #6b6a63;
  --rule: #e4e2d6;
  --accent: #a8322d;      /* deep red: links, highlights */
  --accent-soft: #f3dcd6;
  --good: #2f7d4a;
  --good-soft: #dcefe1;
  --bad: #b03a2e;
  --bad-soft: #f6dcd8;
  --hint: #d9a21b;
  --hint-soft: #fbefcc;
  --panel: #f6f4ea;
  --key-white: #ffffff;
  --key-black: #222220;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151513; --ink: #e9e7de; --muted: #9b998f; --rule: #34332e;
    --accent: #e0806f; --accent-soft: #43251f; --panel: #1f1e1b;
    --good: #6cc48a; --good-soft: #1f3526; --bad: #ec8a7d; --bad-soft: #42221d;
    --hint: #e8bf55; --hint-soft: #3d3218;
  }
}

* { box-sizing: border-box; }
html { font-size: 19px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1100px; margin: 0 auto; padding: 3rem 16px 5rem; }
article > *, .col { max-width: 640px; }
article > .wide { max-width: 100%; clear: both; }

h1 { font-weight: 400; font-size: 2.4rem; line-height: 1.1; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-weight: 400; font-style: italic; font-size: 1.55rem; margin: 2.6rem 0 .6rem; }
h3 { font-weight: 600; font-size: 1.05rem; margin: 1.6rem 0 .4rem; }
p, li { font-size: 1rem; }
.subtitle { font-style: italic; color: var(--muted); font-size: 1.2rem; margin: 0 0 1.5rem; }
.meta { font-family: var(--sans); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .85em; }

/* Sidenotes (Tufte). On narrow screens they drop inline. */
.sidenote {
  float: right; clear: right; width: 260px; margin-right: -300px;
  font-size: .78rem; line-height: 1.4; color: var(--muted); font-family: var(--sans);
}
@media (max-width: 1060px) {
  .sidenote { float: none; display: block; width: auto; margin: .4rem 0 .8rem; padding-left: .8rem; border-left: 2px solid var(--rule); }
}

/* The single win, stated up front */
.goal {
  border-left: 3px solid var(--accent); padding: .6rem 1rem; background: var(--panel);
  font-size: 1.05rem;
}
.goal b { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; display: block; color: var(--accent); margin-bottom: .2rem; }

/* Panels for interactive widgets */
.panel {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1.1rem 1.2rem; margin: 1.2rem 0; font-family: var(--sans); font-size: .9rem;
}
.panel p { font-size: .9rem; margin: .3rem 0 .7rem; }
.panel h4 { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

button, .btn {
  font-family: var(--sans); font-size: .85rem; font-weight: 500;
  padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); cursor: pointer; margin: .15rem .3rem .15rem 0;
}
button:hover { border-color: var(--ink); }
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button:disabled { opacity: .45; cursor: default; }
button.is-correct { background: var(--good-soft); border-color: var(--good); color: var(--good); }
button.is-wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

.feedback { min-height: 1.4em; font-weight: 500; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.score { font-variant-numeric: tabular-nums; color: var(--muted); }
.status-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); margin-right: .35rem; vertical-align: middle; }
.status-dot.on { background: var(--good); }

/* Chord-name "big display" in drills */
.target-name { font-family: var(--serif); font-size: 2.6rem; line-height: 1; margin: .2rem 0 .6rem; }

/* Tables */
table { border-collapse: collapse; font-family: var(--sans); font-size: .85rem; margin: 1rem 0; width: 100%; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.num { font-family: var(--serif); font-size: 1.05rem; }

/* Step list for off-screen practice */
ol.steps { padding-left: 1.2rem; }
ol.steps li { margin: .45rem 0; }

/* Callouts */
.ask {
  border: 1px dashed var(--accent); border-radius: 10px; padding: .8rem 1rem; margin: 2rem 0;
  font-family: var(--sans); font-size: .88rem;
}
.source {
  border-top: 2px solid var(--ink); padding-top: .8rem; margin-top: 2.5rem; font-size: .95rem;
}
.source b { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
nav.lesson-nav { font-family: var(--sans); font-size: .82rem; display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1rem; flex-wrap: wrap; }

/* ---------- Keyboard component (assets/keyboard.js) ---------- */
.kb { position: relative; height: 150px; user-select: none; -webkit-user-select: none; touch-action: manipulation; margin: .6rem 0; }
.kb.small { height: 100px; }
.kb-key { position: absolute; top: 0; border: 1px solid #8f8d84; border-radius: 0 0 6px 6px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; font-family: var(--sans); font-size: .62rem; padding-bottom: 6px; transition: background .08s; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.kb-key.white { height: 100%; background: var(--key-white); color: #77756c; z-index: 1; }
.kb-key.black { height: 62%; background: var(--key-black); color: #ddd; z-index: 2; border-color: #000; }
.kb-key.white:hover { background: #f4f2ea; }
.kb-key.is-target { background: #fbe7a8 !important; box-shadow: inset 0 -6px 0 #d9a21b; color: #5a4300 !important; }
.kb-key.is-down { background: #f3cfc7 !important; box-shadow: inset 0 -6px 0 #a8322d; color: #5b1712 !important; }
.kb-key.is-good { background: #cde9d5 !important; box-shadow: inset 0 -6px 0 #2f7d4a; color: #174227 !important; }
.kb-key.is-bad { background: #f2c9c3 !important; box-shadow: inset 0 -6px 0 #b03a2e; color: #5b1712 !important; }
.kb-key.is-mark.white { background: #fbe7a8; color: #5a4300; }
.kb-key.is-mark.black { background: #8a6a17; }
.kb-label { pointer-events: none; font-weight: 600; }
.kb-finger { position: absolute; top: 40%; font-size: .75rem; font-weight: 700; color: var(--accent); pointer-events: none; }
.kb-key.black .kb-finger { top: 25%; color: var(--hint); }

@media print {
  html { font-size: 11pt; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .no-print, button, .ask, nav.lesson-nav { display: none !important; }
  .panel { break-inside: avoid; background: #fff; }
  .sidenote { float: none; width: auto; margin: 0; display: block; }
  a { color: #000; }
}
