/* Music Production & Engineering — course site
   Studio-console look: dark panels, LED accents, mono labels. */
:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #ebe8e2;
  --line: #d9d4ca;
  --text: #1c1d21;
  --muted: #5d6270;
  --accent: #c26a00;       /* amber LED */
  --accent-soft: #fbe7cc;
  --green: #1f8a4c;
  --green-soft: #d8f1e2;
  --red: #c23434;
  --red-soft: #f7dcdc;
  --blue: #1f6fb2;
  --blue-soft: #dbeaf7;
  --violet: #6b4fc4;
  --violet-soft: #e7e1f8;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --panel: #161920; --panel-2: #1d212a; --line: #2a303b;
    --text: #e8eaef; --muted: #9aa3b2;
    --accent: #f5a524; --accent-soft: #3a2a0d;
    --green: #3ddc84; --green-soft: #10301f;
    --red: #ff6b6b; --red-soft: #3a1717;
    --blue: #5cc8ff; --blue-soft: #0f2a3a;
    --violet: #a58cff; --violet-soft: #231c3d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --panel: #161920; --panel-2: #1d212a; --line: #2a303b;
  --text: #e8eaef; --muted: #9aa3b2;
  --accent: #f5a524; --accent-soft: #3a2a0d;
  --green: #3ddc84; --green-soft: #10301f;
  --red: #ff6b6b; --red-soft: #3a1717;
  --blue: #5cc8ff; --blue-soft: #0f2a3a;
  --violet: #a58cff; --violet-soft: #231c3d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 var(--sans);
}
img, svg { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 1.6em 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin-top: .2em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: .6em 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin: .3em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
code, kbd { font-family: var(--mono); font-size: .88em; }
kbd {
  display: inline-block; min-width: 1.8em; padding: .05em .45em; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 3px;
  border-radius: 6px; color: var(--text); white-space: nowrap;
}
.menu { font-family: var(--mono); font-size: .88em; background: var(--panel-2); padding: .1em .4em; border-radius: 4px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: .7rem 16px;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 700; }
.brand:hover { color: var(--text); }
.brand .leds { display: inline-flex; gap: 3px; }
.brand .leds i { width: 6px; height: 18px; border-radius: 2px; background: var(--green); }
.brand .leds i:nth-child(2) { height: 14px; margin-top: 4px; }
.brand .leds i:nth-child(3) { height: 10px; margin-top: 8px; background: var(--accent); }
.brand .leds i:nth-child(4) { height: 6px; margin-top: 12px; background: var(--red); }
.nav { display: flex; gap: .2rem; margin-left: auto; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--muted); padding: .35rem .7rem; border-radius: 8px;
  font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--panel-2); }
