/* Keep foregrounds and surfaces paired across both CP1 pages. */
body[data-course="cp1"] {
  color-scheme: dark;
  --text-dim: #9baaa6;
  --code-bg: #0d1117;
  --code-text: #e6edf3;
  --button-text: #071012;
}

body[data-course="cp1"].light {
  color-scheme: light;
  --course: #446317;
  --course-soft: rgba(68, 99, 23, .09);
  --py-yellow: var(--course);
  --primary-light: var(--course);
  --text-dim: #596963;
  --code-bg: #edf1ed;
  --code-text: #172720;
  --button-text: #ffffff;
}

/* Override the original pre.code-snippet rule as a foreground/background pair. */
body[data-course="cp1"] pre.code-snippet {
  color: var(--code-text);
  background: var(--code-bg);
  border-color: var(--border);
  font-size: .85rem;
}

body[data-course="cp1"] .nb-btn,
body[data-course="cp1"] .scroll-top {
  color: var(--button-text);
}

body[data-course="cp1"].light .nb-btn:hover,
body[data-course="cp1"].light .scroll-top:hover {
  color: #ffffff;
  background: #344f0f;
}

body[data-course="cp1"] .content a,
body[data-course="cp1"] footer a {
  color: var(--py-blue-light);
  text-decoration: underline;
  text-underline-offset: .2em;
}

body[data-course="cp1"] .content a:hover,
body[data-course="cp1"] footer a:hover {
  color: var(--course);
}

body[data-course="cp1"] :focus-visible {
  outline: 3px solid var(--py-blue-light);
  outline-offset: 3px;
}

/* Keep syllabus content and notebook actions readable on a narrow screen. */
@media screen and (max-width: 600px) {
  body[data-course="cp1"][data-page="syllabus"] .schedule-table,
  body[data-course="cp1"][data-page="syllabus"] .grade-table {
    display: block;
    width: 100%;
    border: 0;
    overflow: visible;
  }

  body[data-course="cp1"][data-page="syllabus"] table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body[data-course="cp1"][data-page="syllabus"] table tbody,
  body[data-course="cp1"][data-page="syllabus"] table tr,
  body[data-course="cp1"][data-page="syllabus"] table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  body[data-course="cp1"][data-page="syllabus"] table tr {
    margin-bottom: 1rem;
    padding: .5rem 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
  }

  body[data-course="cp1"][data-page="syllabus"] table td {
    padding: .45rem .9rem;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-course="cp1"][data-page="syllabus"] table td::before {
    display: block;
    margin-bottom: .2rem;
    color: var(--text-dim);
    font: 500 .65rem/1.5 var(--design-mono);
  }

  body[data-course="cp1"] .schedule-table td:nth-child(1)::before { content: "Week"; }
  body[data-course="cp1"] .schedule-table td:nth-child(2)::before { content: "Topic"; }
  body[data-course="cp1"] .schedule-table td:nth-child(3)::before { content: "Key content"; }
  body[data-course="cp1"] .schedule-table td:nth-child(4)::before { content: "Notebooks"; }
  body[data-course="cp1"] .grade-table td:nth-child(1)::before { content: "Assessment"; }
  body[data-course="cp1"] .grade-table td:nth-child(2)::before { content: "Weight"; }
  body[data-course="cp1"] .grade-table td:nth-child(3)::before { content: "Description"; }
}
