/* ========================================
   Voice Leading Lesson — themed to nician portfolio
   (original Touching Sound stylesheet, retuned for the forest palette)
   ======================================== */

:root {
  --bg:           #0b1410;
  --bg-alt:       #13201a;
  --fg:           #d2dcc9;
  --fg-muted:     #8aa68a;
  --accent:       #7fffd4;
  --accent-hover: #b8ffe8;
  --border:       #28402d;
  --music-bg:     #f4eedd;        /* abc-js renders on a light surface for legibility */
  --music-border: #28402d;
  --radius:       2px;
  --max-width:    820px;
  --font-body:    'Source Serif 4', 'Iowan Old Style', 'Charter', Georgia, serif;
  --font-heading: 'Fraunces', 'Iowan Old Style', Palatino, serif;
  --font-mono:    'JetBrains Mono', 'JetBrainsMono Nerd Font', 'SF Mono', ui-monospace, Menlo, monospace;
}

.lesson-topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.lesson-topnav a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in oklab, var(--accent) 50%, transparent);
}
.lesson-topnav a:hover { border-bottom-style: solid; text-shadow: 0 0 6px var(--accent); }
.lesson-topnav .cur { color: #f5b14b; }
.lesson-topnav span:not(.cur) { color: var(--border); }

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

h3 { font-size: 1.17rem; }
h4 { font-size: 1rem; color: var(--fg-muted); }

p { margin: 0.75rem 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-hover); }

blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--fg-muted);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}
li { margin-bottom: 0.3rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--font-heading);
  font-weight: 600;
  background: var(--bg-alt);
}

/* ABC Music examples */
.abc-example {
  background: var(--music-bg);
  border: 1px solid var(--music-border);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.5rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  position: relative;
}

.abc-render {
  min-height: 80px;
}

.abc-render svg {
  max-width: 100%;
  height: auto;
}

/* Green cursor line during playback */
.abc-cursor {
  position: absolute;
  width: 2px;
  background: #2eaa40;
  pointer-events: none;
  z-index: 10;
  border-radius: 1px;
  opacity: 0.85;
}

/* Disable pointer events on notes (no red click behavior) */
.abc-example svg {
  pointer-events: none;
}

/* Button row */
.abc-btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.abc-play-btn,
.abc-view-btn {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.4rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}
.abc-play-btn:hover,
.abc-view-btn:hover { background: var(--accent-hover); }
.abc-play-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.abc-view-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.abc-view-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ABC source panel */
.abc-source {
  margin-top: 0.5rem;
  position: relative;
}
.abc-source pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
}
.abc-copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.2rem 0.6rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  background: var(--bg);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.abc-copy-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Global tempo panel ─────────────────────────────────── */
#tempo-panel {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

#tempo-panel label {
  font-weight: 600;
  white-space: nowrap;
}

#tempo-slider {
  width: 100px;
  cursor: pointer;
}

#tempo-value {
  min-width: 1.8em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

/* Scale degree hat notation */
.deg { font-style: normal; }

/* Navigation */
nav.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}
nav.toc h2 {
  font-size: 1rem;
  margin-top: 0;
  border: none;
  padding: 0;
}
nav.toc ol {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}
nav.toc li { margin-bottom: 0.2rem; }
nav.toc a { text-decoration: none; }
nav.toc a:hover { text-decoration: underline; }

/* Footer */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--fg-muted);
}
footer a { color: var(--fg-muted); }

/* Responsive */
@media (max-width: 600px) {
  html { font-size: 16px; }
  main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  .abc-example { padding: 0.5rem; }

  #tempo-panel {
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem 0.75rem;
  }
  #tempo-slider { width: 70px; }
}
