/* ARM64 Fieldnotes — paper, ink, and a little room to think. */
:root {
  color-scheme: light;
  --paper: #f7f6f0;
  --surface: #fffef9;
  --surface-muted: #eeeee5;
  --ink: #263e33;
  --muted: #637065;
  --forest: #1d4939;
  --forest-soft: #e5ece1;
  --accent: #d6905e;
  --accent-ink: #97512b;
  --accent-soft: #f5e9dc;
  --line: #d9ddd1;
  --strong-line: #b8c2b3;
  --error: #a33832;
  --error-soft: #f7e6e1;
  --code-bg: #18392e;
  --code-ink: #e8eddf;
  --shadow: 0 14px 40px rgb(27 47 34 / 10%);
  --rail-width: 252px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15241e;
  --surface: #1b2d25;
  --surface-muted: #22372d;
  --ink: #e9ecdf;
  --muted: #a9b7a7;
  --forest: #b6d3b2;
  --forest-soft: #2a4033;
  --accent: #e5a16e;
  --accent-ink: #efb78e;
  --accent-soft: #3b3025;
  --line: #354a3b;
  --strong-line: #53694f;
  --error: #f0a49a;
  --error-soft: #422c29;
  --code-bg: #10281e;
  --code-ink: #e8eddf;
  --shadow: 0 14px 40px rgb(0 0 0 / 22%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 96px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: var(--forest); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button:disabled { cursor: default; opacity: .65; }
svg { flex-shrink: 0; }
button svg, .nav-link svg, .local-note svg, .search-icon { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--forest-soft); color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 4px; }
#main:focus { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.18; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.035em; }
h1 { font-size: clamp(38px, 4.5vw, 66px); }
h2 { font-size: 32px; }
h3 { font-size: 18px; }
p { margin-bottom: 1.2em; }
pre, code { font-family: var(--mono); }
pre { tab-size: 4; }
p code, li code, td code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); font-size: .88em; overflow-wrap: anywhere; }
.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 100; transform: translateY(-160%); padding: 9px 16px; background: var(--surface); border: 1px solid var(--forest); border-radius: 6px; font-weight: 600; }
.skip-link:focus { transform: translateY(0); }

