/* course.css — Programming Fundamentals Using C++
   Clean, accessible documentation styling. No animations, no tracking,
   system fonts, light/dark via the OS preference. */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --bg-code: #f0f2f5;
  --text: #1c2430;
  --text-soft: #52606d;
  --accent: #0b5cad;
  --accent-strong: #08437e;
  --border: #d6dee6;
  --mark: #fff3c4;
  --note-bg: #eef4fb;
  --warn-bg: #fdf3e7;
  --good-bg: #edf7ef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161b22;
    --bg-soft: #1d242e;
    --bg-code: #222a35;
    --text: #e6ebf0;
    --text-soft: #a8b3bf;
    --accent: #6cb2f5;
    --accent-strong: #8fc4f8;
    --border: #3a4553;
    --mark: #5a5122;
    --note-bg: #1e2a3a;
    --warn-bg: #33291b;
    --good-bg: #1d2e22;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem; }
.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }

.site-header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.header-wrap { padding-top: .65rem; padding-bottom: .65rem; }
.brand {
  display: inline-block;
  font-weight: 700; font-size: 1.02rem; line-height: 1.3;
  color: var(--text); text-decoration: none; margin-bottom: .35rem;
}
.brand:hover { color: var(--accent-strong); }
.site-nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.site-nav a {
  color: var(--accent); text-decoration: none; font-size: .92rem; padding: .15rem 0;
}
.site-nav a:hover, .site-nav a:focus { text-decoration: underline; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  max-width: 60rem; margin: 0 auto; padding: .8rem 1.25rem 0;
  font-size: .85rem; color: var(--text-soft);
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span[aria-hidden] { margin: 0 .35rem; }

/* ---------- Main content ---------- */
main {
  max-width: 60rem; margin: 0 auto; padding: 1rem 1.25rem 2rem;
  flex: 1 0 auto; width: 100%;
}

h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }
h1 { font-size: 1.75rem; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.35rem; margin: 1.8rem 0 .7rem; border-bottom: 1px solid var(--border); padding-bottom: .25rem; }
h3 { font-size: 1.12rem; margin: 1.4rem 0 .5rem; }
h4 { font-size: 1rem; margin: 1.1rem 0 .4rem; }

p, ul, ol { margin: .6rem 0; }
li { margin: .25rem 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

blockquote {
  margin: 1rem 0; padding: .6rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-soft); color: var(--text-soft);
}
blockquote p { margin: .3rem 0; }

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

/* ---------- Code ---------- */
code, pre, kbd, samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}
code { background: var(--bg-code); padding: .1em .3em; border-radius: 4px; }
pre {
  background: var(--bg-code); padding: .85rem 1rem; border-radius: 8px;
  overflow-x: auto; line-height: 1.5; border: 1px solid var(--border);
}
pre code { background: transparent; padding: 0; font-size: .95em; }

/* ---------- Tables ---------- */
table { border-collapse: collapse; width: 100%; margin: .9rem 0; font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--bg-soft); }
table code { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* ---------- Notes, details ---------- */
.note {
  background: var(--note-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: .7rem 1rem; margin: 1rem 0;
}
.legacy-note { background: var(--warn-bg); }
.legacy-note a { color: var(--accent-strong); }

details {
  border: 1px solid var(--border); border-radius: 8px;
  padding: .55rem .9rem; margin: .7rem 0; background: var(--bg-soft);
}
details[open] { background: var(--bg); }
summary { cursor: pointer; font-weight: 600; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

mark { background: var(--mark); color: inherit; padding: 0 .15em; }

/* ---------- Pager (previous / next module) ---------- */
.pager {
  max-width: 60rem; margin: 0 auto; padding: 0 1.25rem 1.5rem;
  display: flex; gap: 1rem; align-items: stretch;
}
.pager-link {
  flex: 1 1 0; display: flex; flex-direction: column; gap: .15rem;
  border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .9rem; text-decoration: none;
}
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; }
.pager-dir { font-size: .8rem; color: var(--text-soft); }
.pager-title { color: var(--accent); font-weight: 600; font-size: .95rem; }
.pager-empty { flex: 1 1 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  margin-top: 1.5rem; font-size: .88rem; color: var(--text-soft);
}
.site-footer .wrap { padding-top: 1rem; padding-bottom: 1.4rem; }
.site-footer p { margin: .35rem 0; }
.site-footer a { color: var(--accent); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }
  .pager { flex-direction: column; }
  .pager-next { text-align: left; }
  pre { padding: .7rem .8rem; }
  table code { white-space: normal; }
  th, td { padding: .35rem .4rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .breadcrumbs, .pager, .skip-link { display: none; }
  body { color: #000; background: #fff; }
  pre, details { border: 1px solid #999; }
  details { display: block; }
}
