:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #5a6478;
  --line: #d8dfeb;
  --paper: #ffffff;
  --page: #f3f6fb;
  --blue: #1756a9;
  --blue-soft: #eaf2ff;
  --code: #111827;
  --code-text: #e5edf8;
  --content: 72rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

a { color: var(--blue); }

a:focus-visible,
select:focus-visible {
  outline: 3px solid #f5b82e;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 10;
  padding: .7rem 1rem;
  border-radius: .35rem;
  color: #fff;
  background: var(--ink);
  translate: 0 -200%;
}

.skip-link:focus { translate: 0; }

.site-header,
.site-footer {
  width: min(var(--content), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  color: var(--muted);
  font-size: .9rem;
}

.language-control {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

select {
  min-height: 2.6rem;
  padding: .45rem 2.25rem .45rem .7rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}

main {
  width: min(var(--content), calc(100% - 2rem));
  margin: 3.5rem auto 5rem;
}

.course-intro {
  max-width: 50rem;
  margin-bottom: 3rem;
}

.eyebrow {
  margin: 0 0 .8rem;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.65rem, 7vw, 5.4rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.status {
  display: inline-block;
  margin: 1.5rem 0 0;
  padding: .55rem .8rem;
  border: 1px solid #aac2e7;
  border-radius: 999px;
  color: #174779;
  background: var(--blue-soft);
  font-weight: 700;
}

.course-repository {
  margin: 1.35rem 0 0;
}

.course-repository a {
  font-weight: 800;
}

.house-rules {
  max-width: 46rem;
  margin-top: 2rem;
  padding: 1.2rem 1.35rem;
  border-left: 4px solid var(--blue);
  background: var(--paper);
}

.house-rules h2 {
  margin: 0 0 .45rem;
  font-size: 1rem;
}

.house-rules ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.65;
}

.days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.day-card {
  display: block;
  min-height: 13rem;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(20, 33, 61, .04);
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, translate 150ms ease;
}

.day-card:hover {
  border-color: #91add5;
  box-shadow: 0 16px 36px rgba(20, 33, 61, .09);
  translate: 0 -2px;
}

.day-card p {
  margin: 0;
  color: var(--muted);
}

.day-card h2 {
  margin: .2rem 0 2.5rem;
  color: var(--blue);
  font-size: 3rem;
  line-height: 1;
}

.day-card p:last-child {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.site-footer,
.section-copyright {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: .5rem 1rem;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .03em;
}

.site-footer {
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
}

.section-copyright {
  margin-top: 3.25rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

.site-footer-notice,
.section-copyright-notice { text-align: center; }

.site-footer-links,
.section-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-self: end;
  justify-content: flex-end;
  gap: .35rem .8rem;
}

.site-footer-links a,
.section-legal-links a { color: inherit; }

.day-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  flex-wrap: wrap;
  min-height: 4.25rem;
  padding: .65rem max(1rem, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / .96);
  box-shadow: 0 .25rem .75rem rgba(20, 33, 61, .1);
  backdrop-filter: blur(10px);
}

.day-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: .7rem;
}

.day-control {
  display: grid;
  gap: .3rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.day-control select { min-width: 9rem; }
.day-control-sections select { min-width: 14rem; }

.day-main {
  display: block;
  margin-top: 2rem;
}

.toc-page {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 1rem 3rem rgba(20, 33, 61, .06);
}

.toc-page {
  padding: clamp(1.4rem, 5vw, 3.6rem);
  padding-bottom: 1.25rem;
}
.toc-page h1 { max-width: none; }
.course-document {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.section-toc {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}

.section-toc h2 {
  margin: 0 0 .8rem;
  font-size: 1.25rem;
}

.toc-list {
  display: grid;
  gap: 0;
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.toc-link {
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: center;
  gap: .75rem;
  padding: .72rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.toc-link:hover { color: var(--blue); }
.toc-number {
  color: var(--blue);
  font-weight: 850;
  white-space: nowrap;
}
.empty-state { margin: 0; color: var(--muted); }

.lesson-section {
  padding: clamp(2rem, 6vw, 5rem);
  padding-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 1rem 3rem rgba(20, 33, 61, .06);
  scroll-margin-top: 5rem;
  line-height: 1.62;
}

.section-heading-number {
  color: var(--blue);
  font-size: .72em;
  font-weight: 900;
  letter-spacing: .04em;
}

.section-heading-number::after { content: "."; }

.lesson-section h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.18;
  letter-spacing: -.025em;
}

.lesson-section h3 {
  margin: 2rem 0 .55rem;
  font-size: 1.15rem;
  line-height: 1.18;
  letter-spacing: -.015em;
}

.lesson-section p { margin: 0 0 1rem; }

.security-teaser-answer {
  display: inline-block;
  transform: rotate(180deg);
}

.lesson-section ul,
.lesson-section ol {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

.lesson-section li + li { margin-top: .35rem; }

.lesson-hint {
  margin-top: .6rem;
}

.lesson-hint summary {
  width: fit-content;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.lesson-hint[open] summary { margin-bottom: .6rem; }

.lesson-hint p,
.lesson-hint pre {
  margin-top: 0;
  margin-bottom: 0;
}

.lesson-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.35rem 0;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--code);
}

.lesson-image-portrait {
  width: min(100%, 25rem);
  margin-inline: auto;
}

.lesson-figure {
  margin: 1.35rem 0;
}

.lesson-figure .lesson-image {
  margin: 0;
}

.lesson-figure figcaption,
.typescript-squirrel-figure figcaption {
  margin-top: .65rem;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.lesson-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.35rem 0;
}

.lesson-image-pair .lesson-image {
  margin: 0;
}

.typescript-squirrel-figure {
  margin: 1.35rem 0;
}

.typescript-squirrel-figure .lesson-image-pair {
  width: min(100%, 40rem);
  margin: 0 auto;
}

#typescript-extra .typescript-squirrel-figure .lesson-image-pair {
  background: radial-gradient(circle at center, rgba(183, 239, 82, .8) 0, rgba(96, 255, 82, .28) 34%, transparent 70%);
  box-shadow: 0 0 2.5rem rgba(112, 255, 76, .2);
}

#typescript-extra .typescript-squirrel-figure .lesson-image {
  box-shadow: 0 0 1.15rem rgba(112, 255, 76, .18);
}

#typescript-extra {
  border-color: #2b3950;
  color: #d8e0ec;
  background: var(--code);
}

#typescript-extra h2,
#typescript-extra h3,
#typescript-extra h4 {
  color: #f8fafc;
}

