:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #eceef7;
  --ink: #10143a;
  --ink-2: #4b5075;
  --ink-3: #63688d;
  --line: #dcdfee;
  --link: #1f2fb8;
  --ember: #d63d14;
  --ok: #1f8a4c;
  --warn-bg: #fff4e8;
  --warn-line: #f2b57a;
  --tip-bg: #eef1ff;
  --tip-line: #aab4f5;
  --code-bg: #0d1134;
  --code-ink: #dfe2f8;
  --code-dim: #7b82b8;
  --code-hi: #f8bc0f;
  --shot-shadow: 0 1px 2px rgb(16 20 58 / .08), 0 12px 32px -12px rgb(16 20 58 / .28);
  --sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e24; --surface: #131836; --surface-2: #1a2045;
    --ink: #e8eaf8; --ink-2: #aeb3d6; --ink-3: #8389b2; --line: #262c57;
    --link: #9aa5ff; --ember: #ff7a45; --ok: #4cc27f;
    --warn-bg: #2a1a14; --warn-line: #7a4326; --tip-bg: #161c45; --tip-line: #3a448f;
    --code-bg: #060819;
    --shot-shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -14px rgb(0 0 0 / .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e24; --surface: #131836; --surface-2: #1a2045;
  --ink: #e8eaf8; --ink-2: #aeb3d6; --ink-3: #8389b2; --line: #262c57;
  --link: #9aa5ff; --ember: #ff7a45; --ok: #4cc27f;
  --warn-bg: #2a1a14; --warn-line: #7a4326; --tip-bg: #161c45; --tip-line: #3a448f;
  --code-bg: #060819;
  --shot-shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -14px rgb(0 0 0 / .7);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { text-wrap: balance; margin: 0; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: 24px; }
@media (max-width: 520px) { .wrap { padding-inline: 16px; } }

/* Top bar (same as the main page) */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.brand span { font-weight: 300; }
.top nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.top nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.top nav .gh { color: var(--ink); border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 6px; display: inline-flex; gap: 8px; align-items: center; }
.gh svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 700px) { .top nav .hide-sm { display: none; } }
.top nav .lang { font: 500 12.5px/1 var(--mono); letter-spacing: .06em; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; text-decoration: none; }
@media (max-width: 520px) { .top nav a[aria-current] { display: none; } .top .wrap { gap: 14px; } .top nav { gap: 14px; } }
.top nav .lang:hover { color: var(--ink); border-color: var(--ink-3); }


