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

:root {
  --bg: #fff;
  --bg-2: #f8f8f8;
  --text: #111;
  --text-2: #444;
  --text-3: #888;
  --border: #e5e5e5;
  --accent: #2563eb;
  --radius: 8px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Top nav */
.top-nav {
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
}

.top-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
}

.top-nav a:hover { color: var(--text); }

/* Main */
main {
  max-width: 860px;
  margin: auto;
  padding: 0 40px 80px;
}

/* Page header */
.page-header {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--text-2);
  font-size: 15px;
}

/* Demo Section */
.demo-section {
  margin-bottom: 60px;
}

.demo-section > h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.demo-desc {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
}

.demo-desc code {
  font-family: 'Menlo', 'Monaco', monospace;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
}

.demo-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
  max-width: 240px;
}

.nav-sections {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-radius: 6px;
  text-align: left;
  transition: background 0.15s ease;
}

.section-header:hover { background: #ebebeb; }

.chevron {
  display: inline-block;
  font-size: 16px;
  color: var(--text-3);
  transition: transform 0.2s ease;
  line-height: 1;
}

.nav-section.is-open .chevron { transform: rotate(90deg); }

.section-items {
  list-style: none;
  padding: 2px 0 4px;
}

.nav-item {
  display: block;
  padding: 6px 10px 6px 20px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: #ebebeb;
  color: var(--text);
}

.nav-item.is-active {
  font-weight: 600;
  color: var(--text);
  border-left-color: var(--accent);
  background: #e8eefb;
}

/* ── Tab Interface ── */
.tabs-widget {
  display: flex;
  flex-direction: column;
}

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--text);
}

.tab-panel h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tab-panel p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}

.tab-panel.is-hidden { display: none; }

.lesson-list, .resource-list {
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.9;
}

.resource-list a {
  color: var(--accent);
  text-decoration: none;
}

.resource-list a:hover { text-decoration: underline; }

/* ── Breadcrumb + Pagination ── */
.breadcrumb {
  margin-bottom: 28px;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  flex-wrap: wrap;
}

.breadcrumb li {
  font-size: 13px;
  color: var(--text-2);
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb li[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

.breadcrumb .sep {
  color: var(--text-3);
  font-size: 12px;
  user-select: none;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-numbers {
  display: flex;
  gap: 4px;
  list-style: none;
}

.page-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  padding: 6px 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.page-btn:hover {
  background: var(--bg-2);
  color: var(--text);
}

.page-num.is-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  font-weight: 600;
}

.prev-btn, .next-btn {
  font-size: 13px;
  border: 1px solid var(--border);
}

/* Mobile */
@media (max-width: 640px) {
  .top-nav { padding: 16px 20px; }
  main { padding: 0 20px 60px; }
  .page-header { padding-top: 32px; }
  .demo-box { padding: 20px 16px; }
  .page-header h1 { font-size: 22px; }
}