#typescript-extra .section-heading-number,
#typescript-extra a {
  color: #9fc5ff;
}

#typescript-extra .lesson-image {
  border-color: #3b4a62;
}

#typescript-extra .typescript-squirrel-figure figcaption {
  color: #d8e0ec;
}

#typescript-extra pre {
  border: 1px solid #2b3950;
  background: #0a1220;
}

pre {
  margin: 1.35rem 0;
  padding: 1.15rem;
  overflow-x: auto;
  border-radius: .35rem;
  color: var(--code-text);
  background: var(--code);
  font: .92rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

pre code {
  color: inherit;
  background: none;
  font: inherit;
}

@media (max-width: 760px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .site-footer,
  .section-copyright { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .site-footer-links,
  .section-legal-links { justify-self: center; justify-content: center; }
  .day-controls { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .day-control { flex: 1 1 10rem; }
  .day-control select { width: 100%; min-width: 0; }
  main { margin-top: 2rem; }
  .days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 460px) {
  .days { grid-template-columns: 1fr; }
  .day-card { min-height: 10rem; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .site-header,
  .site-footer { display: none; }
  main { width: 100%; margin: 0; }
  .days { grid-template-columns: repeat(2, 1fr); }
  .day-card { min-height: 8rem; box-shadow: none; break-inside: avoid; }
}

.course-objective {
  max-width: 54rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.prerequisite,
.callout {
  margin: 1.5rem 0;
  padding: 1.15rem 1.3rem;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  line-height: 1.6;
}

.prerequisite strong { margin-right: .3rem; }

.callout {
  margin-top: 2rem;
  background: #f6f9fd;
}

.checkpoint {
  border-left-color: #2f7d4a;
  background: #f1faf4;
}

.callout h4 {
  margin: 0 0 .65rem;
  font-size: 1rem;
}

.callout p:last-child { margin-bottom: 0; }

.lesson-section :not(pre) > code,
.prerequisite code,
.callout code {
  padding: .08em .3em;
  border-radius: .25rem;
  color: #173f74;
  background: #e9f0fa;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

.extra-section {
  border-top: .35rem solid var(--blue);
}

.section-heading-number::after { content: " –"; }

@media print {
  .toc-page { break-after: page; }
  .course-document { gap: 0; margin-top: 0; }
  .lesson-section {
    padding: 12mm 4mm;
    border: 0;
    box-shadow: none;
    break-before: page;
  }
  .callout,
  pre { break-inside: avoid; }
}
