/* MAM2046W — main stylesheet */

:root {
  --accent: #1a5fa8;
  --text: #222;
  --bg: #fff;
  --border: #ddd;
  --nav-bg: #f5f5f5;
  --max-width: 860px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Georgia", serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ── Navigation ── */
.site-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.nav-links a:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Main content ── */
main.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Home / Table of Contents ── */
.home h1 { font-size: 1.9rem; margin-bottom: 0.3rem; }
.home .lead { color: #555; margin-top: 0; font-size: 1rem; }

.toc { margin-top: 2rem; }
.toc h2 {
  font-size: 1.15rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
}
.toc ul { padding-left: 1.2rem; list-style: none; }
.toc li { margin: 0.3rem 0; }
.toc li::before { content: ""; }
.toc a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
}
.toc a:hover { text-decoration: underline; }

/* ── Notebook page ── */
.page-header h1 {
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.4rem;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0 1.5rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
}

.page-nav.bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

a.prev-next {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

a.prev-next:hover { background: var(--accent); color: #fff; }
a.prev-next.next { margin-left: auto; }

/* ── Notebook content typography ── */
.notebook-content h2 {
  font-size: 1.3rem;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.notebook-content h3 {
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.3rem;
}

.notebook-content h4 {
  font-size: 1rem;
  margin-top: 1.5rem;
  font-style: italic;
}

.notebook-content p {
  margin: 0.6rem 0 1rem;
}

.notebook-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 4px;
}

/* ── Code blocks (Mathematica) ── */
.notebook-content pre {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0.8rem 0;
}

.notebook-content code {
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  font-size: 0.85em;
}

.notebook-content p code {
  background: #f0f0f0;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* ── Display math ── */
.notebook-content .katex-display {
  margin: 1.2rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ── Lists ── */
.notebook-content ul,
.notebook-content ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.5rem;
}

.notebook-content li {
  margin: 0.3rem 0;
}

/* Nested sub-items */
.notebook-content li > ul {
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

/* ── Inline math spacing ── */
.katex { font-size: 1.05em; }

/* ── Bold/emphasis ── */
.notebook-content strong {
  font-weight: 700;
  color: #111;
}

/* ── Frame-swapping slider widget ── */
.frame-widget {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 2rem 0;
  background: #fafafa;
}

.frame-widget img { margin: 0 auto 0.8rem; }

.frame-widget input[type=range] {
  width: 100%;
  cursor: pointer;
}

.frame-widget .param-label {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  text-align: center;
  color: #555;
}

/* ── JSXGraph board ── */
.jxgbox {
  border: 1px solid var(--border) !important;
  border-radius: 4px;
  margin: 1.5rem auto;
}

/* ── GIF animations ── */
.anim-gif {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ── Footer ── */
footer {
  text-align: center;
  font-size: 0.82rem;
  color: #999;
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: 2rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

footer a {
  color: #888;
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

footer p { margin: 0.2rem 0; }

/* ── Mobile ── */
@media (max-width: 600px) {
  body { font-size: 16px; }

  main.content { padding: 1.2rem 1rem 3rem; }

  .page-header h1 { font-size: 1.3rem; }
  .notebook-content h2 { font-size: 1.15rem; }

  .page-nav { flex-direction: column; gap: 0.5rem; }
  a.prev-next.next { margin-left: 0; }
  a.prev-next { text-align: center; }

  .site-title { font-size: 0.95rem; }

  .notebook-content .katex-display {
    font-size: 0.9rem;
  }
}
