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

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --border: #e2e0d8;
  --border-strong: #c8c5b8;
  --text: #1a1915;
  --muted: #6b6860;
  --accent: #c85a1e;
  --accent-bg: #fdf0ea;
  --blue: #2a5fa8;
  --blue-bg: #edf2fc;
  --green: #0f7040;
  --green-bg: #eaf5ee;
  --code-bg: #1c1b18;
  --code-text: #e8e6df;
  --radius: 6px;
  --nav-height: 58px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Header / Nav ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-title {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  gap: 1px;
  flex-shrink: 0;
}

.course-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.course-name {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--text); color: #fff; }

/* ── Main content ── */
main.page-content {
  flex: 1;
}

/* ── Home page ── */
.home-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 52px 32px 44px;
}

.home-hero-inner {
  max-width: 960px;
  margin: 0 auto;
}

.home-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.home-title {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 12px;
  max-width: 640px;
}

.home-desc {
  font-size: 15px;
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 28px;
  line-height: 1.65;
}

.home-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: var(--bg);
}

.home-grid {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Quick links */
.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 32px;
}

.nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  display: block;
  transition: border-color .15s, box-shadow .15s;
}

.nav-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  text-decoration: none;
}

.nav-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.nav-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* This week / sidebar */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.sidebar-card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--bg);
}

.sidebar-card-body {
  padding: 14px 16px;
  font-size: 13px;
}

.sidebar-card-body p { margin-bottom: 6px; color: var(--muted); }
.sidebar-card-body strong { color: var(--text); font-weight: 500; }

/* ── Generic page layout ── */
.page-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.page-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ── Markdown content styles ── */
.page-body h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.page-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}

.page-body p {
  margin-bottom: 14px;
  color: var(--text);
}

.page-body ul, .page-body ol {
  margin: 0 0 14px 20px;
  color: var(--text);
}

.page-body li { margin-bottom: 5px; }

.page-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 16px 0 24px;
}

.page-body th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.page-body td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.page-body tr:last-child td { border-bottom: none; }

.page-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  background: #eceae3;
  padding: 1px 5px;
  border-radius: 3px;
  color: #2a2825;
}

.page-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 10px 0 18px;
  line-height: 1.6;
}

.page-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.page-body blockquote {
  border-left: 3px solid var(--border-strong);
  padding: 2px 0 2px 16px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

/* ── Callout / note ── */
.note {
  background: #fffbf0;
  border: 1px solid #e8d98a;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #6b5800;
  margin: 12px 0;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge-orange { background: var(--accent-bg); color: #9a3e10; }
.badge-blue   { background: var(--blue-bg);   color: #1a4080; }
.badge-green  { background: var(--green-bg);  color: #0a5230; }
.badge-gray   { background: var(--bg);        color: var(--muted); border: 1px solid var(--border); }

/* ── Schedule week rows ── */
.week-row { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.week-row:last-child { border-bottom: none; }
.week-num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); width: 44px; flex-shrink: 0; padding-top: 3px; }
.week-content { flex: 1; }
.week-title { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.week-meta { font-size: 12px; color: var(--muted); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  background: var(--surface);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Guides list ── */
.guide-list { display: flex; flex-direction: column; gap: 10px; }

.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  transition: border-color .15s;
}

.guide-card:hover { border-color: var(--border-strong); text-decoration: none; }
.guide-card-left {}
.guide-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.guide-card-desc  { font-size: 13px; color: var(--muted); }
.guide-card-arrow { font-size: 18px; color: var(--border-strong); flex-shrink: 0; margin-left: 16px; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .header-inner { padding: 0 16px; }
  .course-name { display: none; }
  .home-grid { grid-template-columns: 1fr; padding: 28px 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .home-hero { padding: 32px 16px 28px; }
  .page-wrap { padding: 32px 16px 60px; }
  .footer-inner { flex-direction: column; }
}

/* ── Session blocks (weekly detail pages) ── */
.session-block {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.session-block:last-of-type { border-bottom: none; }

.session-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
  padding-top: 4px;
}

.session-content { flex: 1; }

.session-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.session-content p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 10px;
}

.session-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.topic-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: #1a4080;
}

/* ── Assignment preview card (weekly detail pages) ── */
.assignment-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
}

.assignment-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.assignment-preview-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 10px;
}

.assignment-preview p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.assignment-link {
  font-size: 13px;
  font-weight: 500;
}

/* ── Assignment rows (assignments index page) ── */
.assignment-row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.assignment-row:last-of-type { border-bottom: none; }

.assignment-week {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  width: 44px;
  flex-shrink: 0;
  padding-top: 3px;
}

.assignment-content { flex: 1; }

.assignment-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.assignment-title a { color: var(--text); }
.assignment-title a:hover { color: var(--accent); }

.assignment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.assignment-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Week detail page: linked week title on schedule ── */
.week-title a { color: var(--text); }
.week-title a:hover { color: var(--accent); }
