/* Layout: course masthead band, then a sticky outline sidebar beside a single reading column. */
:root {
  --ink: #17232b;
  --ink-soft: #4a5a64;
  --paper: #f6f7f5;
  --panel: #ffffff;
  --line: #d9dfdf;
  --band: #14303b;
  --band-ink: #eef4f3;
  --accent: #e08a00;
  --accent-ink: #2a1a00;
  --accent-soft: #fff3dc;
  --link: #0d6b78;
  --font-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e4ebec; --ink-soft: #a6b5ba; --paper: #0f171b; --panel: #16222a; --line: #2a3a42;
    --band: #0a1f27; --band-ink: #eef4f3; --accent: #f2a43a; --accent-ink: #1e1300; --accent-soft: #2e2412; --link: #5fc3cf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e4ebec; --ink-soft: #a6b5ba; --paper: #0f171b; --panel: #16222a; --line: #2a3a42;
  --band: #0a1f27; --band-ink: #eef4f3; --accent: #f2a43a; --accent-ink: #1e1300; --accent-soft: #2e2412; --link: #5fc3cf;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.6; }
a { color: var(--link); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.masthead { background: var(--band); color: var(--band-ink); border-bottom: 6px solid var(--accent);
  background-image: repeating-linear-gradient(-45deg, transparent 0 22px, rgba(255,255,255,.03) 22px 44px); }
.masthead-inner { max-width: 1160px; margin: 0 auto; padding: 22px 20px 26px; }
.crumbs { font-size: 14px; opacity: .8; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--band-ink); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.code-tag { display: inline-block; margin-top: 12px; font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em;
  background: var(--accent); color: var(--accent-ink); padding: 2px 8px; border-radius: 3px; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 5vw, 48px); line-height: 1.05; margin: 8px 0 10px; text-wrap: balance; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 15px; opacity: .92; }
.meta b { font-weight: 600; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 36px; }
@media (max-width: 820px) { .wrap { grid-template-columns: minmax(0,1fr); } }

.sidebar { align-self: start; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
@media (max-width: 820px) { .sidebar { position: static; } }
.sidebar h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--link); margin: 0 0 8px; }
.sidebar h2 + ol, .sidebar h2 + ul { margin-bottom: 26px; }
.sidebar ol, .sidebar ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.sidebar a { display: block; padding: 6px 12px; font-size: 15px; color: var(--ink-soft); text-decoration: none; border-left: 2px solid transparent; margin-left: -2px; }
.sidebar a:hover { color: var(--ink); border-left-color: var(--accent); background: var(--accent-soft); }
.sidebar .n { font-family: var(--font-mono); font-size: 12px; margin-right: 6px; color: var(--accent); }

main { min-width: 0; }
.enroll { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 4px; margin-bottom: 28px; font-size: 15px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  padding: 8px 16px; border-radius: 3px; font-size: 15px; }
.btn:hover { filter: brightness(1.05); }

h2.sec { font-family: var(--font-display); font-weight: 600; font-size: 32px; color: var(--accent); margin: 36px 0 10px; line-height: 1.1; text-wrap: balance; }
h2.sec:first-of-type { margin-top: 0; }
p { margin: 0 0 14px; max-width: 68ch; }

.intro { display: grid; grid-template-columns: minmax(0,1fr) 230px; gap: 28px; align-items: start; }
@media (max-width: 640px) { .intro { grid-template-columns: minmax(0,1fr); } }

