/* Minimal reader layout — cream paper, dark type (blog / lecture notes) */
:root {
  --bg: #f7f2e9;
  --bg-elevated: #faf7f0;
  --text: #1c1917;
  --text-muted: #57534e;
  --accent: #44403c;
  --rule: #d6d3d1;
  --link: #0f766e;
  --link-hover: #115e59;
  --max-width: 42rem;
  --font-serif: "Literata", "Georgia", "Times New Roman", serif;
  --font-sans: "Source Sans 3", system-ui, sans-serif;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.site-header {
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-elevated);
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  color: var(--text);
}

.site-header .subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 400;
}

.site-header .meta {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.site-header .ornament {
  margin: 1rem auto 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.chapter-opener {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.chapter-opener .label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chapter-opener h1 {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.chapter-opener .focus {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.nav-row a {
  font-weight: 500;
}

/* Index chapter list */
.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list li {
  margin: 0;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.chapter-list li:first-child {
  padding-top: 0;
}

.chapter-list a.title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  border: none;
}

.chapter-list a.title:hover {
  color: var(--link);
}

.chapter-list .week {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Prose (generated from Markdown) */
.prose {
  font-size: 1rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.prose h1 {
  font-size: 1.35rem;
}

.prose h2 {
  font-size: 1.2rem;
  margin-top: 2.25rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.prose h3 {
  font-size: 1.05rem;
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin: 0.35rem 0;
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--text-muted);
}

.prose code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.prose pre {
  background: #292524;
  color: #e7e5e4;
  padding: 1rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 1.25rem 0;
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.prose table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.92rem;
  margin: 1.25rem 0;
  font-family: var(--font-sans);
}

.prose th,
.prose td {
  border: 1px solid var(--rule);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.prose th {
  background: var(--bg-elevated);
}

.section-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 3rem 0 1rem;
}

.exercises-block {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.exercises-block h2 {
  margin-top: 0;
  border: none;
  font-size: 1.1rem;
}

/* KaTeX: keep inline math from overflowing */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}
