.section.course-page {
  width: min(var(--course-content-width), calc(100% - 2 * var(--course-page-gutter)));
  min-height: 0;
  padding: 22px 0 40px;
}

.chapter-view :is(h1, h2, h3) {
  color: var(--accent2);
}

.course-cover-card {
  min-height: clamp(182px, 20vw, 258px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--hero);
}

.course-cover-card h1 {
  margin: 0;
  color: var(--accent2);
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chapter-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  margin: 0 0 28px;
}

.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
  margin-bottom: 20px;
  padding: clamp(20px, 3.4vw, 48px);
}

.chapter-hero-copy {
  width: 54%;
  padding: clamp(20px, 3.4vw, 48px);
}

.chapter-hero-number {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.chapter-cover {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: -1;
  display: block;
  width: 57%;
  height: 100%;
  object-fit: cover;
  object-position: center 61%;
  mask-image: linear-gradient(to right, transparent, black 26%);
}

html[data-theme="dark"] .chapter-cover {
  filter: brightness(.78);
}

.chapter-view .chapter-heading {
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}

.chapter-view .chapter-heading h2 {
  margin: 0;
  font-size: 25px;
}

.chapter-lessons {
  margin-bottom: 28px;
}

.chapter-lesson-list,
.chapter-view #chapter-cases {
  display: grid;
  gap: 10px;
}

.chapter-lesson-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-lesson-number {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.chapter-view .case-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(200px, 26%, 320px) auto;
  gap: 20px;
  align-items: center;
  max-width: none;
  padding: 14px 19px;
  border-radius: 7px;
}

.chapter-view .case-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.45;
}

.chapter-view .case-card p {
  font-size: 15px;
  line-height: 1.7;
}

.chapter-case-figure, .case-page-figure {
  display: grid;
  min-width: 0;
  aspect-ratio: 2.2;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}

.chapter-case-figure {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface2);
}

.case-page-figure {
  aspect-ratio: 2.25;
}

.chapter-case-figure > svg, .case-page-figure > svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.chapter-lesson-figure {
  overflow: hidden;
  padding: 0;
}

.chapter-lesson-figure img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: 58% center;
}

.case-preview-schematic text {
  fill: var(--text);
  font-size: 22px;
}

.case-preview-schematic .preview-node {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 2;
}

.case-preview-schematic .preview-outcome {
  stroke: var(--accent);
}

.case-preview-schematic .preview-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chapter-view .case-link {
  margin: 0;
  font-size: 22px;
}

@media (max-width: 650px) {
  .course-cover-card {
    min-height: 0;
  }

  .chapter-hero {
    display: block;
  }

  .chapter-hero-copy {
    width: 100%;
    padding: 16px 19px 17px;
  }

  .chapter-hero-number {
    margin-bottom: 5px;
    font-size: 14px;
  }

  .chapter-cover {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 2.5;
    mask-image: none;
  }

  .case-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 18px 19px;
  }

  .case-page-figure {
    width: min(100%, 420px);
    margin-inline: auto;
  }

  .chapter-view .chapter-heading h2 {
    font-size: 22px;
  }

  .chapter-view .case-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding-inline: 13px;
  }

  .chapter-case-copy {
    grid-column: 1;
  }

  .chapter-view .case-card h3 {
    font-size: 17px;
  }

  .chapter-view .case-card p {
    font-size: 14px;
  }

  .chapter-case-figure {
    grid-column: 1;
    width: min(100%, 260px);
  }

  .chapter-view .case-link {
    grid-area: 1 / 2;
    font-size: 17px;
  }
}
