:root,
html[data-theme="light"] {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #4b5563;
  --heading: #111827;
  --link: #0b57d0;
  --border: #e5e7eb;
  --code-bg: #f6f8fa;
  --table-head: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --text: #e5e7eb;
    --muted: #cbd5e1;
    --heading: #f8fafc;
    --link: #8ab4f8;
    --border: #334155;
    --code-bg: #111827;
    --table-head: #1f2937;
  }
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --text: #e5e7eb;
  --muted: #cbd5e1;
  --heading: #f8fafc;
  --link: #8ab4f8;
  --border: #334155;
  --code-bg: #111827;
  --table-head: #1f2937;
}

html,
body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

body {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  letter-spacing: -0.01em;
}

h1 {
  margin-bottom: 0.2rem;
}

p,
li {
  color: var(--text);
}

a {
  color: var(--link);
}

strong {
  color: var(--heading);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
}

code,
pre {
  background: var(--code-bg) !important;
}

pre {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* Make the schedule tables readable (time vs content). */
#course-schedule table {
  table-layout: fixed;
}

/* Pandoc may emit <colgroup><col style="width: 50%">…; override that. */
#course-schedule table colgroup col:first-child {
  width: 8.5rem !important;
}

#course-schedule table colgroup col:nth-child(2) {
  width: auto !important;
}

#course-schedule table th:first-child,
#course-schedule table td:first-child {
  width: 8.5rem;
  white-space: nowrap;
}

#course-schedule table th:nth-child(2),
#course-schedule table td:nth-child(2) {
  width: auto;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
}

th {
  background: var(--table-head);
}

#TOC {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.theme-toggle-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.theme-toggle-btn:hover {
  filter: brightness(1.1);
}