.cert { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px; text-align: center; }
.cert-card { aspect-ratio: 1.4; max-width: 100%; border: 3px double var(--band); background: #fffdf7; color: #17232b; padding: 12px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px; font-size: 11px; line-height: 1.3; }
.cert-card .brand { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: #14303b; letter-spacing: .02em; }
.cert-card .brand span { color: #c47800; }
.cert-card .t { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.cert-card .sig { border-top: 1px solid #9aa7ab; margin: 6px auto 0; padding-top: 2px; width: 70%; font-size: 9.5px; }
.cert figcaption { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-display); font-size: 16px; letter-spacing: .03em; font-weight: 600; background: var(--band); color: var(--band-ink); }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper) 60%, var(--panel)); }
td.id { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; color: var(--link); width: 1%; }
tr.to td { font-weight: 600; }
.key { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }

.modules { display: grid; gap: 14px; margin-top: 6px; }
.module { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; scroll-margin-top: 16px; }
.module header { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.module .num { font-family: var(--font-mono); font-size: 13px; color: var(--accent-ink); background: var(--accent); padding: 1px 7px; border-radius: 3px; }
.module h3 { font-family: var(--font-display); font-weight: 600; font-size: 23px; margin: 0; line-height: 1.15; }
.module p { margin: 8px 0 8px; font-size: 16px; }
.module ul { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink-soft); columns: 2 220px; column-gap: 28px; }
.module li { break-inside: avoid; margin-bottom: 3px; }
.module.exam { border: 2px solid var(--accent); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.facts div { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.trainer { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 18px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--band); color: var(--accent); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 26px; flex: none; }
.trainer div { min-width: 0; }
.trainer > div:not(.avatar) { flex: 1 1 200px; }
.btn.li { background: #0a66c2; color: #fff; }
.bio { margin-top: 14px; }
.trainer strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; display: block; }

footer { border-top: 1px solid var(--line); padding: 18px 20px; text-align: center; font-size: 14px; color: var(--ink-soft); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }


/* ---- Lesson pages ---- */
:root { --good: #1d7a46; --good-soft: #e3f4ea; --bad: #b3261e; --bad-soft: #fbe6e4; --bd: #006a4e; --bd-soft: #e2f2ec; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --good: #5fd08f; --good-soft: #15301f; --bad: #ff8a80; --bad-soft: #3a1a18; --bd: #4fd1a5; --bd-soft: #11302a; } }
:root[data-theme="dark"] { --good: #5fd08f; --good-soft: #15301f; --bad: #ff8a80; --bad-soft: #3a1a18; --bd: #4fd1a5; --bd-soft: #11302a; }

.sidebar a.current { color: var(--ink); font-weight: 600; border-left-color: var(--accent); background: var(--accent-soft); }
.module h3 a { color: inherit; text-decoration: none; }
.module h3 a:hover { color: var(--link); text-decoration: underline; }
.module .go { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 15px; }

.lesson h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; color: var(--accent); margin: 34px 0 10px; line-height: 1.15; text-wrap: balance; }
.lesson h3 { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin: 22px 0 6px; }
.lesson ul, .lesson ol { margin: 0 0 14px; padding-left: 22px; max-width: 68ch; }
.lesson li { margin-bottom: 4px; }
.lesson .table-scroll { margin: 8px 0 16px; }
.lesson td { font-size: 15px; }
.lesson td.c { text-align: center; }

.goals { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 18px; margin-bottom: 8px; }
.goals h2 { margin: 0 0 6px; font-size: 22px; }
.goals ul { margin: 0; }

.box { border-radius: 4px; padding: 12px 16px; margin: 14px 0 18px; max-width: 74ch; border: 1px solid var(--line); background: var(--panel); }
.box > b:first-child { display: block; font-family: var(--font-display); font-size: 17px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }
.box p:last-child, .box ul:last-child { margin-bottom: 0; }
.box.bd { border-left: 5px solid var(--bd); background: var(--bd-soft); }
.box.bd > b:first-child { color: var(--bd); }
.box.std { border-left: 5px solid var(--link); }
.box.std > b:first-child { color: var(--link); }
.box.key { border-left: 5px solid var(--accent); background: var(--accent-soft); }
.box.key > b:first-child { color: var(--ink); }

.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager a { display: block; text-decoration: none; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); min-width: 0; }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.pager span { font-weight: 600; color: var(--ink); }
.pager .next { margin-left: auto; text-align: right; }

/* ---- Quiz ---- */
.quiz { margin-top: 10px; display: grid; gap: 14px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 18px; margin: 0; }
.q legend { float: left; width: 100%; font-weight: 600; padding: 0; margin-bottom: 8px; }
.q legend + * { clear: both; }
.q legend .qn { font-family: var(--font-mono); font-size: 13px; color: var(--link); margin-right: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.opt:hover { background: var(--accent-soft); }
.opt input { margin-top: 5px; accent-color: var(--accent); flex: none; }
.opt.right { background: var(--good-soft); border-color: var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.fb { margin-top: 8px; font-size: 15px; padding: 8px 12px; border-radius: 4px; }
.fb.ok { background: var(--good-soft); color: var(--good); }
.fb.no { background: var(--bad-soft); color: var(--bad); }
.fb span { color: var(--ink); }
.qbtn { font: inherit; font-weight: 700; font-size: 15px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 3px; padding: 8px 16px; cursor: pointer; margin-top: 8px; }
.qbtn.ghost { background: transparent; color: var(--link); border: 1px solid var(--line); }
.qbtn:disabled { opacity: .5; cursor: default; }
.result { background: var(--panel); border: 2px solid var(--line); border-radius: 4px; padding: 16px 18px; }
.result.pass { border-color: var(--good); }
.result.fail { border-color: var(--bad); }
.result strong { font-family: var(--font-display); font-size: 30px; display: block; line-height: 1.1; }
.exam-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; background: var(--paper); padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; }

/* ---- Course list ---- */
.course-list { display: grid; gap: 18px; margin-top: 8px; }
.course-card { background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--accent); border-radius: 4px; padding: 18px 20px; display: grid; gap: 8px; justify-items: start; }
.course-card .code-tag { margin-top: 0; }
.course-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.1; margin: 0; text-wrap: balance; }
.course-card h3 a { color: var(--ink); text-decoration: none; }
.course-card h3 a:hover { color: var(--link); text-decoration: underline; }
.course-card p { margin: 0; }
.course-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 4px 0; }
.course-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.course-facts dd { margin: 0; font-weight: 600; }
.course-trainer { font-size: 15px; color: var(--ink-soft); }

