/* Shared lesson stylesheet for the Bun-scripting workspace.
   Link from every lesson: <link rel="stylesheet" href="../assets/lesson.css">
   Design goals: Tufte-clean typography, printable, consistent course feel. */

:root {
  --ink: #1a1a1a;
  --paper: #fdfcf8;
  --muted: #6b6b6b;
  --accent: #a8322d;
  --code-bg: #f1efe7;
  --rule: #ddd8cc;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0 auto;
  max-width: 46rem;
  padding: 3rem 1.5rem 5rem;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
}

/* ---- Type ---- */
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.9rem; margin: 0 0 .15rem; border-bottom: 2px solid var(--accent); padding-bottom: .5rem; }
h2 { font-size: 1.35rem; margin: 2.4rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.6rem 0 .4rem; }
p { margin: .7rem 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { opacity: .8; }
strong { font-weight: 600; }
small, .muted { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--muted); font-style: italic; }

/* ---- Code ---- */
code, pre {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--code-bg);
  border-radius: 3px;
}
code { padding: .1em .3em; }
pre {
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
}
pre code { background: none; padding: 0; font-size: .92em; }
.comment { color: var(--muted); }

/* ---- Blocks ---- */
.callout, .goal, .warn {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  background: #faf8f2;
  padding: .8rem 1.1rem;
  margin: 1.2rem 0;
  border-radius: 0 4px 4px 0;
  font-size: .95rem;
}
.warn { border-left-color: #b8860b; background: #fdf9ec; }
.goal { border-left-color: #2d6a4f; background: #f2f8f4; }

/* ---- Meta / header ---- */
.meta { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin: .4rem 0 2rem; }
.meta a { color: var(--muted); text-decoration: none; }
.meta a:hover { color: var(--accent); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* ---- Lists ---- */
ul, ol { padding-left: 1.3rem; }
li { margin: .25rem 0; }

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 1rem 0; }
th, td { border: 1px solid var(--rule); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { font-family: var(--sans); font-weight: 600; background: var(--code-bg); }

/* ---- Quiz widget ---- */
.quiz { border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.2rem; margin: 1.4rem 0; background: #fff; }
.quiz h3 { margin-top: 0; }
.quiz .options { display: flex; flex-direction: column; gap: .45rem; }
.quiz button {
  font-family: var(--sans); font-size: .9rem; text-align: left;
  border: 1px solid var(--rule); background: var(--paper);
  padding: .5rem .75rem; border-radius: 4px; cursor: pointer;
}
.quiz button:hover { border-color: var(--accent); }
.quiz button.correct { border-color: #2d6a4f; background: #f2f8f4; }
.quiz button.wrong { border-color: #a8322d; background: #fdf0ef; }
.quiz .reveal { display: none; margin-top: .6rem; font-size: .9rem; }
.quiz .reveal.show { display: block; }

footer { margin-top: 4rem; font-family: var(--sans); font-size: .8rem; color: var(--muted); }
footer .footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
footer .footer-nav a {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--rule);
  background: #fff;
  border-radius: 4px;
  padding: .45rem .65rem;
  font-size: .82rem;
  line-height: 1.3;
}
footer .footer-nav a:hover { border-color: var(--accent); }
footer .footer-nav .next { margin-left: auto; }
footer .ask { display: block; margin-bottom: .5rem; padding: .6rem .9rem; background: var(--code-bg); border-radius: 5px; }

/* ---- Print ---- */
@media print {
  body { max-width: none; padding: .5in; font-size: 11pt; }
  pre { white-space: pre-wrap; word-wrap: break-word; }
  .quiz button { border: 0; background: none; padding: .1rem 0; }
  .quiz button.correct::after { content: "  ✓"; color: #2d6a4f; }
  .quiz button.wrong::after { content: "  ✗"; color: #a8322d; }
  .reveal { display: block !important; }
  footer { display: none; }
}