/* Exercise page: title bar, three-column layout, instructions panel, rendered Markdown. */

/* ── Title bar ── */
.exercise-header {
  height: 54px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  padding-right: 14px; border-right: 1px solid var(--border);
  transition: color .15s;
}
.back-link:hover { color: var(--accent); }

/* --badge is set per exercise from JS */
#m-cat-badge {
  --badge: var(--accent);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 2px 8px; border-radius: 3px;
  color: var(--badge); border: 1.5px solid var(--badge);
}
#m-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

/* "Recommended first" - a sticky note, not a warning */
.locked-notice {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  font-size: 13px; color: var(--text);
  background: color-mix(in srgb, var(--marker) 38%, var(--bg));
  border-bottom: 1px solid var(--border);
}
.locked-notice i { color: var(--accent); }
.locked-notice a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── Body: instructions | gutter | editor | gutter | results ──
 * Column widths are CSS variables updated by static/js/resize.js. */
#exercise-body {
  --left: 540px;
  --right: 360px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left) 6px minmax(0, 1fr) 6px var(--right);
  overflow: hidden;
}

.gutter {
  background: var(--border);
  cursor: col-resize;
  transition: background .15s;
  touch-action: none;
}
.gutter:hover, .gutter:focus-visible, .gutter.dragging { background: var(--accent); outline: none; }
body.resizing { cursor: col-resize; user-select: none; }

/* Reading panel. Everything inside is sized in em from one base size, which
 * static/js/fit.js scales via --fit so the whole lesson fits without scrolling. */
.m-panel {
  --fit: 1;
  font-size: calc(16px * var(--fit));
  overflow-y: auto; /* only used if the lesson can't fit even at the minimum scale */
  padding: 1.5em 1.75em 1.75em;
  background: var(--bg);
}

.m-section { margin-bottom: 1.4em; }
.m-divided { border-top: 1px solid var(--border); padding-top: 1.2em; }
.m-section-label {
  font-family: var(--font-mono); font-size: 0.7em; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: 0.7em;
}

.m-desc,
.m-course-text,
.m-instructions { font-size: 1em; color: var(--body-text); line-height: 1.7; }
/* the overview reads as a lead paragraph, set in the display face */
.m-desc { font-family: var(--font-display); font-size: 1.15em; line-height: 1.5; color: var(--text); }
.md strong { color: var(--text); font-weight: 600; }
.md em { font-family: var(--font-display); font-style: italic; }

/* "You'll practise" tags */
.m-concepts { display: flex; flex-wrap: wrap; gap: 0.4em; margin-top: 0.9em; }
.m-concepts li {
  font-family: var(--font-mono); font-size: 0.72em; line-height: 1.4;
  padding: 0.25em 0.6em; border-radius: 3px;
  color: var(--body-text); background: var(--surface); border: 1px solid var(--border);
}

/* ── Rendered Markdown (lesson + task) ── */
.md p { margin-bottom: 0.8em; }
.md > :last-child { margin-bottom: 0; }
.md ol, .md ul { padding-left: 1.4em; margin-bottom: 0.8em; }
.md ol { list-style: decimal; }
.md ul { list-style: square; }
.md li { margin-bottom: 0.35em; padding-left: 2px; }
.md li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.md :not(pre) > code {
  font-size: 0.86em; font-family: var(--font-mono);
  background: var(--inline-code-bg); color: var(--inline-code-fg);
  padding: 1px 5px; border-radius: 3px;
}

/* ── Code blocks (server-side Pygments via Markdown codehilite) ── */
.code-block {
  margin: 0.4em 0 1em;
  padding: 0.85em 1em;
  font-family: var(--font-mono); font-size: 0.86em; line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow-color);
  overflow-x: auto;
}
.code-block pre, .code-block code { font: inherit; color: inherit; white-space: pre; }
/* Pygments token classes: k* keywords, ow operator words, n* names, s* strings, m* numbers, c* comments */
.code-block .k, .code-block .kn, .code-block .kc, .code-block .kd,
.code-block .kr, .code-block .ow                  { color: #a64c36; font-weight: 500; }
.code-block .nf, .code-block .nb, .code-block .nc,
.code-block .bp                                   { color: #2d6a8a; }
.code-block .s, .code-block .s1, .code-block .s2, .code-block .sa,
.code-block .sd, .code-block .si, .code-block .sb { color: #3d7650; }
.code-block .m, .code-block .mi, .code-block .mf  { color: #8a6516; }
.code-block .c, .code-block .c1, .code-block .cm  { color: #6e747d; font-style: italic; }

[data-theme="dark"] .code-block .k, [data-theme="dark"] .code-block .kn,
[data-theme="dark"] .code-block .kc, [data-theme="dark"] .code-block .kd,
[data-theme="dark"] .code-block .kr, [data-theme="dark"] .code-block .ow { color: #f0a98f; }
[data-theme="dark"] .code-block .nf, [data-theme="dark"] .code-block .nb,
[data-theme="dark"] .code-block .nc, [data-theme="dark"] .code-block .bp { color: #9cc8e8; }
[data-theme="dark"] .code-block .s, [data-theme="dark"] .code-block .s1,
[data-theme="dark"] .code-block .s2, [data-theme="dark"] .code-block .sa,
[data-theme="dark"] .code-block .sd, [data-theme="dark"] .code-block .si,
[data-theme="dark"] .code-block .sb { color: #9fd4b3; }
[data-theme="dark"] .code-block .m, [data-theme="dark"] .code-block .mi,
[data-theme="dark"] .code-block .mf { color: #edd28a; }
[data-theme="dark"] .code-block .c, [data-theme="dark"] .code-block .c1,
[data-theme="dark"] .code-block .cm { color: #7f8a96; }

/* ── Responsive ── */
@media (max-width: 960px) {
  #exercise-body { grid-template-columns: 1fr; overflow-y: auto; }
  .gutter { display: none; }
}