/* Permanent desktop rail; the lesson index owns the available scroll space. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--rail-width); display: flex; flex-direction: column; padding: 30px 18px 0; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; color: var(--forest); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; }
.brand-type { display: flex; flex-direction: column; }
.brand-name { font-size: 24px; font-weight: 750; letter-spacing: -.055em; line-height: 1.1; }
.brand-slash { color: var(--accent-ink); font-weight: 400; }
.brand-subtitle { padding-top: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .21em; line-height: 1.4; }
.sidebar-caption { margin: 20px 8px 23px; color: var(--muted); font-size: 11px; }
.sidebar-nav { display: grid; gap: 4px; padding-bottom: 24px; }
.nav-link { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 550; text-decoration: none; }
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover, .nav-link.is-active { color: var(--forest); background: var(--forest-soft); }
.nav-link.is-active { border-color: var(--line); }
.nav-tag { margin-left: auto; color: var(--accent-ink); font-family: var(--mono); font-size: 8px; letter-spacing: .06em; }
.sidebar-course-label { display: flex; justify-content: space-between; gap: 8px; padding: 14px 8px 12px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.sidebar-course-label span:last-child { opacity: .8; font-size: 8px; }
.sidebar-lessons { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 0 20px; scrollbar-width: thin; scrollbar-color: var(--strong-line) transparent; }
.sidebar-group { margin-bottom: 21px; }
.sidebar-group-title { margin: 10px 8px 7px; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; }
.sidebar-lesson { position: relative; display: flex; align-items: baseline; gap: 10px; padding: 7px 8px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); font-size: 12px; line-height: 1.55; text-decoration: none; }
.sidebar-lesson-number { min-width: 18px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.sidebar-lesson:hover { background: var(--surface-muted); color: var(--ink); }
.sidebar-lesson.is-active { background: var(--forest-soft); border-color: var(--line); color: var(--forest); font-weight: 600; }
.sidebar-lesson.is-active::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; background: var(--forest); border-radius: 2px; }
.sidebar-lesson.is-complete { padding-right: 25px; }
.sidebar-lesson.is-complete::after { content: "✓"; position: absolute; right: 8px; color: var(--forest); font-size: 12px; }
.sidebar-lesson.is-complete .sidebar-lesson-number { color: var(--forest); }
.sidebar-footer { flex-shrink: 0; margin: 0 -18px; padding: 18px 25px 19px; border-top: 1px solid var(--line); background: var(--surface); }
.progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: 11px; }
#progress-count { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.progress-track { height: 4px; overflow: hidden; border-radius: 3px; background: var(--surface-muted); }
.progress-fill { height: 100%; max-width: 100%; background: var(--forest); transition: width .25s ease; }
.resume-link { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 12px; font-weight: 600; text-decoration: none; }
.resume-link:hover { text-decoration: underline; }
.local-note { display: flex; align-items: center; gap: 5px; margin: 10px 0 0; color: var(--muted); font-size: 9px; }
.local-note svg { width: 12px; height: 12px; }

/* Header and global surfaces. */
.app-shell { margin-left: var(--rail-width); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; padding: 15px 42px; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--forest); }
.topbar-controls { display: flex; align-items: center; gap: 13px; margin-left: auto; }
.search-shell { position: relative; width: clamp(210px, 22vw, 330px); }
.search-icon { position: absolute; top: 12px; left: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
#search { width: 100%; height: 40px; padding: 8px 13px 8px 38px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); font-size: 12px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--forest); }
.icon-button:hover { background: var(--forest-soft); border-color: var(--strong-line); }
.icon-button svg { width: 19px; height: 19px; }
.menu-toggle { display: none; }
.theme-sun { display: none; }
html[data-theme="dark"] .theme-sun { display: block; }
html[data-theme="dark"] .theme-moon { display: none; }
#main { max-width: 1320px; margin: 0 auto; padding: 45px 48px 64px; }
#view { min-width: 0; }
.page-eyebrow, .section-kicker, .lesson-kicker, .exercise-label { color: var(--accent-ink); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.page-eyebrow { margin-bottom: 20px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 10px 17px; border: 1px solid var(--strong-line); border-radius: 5px; color: var(--forest); background: var(--surface); font-family: var(--sans); font-size: 12px; font-weight: 600; line-height: 1.45; text-align: center; text-decoration: none; transition: background-color .15s ease, border-color .15s ease; }
.button:hover { background: var(--forest-soft); border-color: var(--forest); }
.button-primary { color: var(--paper); background: var(--forest); border-color: var(--forest); }
.button-primary:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.button-secondary { background: transparent; }
.button svg { width: 16px; height: 16px; }
.button.is-complete, #complete-lesson.is-complete { background: var(--forest-soft); color: var(--forest); border-color: var(--strong-line); }

/* Course overview. */
.hero { display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; gap: 44px; padding: 12px 0 44px; }
.hero-copy { min-width: 0; }
.hero h1 { max-width: 540px; margin-bottom: 21px; line-height: 1.06; }
.hero h1 em { color: var(--forest); font-weight: inherit; }
.lede { max-width: 490px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 17px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 7px 17px; color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.7; }
.hero-terminal { min-width: 0; overflow: hidden; border: 1px solid #355645; border-radius: 8px; background: var(--code-bg); color: var(--code-ink); box-shadow: 7px 7px 0 var(--surface-muted); }
.terminal-bar { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 11px 17px; border-bottom: 1px solid #355645; }
.terminal-bar > i, .terminal-bar > .terminal-dot { width: 6px; height: 6px; border: 1px solid #829784; border-radius: 50%; }
.terminal-title { margin-left: auto; color: #b2c7b3; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.hero-terminal pre { margin: 0; padding: 25px 22px; overflow: auto; font-size: 12px; line-height: 2; }
.terminal-dots { color: #a8bea6; font-size: 8px; letter-spacing: 2px; white-space: nowrap; }
.terminal-bar > span:last-child:not(.terminal-title) { color: #b2c7b3; font-family: var(--mono); font-size: 9px; }
.terminal-caption { display: flex; align-items: center; gap: 7px; padding: 11px 16px; border-top: 1px solid #355645; color: #b2c7b3; font-family: var(--mono); font-size: 9px; }
.terminal-status { width: 5px; height: 5px; border-radius: 50%; background: #b5d49b; }
.hero-terminal .comment, .code-comment { color: #a8bea6; }
.hero-terminal .instruction, .code-instruction, .code-op { color: #efb48b; }
.hero-terminal .register, .code-register, .code-value { color: #d7e4b9; }
.register-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border-top: 1px solid #355645; background: #355645; }
.register-cell { display: flex; flex-direction: column; gap: 4px; padding: 13px 17px; background: var(--code-bg); font-family: var(--mono); font-size: 12px; }
.register-cell span:first-child, .register-cell small { color: #b2c7b3; font-size: 9px; }
.register-cell strong { font-weight: 500; }
.register-result { background: #264936; }
.register-result strong { color: #efb48b; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 29px 0 21px; padding-top: 26px; border-top: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 0; font-size: 30px; }
.section-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.section-kicker { display: block; margin-bottom: 9px; font-size: 9px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.module-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 21px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.module-card:hover { border-color: var(--forest); background: var(--forest-soft); }
.module-card > a { color: inherit; text-decoration: none; }
.module-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.module-number { color: var(--accent-ink); font-family: var(--mono); font-size: 10px; letter-spacing: .06em; }
.module-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; color: var(--forest); background: var(--forest-soft); border-radius: 5px; font-family: var(--mono); font-size: 13px; }
.module-icon svg { width: 19px; height: 19px; }
.module-card h3 { margin-bottom: 9px; font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: -.025em; }
.module-card p { margin-bottom: 22px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.module-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.module-count { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.module-arrow { color: var(--forest); font-size: 18px; }
.module-progress { height: 3px; margin-top: 12px; overflow: hidden; background: var(--surface-muted); border-radius: 2px; }
.module-progress::before { content: ""; display: block; width: var(--progress, 0%); max-width: 100%; height: 100%; background: var(--forest); }
.module-progress > span, .module-progress > div { display: block; height: 100%; background: var(--forest); }
.module-section { margin: 30px 0; }
.module-section > h3 { margin-bottom: 12px; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.lesson-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 15px; min-height: 54px; padding: 13px 15px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; text-decoration: none; }
.lesson-row > a { color: inherit; text-decoration: none; }
.lesson-row:hover { background: var(--forest-soft); }
.lesson-number { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.lesson-name { font-weight: 500; }
.lesson-time { color: var(--muted); font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.lesson-status { min-width: 15px; color: var(--muted); font-size: 12px; text-align: center; }
.lesson-row.is-complete .lesson-status, .lesson-status.is-complete { color: var(--forest); }
.callout { display: flex; align-items: flex-start; gap: 16px; margin: 30px 0; padding: 22px 24px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--accent-soft); font-size: 13px; }
.callout-icon { flex-shrink: 0; color: var(--accent-ink); font-family: var(--mono); font-size: 20px; line-height: 1.3; }
.callout h2, .callout h3 { margin-bottom: 6px; font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.callout p { margin: 0; }
.callout > div { min-width: 0; }
.callout > .button { align-self: center; flex-shrink: 0; margin-left: auto; }
.attribution { margin-top: 35px; padding-top: 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.8; }
.attribution a { font-weight: 500; }

/* Quiet, generous reading pages. */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 27px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--forest); text-decoration: underline; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 205px; align-items: start; gap: 42px; }
.lesson-content { min-width: 0; max-width: 740px; }
.lesson-header { margin-bottom: 28px; }
.lesson-kicker { display: block; margin-bottom: 13px; }
.lesson-header h1 { margin-bottom: 17px; font-size: clamp(35px, 3.6vw, 51px); line-height: 1.12; }
.lesson-summary { margin-bottom: 18px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 7px 17px; padding-bottom: 25px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 10px; }
.objectives { margin-bottom: 35px; padding: 21px 24px; background: var(--forest-soft); border: 1px solid var(--line); border-radius: 5px; }
.objectives h2 { margin-bottom: 11px; color: var(--forest); font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.objectives ul { margin: 0; padding-left: 17px; font-size: 13px; line-height: 1.8; }
.objectives li + li { margin-top: 4px; }
.objectives li::marker { color: var(--forest); }
.lesson-section { margin: 32px 0; scroll-margin-top: 100px; }
.lesson-section h2 { margin-bottom: 17px; font-size: 29px; }
.lesson-section h3 { margin-top: 24px; font-size: 17px; }
.lesson-section p, .lesson-section li { font-size: 15px; line-height: 1.9; overflow-wrap: anywhere; }
.lesson-section ul, .lesson-section ol { padding-left: 24px; }
.code-block { overflow: hidden; margin: 22px 0; border: 1px solid #355645; border-radius: 6px; background: var(--code-bg); color: var(--code-ink); }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 39px; padding: 8px 15px; border-bottom: 1px solid #355645; color: #b2c7b3; font-family: var(--mono); font-size: 9px; }
.code-toolbar button { margin-left: auto; padding: 4px 8px; border: 1px solid #55725c; border-radius: 4px; color: #e8eddf; background: transparent; font-family: var(--mono); font-size: 9px; }
.code-toolbar button:hover { background: #294837; }
.code-block pre, .exercise pre { margin: 0; padding: 20px; overflow: auto; max-width: 100%; font-size: 12px; line-height: 1.9; scrollbar-width: thin; }
.code-block code, .exercise pre code { white-space: pre; overflow-wrap: normal; }
pre.wrap, .code-block.is-wrapped pre, .code-block.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.wrap code, .code-block.is-wrapped code, .code-block.wrap code { white-space: inherit; overflow-wrap: inherit; }
.exercise { margin: 34px 0; padding: 26px; border: 1px solid var(--strong-line); border-radius: 6px; background: var(--surface); }
.exercise-label { display: block; margin-bottom: 10px; font-size: 9px; }
.exercise h2 { margin-bottom: 12px; font-size: 27px; }
.exercise p { font-size: 13px; line-height: 1.8; }
.exercise pre { margin: 17px 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); color: var(--ink); }
.exercise .code-block pre { margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--code-ink); }
.answer-button { min-height: 40px; padding: 8px 13px; border: 1px solid var(--strong-line); border-radius: 4px; color: var(--forest); background: transparent; font-size: 12px; font-weight: 600; }
.answer-button:hover { background: var(--forest-soft); }
.exercise-answer { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.exercise-answer p:last-child { margin-bottom: 0; }
.knowledge-check { margin: 34px 0; padding: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.knowledge-check h2 { margin-bottom: 13px; font-size: 27px; }
.knowledge-check > p { font-size: 13px; line-height: 1.8; }
.quiz-options { display: grid; gap: 9px; }
.quiz-option { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 47px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--paper); font-size: 13px; line-height: 1.65; text-align: left; }
.quiz-option::before { content: ""; flex-shrink: 0; width: 13px; height: 13px; border: 1px solid var(--strong-line); border-radius: 50%; }
.quiz-option:not(:disabled):hover { border-color: var(--forest); background: var(--forest-soft); }
.quiz-option.is-selected, .quiz-option.selected { border-color: var(--forest); }
.quiz-option.is-correct, .quiz-option.correct, .quiz-option[data-state="correct"] { border-color: var(--forest); background: var(--forest-soft); color: var(--forest); opacity: 1; }
.quiz-option.is-correct::before, .quiz-option.correct::before, .quiz-option[data-state="correct"]::before { background: var(--forest); border-color: var(--forest); box-shadow: inset 0 0 0 3px var(--forest-soft); }
.quiz-option.is-incorrect, .quiz-option.incorrect, .quiz-option[data-state="incorrect"] { border-color: var(--error); background: var(--error-soft); color: var(--error); opacity: 1; }
.quiz-feedback { margin-top: 15px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; line-height: 1.8; }
.quiz-feedback:empty { display: none; }
.quiz-feedback.success { color: var(--forest); background: var(--forest-soft); border-color: var(--strong-line); }
.quiz-feedback.error { color: var(--error); background: var(--error-soft); border-color: var(--error); }
.quiz-letter { flex-shrink: 0; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.quiz-option:has(.quiz-letter)::before { display: none; }
.quiz-option.is-correct .quiz-letter { color: var(--forest); }
.quiz-option.is-incorrect .quiz-letter { color: var(--error); }
.lesson-completion { margin-top: 34px; padding: 25px; border: 1px solid var(--line); border-radius: 6px; background: var(--forest-soft); text-align: center; }
.lesson-completion p { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
#complete-lesson[aria-pressed="true"] { color: var(--forest); background: var(--surface); }
.lesson-navigation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 35px; padding-top: 24px; border-top: 1px solid var(--line); }
.lesson-navigation .button { max-width: 100%; }
.lesson-aside { position: sticky; top: 105px; min-width: 0; }
.aside-card { margin-bottom: 19px; padding: 19px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.aside-title { margin-bottom: 14px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.toc-link { display: block; padding: 7px 0; color: var(--muted); font-size: 11px; line-height: 1.65; text-decoration: none; }
.toc-link:hover, .toc-link.is-active { color: var(--forest); }
.toc-link.is-active { font-weight: 650; }
.aside-card p { margin-bottom: 12px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.source-link { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; font-weight: 600; }
.source-link svg { width: 12px; height: 12px; }
.aside-card hr { margin: 17px 0; border: 0; border-top: 1px solid var(--line); }
.aside-card .source-link { display: flex; margin: 10px 0; font-size: 10px; }
.aside-card .aside-note { margin-top: 17px; }
.aside-note { color: var(--muted); font-size: 11px; line-height: 1.85; }
.reading-progress { height: 3px; overflow: hidden; border-radius: 2px; background: var(--surface-muted); }
.reading-progress > span, .reading-progress > div { display: block; height: 100%; background: var(--forest); }

/* Reference pages and the deliberately small register workbench. */
.glossary-header { margin-bottom: 30px; }
.glossary-header h1 { margin-bottom: 18px; }
.glossary-header p { max-width: 560px; color: var(--muted); }
#glossary-search { width: 100%; max-width: 460px; min-height: 45px; margin-top: 10px; padding: 10px 14px; border: 1px solid var(--strong-line); border-radius: 5px; color: var(--ink); background: var(--surface); font-size: 13px; }
.glossary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.glossary-entry { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.glossary-entry h2 { margin-bottom: 12px; color: var(--forest); font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.glossary-entry p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.85; overflow-wrap: anywhere; }
.lab-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 24px; margin-top: 28px; }
.lab-editor { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.lab-editor > h2, .lab-editor > label:not(.sr-only) { display: block; margin: 0; padding: 17px 20px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.lab-editor .code-toolbar { flex-wrap: wrap; border-color: var(--line); background: var(--surface-muted); color: var(--muted); }
.lab-editor > .aside-note { margin: 0; padding: 0 17px 17px; }
.lab-layout > section > .section-heading { margin-top: 0; padding-top: 0; border-top: 0; }
.lab-layout > section > .section-heading h2 { font-size: 25px; }
.lab-layout .section-kicker { margin-bottom: 0; font-size: 8px; }
.lab-disclaimer { font-size: 12px; }
#lab-code { display: block; width: 100%; min-height: 285px; padding: 22px; resize: vertical; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline-offset: -4px; background: var(--code-bg); color: var(--code-ink); font-family: var(--mono); font-size: 12px; line-height: 2; white-space: pre; overflow: auto; tab-size: 4; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.lab-actions .button { min-height: 38px; padding: 8px 13px; font-size: 11px; }
#lab-sample { max-width: 100%; min-height: 40px; padding: 8px 30px 8px 12px; border: 1px solid var(--strong-line); border-radius: 5px; color: var(--ink); background: var(--surface); font-size: 12px; }
#lab-status { margin: 0; padding: 0 17px 17px; color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
#lab-status:empty { display: none; }
#lab-status.error { color: var(--error); }
#lab-status.success { color: var(--forest); }
.lab-registers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lab-registers > h2 { grid-column: 1 / -1; margin-bottom: 5px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .05em; }
.lab-register { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.lab-register > span:first-child, .lab-register label, .lab-register small { color: var(--muted); font-size: 10px; }
.lab-register strong { color: var(--forest); font-size: 20px; font-weight: 500; line-height: 1.4; }
.lab-register.changed, .lab-register.is-changed { border-color: var(--accent-ink); background: var(--accent-soft); }
.lab-register .register-label { color: var(--forest); font-size: 10px; }
.lab-register .register-decimal { color: var(--muted); font-size: 9px; }
.lab-register > code { font-size: 10px; }
.lab-output { margin-top: 17px; padding: 18px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); font-family: var(--mono); font-size: 11px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.lab-output h2 { margin-bottom: 12px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .05em; }
.lab-output pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Search floats above the page without taking keyboard focus away. */
.search-results { position: absolute; top: calc(100% + 9px); right: 0; z-index: 50; width: min(440px, calc(100vw - 40px)); max-height: min(65vh, 480px); overflow-y: auto; padding: 7px; border: 1px solid var(--strong-line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.search-result { display: block; padding: 13px 12px; border-radius: 4px; color: var(--ink); text-decoration: none; }
.search-result + .search-result { border-top: 1px solid var(--line); }
.search-result:hover, .search-result:focus-visible { background: var(--forest-soft); }
.search-result-title { display: block; margin-bottom: 4px; color: var(--forest); font-size: 13px; font-weight: 600; }
.search-result-description { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.search-result mark { color: var(--accent-ink); background: var(--accent-soft); }
.empty-state { padding: 45px 24px; border: 1px dashed var(--strong-line); border-radius: 6px; color: var(--muted); text-align: center; }
.empty-state h2 { margin-bottom: 13px; color: var(--ink); }
.empty-state p { margin-bottom: 0; font-size: 13px; }
.search-results .empty-state { padding: 20px 13px; border: 0; font-size: 12px; }
.loading-state { max-width: 600px; padding: 55px 0; }
.loading-state h1 { font-size: 46px; }
.loading-state > p:last-child { color: var(--muted); font-size: 14px; }
.loading-mark { display: flex; gap: 7px; margin-bottom: 30px; }
.loading-mark span { display: flex; align-items: center; justify-content: center; width: 58px; height: 40px; border: 1px solid var(--line); border-radius: 4px; color: var(--forest); background: var(--forest-soft); font-family: var(--mono); font-size: 10px; }
.loading-mark span:last-child { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 70; max-width: min(420px, calc(100vw - 40px)); padding: 13px 19px; border: 1px solid var(--strong-line); border-radius: 6px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 12px; }
.toast:empty { display: none; }
.sidebar-overlay { position: fixed; inset: 0; z-index: 35; border: 0; background: rgb(8 25 16 / 45%); }
noscript .callout { display: block; }
noscript .callout h2 { margin-bottom: 10px; }

@media (min-width: 1700px) {
  #main { padding-top: 55px; }
  .hero { gap: 65px; }
  .hero h1 { font-size: 76px; }
}
@media (max-width: 1200px) {
  .topbar { padding-inline: 30px; }
  .topbar-note { font-size: 10px; }
  #main { padding: 35px 30px 55px; }
  .hero { gap: 25px; }
  .hero h1 { font-size: 53px; }
  .hero-terminal pre { padding: 22px 17px; font-size: 11px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-layout { grid-template-columns: minmax(0, 1fr) 180px; gap: 25px; }
  .aside-card { padding: 15px; }
}
@media (max-width: 1050px) {
  .topbar-note { display: none; }
  .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  .lesson-content { max-width: none; }
  .lesson-aside { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hero-copy { max-width: 560px; }
  .hero-terminal { max-width: 530px; }
  .hero h1 { font-size: 60px; }
  .hero-terminal pre { font-size: 12px; }
  .lab-layout { grid-template-columns: minmax(0, 1fr); }
  .lab-registers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  html { scroll-padding-top: 86px; }
  .sidebar { width: 270px; visibility: hidden; transform: translateX(-100%); transition: transform .2s ease, visibility .2s ease; }
  .mobile-open { overflow: hidden; }
  .mobile-open .sidebar { visibility: visible; transform: translateX(0); }
  .sidebar-overlay { display: none; }
  .mobile-open .sidebar-overlay:not([hidden]) { display: block; }
  .app-shell { margin-left: 0; }
  .topbar { min-height: 68px; padding: 13px 24px; gap: 12px; }
  .menu-toggle { display: inline-flex; }
  .topbar-controls { flex: 1; justify-content: flex-end; gap: 10px; }
  .search-shell { width: min(350px, 100%); }
  #main { max-width: 800px; padding: 34px 30px 50px; }
  .hero { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 27px; }
  .hero h1 { font-size: 51px; }
  .hero-terminal pre { padding: 18px 14px; font-size: 10px; }
  .register-cell { padding: 11px; }
  .lab-layout { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: 17px; }
  .lab-registers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-section { scroll-margin-top: 86px; }
}
@media (max-width: 620px) {
  .topbar { padding-inline: 20px; }
  .topbar-controls { min-width: 0; }
  .search-shell { flex: 1; min-width: 0; }
  #search { font-size: 16px; }
  .search-icon { width: 15px; height: 15px; }
  .search-results { position: fixed; top: 62px; right: 20px; left: 20px; width: auto; max-height: 65vh; }
  #main { padding: 28px 20px 42px; }
  .page-eyebrow { font-size: 9px; margin-bottom: 18px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 5px; padding-bottom: 27px; gap: 26px; }
  .hero h1 { max-width: 400px; font-size: clamp(44px, 11.8vw, 62px); }
  .lede { font-size: 14px; }
  .hero-actions { gap: 9px; margin-top: 21px; }
  .hero-meta { font-size: 9px; gap: 6px 13px; }
  .hero-terminal { width: calc(100% - 6px); }
  .hero-terminal pre { padding: 20px; font-size: 12px; }
  .register-cell { padding: 13px 16px; }
  .section-heading { align-items: start; flex-direction: column; gap: 7px; margin-top: 20px; padding-top: 22px; }
  .section-heading h2 { font-size: 28px; }
  .section-heading p { font-size: 11px; }
  .module-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .module-card { padding: 20px; }
  .module-card-header { margin-bottom: 17px; }
  .module-card h3 { font-size: 25px; }
  .module-card p { font-size: 13px; margin-bottom: 18px; }
  .module-card-footer { padding-top: 12px; }
  .lesson-row { grid-template-columns: 21px minmax(0, 1fr) auto 15px; gap: 10px; padding: 13px 6px; font-size: 12px; }
  .lesson-time { font-size: 9px; }
  .lesson-status { display: block; }
  .callout { flex-wrap: wrap; padding: 18px; gap: 12px; font-size: 12px; }
  .callout > div { flex: 1; }
  .callout > .button { margin-left: 0; }
  .attribution { margin-top: 28px; font-size: 10px; }
  .breadcrumbs { margin-bottom: 23px; font-size: 9px; }
  .lesson-header h1 { font-size: 39px; }
  .lesson-summary { font-size: 15px; }
  .lesson-meta { font-size: 9px; gap: 6px 13px; }
  .objectives { padding: 19px; }
  .lesson-section h2 { font-size: 28px; }
  .lesson-section p, .lesson-section li { font-size: 14px; line-height: 1.9; }
  .code-block pre, .exercise pre { padding: 17px; font-size: 11px; }
  .exercise, .knowledge-check { padding: 20px; }
  .exercise h2, .knowledge-check h2 { font-size: 26px; }
  .quiz-option { padding: 11px 12px; font-size: 12px; }
  .lesson-navigation { gap: 10px; }
  .lesson-navigation .button { flex: 1; }
  #complete-lesson { flex-basis: 100%; }
  .lesson-aside { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .aside-card { padding: 19px; }
  .glossary-header h1 { font-size: 44px; }
  .glossary-header p { font-size: 14px; }
  #glossary-search { font-size: 16px; }
  .glossary-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .glossary-entry { padding: 21px; }
  .lab-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  #lab-code { font-size: 16px; min-height: 270px; padding: 18px; }
  #lab-sample { width: 100%; font-size: 16px; }
  .lab-editor .code-toolbar { gap: 8px; }
  .lab-editor .code-toolbar > label { width: 100%; }
  .lab-registers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loading-state { padding-top: 35px; }
  .loading-state h1 { font-size: 40px; }
  .toast { left: 20px; right: 20px; bottom: 20px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .sidebar-overlay, .lesson-aside, .hero-terminal, .hero-actions, .quiz-options, .lesson-navigation, .toast, .skip-link, .code-toolbar button { display: none !important; }
  :root, html[data-theme="dark"] { --paper: #fff; --surface: #fff; --ink: #111; --muted: #444; --forest: #18392e; --line: #ccc; }
  .app-shell { margin: 0; }
  #main { max-width: none; padding: 0; }
  .hero, .lesson-layout { display: block; }
  .code-block { background: #f5f5f5; color: #111; border-color: #ccc; break-inside: avoid; }
  .code-block pre { white-space: pre-wrap; }
  .code-block code { white-space: inherit; }
  a { color: inherit; }
}