.theme-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 8px; padding: .3rem .55rem; cursor: pointer; font: inherit; font-size: .85rem;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.content { max-width: 760px; }
main { padding: 2rem 0 4rem; }
.crumbs { font-family: var(--mono); font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.eyebrow { font-family: var(--mono); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 680px; }

/* ---------- Hero ---------- */
.hero { padding: 3rem 0 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.hero h1 { max-width: 800px; }
.stats { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem 1rem; min-width: 120px;
}
.stat b { display: block; font-family: var(--display); font-size: 1.5rem; }
.stat span { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow); position: relative;
  display: flex; flex-direction: column;
}
.card h3 { margin: .3em 0 .4em; }
.card p { color: var(--muted); margin: 0 0 .8em; }
.card .meta { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .foot { margin-top: auto; padding-top: .6rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
a.card { text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); color: inherit; }
.card.locked { opacity: .72; box-shadow: none; }
.pill {
  display: inline-block; font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .15rem .55rem; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.live { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.soon { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.unit-num {
  font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--accent);
}

/* ---------- Lesson list ---------- */
.lesson-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .6rem; }
.lesson-list li { margin: 0; }
.lesson-list a {
  display: grid; grid-template-columns: 3.2rem 1fr auto; gap: .8rem; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .75rem 1rem; text-decoration: none; color: var(--text);
}
.lesson-list a:hover { border-color: var(--accent); }
.lesson-list .n { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.lesson-list .t { font-weight: 600; }
.lesson-list .s { display: block; font-size: .9rem; color: var(--muted); font-weight: 400; }
.lesson-list .done-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.lesson-list .done-dot.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- Lesson header meter ---------- */
.meter { display: flex; gap: 4px; margin: .8rem 0 1.2rem; }
.meter i { flex: 1; max-width: 42px; height: 8px; border-radius: 2px; background: var(--panel-2); border: 1px solid var(--line); }
.meter i.on { background: var(--green); border-color: var(--green); }
.meter i.here { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }

.agenda { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 1.5rem; }
.agenda span {
  font-family: var(--mono); font-size: .75rem; padding: .3rem .6rem; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.agenda span b { color: var(--text); font-weight: 600; }

/* ---------- Boxes ---------- */
.box {
  border: 1px solid var(--line); border-left: 4px solid var(--line); background: var(--panel);
  border-radius: 10px; padding: 1rem 1.2rem; margin: 1.4rem 0;
}
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box-label {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 700; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem;
}
.box-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.targets { border-left-color: var(--accent); }
.targets .box-label { color: var(--accent); }
.targets ul { list-style: none; padding: 0; }
.targets li::before { content: "▸ "; color: var(--accent); }
.logic { border-left-color: var(--blue); }
.logic .box-label { color: var(--blue); }
.board { border-left-color: var(--violet); background: color-mix(in srgb, var(--violet-soft) 45%, var(--panel)); }
.board .box-label { color: var(--violet); }
.practice { border-left-color: var(--green); }
.practice .box-label { color: var(--green); }
.warn { border-left-color: var(--red); }
.warn .box-label { color: var(--red); }
.exit { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel)); }
.exit .box-label { color: var(--accent); }
.logic ol { counter-reset: step; list-style: none; padding-left: 0; }
.logic ol > li { counter-increment: step; position: relative; padding-left: 2.3rem; margin: .7rem 0; }
.logic ol > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue); font-family: var(--mono); font-size: .8rem; font-weight: 700;
}

/* New term */
.term {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; align-items: baseline;
  background: var(--panel-2); border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0;
}
.term dt { font-family: var(--display); font-weight: 700; }
.term dt::before { content: "NEW TERM"; display: block; font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.term dd { margin: 0; }
@media (max-width: 560px) { .term { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }

/* Step grid (drum pattern diagrams) */
.steps { overflow-x: auto; margin: 1rem 0 1.4rem; padding-bottom: .3rem; }
.steps table { width: auto; min-width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.steps th, .steps td { padding: 0; border: 0; text-align: center; }
.steps th.row { text-align: left; padding: 0 .7rem; font-size: .7rem; white-space: nowrap; }
.steps thead th { padding: .35rem 0; font-size: .65rem; min-width: 30px; }
.steps thead th.beat { color: var(--accent); }
.steps td span { display: block; width: 24px; height: 24px; margin: 3px auto; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); }
.steps td.b span { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.steps td span.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); }
.steps td span.soft { background: color-mix(in srgb, var(--accent) 45%, var(--panel-2)); border-color: var(--accent); }

/* Quick check */
.quiz { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.quiz .q { font-weight: 600; margin: 0 0 .6rem; }
.quiz .opts { display: grid; gap: .4rem; }
.quiz button {
  text-align: left; font: inherit; font-size: .95rem; padding: .55rem .8rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.quiz button:hover { border-color: var(--blue); }
.quiz button.right { background: var(--green-soft); border-color: var(--green); }
.quiz button.wrong { background: var(--red-soft); border-color: var(--red); }
.quiz .fb { margin: .6rem 0 0; font-size: .92rem; min-height: 1.2em; }

/* Checklist */
.checklist { list-style: none; padding: 0; }
.checklist li { margin: .45rem 0; }
.checklist label { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.checklist input { width: 1.15rem; height: 1.15rem; margin-top: .25rem; accent-color: var(--green); flex-shrink: 0; }

/* Prev / next */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }
.pager a {
  flex: 1; min-width: 220px; text-decoration: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem 1rem; color: var(--text);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pager .next { text-align: right; }
.done-btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: .6rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--green); background: transparent; color: var(--green);
}
.done-btn.on { background: var(--green); color: #06170d; }

/* Two-column (lesson with side nav) */
.with-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 980px) {
  .with-side { grid-template-columns: minmax(0, 760px) 240px; justify-content: space-between; }
  .side { position: sticky; top: 5rem; align-self: start; }
}
.side { font-size: .9rem; }
.side h4 { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; }
.side ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.side li { margin: 0; }
.side a { display: block; padding: .3rem .8rem; color: var(--muted); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.side a:hover { color: var(--text); border-left-color: var(--accent); }

/* Glossary */
.gloss { display: grid; gap: .6rem; }
.gloss div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.gloss dt { font-family: var(--display); font-weight: 700; }
.gloss dd { margin: .2rem 0 0; }
.gloss .where { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.search {
  width: 100%; font: inherit; padding: .7rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); margin: 1rem 0;
}

footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .85rem; }

@media print {
  .topbar, .pager, .side, .theme-btn, .done-btn { display: none !important; }
  body { background: #fff; color: #000; }
}

/* fixes */
.meter i { min-width: 0; }
.steps thead th { text-transform: none; font-size: .72rem; }
@media (max-width: 700px) {
  .topbar-inner { gap: .4rem; padding: .5rem 16px; }
  .brand { font-size: .95rem; flex: 1; }
  .nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { padding: .3rem .55rem; white-space: nowrap; }
}
