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

:root {
  --sidebar-w: 260px;
  --accent: #5c6bc0;
  --accent-dark: #3949ab;
  --bg: #f8f9fb;
  --surface: #fff;
  --text: #1a1a2e;
  --muted: #666;
  --border: #e2e4ea;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding-bottom: 2rem;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-header a {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-dark);
  text-decoration: none;
  line-height: 1.3;
  display: block;
}

#sidebar ul { list-style: none; padding: 0.5rem 0; }
#sidebar ul li a {
  display: block;
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
#sidebar ul li a:hover { color: var(--accent); }
#sidebar ul li.active a {
  color: var(--accent-dark);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Main content */
main {
  flex: 1;
  max-width: 780px;
  padding: 2.5rem 2rem 4rem;
}

/* Mobile toggle */
#nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Hero */
.hero { margin-bottom: 2.5rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--muted); font-size: 1.05rem; }

/* Module grid */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: block;
}
.module-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(92,107,192,.12); }
.module-card h2 { font-size: 1rem; margin: 0.3rem 0 0.5rem; color: var(--accent-dark); }
.module-card p { font-size: 0.85rem; color: var(--muted); }

/* Module num badge */
.module-num {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
}

/* Module header */
.module-header { margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1.25rem; }
.module-header h1 { font-size: 1.75rem; margin-top: 0.3rem; }
.module-updated {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: #eef0f4;
  border-radius: 100px;
  padding: 0.2rem 0.7rem;
}

/* What's new (dated updates, newest first) */
.whats-new {
  background: #fff8ec;
  border: 1px solid #f0e0bf;
  border-left: 4px solid #e0a82e;
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.75rem;
}
.whats-new h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #b9831a;
  margin-bottom: 0.75rem;
}
.update-entry { margin-bottom: 0.9rem; }
.update-entry:last-child { margin-bottom: 0; }
.update-date {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #b9831a;
  margin-bottom: 0.3rem;
}
.whats-new ul { margin: 0; padding-left: 1.1rem; list-style: disc; }
.whats-new li { margin-bottom: 0.35rem; font-size: 0.93rem; line-height: 1.5; }

/* Key points (glanceable summary) */
.key-points {
  background: #eef1fb;
  border: 1px solid #d4daf2;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.75rem;
}
.key-points h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent-dark);
  margin-bottom: 0.65rem;
}
.key-points ul { margin: 0; padding-left: 1.1rem; list-style: disc; }
.key-points li { margin-bottom: 0.4rem; font-size: 0.95rem; line-height: 1.5; }
.key-points li:last-child { margin-bottom: 0; }

/* Lessons */
.lesson {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.lesson h3 { font-size: 1.05rem; margin-bottom: 1rem; color: var(--accent-dark); }
.lesson-body p { margin-bottom: 0.85rem; }
.lesson-body p:last-child { margin-bottom: 0; }

/* Sources */
.sources { margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }
.sources summary { cursor: pointer; color: var(--accent); }
.sources ul { margin-top: 0.4rem; padding-left: 1rem; list-style: disc; }
.sources a { color: var(--muted); }

/* Nav footer */
.nav-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.nav-footer a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }

@media (max-width: 700px) {
  #nav-toggle { display: block; }
  #sidebar {
    position: fixed;
    left: -var(--sidebar-w);
    top: 0;
    height: 100%;
    z-index: 100;
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform 0.25s;
  }
  #sidebar.open { transform: translateX(0); }
  main { padding: 4rem 1.25rem 3rem; }
}