/* Hero */
.hero { padding-block: 64px 48px; border-bottom: 1px solid var(--line); }
.eyebrow { font: 500 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.hero h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.04; font-weight: 900; letter-spacing: -.028em; margin-top: 16px; }
.hero h1 span { font-weight: 300; }
.hero .lede { font-size: clamp(18px, 2vw, 20px); color: var(--ink-2); max-width: 60ch; margin-top: 18px; }
.modules { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 40px; }
@media (max-width: 1000px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .modules { grid-template-columns: minmax(0, 1fr); } }
.mod { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 16px; transition: border-color .15s; }
.mod:hover { border-color: var(--ink-3); }
.mod .n { font: 500 12px/1 var(--mono); letter-spacing: .08em; color: var(--ember); }
.mod h3 { font-size: 17px; font-weight: 700; margin-top: 10px; }
.mod p { font-size: 14px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.mod .meter { margin-top: 14px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.mod .meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }

/* Layout: sidebar + lessons */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; padding-block: 48px 96px; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 14.5px; }
@media (max-width: 960px) { .toc { position: static; max-height: none; } }
.toc details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.toc summary { cursor: pointer; padding: 12px 16px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.toc summary::-webkit-details-marker { display: none; }
.toc .prog { font: 400 12.5px/1.6 var(--mono); color: var(--ink-3); }
.toc .inner { padding: 0 16px 14px; }
.toc h4 { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 6px; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li a { display: grid; grid-template-columns: 2.4em 1fr 14px; gap: 4px; padding: 5px 0; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc li a:hover { color: var(--ink); }
.toc li a .num { font: 400 12.5px/1.6 var(--mono); color: var(--ink-3); }
.toc li a .chk { color: var(--ok); visibility: hidden; font-weight: 700; }
.toc li.done a .chk { visibility: visible; }
.toc li.here a { color: var(--ink); font-weight: 500; }

/* Module + lesson */
.module-h { padding-top: 8px; border-top: 2px solid var(--ink); margin-top: 72px; }
.module-h:first-child { margin-top: 0; }
.module-h .eyebrow { color: var(--ember); margin-top: 14px; }
.module-h h2 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.02em; margin-top: 10px; }
.module-h p { color: var(--ink-2); margin-top: 10px; max-width: 64ch; }
.lesson { margin-top: 48px; padding: 32px 36px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 640px) { .lesson { padding: 22px 18px 20px; } }
.lesson-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.lesson-top .num { font: 500 13px/1 var(--mono); color: var(--ink-3); }
.lesson h3 { font-size: 26px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; flex-basis: 100%; }
.lesson .goal { color: var(--ink-2); margin-top: 10px; max-width: 64ch; }
.need { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.need span { font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 999px; padding: 3px 11px; }
.need b { font-weight: 500; color: var(--ink); }
.lesson h4 { font-size: 18px; font-weight: 700; margin-top: 30px; }
.lesson > p, .lesson .body > p { margin-top: 12px; max-width: 68ch; color: var(--ink); }
.lesson ul.plain { margin: 12px 0 0; padding-left: 1.2em; max-width: 68ch; }
.lesson ul.plain li { margin-top: 6px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 18px 0 0; display: grid; gap: 18px; }
.steps > li { counter-increment: s; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; }
.steps > li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--ink); font: 500 14px/27px var(--mono); text-align: center; }
.steps > li > div > p + p, .steps > li > div > p + .code, .steps > li > div > .code + p { margin-top: 10px; }
.steps b { font-weight: 500; }
.ui { font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: .93em; white-space: nowrap; }
.cdu { font: 500 .88em var(--mono); background: #050806; color: #3ce37a; border-radius: 3px; padding: 1px 6px; white-space: nowrap; }

.code { margin-top: 14px; background: var(--code-bg); border-radius: 8px; position: relative; padding-right: 72px; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 400 14px/1.7 var(--mono); color: var(--code-ink); }
.code .c { color: var(--code-dim); }
.code .p { color: var(--code-hi); user-select: none; }
.code button { position: absolute; top: 8px; right: 8px; font: 500 12px/1 var(--sans); color: var(--code-ink); background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .16); border-radius: 5px; padding: 6px 10px; cursor: pointer; }
.code button:hover { background: rgb(255 255 255 / .16); }

.note { margin-top: 18px; border-left: 3px solid var(--tip-line); background: var(--tip-bg); border-radius: 0 8px 8px 0; padding: 12px 16px; font-size: 15.5px; max-width: 72ch; }
.note.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.note b.lab { display: block; font: 500 11.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }

figure { margin: 22px 0 0; }
figure .shot { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shot-shadow); background: #161616; }
figcaption { font-size: 14px; color: var(--ink-3); margin-top: 10px; max-width: 70ch; }

.tbl { margin-top: 16px; overflow-x: auto; }
table { border-collapse: collapse; font-size: 15px; min-width: 520px; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
td:first-child { white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }

/* State machine diagram */
.fsm { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1fr) 1.3fr minmax(0, 1fr) 1.3fr minmax(0, 1fr); align-items: center; gap: 0; }
.st { border: 1.5px solid var(--ink); border-radius: 10px; padding: 14px 12px; text-align: center; background: var(--surface); }
.st b { display: block; font: 500 15px/1.2 var(--mono); letter-spacing: .04em; }
.st span { display: block; font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }
.st.fly { border-color: #e9075e; box-shadow: 0 0 0 1px #e9075e inset; }
.tr { text-align: center; font: 400 12.5px/1.4 var(--mono); color: var(--ink-2); padding-inline: 8px; }
.tr i { display: block; height: 2px; background: var(--ink-3); margin: 6px 0; position: relative; }
.tr i::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--ink-3); border-right: 0; }
.fsm-back { margin-top: 12px; font: 400 12.5px/1.5 var(--mono); color: var(--ink-2); text-align: center; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
@media (max-width: 700px) {
  .fsm { grid-template-columns: minmax(0, 1fr); }
  .tr { padding-block: 6px; }
  .tr i { width: 2px; height: 22px; margin: 6px auto; }
  .tr i::after { right: -4px; top: auto; bottom: -3px; border: 5px solid transparent; border-top: 7px solid var(--ink-3); border-bottom: 0; }
}

/* Leg matching diagram */
.diagram { margin-top: 20px; background: var(--surface-2); border-radius: 10px; padding: 14px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 520px; height: auto; }
.diagram text { font-family: var(--mono); font-size: 12px; fill: var(--ink-2); }
.diagram .strong { fill: var(--ink); font-weight: 500; }

/* Done + quiz */
.done-row { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.done-row label { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.done-row input { width: 18px; height: 18px; accent-color: var(--ok); }
.done-row a { font-size: 15px; }
.quiz { margin-top: 48px; border: 1.5px solid var(--ink); border-radius: 12px; padding: 28px 32px; background: var(--surface); }
@media (max-width: 640px) { .quiz { padding: 20px 18px; } }
.quiz h3 { font-size: 22px; font-weight: 700; }
.quiz > p { color: var(--ink-2); margin-top: 6px; }
.q { margin-top: 24px; }
.q .ask { font-weight: 500; }
.q .opts { display: grid; gap: 8px; margin-top: 10px; }
.q button { text-align: left; font: 400 15.5px/1.45 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; cursor: pointer; }
.q button:hover:not(:disabled) { border-color: var(--ink-3); }
.q button.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--bg)); }
.q button.wrong { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 10%, var(--bg)); }
.q button:disabled { cursor: default; }
.q .why { margin-top: 10px; font-size: 15px; color: var(--ink-2); }


