/* Reset + base typography + rendered-markdown styles (.md) */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { font-size: var(--fs-root); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-lao);
  line-height: var(--lh);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------
   Rendered markdown (.md) — shared by overview / exercises / slides
   --------------------------------------------------------------- */
.md { overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }

.md h1, .md h2, .md h3, .md h4 {
  line-height: 1.3; font-weight: 700; margin: 1.4em 0 .6em;
}
.md h1 { font-size: 1.9rem; }
.md h2 { font-size: 1.45rem; }
.md h3 { font-size: 1.2rem; }
.md h2, .md h3 {
  padding-bottom: .25em; border-bottom: 1px solid var(--border);
}
.md h3 { border-bottom: 0; }

.md p, .md ul, .md ol, .md blockquote, .md pre, .md .table-wrap { margin: 0 0 1em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: .3em 0; }
.md li > ul, .md li > ol { margin: .3em 0; }

.md strong { font-weight: 700; }
.md a { text-decoration: underline; }

.md blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-weak);
  padding: .7em 1em; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}
.md blockquote > :last-child { margin-bottom: 0; }

.md code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--surface-2);
  padding: .12em .4em; border-radius: 6px;
}
.md pre {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1em; border-radius: var(--radius-sm);
  overflow-x: auto; line-height: 1.45;
}
.md pre code { background: none; padding: 0; font-size: .95em; white-space: pre; }

/* Tables — wrapped by markdown.js in .table-wrap for horizontal scroll on mobile */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md table { border-collapse: collapse; width: 100%; font-size: .97rem; }
.md th, .md td {
  border: 1px solid var(--border);
  padding: .5em .7em; text-align: left; vertical-align: top;
}
.md thead th { background: var(--surface-2); font-weight: 700; }
.md tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }

.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }

/* Fill-in write-in line — replaces raw underscore runs so they don't become <hr> */
.writein {
  border-bottom: 2px solid var(--muted);
  height: 1.5em; margin: .3em 0; min-width: 60%;
}
