@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700;900&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #f9fafb;
  --paper: #ffffff;
  --ink: #050505;
  --body: rgba(0, 0, 0, 0.66);
  --muted: rgba(0, 0, 0, 0.42);
  --faint: rgba(0, 0, 0, 0.25);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --soft: rgba(0, 0, 0, 0.025);
  --soft-strong: rgba(0, 0, 0, 0.045);
  --code-bg: #080808;
  --code-text: rgba(255, 255, 255, 0.86);
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Noto Serif SC", Georgia, serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.86;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 300px, transparent 0 250px, rgba(0, 0, 0, 0.045) 251px, transparent 252px),
    radial-gradient(circle at 50% 300px, transparent 0 365px, rgba(0, 0, 0, 0.035) 366px, transparent 367px),
    radial-gradient(circle at 50% 300px, transparent 0 485px, rgba(0, 0, 0, 0.025) 486px, transparent 487px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(249, 250, 251, 0) 260px);
}

a {
  color: var(--ink);
  text-decoration-color: rgba(0, 0, 0, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 180ms ease, text-decoration-color 180ms ease, background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

a:hover {
  color: rgba(0, 0, 0, 0.72);
  text-decoration-color: rgba(0, 0, 0, 0.72);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1200px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  font-size: 14px;
  scrollbar-width: none;
  white-space: nowrap;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav a {
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  text-decoration: none;
}

.topnav a:hover {
  background: var(--soft);
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.course-subscribe-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.course-subscribe-button:hover {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
}

.course-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 56px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 88px;
}

.course-nav {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100svh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  scrollbar-width: thin;
}

.course-nav h2 {
  margin: 0 0 15px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.course-nav ol,
.course-nav ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-nav a {
  display: block;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
}

.course-nav a.active,
.course-nav a:hover {
  background: var(--soft);
  color: var(--ink);
}

.course-nav li {
  min-width: 0;
}

.course-group {
  margin-top: 16px;
}

.course-group:first-of-type {
  margin-top: 0;
}

.course-group-title {
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 600;
}

.course-subnav {
  padding-left: 8px !important;
  border-left: 1px solid var(--line);
}

.course-subnav a {
  padding: 6px 10px;
  font-size: 13px;
}

.course-tree .course-group {
  margin-top: 18px;
}

.course-tree .course-group:first-of-type {
  margin-top: 0;
}

.course-tree .course-group-title {
  position: relative;
  padding-right: 24px;
}

.course-tree .course-group.is-expanded .course-group-title::after {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transform: translateY(-65%) rotate(45deg);
  opacity: 0.45;
}

.course-tree .course-subnav {
  margin-top: 5px;
}

.course-tree .course-tree-item > a {
  color: var(--muted);
}

.course-tree .course-tree-item.is-current > a {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}

.course-tree .course-anchor-list {
  margin: 4px 0 6px 10px;
  padding-left: 10px !important;
  border-left: 1px solid var(--line);
}

.course-tree .course-anchor-list a {
  padding: 5px 9px;
  color: var(--faint);
  font-size: 12px;
}

.course-tree .course-anchor-list a.active,
.course-tree .course-anchor-list a:hover {
  background: transparent;
  color: var(--ink);
}

.course-content {
  min-width: 0;
}

.article {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 14px 0 24px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.24;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 0 0 20px;
  font-size: 56px;
  font-weight: 900;
}

h2 {
  margin: 56px 0 16px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 30px;
  font-weight: 700;
}

h3 {
  margin: 34px 0 10px;
  font-size: 22px;
  font-weight: 700;
}

h4 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-weight: 700;
}

p {
  margin: 0 0 17px;
}

.lead {
  max-width: 720px;
  margin-bottom: 34px;
  color: rgba(0, 0, 0, 0.52);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.95;
}

.library-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.library-hero > div {
  min-width: 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.82);
}

.library-hero span,
.course-status {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.library-hero strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.28;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0 10px;
  margin-top: 26px;
  background: transparent;
}

.course-card-grid,
.lesson-list {
  display: grid;
  gap: 12px;
  margin: 28px 0 10px;
}

.course-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-item,
.diagram-step,
.timeline-step,
.exercise-list li,
.lesson-list > a,
.lesson-list > div {
  min-width: 0;
  background: rgba(255, 255, 255, 0.78);
}

.course-card,
.lesson-list > a,
.lesson-list > div,
.chapter-link {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.meta-item,
.course-card,
.lesson-list > a,
.lesson-list > div,
.chapter-link {
  padding: 18px;
}

.meta-item strong,
.course-card strong,
.lesson-list strong,
.chapter-link strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-weight: 600;
}

.course-card,
.lesson-list > a,
.chapter-link {
  color: var(--body);
  text-decoration: none;
}

.course-card:hover,
.lesson-list > a:hover,
.chapter-link:hover {
  background: #fff;
  color: var(--ink);
  transform: translateY(-1px);
}

.course-card p {
  margin-bottom: 18px;
}

.course-card em {
  color: var(--ink);
  font-style: normal;
  font-weight: 600;
}

.callout {
  margin: 28px 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: 8px;
  padding: 18px 20px;
  background: #fff;
  color: rgba(0, 0, 0, 0.62);
}

.callout.blue,
.callout.amber {
  border-left-color: var(--ink);
  background: #fff;
}

.callout strong {
  color: var(--ink);
}

.diagram-loop {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.diagram-step,
.timeline-step {
  padding: 16px;
}

.diagram-step span,
.timeline-step span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 1px;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

table {
  display: block;
  width: 100%;
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  font-size: 15px;
}

thead,
tbody,
tr {
  width: 100%;
}

th,
td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: rgba(0, 0, 0, 0.025);
  color: var(--ink);
  font-weight: 600;
}

code {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 5px;
  padding: 0.12em 0.34em;
  background: rgba(0, 0, 0, 0.045);
  color: rgba(0, 0, 0, 0.78);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

pre {
  overflow-x: auto;
  margin: 26px 0;
  border-radius: 8px;
  padding: 20px;
  background: var(--code-bg);
  color: var(--code-text);
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
}

.exercise-list {
  display: grid;
  gap: 1px;
  margin: 26px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  list-style: none;
}

.exercise-list li {
  padding: 17px 18px;
}

.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.chapter-pager a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 48%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 18px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}

.chapter-pager a:last-child {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.chapter-pager a:hover {
  background: var(--soft);
  color: var(--ink);
}

.chapter-pager a:last-child:hover {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
}

.small {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 980px) {
  .course-shell {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 32px;
  }

  h1 {
    font-size: 46px;
  }
}

@media (max-width: 860px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
  }

  .topbar-actions {
    width: 100%;
  }

  .topnav {
    flex: 1 1 auto;
    padding-bottom: 2px;
  }

  .course-shell {
    display: block;
    width: min(820px, calc(100% - 28px));
    padding-top: 24px;
  }

  .course-nav {
    position: static;
    max-height: 420px;
    margin-bottom: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.82);
    overflow: auto;
  }

  .course-nav ol,
  .course-nav ul {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .course-nav ol::-webkit-scrollbar,
  .course-nav ul::-webkit-scrollbar {
    display: none;
  }

  .course-nav a {
    white-space: nowrap;
  }

  .course-nav li {
    flex: 0 0 auto;
  }

  .course-group {
    margin-top: 12px;
  }

  .course-subnav {
    padding-left: 0 !important;
    border-left: 0;
  }

  .course-tree .course-subnav,
  .course-tree .course-anchor-list {
    display: grid;
    gap: 2px;
    overflow: visible;
    padding-bottom: 0;
    scrollbar-width: auto;
  }

  .course-tree .course-anchor-list {
    margin-left: 8px;
    padding-left: 10px !important;
    border-left: 1px solid var(--line);
  }

  .course-tree .course-subnav li,
  .course-tree .course-anchor-list li {
    flex: initial;
  }

  .article {
    padding: 4px 0 48px;
  }

  h1 {
    font-size: 38px;
  }

  h2 {
    margin-top: 44px;
    font-size: 26px;
  }

  .lead {
    font-size: 17px;
  }

  .meta-grid,
  .chapter-grid,
  .course-card-grid,
  .library-hero,
  .diagram-loop {
    grid-template-columns: 1fr;
  }

  .chapter-pager {
    flex-direction: column;
  }

  .chapter-pager a {
    max-width: none;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .topbar-inner,
  .course-shell {
    width: min(820px, calc(100% - 24px));
  }

  .brand {
    font-size: 17px;
  }

  .topnav a {
    padding: 7px 9px;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topnav {
    width: 100%;
  }

  .course-subscribe-button {
    width: 100%;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 20px;
  }

  .meta-item,
  .chapter-link,
  .diagram-step,
  .timeline-step,
  .exercise-list li,
  .callout {
    padding: 15px;
  }

  pre {
    padding: 16px;
  }
}