/* ---- Certificate claim ---- */
.cert-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.cert-box h3 { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin: 0; }
.cert-box p { margin: 0; }
.cert-form { display: grid; gap: 8px; max-width: 460px; }
.cert-form label { font-weight: 600; font-size: 15px; }
.cert-form input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); }
.cert-form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.cert-form .qbtn { justify-self: start; }
.cert-preview { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; max-width: 760px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.cert-preview canvas { display: block; width: 100%; height: auto; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-actions .qbtn { margin-top: 0; }
.cert-msg { font-size: 14px; color: var(--ink-soft); }

/* ---- Brand logo in the masthead ---- */
.masthead-inner { position: relative; padding-right: 130px; }
.masthead .brand { position: absolute; right: 20px; top: 20px; background: #ffffff; border-radius: 8px; padding: 6px; line-height: 0; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.masthead .brand img { height: 84px; width: auto; display: block; }
@media (max-width: 640px) { .masthead-inner { padding-right: 88px; } .masthead .brand { right: 16px; top: 16px; } .masthead .brand img { height: 52px; } }
footer { line-height: 1.7; }

/* ---- Course card image ---- */
.course-card { grid-template-columns: 1fr; }
.course-img { display: block; justify-self: stretch; margin: -18px -20px 6px; line-height: 0; background: #fff; border-bottom: 1px solid var(--line); }
.course-img img { width: 100%; height: 220px; object-fit: cover; display: block; }
@media (min-width: 900px) {
  .course-card { grid-template-columns: 300px 1fr; column-gap: 24px; }
  .course-card > *:not(.course-img) { grid-column: 2; }
  .course-img { grid-column: 1; grid-row: 1 / span 7; margin: -18px 0 -18px -20px; border-bottom: 0; border-right: 1px solid var(--line); }
  .course-img img { height: 100%; min-height: 260px; }
}
.course-img.contain img { object-fit: contain; }
