/* Investment & Portfolio Theory course stylesheet.
   Loaded after /assets/style.css. House look: Tufte-like serif, blue accent,
   mono data. Problem sets + KaTeX styling per PRACTICE.md, locked issue #7. */

:root {
  --ipt-accent: #2563eb;
  --ipt-accent-dim: #93c5fd;
  --ipt-amber: #f59e0b;
  --ipt-card: #ffffff;
  --ipt-border: #e2e8f0;
}

/* ---------- lesson header ---------- */
.lesson-header {
  margin: 2.5rem 0 2rem;
}
.lesson-number {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.4rem;
}
.lesson-header h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}
.subtitle {
  color: var(--muted);
  font-size: 1.02rem;
  font-style: italic;
}

/* ---------- sections ---------- */
h2 {
  margin-top: 2.4rem;
  font-size: 1.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
h3 {
  margin-top: 1.6rem;
  font-size: 1.08rem;
}
p { margin: 0.7rem 0; }
ul, ol { margin: 0.7rem 0 0.7rem 1.4rem; }
li { margin: 0.3rem 0; }
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #eef2f7;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.9rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 0;
  margin: 1rem 0;
  font-size: 0.92rem;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
th { background: #f1f5f9; font-family: var(--mono); font-size: 0.8rem; }
td { font-family: var(--mono); font-size: 0.85rem; }
td.num, th.num { text-align: right; }

/* ---------- callouts ---------- */
.callout {
  border-left: 3px solid var(--ipt-accent);
  background: #f5f8ff;
  padding: 0.8rem 1rem;
  margin: 1.2rem 0;
  border-radius: 0 6px 6px 0;
}
.callout .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ipt-accent);
  margin-bottom: 0.3rem;
}
.callout.tip { border-color: var(--ipt-amber); background: #fffaf0; }
.callout.tip .label { color: #b45309; }
.callout.warn { border-color: #dc2626; background: #fef2f2; }
.callout.warn .label { color: #b91c1c; }

/* ---------- real market artifact ---------- */
.artifact {
  border: 1px solid var(--ipt-border);
  border-radius: 8px;
  background: var(--ipt-card);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.artifact .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ipt-accent);
  margin-bottom: 0.4rem;
}

/* ---------- figures ---------- */
figure {
  margin: 1.4rem auto;
  text-align: center;
}
figure img {
  max-width: 520px;
  width: 100%;
  height: auto;
  border-radius: 4px;
}
.diagram-caption {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.4rem;
}
.diagram-caption a { color: var(--ipt-accent-dim); }

/* ---------- problem sets (PRACTICE.md) ---------- */
.problem-set {
  margin-top: 2rem;
}
.problem {
  border: 1px solid var(--ipt-border);
  border-left: 3px solid var(--ipt-accent);
  border-radius: 0 8px 8px 0;
  background: var(--ipt-card);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.problem h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-family: var(--mono);
}
.problem-title { font-family: var(--serif); font-weight: 600; }
.problem-body { margin: 0.4rem 0; }
details.solution {
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}
details.solution summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ipt-accent);
  user-select: none;
}
details.solution summary:hover { text-decoration: underline; }
details.solution[open] summary { margin-bottom: 0.4rem; }
details.solution .solution-body { font-size: 0.95rem; }
details.solution .solution-body p { margin: 0.5rem 0; }

/* ---------- mastery check ---------- */
.mastery-check {
  border: 2px solid var(--ipt-accent);
  border-radius: 8px;
  background: #f5f8ff;
  padding: 1rem 1.2rem;
  margin: 1.8rem 0;
}
.mastery-check h3 {
  margin-top: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ipt-accent);
}
.mastery-check ul { list-style: none; margin-left: 0; }
.mastery-check li {
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--border);
}
.mastery-check li:last-child { border-bottom: none; }

/* ---------- labeled equations ---------- */
.equation {
  position: relative;
  margin: 1rem 0 1.4rem;
}
.eq-math {
  max-width: calc(100% - 4.2rem);
}
.eq-math .katex-display {
  margin: 0.25rem 0;
}
.eq-label {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--muted);
}
@media (max-width: 480px) {
  .eq-label { font-size: 0.9rem; }
}

/* ---------- KaTeX ---------- */
.katex {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
}
.katex-display {
  margin: 1rem 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* ---------- lesson footer ---------- */
.lesson-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin-bottom: 0.6rem;
}
.nav-links a { color: var(--ipt-accent); text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .lesson-header h1 { font-size: 1.5rem; }
  figure img { max-width: 100%; }
}