/* Certificate */
.cert { margin-top: 72px; padding-top: 8px; border-top: 2px solid var(--ink); }
.cert .eyebrow { color: var(--ember); margin-top: 14px; }
.cert h2 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.02em; margin-top: 10px; }
.cert > p { color: var(--ink-2); margin-top: 10px; max-width: 64ch; }
.cert-box { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; }
@media (max-width: 640px) { .cert-box { padding: 20px 18px; } }
.cert-lock { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cert-lock .bar { flex: 1 1 240px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.cert-lock .bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.cert-lock p { color: var(--ink-2); flex-basis: 100%; }
.cert-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.cert-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; flex: 1 1 280px; }
.cert-form input { font: 400 17px/1.4 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%; }
.cert-form button { font: 500 16px/1 var(--sans); color: var(--bg); background: var(--ink); border: 0; border-radius: 6px; padding: 13px 20px; cursor: pointer; }
.cert-form button:disabled { opacity: .5; cursor: default; }
.cert-out { margin-top: 24px; }
.cert-out img { width: 100%; border-radius: 6px; box-shadow: var(--shot-shadow); }
.cert-out p { font-size: 14.5px; color: var(--ink-3); margin-top: 12px; }

footer { border-top: 1px solid var(--line); padding-block: 32px 48px; font-size: 14px; color: var(--ink-3); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }

/* Lesson outcome: what you'll have at the end, in one line */
.outcome { margin-top: 14px; max-width: 68ch; font-weight: 500; }
.outcome b { margin-right: 10px; font: 500 11.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ok); }

/* Required steps: the path you follow, on a rail */
.req { margin-top: 26px; border-left: 3px solid var(--ink); padding: 2px 0 4px 18px; }
@media (max-width: 640px) { .req { padding-left: 12px; } }
.req-lab { font: 500 11.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ember); }
.req > .steps:first-of-type, .req > .req-lab + p { margin-top: 12px; }
.req > p { margin-top: 12px; max-width: 68ch; }

/* Reference and optional material, folded */
details.ref { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
details.ref > summary { cursor: pointer; list-style: none; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-weight: 500; }
details.ref > summary::-webkit-details-marker { display: none; }
details.ref > summary::after { content: "+"; margin-left: auto; font: 400 18px/1 var(--mono); color: var(--ink-3); }
details.ref[open] > summary::after { content: "−"; }
details.ref > summary .tag { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
details.ref > .body { padding: 0 16px 18px; border-top: 1px solid var(--line); }
details.ref > .body > p, details.ref > .body > h4 + p { margin-top: 12px; max-width: 68ch; }
details.ref > .body > .note:first-child, details.ref > .body > p:first-child, details.ref > .body > .steps:first-child, details.ref > .body > .tbl:first-child, details.ref > .body > .need:first-child { margin-top: 16px; }
details.ref > .body h4 { margin-top: 20px; }
@media (max-width: 640px) { details.ref > summary, details.ref > .body { padding-inline: 12px; } }

/* Checkride scoring */
.quiz .pass-mark { font: 500 12.5px/1.6 var(--mono); color: var(--ink-3); }
.quiz .result { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.quiz .result[hidden] { display: none; }
.quiz .result .score { font-weight: 500; }
.quiz .result.pass .score { color: var(--ok); }
.quiz .result.fail .score { color: var(--ember); }
.quiz .result button { font: 500 15px/1 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--ink-3); border-radius: 6px; padding: 10px 16px; cursor: pointer; }
.quiz .result a { font-size: 15px; margin-left: auto; }
.quiz .passed-tag { display: inline-block; margin-left: 10px; font: 500 11.5px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ok); border: 1px solid var(--ok); border-radius: 999px; padding: 0 8px; vertical-align: middle; }
.quiz .passed-tag[hidden] { display: none; }

/* Capstone */
.capstone { margin-top: 48px; padding: 32px 36px 28px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 12px; }
@media (max-width: 640px) { .capstone { padding: 22px 18px 20px; } }
.capstone .phase { margin-top: 26px; }
.capstone .phase h4 { font-size: 18px; font-weight: 700; display: flex; gap: 10px; align-items: baseline; }
.capstone .phase h4 span { font: 500 12px/1 var(--mono); color: var(--ink-3); }
.tasks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.tasks label { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; cursor: pointer; max-width: 72ch; }
.tasks input { width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--ok); }
.tasks .see { color: var(--ink-3); font-size: 14.5px; white-space: nowrap; }
.cap-prog { margin-top: 22px; font: 500 13px/1.6 var(--mono); color: var(--ink-3); }

/* Certificate requirements */
.cert-reqs { list-style: none; padding: 0; margin: 0; flex-basis: 100%; display: grid; gap: 4px; }
.cert-reqs li { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); border-bottom: 1px dashed var(--line); padding: 4px 0; }
.cert-reqs li b { font: 500 14px/1.6 var(--mono); color: var(--ink); }
.cert-reqs li.met b { color: var(--ok); }
