/* Mixed-Signal Audio Course — Shared Stylesheet
   Design goal: clean, readable, print-friendly. Tufte-ish.
   Every lesson and reference document in this workspace links this stylesheet. */

:root {
  --bg: #fafaf7;
  --ink: #1a1a1a;
  --ink-soft: #555;
  --rule: #d4d4cf;
  --accent: #8b0000; /* dark red — signals "important" */
  --accent-soft: #8b0000;
  --highlight: #fff3b0;
  --code-bg: #f3f3ee;
  --link: #0050b3;
  --link-hover: #8b0000;
  --max-width: 42rem;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  padding: 2rem 1rem 4rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
}

header.masthead {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

header.masthead .course {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

header.masthead h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 0.4rem 0;
  font-family: var(--serif);
  font-weight: 700;
}

header.masthead .subtitle {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0;
}

.lesson-num {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}

h2 {
  font-family: var(--sans);
  font-size: 1.25rem;
  margin-top: 2.2rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.2rem;
  font-weight: 600;
}

h3 {
  font-family: var(--sans);
  font-size: 1.05rem;
  margin-top: 1.6rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

p { margin: 0 0 1rem 0; }

a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--link-hover); color: var(--link-hover); }

strong, b { font-weight: 700; }
em, i { font-style: italic; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.12em 0.32em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.45;
  border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 1.4rem 0;
  padding: 0.4rem 0 0.4rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

mark { background: var(--highlight); padding: 0 0.15em; border-radius: 2px; }

ul, ol { padding-left: 1.4rem; }
li { margin-bottom: 0.35rem; }

aside.callout {
  background: #fdf6e3;
  border-left: 4px solid #cb4b16;
  padding: 0.8rem 1rem;
  margin: 1.4rem 0;
  border-radius: 0 4px 4px 0;
}
aside.callout strong { color: #cb4b16; }

aside.key {
  background: #eef6ff;
  border-left: 4px solid #0050b3;
  padding: 0.8rem 1rem;
  margin: 1.6rem 0;
  border-radius: 0 4px 4px 0;
}
aside.key strong { color: #0050b3; }

figure { margin: 1.5rem 0; text-align: center; }
figure svg { max-width: 100%; height: auto; }
figcaption {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
  font-style: italic;
  font-family: var(--sans);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.9rem;
  font-family: var(--sans);
}
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { border-bottom: 2px solid var(--ink); font-weight: 600; }

/* Quiz widget (reusable component) */
.quiz {
  background: #f3f3ee;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.2rem 1.2rem 0.6rem;
  margin: 1.8rem 0;
}
.quiz .q-prompt {
  font-weight: 600;
  font-family: var(--sans);
  margin-bottom: 0.8rem;
}
.quiz .options { list-style: none; padding: 0; margin: 0 0 0.6rem 0; }
.quiz .options label {
  display: block;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.3rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.95rem;
  transition: background 0.1s, border-color 0.1s;
}
.quiz .options label:hover { background: #f0f0eb; }
.quiz .options input { margin-right: 0.5rem; transform: scale(1.15); accent-color: var(--accent); }
.quiz .options label.correct { background: #e6ffe6; border-color: #2a8a2a; }
.quiz .options label.incorrect { background: #ffe6e6; border-color: #c33; }
.quiz .feedback {
  min-height: 1.2rem;
  font-size: 0.9rem;
  font-family: var(--sans);
  margin-top: 0.4rem;
  padding: 0.5rem 0;
  border-top: 1px dotted var(--rule);
}
.quiz .feedback.ok { color: #2a8a2a; }
.quiz .feedback.no { color: #c33; }

footer.nav {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}
footer.nav a.prev::before { content: "← "; }
footer.nav a.next::after { content: " →"; }

footer.creds {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  border-top: 1px dotted var(--rule);
  padding-top: 0.8rem;
}

/* Print friendliness */
@media print {
  body { font-size: 11pt; padding: 0; background: #fff; }
  .quiz .options label { border: 1px solid #999; }
  aside, .quiz { page-break-inside: avoid; }
  a { color: #000; border-bottom: none; }
}
