:root {
  --bg: #fbfaf7;
  --paper: #ffffff;
  --paper-soft: #f6f8fb;
  --ink: #1f2a37;
  --muted: #5b6470;
  --line: #d8dce2;
  --accent: #0f766e;
  --accent-soft: #e6f6f4;
  --link: #0f4c81;
  --link-hover: #0a3459;
  --warning: #7a2e0c;
  --warning-soft: #fff2ea;
  --fact-soft: #fdecec;
  --fact-border: #c44545;
  --header-bg: #184d3b;
  --header-ink: #f5fbf8;
  --header-link: #d8f0e4;
  --header-link-hover: #ffffff;
  --code-bg: #0f172a;
  --code-ink: #f8fafc;
  --table-head-bg: #f2f5f8;
  --solution-border: #bfdbfe;
  --solution-bg: #f8fbff;
  --solution-ink: #0a3a69;
  --myopenmath-border: #a855f7;
  --myopenmath-bg: #fff7e8;
  --myopenmath-ink: #6b21a8;
  --figure-bg: #fdfefe;
  --callout-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  --danger: #b42318;
  --max-width: 72rem;
  --radius: 10px;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 5% -10%, #e8f6f3 5%, transparent 60%),
    radial-gradient(900px 350px at 95% -20%, #f7efe2 0%, transparent 60%),
    var(--bg);
  line-height: 1.65;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.site-footer {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--header-bg) 78%, white 22%);
  box-shadow: 0 10px 24px rgba(5, 17, 13, 0.14);
}

.site-footer {
  border-top: 1px solid var(--line);
  border-bottom: none;
  margin-top: 2rem;
  text-align: center;
  color: var(--muted);
}

.site-header-inner,
.site-footer {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
  padding: 0.9rem 0;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--header-ink);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  align-items: center;
}

.site-courses-menu {
  position: relative;
}

.site-courses-menu > summary {
  list-style: none;
  cursor: pointer;
  color: var(--header-link);
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  gap: 0.4rem;
}

.site-courses-menu > summary::-webkit-details-marker {
  display: none;
}

.site-courses-menu > summary::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.18s ease;
}

.site-courses-menu[open] > summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.site-courses-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  min-width: 13rem;
  margin: 0;
  padding: 0.45rem;
  list-style: none;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--header-bg) 65%, white 35%);
  background: #f8fdfb;
  box-shadow: 0 10px 24px rgba(5, 17, 13, 0.2);
}

.site-courses-list li + li {
  margin-top: 0.2rem;
}

.site-header .site-courses-list a {
  display: block;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  color: #0f2f25;
  text-decoration: none;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 600;
}

.site-header .site-courses-list a:hover,
.site-header .site-courses-list a:focus-visible {
  background: #e5f3ee;
  color: #0a221a;
}

