:root {
  --bg: #fbfaf7;
  --text: #1f2328;
  --muted: #5b636d;
  --rule: #e2ded6;
  --accent: #1d5c8a;
  --tag: #eef3f7;
  --measure: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --text: #e6e6e3;
    --muted: #9aa3ad;
    --rule: #2c3138;
    --accent: #7db4df;
    --tag: #1f2a34;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  line-height: 1.6;
}
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  align-items: baseline; justify-content: space-between;
  padding-top: 1.25rem; padding-bottom: 1rem;
}
.name { font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; }
nav { display: flex; gap: 1.1rem; font-family: system-ui, sans-serif; font-size: .92rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a[aria-current="page"], nav a:hover { color: var(--text); text-decoration: underline; }

main { padding-top: 2rem; padding-bottom: 3rem; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 2.25rem 0 .6rem; padding-bottom: .25rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.05rem; margin: 1.5rem 0 .3rem; }
.lede { font-size: 1.1rem; color: var(--muted); margin-top: 0; }

.intro { display: flex; gap: 1.5rem; align-items: flex-start; }
.intro img { width: 150px; height: 150px; object-fit: cover; border-radius: 6px; flex: none; }
@media (max-width: 560px) { .intro { flex-direction: column; } }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.list .meta { display: block; color: var(--muted); font-size: .9rem; font-family: system-ui, sans-serif; }

.tag {
  display: inline-block; font: .75rem system-ui, sans-serif;
  background: var(--tag); color: var(--muted);
  padding: .1rem .45rem; border-radius: 4px; vertical-align: middle;
}

.button {
  display: inline-block; padding: .45rem .9rem; border: 1px solid var(--accent);
  border-radius: 5px; text-decoration: none; font: .9rem system-ui, sans-serif;
}

.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font: .85rem system-ui, sans-serif; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-top: 1rem; padding-bottom: 2rem; }

/* ===== Course pages ===== */
:root { --brand: #d9661a; --brand-soft: #fdf1e8; --box: #f4f2ee; --code-bg: #23272e; --code-fg: #e8e6e3; }
@media (prefers-color-scheme: dark) {
  :root { --brand: #f0914a; --brand-soft: #2b2119; --box: #1c2026; }
}
.crumbs { font: .85rem system-ui, sans-serif; margin-bottom: 1rem; }
.crumbs a { color: var(--muted); }
.eyebrow { font: 600 .78rem system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); margin: 0 0 .35rem; }
.doc-head { margin-bottom: 1.5rem; }
.doc-head h1 { margin-bottom: .35rem; }

.doc h2, .doc h3 { scroll-margin-top: 1rem; }
.doc h2 { color: var(--text); border-bottom-color: var(--brand); }
.doc img { max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; }
.doc figure { margin: 1.5rem 0; text-align: center; }
.doc figcaption { font: italic .9rem system-ui, sans-serif; color: var(--muted); margin-top: .4rem; }
.doc code { font-size: .88em; background: var(--box); padding: .08em .3em; border-radius: 3px; }
.doc table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font: .92rem system-ui, sans-serif; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: .45rem .6rem; border-bottom: 1px solid var(--rule); }
.doc thead th { border-bottom: 2px solid var(--brand); }
.doc blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }

.doc .insightbox, .doc .warningbox, .doc .securitybox, .doc .iureadingbox, .doc .isubox, .doc .coursedetails, .doc .terminalbox {
  margin: 1.4rem 0; padding: .9rem 1.1rem; border-radius: 6px; border: 1px solid var(--rule); background: var(--box);
}
.doc .box-title { margin: 0 0 .5rem; font: 700 .82rem system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.doc .insightbox { background: var(--brand-soft); border-left: 4px solid var(--brand); }
.doc .insightbox .box-title, .doc .iureadingbox .box-title, .doc .isubox .box-title { color: var(--brand); }
.doc .warningbox { border-left: 4px solid var(--text); }
.doc .securitybox { border-left: 4px solid var(--muted); font-size: .95rem; }
.doc .iureadingbox { background: transparent; border: 1px solid var(--brand); }
.doc .isubox { border-top: 3px solid var(--brand); }
.doc .coursedetails { background: var(--brand-soft); }
.doc .terminalbox { background: var(--code-bg); color: var(--code-fg); border: 0; font: .86rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-x: auto; }
.doc .terminalbox p { margin: .2rem 0; }
.doc .terminalbox code { background: none; color: inherit; }
.doc > :first-child, .doc [class$="box"] > :last-child { margin-bottom: 0; }
.badge { display: inline-block; min-width: 1.6em; padding: .05em .4em; border-radius: 1em; background: var(--brand); color: #fff; font: 700 .78rem system-ui, sans-serif; text-align: center; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: system-ui, sans-serif; }
.pager a { text-decoration: none; max-width: 48%; }
.pager a:last-child { text-align: right; margin-left: auto; }
.pager .meta { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; margin: 1.5rem 0 2rem; }
.ref-card { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem .9rem; border: 1px solid var(--rule); border-radius: 6px; font-family: system-ui, sans-serif; }
.ref-card a:first-child { font-weight: 600; text-decoration: none; }
a.pdf { font: .75rem system-ui, sans-serif; color: var(--muted); margin-left: .5rem; }

details.module { border: 1px solid var(--rule); border-radius: 6px; margin: .75rem 0; }
details.module summary { cursor: pointer; padding: .8rem 1rem; font-weight: 700; list-style-position: inside; }
details.module summary .eyebrow { display: inline; margin-right: .4rem; }
details.module .list { padding: 0 1rem .5rem; }
details.module .list li { padding: .5rem 0; }
details.module .tag { min-width: 5.2rem; text-align: center; margin-right: .4rem; }
