/* Readable default UI for course / lab docs */
:root {
  /* UofT ASIC-leaning teal (not the default Docsify green) */
  --theme-color: #0b5f8a;
  --content-max-width: 800px;
}

body {
  font-family: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  color: #1f2933;
}

.sidebar {
  background: #f7fafc;
}

.sidebar-nav > ul > li > p {
  margin: 0.75em 0 0.25em;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #627d98;
}

.markdown-section {
  max-width: var(--content-max-width);
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.markdown-section code {
  background: #eef2f6;
  color: #243b53;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.markdown-section pre > code {
  background: transparent;
  padding: 0;
}

.markdown-section img {
  max-width: 100%;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.markdown-section blockquote {
  border-left-color: var(--theme-color);
  background: #f0f7fa;
  color: #334e68;
}

/* MathJax breathing room */
.markdown-section mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
}

/* Theme toggle (navbar) — clear the GitHub corner */
.app-nav {
  margin-right: 90px;
}

.app-nav .theme-toggle-item {
  margin-right: 0;
  padding-top: 2px;
  vertical-align: middle;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #34495e;
  cursor: pointer;
  vertical-align: middle;
  line-height: 0;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--theme-color);
  border-color: rgba(11, 95, 138, 0.25);
  outline: none;
}

.theme-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(11, 95, 138, 0.35);
}

/* ---- Dark mode ---- */
html.dark {
  color-scheme: dark;
}

html.dark body {
  background: #0f172a;
  color: #e2e8f0;
}

html.dark .sidebar {
  background: #111827;
  border-right-color: #1f2937;
  color: #e2e8f0;
}

html.dark .sidebar > h1,
html.dark .sidebar > h1 a,
html.dark .app-name,
html.dark .app-name-link {
  color: #f8fafc;
}

html.dark .sidebar ul li a {
  color: #cbd5e1;
}

html.dark .sidebar ul li.active > a {
  color: var(--theme-color);
  border-right-color: var(--theme-color);
}

html.dark .sidebar-nav > ul > li > p {
  color: #94a3b8;
}

html.dark .sidebar-toggle {
  background-color: transparent;
}

html.dark .sidebar-toggle span {
  background-color: #94a3b8;
}

html.dark .app-nav a {
  color: #cbd5e1;
}

html.dark .app-nav a:hover {
  color: var(--theme-color);
}

html.dark .markdown-section {
  color: #e2e8f0;
}

html.dark .markdown-section h1,
html.dark .markdown-section h2,
html.dark .markdown-section h3,
html.dark .markdown-section h4,
html.dark .markdown-section h5,
html.dark .markdown-section h6,
html.dark .markdown-section strong {
  color: #f8fafc;
}

/* Docsify wraps heading text in .anchor > span with a fixed gray */
html.dark .markdown-section .anchor span {
  color: #f8fafc;
}

html.dark .markdown-section a {
  color: #38bdf8;
}

html.dark .markdown-section hr {
  border-bottom-color: #334155;
}

html.dark .markdown-section code {
  background: #1e293b;
  color: #e2e8f0;
}

html.dark .markdown-section pre,
html.dark .markdown-section pre > code {
  background: #1e293b;
  color: #e2e8f0;
}

html.dark .markdown-section blockquote {
  background: #1e293b;
  color: #94a3b8;
  border-left-color: var(--theme-color);
}

html.dark .markdown-section table {
  display: block;
  overflow-x: auto;
}

html.dark .markdown-section tr {
  border-top-color: #334155;
}

html.dark .markdown-section th,
html.dark .markdown-section td {
  border-color: #334155;
}

html.dark .markdown-section tr:nth-child(2n) {
  background-color: #1e293b;
}

html.dark .markdown-section img {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  opacity: 0.95;
}

html.dark .search input {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

html.dark .search .matching-post {
  border-bottom-color: #334155;
}

html.dark .search .results-panel {
  background: #111827;
}

html.dark .pagination-item a {
  color: #94a3b8;
}

html.dark .pagination-item a:hover {
  color: var(--theme-color);
}

html.dark .theme-toggle {
  color: #e2e8f0;
}

html.dark .theme-toggle:hover,
html.dark .theme-toggle:focus-visible {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}