.site-header nav a {
  color: var(--header-link);
  text-decoration: none;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 600;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.site-courses-menu > summary:hover,
.site-courses-menu > summary:focus-visible,
.brand:hover,
.brand:focus-visible {
  color: var(--header-link-hover);
}

.sidebar-toggle {
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-header a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

.shell {
  width: min(100% - 2rem, var(--max-width));
  margin: 1.4rem auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}

.shell.has-sidebar {
  grid-template-columns: 18rem minmax(0, 1fr);
}

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

.main-actions {
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.sidebar-toggle {
  background: var(--paper-soft);
}

.sidebar-toggle:hover {
  background: color-mix(in srgb, var(--paper-soft) 78%, var(--ink) 22%);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.shell.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.shell.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar,
.note-page,
.course-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 1rem;
  padding: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.sidebar-details {
  display: block;
}

.sidebar-details > summary {
  display: none;
}

.sidebar-body {
  display: block;
}

.sidebar h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-size: 1.1rem;
}

.course-link {
  display: inline-block;
  margin-bottom: 0.8rem;
}

.sidebar-chapter {
  margin-top: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.sidebar-chapter:first-of-type {
  margin-top: 0;
}

.sidebar-chapter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-chapter-summary::-webkit-details-marker {
  display: none;
}

.sidebar-chapter-summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s ease;
}

.sidebar-chapter[open] > .sidebar-chapter-summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.sidebar-chapter-title {
  min-width: 0;
}

.sidebar-chapter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.sidebar ol {
  margin: 0;
  padding-left: 1.2rem;
}

.sidebar-chapters-list {
  list-style: none;
  margin: 0.45rem 0 0;
  padding-left: 0;
}

.sidebar-chapters-list > li + li {
  margin-top: 0.35rem;
}

.sidebar-section-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-section-link {
  min-width: 0;
  flex: 1;
}

.sidebar-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sidebar-section-toggle:hover {
  background: color-mix(in srgb, var(--paper-soft) 80%, white 20%);
  color: var(--ink);
}

.sidebar-section-toggle:focus-visible,
.sidebar-chapter-summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.sidebar-section-toggle::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s ease;
}

.sidebar-section-toggle[aria-expanded="true"]::after {
  transform: rotate(225deg) translateY(-1px);
}

.sidebar-section-toggle-count {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar-subsections {
  list-style-type: disc;
  padding-left: 1.2rem;
  margin: 0.2rem 0 0.3rem;
}

.sidebar-subsections[hidden] {
  display: none;
}

.sidebar a[aria-current="page"] {
  font-weight: 700;
  color: var(--accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.enumerate-list {
  list-style: none;
  margin: 0 0 1rem;
  padding-left: 0;
  counter-reset: enumerate-item;
}

.enumerate-list > li {
  position: relative;
  margin: 0.2rem 0;
  padding-left: 2rem;
  counter-increment: enumerate-item;
}

.enumerate-list > li::before {
  content: counter(enumerate-item, lower-alpha) ".) ";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
}

.enumerate-list[data-enum="num"] > li::before {
  content: counter(enumerate-item, decimal) ".) ";
}

.enumerate-list[data-enum="roman"] > li::before {
  content: counter(enumerate-item, lower-roman) ".) ";
}

.breadcrumbs {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  padding: 0.4rem 0;
  transition: transform 0.3s ease, margin-bottom 0.3s ease;
}

.breadcrumbs-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-width: 0;
}

.breadcrumbs span {
  margin: 0 0.35rem;
}

/* Mobile auto-hide breadcrumb on scroll down */
@media (max-width: 767px) {
  .breadcrumbs--hidden {
    transform: translateY(-100%);
    margin-bottom: 0;
  }
}

.note-page {
  padding: 1.2rem 1.4rem 1.5rem;
}

.note-header h1 {
  margin: 0.1rem 0 0.4rem;
  line-height: 1.22;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.lede {
  color: var(--muted);
}

.chapter-block {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}

.chapter-block h3 {
  margin: 0;
}

.toc-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  margin: 1rem 0;
  background: var(--paper);
}

.toc-panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.toc-panel ul {
  margin: 0;
  padding-left: 1.1rem;
}

.toc-level-3 {
  margin-left: 0.9rem;
}

.note-content h2,
.note-content h3,
.note-content h4 {
  margin-top: 1.25em;
}

.note-content code,
.note-content pre {
  font-family: "Fira Code", Consolas, monospace;
}

.note-content pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.8rem;
  border-radius: 8px;
  overflow-x: auto;
}

.note-content mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.note-content mjx-container[display="true"] > mjx-math {
  min-width: max-content;
}

.note-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.note-content th,
.note-content td {
  border: 1px solid var(--line);
  text-align: left;
  padding: 0.45rem 0.6rem;
}

.note-content th {
  background: var(--table-head-bg);
}

.note-content td img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.callout,
.note-content blockquote {
  border: 2px solid var(--accent);
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: transparent;
  box-shadow: var(--callout-shadow);
}

.note-content .definition,
.note-content .example,
.note-content .theorem,
.note-content .fact,
.note-content .proof,
.note-content .warning,
.note-content .exercise,
.note-content .solution {
  border: 2px solid var(--accent);
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: transparent;
  box-shadow: var(--callout-shadow);
}

.note-content .definition {
  border-color: #2f8f5b;
}

.note-content .example {
  border-color: #2563eb;
}

.note-content .theorem {
  border-color: #d1436f;
}

.note-content .fact {
  border-color: var(--fact-border);
}

.callout.fact,
.note-content blockquote.fact {
  border-color: var(--fact-border);
}

.note-content .proof {
  border-color: #6b7280;
}

.callout.warning,
.note-content blockquote.warning {
  border-color: var(--warning);
}

.note-content .warning {
  border-color: var(--warning);
}

.callout.exercise,
.note-content blockquote.exercise {
  border-color: #1d4ed8;
}

.note-content .exercise {
  border-color: #1d4ed8;
}

.solution-block {
  margin-top: 0.6rem;
}

.solution-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  list-style: none;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 700;
  color: var(--solution-ink);
  padding: 0;
}

.solution-toggle::-webkit-details-marker {
  display: none;
}

.solution-toggle::before {
  content: "+";
  margin-right: 0.35rem;
  font-weight: 700;
}

.solution-block[open] .solution-toggle::before {
  content: "-";
}

.solution-body {
  margin-top: 0.5rem;
}

.tikz-figure {
  margin: 1rem auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--figure-bg);
  padding: 0.8rem;
  width: 100%;
  box-sizing: border-box;
  max-width: 30rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.tikz-figure--wide {
  max-width: 40rem;
}

.tikz-image {
  display: block;
  width: 100%;
  height: auto;
}

.tikz-figure svg {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  margin: 0 auto;
}

.tikz-figure:has(svg) .tikz-fallback {
  display: none;
}

.tikz-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.tikz-missing {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.tikz-source {
  display: none;
}

.mermaid {
  width: 100%;
  margin: 1rem 0;
}

.mermaid svg {
  display: block;
  width: 100% !important;
  height: 250px !important;
  max-width: 100% !important;
}

.mermaid.is-auto svg {
  height: auto !important;
}

.note-image-figure {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--figure-bg);
  padding: 0.8rem;
}

.note-image-figure.note-image-centered,
.note-image-figure.note-image-align-center {
  margin-left: auto;
  margin-right: auto;
  max-width: 34rem;
}

.note-image-figure.note-image-align-left {
  margin-left: 0;
  margin-right: auto;
  max-width: 34rem;
}

.note-image-figure.note-image-align-right {
  margin-left: auto;
  margin-right: 0;
  max-width: 34rem;
}

.note-image {
  display: block;
  width: 100%;
  height: auto;
}

.note-image-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.note-image-missing {
  margin: 1rem 0;
  color: var(--danger);
  font-weight: 700;
}

.geogebra-figure {
  margin: 1rem auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--figure-bg);
  padding: 0.8rem;
  width: 100%;
}

.geogebra-shell {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.geogebra-applet {
  min-height: 20rem;
}

.geogebra-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.geogebra-link {
  margin: 0.55rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.geogebra-missing {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.myopenmath-details {
  margin: 1rem 0;
  border: 2px solid var(--myopenmath-border);
  border-radius: 12px;
  box-shadow: var(--callout-shadow);
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

.myopenmath-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  list-style: none;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 700;
  color: var(--myopenmath-ink);
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.myopenmath-toggle::-webkit-details-marker {
  display: none;
}

.myopenmath-toggle::before {
  content: "+";
  margin-right: 0.35rem;
  font-weight: 700;
}

.myopenmath-details[open] .myopenmath-toggle::before {
  content: "-";
}

.myopenmath-body {
  margin-top: 0.5rem;
}

.myopenmath-embed {
  display: block;
  width: 100%;
  min-height: 16rem;
  border: 0;
}

.myopenmath-missing {
  margin: 1rem 0;
  color: var(--danger);
  font-weight: 700;
}

.video-embed {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.youtube-figure {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--figure-bg);
  padding: 0.8rem;
  width: 100%;
}

.youtube-shell {
  width: 100%;
}

.youtube-embed {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.youtube-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.youtube-link {
  margin: 0.55rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.youtube-missing {
  margin: 1rem 0;
  color: var(--danger);
  font-weight: 700;
}

/* ── Magic Square grid ─────────────────────────────────────────── */

.magic-square-figure {
  width: fit-content;
  margin: 1rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.magic-square {
  border-collapse: collapse;
  width: auto;
  margin: 0;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.magic-square td {
  width: 3.2rem;
  height: 3.2rem;
  text-align: center;
  vertical-align: middle;
  border: 2px solid var(--ink);
  font-weight: 600;
  padding: 0;
}

.magic-square-figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

.magic-square-missing {
  color: var(--danger);
  font-weight: 700;
  margin: 1rem 0;
}

.magic-squares-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  width: fit-content;
  margin: 1rem auto;
  align-items: flex-start;
}

.magic-squares-row .magic-square-figure {
  margin: 0;
}

.lattice-figure {
  width: 100%;
  max-width: 100%;
  margin: 1rem auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.lattice-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.note-content .lattice-table {
  border-collapse: collapse;
  width: max-content;
  margin: 0;
  display: table;
  overflow: visible;
  font-variant-numeric: tabular-nums;
}

.note-content .lattice-table td,
.note-content .lattice-table th {
  width: 3.1rem;
  height: 2.4rem;
  min-width: 3.1rem;
  border: 1px solid var(--ink);
  padding: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.note-content .lattice-table .lattice-cell-split {
  position: relative;
  background-image: linear-gradient(135deg, transparent 49%, var(--ink) 49.5%, var(--ink) 50.5%, transparent 51%);
  padding: 0;
}

.lattice-cell-split .lattice-top {
  position: absolute;
  top: 0.15rem;
  left: 0.3rem;
  line-height: 1;
  font-size: 0.92rem;
}

.lattice-cell-split .lattice-bottom {
  position: absolute;
  bottom: 0.15rem;
  right: 0.3rem;
  line-height: 1;
  font-size: 0.92rem;
}

.note-content .lattice-table .lattice-empty {
  background: #fff;
}

.note-content .lattice-table .lattice-diagonal-label {
  text-align: left;
  font-weight: 600;
  background: var(--paper-soft);
  padding: 0.35rem 0.55rem;
}

.lattice-figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

.lattice-missing {
  color: var(--danger);
  font-weight: 700;
  margin: 1rem 0;
}

.callout-title {
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.callout-name {
  margin: 0 0 0.35rem;
  font-family: Verdana, "Segoe UI", Tahoma, Geneva, sans-serif;
  font-weight: 600;
}

.callout-kind {
  font-weight: 700;
}

.pager {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.pager-link {
  display: inline-block;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  text-decoration: none;
  flex: 1;
}

.pager-link.disabled {
  color: #3f4b59;
  background: #ffffff;
  border-color: #93a0b2;
  font-weight: 600;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.course-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1rem;
}

.course-card > * {
  position: relative;
  z-index: 1;
}

.course-card-plot {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}

.course-card-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.course-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.7));
}

.course-card-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
}

.course-card-plot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.66));
}

.course-card-plot .function-plot,
.course-card-plot svg {
  width: 100%;
  height: 100%;
}

.course-card[data-course-id="trig"] {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line) 62%);
  background:
    radial-gradient(110% 80% at 105% 8%, rgba(15, 118, 110, 0.14), transparent 65%),
    var(--paper);
}

.course-card[data-course-id="calc1"] {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line) 66%);
  background:
    radial-gradient(105% 82% at 103% 6%, rgba(194, 65, 12, 0.12), transparent 64%),
    var(--paper);
}

.course-card[data-course-id="numbersandoperations"] {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line) 68%);
  background:
    radial-gradient(120% 95% at 102% 4%, rgba(25, 79, 131, 0.12), transparent 64%),
    var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  .course-card-video {
    display: none;
  }
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .shell.has-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .sidebar-details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
  }

  .sidebar-details > summary {
    display: block;
    cursor: pointer;
    padding: 0.8rem 1rem;
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    font-weight: 700;
  }

  .sidebar-details[open] > summary {
    border-bottom: 1px solid var(--line);
  }

  .sidebar-body {
    padding: 0.85rem 1rem 1rem;
  }

  .main-actions {
    margin-bottom: 0.6rem;
  }

  .myopenmath-embed {
    min-height: 14rem;
  }
}

@media (max-width: 767px) {
  .tikz-figure,
  .tikz-figure--wide,
  .note-image-figure,
  .note-image-figure.note-image-centered,
  .note-image-figure.note-image-align-center,
  .note-image-figure.note-image-align-left,
  .note-image-figure.note-image-align-right {
    max-width: 100%;
    padding: 0.6rem;
  }
}

@media (max-width: 600px) {
  .tikz-figure,
  .tikz-figure--wide,
  .note-image-figure,
  .note-image-figure.note-image-centered,
  .note-image-figure.note-image-align-center,
  .note-image-figure.note-image-align-left,
  .note-image-figure.note-image-align-right {
    max-width: 100%;
    padding: 0.5rem;
  }
}
