:root {
  color-scheme: light;
  --ink: #101d38;
  --muted: #53617a;
  --line: #cbd6e6;
  --paper: #fff;
  --canvas: #edf2f8;
  --soft: #f5f8fc;
  --blue: #1762c7;
  --blue-dark: #0b458f;
  --blue-soft: #eaf2ff;
  --cyan: #087f9c;
  --gold: #b97908;
  --green: #147a54;
  --red: #a82e42;
  --code: #0f1a2e;
  --shadow: 0 18px 55px rgba(20, 39, 70, .12);
  --shell: min(1160px, calc(100vw - 32px));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.62; }
a { color: var(--blue-dark); text-underline-offset: .18em; }
button, select, input { font: inherit; }
:focus-visible { outline: 3px solid #63c7f2; outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; color: white; background: var(--ink); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.toolbar { position: sticky; z-index: 50; top: 0; display: flex; justify-content: space-between; align-items: center; min-height: 68px; padding: 10px max(16px, calc((100vw - 1210px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); }
.breadcrumb, .toolbar-actions { display: flex; align-items: center; gap: 11px; }
.breadcrumb { font-size: .9rem; font-weight: 760; }
.breadcrumb span[aria-hidden] { color: #8a97aa; }
.toolbar select { min-height: 43px; padding: 0 38px 0 13px; border: 1px solid #aebbd0; border-radius: 8px; color: var(--ink); background: white; }
.section-navigation { width: min(330px, 31vw); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 43px; padding: 9px 15px; border: 1px solid #99abc3; border-radius: 8px; color: var(--ink); background: white; font-weight: 760; text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--blue); color: var(--blue-dark); }
.button-primary { border-color: var(--blue); color: white; background: var(--blue); }
.button-primary:hover { color: white; background: var(--blue-dark); }
.button.is-complete { border-color: var(--green); color: var(--green); background: #effbf6; }

main { width: var(--shell); margin: 30px auto 0; }
.toc-page, .lesson-section { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.toc-page { min-height: calc(100vh - 110px); padding: clamp(36px, 7vw, 84px); }
.document-mark, .eyebrow, .mini-kicker { margin: 0; color: var(--blue); font-size: .78rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow { margin-top: 34px; }
.toc-page h1 { max-width: 980px; margin: 15px 0 20px; font-size: clamp(3rem, 6.4vw, 6.1rem); line-height: .98; letter-spacing: -.052em; }
.toc-intro { max-width: 850px; margin: 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.34rem); }
.course-status { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 36px 0 26px; padding: 15px 18px; border-left: 4px solid var(--blue); background: var(--blue-soft); }
.course-status span { color: var(--muted); }

.days-overview { display: grid; gap: 14px; margin-top: 20px; }
.day-overview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.day-overview > summary { display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: center; padding: 21px 24px; list-style: none; background: var(--soft); cursor: pointer; }
.day-overview > summary::-webkit-details-marker { display: none; }
.day-overview > summary::after { content: "+"; font-size: 1.45rem; color: var(--blue); }
.day-overview[open] > summary::after { content: "−"; }
.day-overview > summary > span:nth-child(2) { display: grid; }
.day-overview summary small { color: var(--muted); }
.day-number { color: var(--blue); font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.day-outcome { margin: 0; padding: 20px 24px; border-top: 1px solid var(--line); }
.overview-periods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.overview-period { padding: 22px 24px; }
.overview-period + .overview-period { border-left: 1px solid var(--line); }
.overview-period h3 { margin: 0 0 12px; color: var(--blue-dark); }
.overview-period ol { margin: 0; padding: 0; list-style: none; }
.overview-period li + li { border-top: 1px solid var(--line); }
.overview-period a { display: grid; grid-template-columns: 58px 1fr; gap: 1px 10px; padding: 12px 0; text-decoration: none; }
.overview-period a > span { grid-row: 1 / 3; color: var(--blue); font-variant-numeric: tabular-nums; }
.overview-period a strong { color: var(--ink); }
.overview-period a small { color: var(--muted); }
.overview-period .is-optional a { opacity: .84; }

.course-facts { margin-top: 42px; }
.course-facts > h2 { margin: 0 0 16px; font-size: 1.55rem; }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.facts-grid > div { padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts-grid h3 { margin: 0 0 8px; color: var(--blue-dark); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.facts-grid p, .facts-grid ul { margin: 0; }
.facts-grid ul { padding-left: 20px; }

.course-document { margin-top: 34px; }
.lesson-section { position: relative; min-height: 100vh; padding: clamp(34px, 6vw, 76px); scroll-margin-top: 80px; }
.lesson-section + .lesson-section { margin-top: 26px; }
.lesson-section.is-optional { border-top: 5px solid var(--cyan); }
.lesson-heading { max-width: 940px; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 17px; }
.lesson-meta span { padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .76rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.lesson-meta span:first-child { color: var(--blue-dark); border-color: #b4ccec; background: var(--blue-soft); }
.lesson-heading h2 { margin: 0; font-size: clamp(2.25rem, 5vw, 4.5rem); line-height: 1.02; letter-spacing: -.045em; }
.lesson-heading h2 span { color: var(--blue); margin-right: 7px; font-variant-numeric: tabular-nums; }
.lesson-heading > p:last-child { max-width: 850px; color: var(--muted); font-size: 1.15rem; }
.objective, .intrigue, .completion, .expected-result { margin: 28px 0; padding: 20px 22px; border-left: 4px solid var(--blue); background: var(--blue-soft); }
.intrigue { border-color: var(--gold); background: #fff8e8; }
.completion { border-color: var(--green); background: #effbf6; }

.lesson-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin: 30px 0; }
.lesson-grid > section { padding: 23px; border: 1px solid var(--line); background: var(--soft); }
.lesson-grid h3, .example-block h3, .references h3, .investigation h3, .incident-template h3 { margin: 0 0 13px; font-size: 1.18rem; }
.lesson-grid ul, .investigation ol { margin: 0; padding-left: 21px; }
.lesson-grid li + li, .investigation li + li { margin-top: 10px; }
.practice-grid > section:first-child { border-top: 4px solid var(--green); }
.practice-grid > section:last-child { border-top: 4px solid var(--gold); }
.tool-selection { border-top: 4px solid var(--blue) !important; }
.vocabulary-list { display: grid; gap: 9px; margin: 0; }
.vocabulary-list > div { display: grid; grid-template-columns: minmax(115px, .45fr) 1fr; gap: 12px; }
.vocabulary-list dt, .vocabulary-list dd { margin: 0; }
.vocabulary-list code { color: var(--blue-dark); font-weight: 750; }
.investigation, .incident-template { margin: 30px 0; padding: 23px; border: 1px solid var(--line); }
.investigation { background: #f7fbff; }
.incident-template { background: #fffaf0; }
.incident-template dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.incident-template dl > div { padding: 12px; border: 1px solid var(--line); background: white; }
.incident-template dt { font-weight: 800; }
.incident-template dd { margin: 3px 0 0; color: var(--muted); }

.example-block { margin: 34px 0; }
.code-frame { position: relative; border: 1px solid #273953; border-radius: 10px; overflow: hidden; background: var(--code); }
.code-frame pre { margin: 0; padding: 42px 24px 24px; overflow-x: auto; color: #edf5ff; font: .93rem/1.65 "Cascadia Code", "SFMono-Regular", Consolas, monospace; tab-size: 2; }
.code-language { position: absolute; top: 12px; left: 16px; color: #78c6ff; font: 700 .72rem/1 ui-monospace, monospace; text-transform: uppercase; }
.copy-button { min-height: 34px; padding: 5px 10px; border: 1px solid #6e7f9b; border-radius: 6px; color: #eef6ff; background: #1b2940; cursor: pointer; }
.code-frame > .copy-button { position: absolute; top: 8px; right: 9px; }

.repository-card { margin: 40px 0 28px; padding: 26px; border: 1px solid #9ab6dc; border-radius: 12px; background: #f1f6fd; }
.repository-card-heading { display: flex; justify-content: space-between; gap: 20px; }
.repository-card-heading h3 { margin: 4px 0 0; font-size: 1.45rem; }
.repository-card-heading > span { color: var(--blue); font: 800 .85rem/1.3 ui-monospace, monospace; }
.repository-meta { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin: 20px 0; }
.repository-meta > div { padding: 13px; background: white; border: 1px solid var(--line); }
.repository-meta dt { margin-bottom: 5px; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
.repository-meta dd { margin: 0; overflow-wrap: anywhere; }
.track-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.track-links a { display: grid; grid-template-columns: 30px 1fr; align-items: center; min-height: 56px; padding: 10px; border: 1px solid #9ab6dc; border-radius: 7px; color: var(--ink); background: white; font-weight: 750; text-decoration: none; }
.track-links a:hover { border-color: var(--blue); }
.track-links span { color: var(--blue); font: 800 .8rem ui-monospace, monospace; }
.commands { display: grid; gap: 9px; margin-top: 18px; }
.command-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); background: white; }
.command-row > span { color: var(--muted); font-size: .82rem; font-weight: 750; }
.command-row code { overflow-x: auto; color: var(--ink); }
.command-row .copy-button { color: var(--ink); background: white; }
.clone-note { color: var(--muted); font-size: .9rem; }
.repository-actions, .lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.hints, .extra-mile { margin: 24px 0; border: 1px solid var(--line); }
.hints summary, .extra-mile summary { padding: 15px 18px; font-weight: 800; cursor: pointer; background: var(--soft); }
.hints ol, .extra-mile > div { margin: 0; padding: 18px 24px 18px 54px; }
.hints li + li { margin-top: 10px; }
.references { margin-top: 28px; padding-top: 23px; border-top: 1px solid var(--line); }
.references ul { display: flex; flex-wrap: wrap; gap: 9px 24px; margin: 0; padding-left: 20px; }
.lesson-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 34px; }
.lesson-navigation a { display: grid; padding: 14px 16px; border: 1px solid var(--line); text-decoration: none; }
.lesson-navigation a:last-child { text-align: right; }
.lesson-navigation span { color: var(--muted); font-size: .8rem; }
.lesson-navigation strong { color: var(--ink); }
.section-footer { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.course-footer { display: flex; justify-content: space-between; gap: 20px; width: var(--shell); margin: 24px auto 0; padding: 22px 0 34px; color: var(--muted); font-size: .78rem; }
.noscript-message { width: var(--shell); margin: 20px auto; padding: 18px; background: white; border: 1px solid var(--red); }

.quiz-dialog { width: min(840px, calc(100vw - 28px)); max-height: min(850px, calc(100vh - 28px)); padding: 0; border: 1px solid #8198bb; border-radius: 12px; color: var(--ink); background: white; box-shadow: 0 24px 90px rgba(6, 20, 46, .38); }
.quiz-dialog::backdrop { background: rgba(6, 14, 29, .72); backdrop-filter: blur(3px); }
.quiz-header { position: sticky; z-index: 2; top: 0; display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: white; }
.quiz-header p { margin: 0; color: var(--blue); font-size: .74rem; font-weight: 850; letter-spacing: .1em; }
.quiz-header h2 { margin: 3px 0 0; font-size: 1.65rem; }
.quiz-close { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; font-size: 1.35rem; cursor: pointer; }
.quiz-body { padding: 24px; }
.quiz-summary-numbers { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 20px 0; padding: 16px; background: var(--soft); }
.quiz-review-setting { display: flex; gap: 10px; align-items: start; margin: 20px 0; padding: 13px; border: 1px solid var(--line); }
.quiz-review-setting input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue); }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.quiz-counter { color: var(--blue); font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.quiz-question { margin: 0; padding: 0; border: 0; }
.quiz-question legend { font-size: 1.35rem; font-weight: 800; line-height: 1.35; }
.quiz-options { display: grid; gap: 10px; margin-top: 18px; }
.quiz-option { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.quiz-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.quiz-option.is-expected { border-color: var(--green); }
.quiz-option input { margin-top: 5px; accent-color: var(--blue); }
.quiz-feedback { margin-top: 20px; padding: 18px; border-left: 4px solid var(--green); background: #effbf6; }
.quiz-feedback.is-incorrect { border-color: var(--red); background: #fff1f3; }
.quiz-feedback h3 { margin: 0 0 10px; }
.quiz-feedback dl { margin: 0; }
.quiz-feedback dl > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 0; }
.quiz-feedback dt { font-weight: 750; }
.quiz-feedback dd { margin: 0; }
.quiz-review-list { display: grid; gap: 13px; }
.quiz-review-card { padding: 17px; border: 1px solid var(--line); border-left: 4px solid var(--green); }
.quiz-review-card.is-incorrect { border-left-color: var(--red); }
.quiz-review-card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.quiz-review-card p { margin: 7px 0; }

@media (max-width: 900px) {
  .toolbar, .toolbar-actions { flex-wrap: wrap; }
  .breadcrumb, .toolbar-actions { width: 100%; }
  .section-navigation { flex: 1; width: auto; min-width: 180px; }
  .toc-page { padding: 36px 24px; }
  .overview-periods, .lesson-grid, .facts-grid { grid-template-columns: 1fr; }
  .overview-period + .overview-period { border-left: 0; border-top: 1px solid var(--line); }
  .repository-meta, .track-links, .incident-template dl { grid-template-columns: 1fr; }
  .command-row { grid-template-columns: 1fr auto; }
  .command-row > span { grid-column: 1 / -1; }
  .section-footer { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  :root { --shell: calc(100vw - 18px); }
  html { scroll-padding-top: 150px; }
  .toolbar { padding: 9px; }
  .toolbar-actions select, .toolbar-actions .button { flex: 1; min-width: 0; }
  .day-overview > summary { grid-template-columns: 1fr auto; }
  .day-overview > summary > span:nth-child(2) { grid-column: 1; }
  .lesson-section { min-height: 0; padding: 32px 19px; }
  .lesson-heading h2 { font-size: 2.3rem; }
  .repository-card { padding: 18px; }
  .lesson-navigation { grid-template-columns: 1fr; }
  .lesson-navigation a:last-child { text-align: left; }
  .course-footer { flex-direction: column; }
  .quiz-body { padding: 18px; }
  .quiz-feedback dl > div { grid-template-columns: 1fr; gap: 2px; }
}

@page { size: A4; margin: 14mm; }
@media print {
  :root { --ink: #000; --muted: #333; --paper: #fff; --canvas: #fff; --line: #aaa; }
  html { scroll-padding-top: 0; }
  body { background: white; font-size: 10.3pt; }
  .screen-only, .quiz-dialog, .copy-button, .repository-card, .course-footer { display: none !important; }
  main { width: 100%; margin: 0; }
  .toc-page, .lesson-section { border: 0; box-shadow: none; }
  .toc-page { min-height: 257mm; padding: 10mm 6mm; break-after: page; }
  .toc-page h1 { font-size: 36pt; }
  .lesson-section { min-height: auto; margin: 0 !important; padding: 12mm 6mm; break-before: page; }
  .lesson-heading h2 { font-size: 27pt; }
  .day-overview, .day-overview > summary, .overview-periods, .facts-grid, .lesson-grid, .code-frame, .investigation, .incident-template, .completion { break-inside: avoid; }
  .day-overview > summary, .lesson-grid > section, .investigation, .incident-template { background: white; }
  details > * { display: block !important; }
  .extra-mile[open] > *, .hints[open] > * { display: block !important; }
  .code-frame { border-color: #444; }
  .code-frame pre { color: #000; background: #f2f2f2; white-space: pre-wrap; }
  .code-language { color: #333; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; overflow-wrap: anywhere; }
}
