/* UVM Tutorial — Clean Professional Light Theme */
:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-code: #f6f8fa;
  --text: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --accent: #0969da;
  --accent-light: #ddf4ff;
  --green: #1a7f37;
  --green-light: #dafbe1;
  --red: #cf222e;
  --red-light: #ffebe9;
  --orange: #9a6700;
  --orange-light: #fff8c5;
  --purple: #8250df;
  --border: #d0d7de;
  --border-light: #e8ecf0;
  --sidebar-width: 280px;
  --header-height: 56px;
  --max-width: 820px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Header ── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  z-index: 1000;
}

.header-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.header-logo svg { width: 24px; height: 24px; }
.header-nav { margin-left: auto; display: flex; gap: 20px; }
.header-nav a {
  color: var(--text-secondary); text-decoration: none; font-size: 0.875rem;
}
.header-nav a:hover { color: var(--accent); }

.menu-toggle {
  display: none; background: none; border: none;
  color: var(--text); font-size: 1.25rem; cursor: pointer; padding: 4px;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--header-height); left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  z-index: 900;
  transition: transform 0.25s ease;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-section { padding: 8px 16px 4px; }
.sidebar-section-title {
  font-size: 0.675rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); font-weight: 600;
}

/* Hide progress bar and text */
.progress-bar, .progress-text { display: none; }

.nav-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 16px; cursor: pointer;
  color: var(--text-secondary); text-decoration: none; font-size: 0.8125rem;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.nav-item.active {
  background: var(--accent-light); color: var(--accent);
  border-left-color: var(--accent); font-weight: 500;
}
.nav-item .lesson-num {
  font-size: 0.75rem; font-weight: 600; min-width: 20px;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.nav-item.active .lesson-num { color: var(--accent); }
.nav-item .lesson-title { flex: 1; line-height: 1.4; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* Hide the landing page entirely */
.landing-page { display: none !important; }

.lesson-container {
  display: none;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 40px 80px;
}
.lesson-container.active { display: block; }

/* ── Typography ── */
.lesson-container h1 {
  font-size: 1.75rem; font-weight: 600; margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.lesson-container h2 {
  font-size: 1.3rem; font-weight: 600;
  margin: 40px 0 12px; padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.lesson-container h2:first-of-type { border-top: none; margin-top: 24px; }
.lesson-container h3 { font-size: 1.05rem; font-weight: 600; margin: 24px 0 8px; }
.lesson-container h4 { font-size: 0.95rem; font-weight: 600; margin: 16px 0 6px; color: var(--text-secondary); }

.lesson-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px; padding: 12px 16px;
  background: var(--bg-secondary); border-radius: 6px;
  border-left: 3px solid var(--accent); font-size: 0.85rem;
}
.lesson-meta span { color: var(--text-secondary); }
.lesson-meta strong { color: var(--text); }

p { margin-bottom: 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Tables ── */
table {
  width: 100%; border-collapse: collapse;
  margin: 12px 0 20px; font-size: 0.875rem;
}
th, td { padding: 8px 12px; text-align: left; border: 1px solid var(--border-light); }
th { background: var(--bg-secondary); font-weight: 600; }

/* ── Code ── */
pre {
  background: var(--bg-code); border: 1px solid var(--border-light);
  border-radius: 6px; padding: 16px; overflow-x: auto;
  margin: 12px 0 20px; font-size: 0.8125rem; line-height: 1.55;
}
code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
}
:not(pre) > code {
  background: rgba(175,184,193,0.2); padding: 2px 5px; border-radius: 3px;
}
pre code { background: none; padding: 0; }

/* Prism overrides for light theme */
pre[class*="language-"], code[class*="language-"] {
  background: var(--bg-code) !important;
  color: var(--text) !important;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  font-size: 0.8125rem !important;
  text-shadow: none !important;
}
pre[class*="language-"] {
  border: 1px solid var(--border-light) !important;
  border-radius: 6px !important;
  padding: 16px !important;
  margin: 12px 0 20px !important;
}
/* Light Prism token colors */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6a737d; }
.token.punctuation { color: #24292e; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #005cc5; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin { color: #032f62; }
.token.operator, .token.entity, .token.url { color: #d73a49; }
.token.atrule, .token.attr-value, .token.keyword { color: #d73a49; }
.token.function, .token.class-name { color: #6f42c1; }
.token.regex, .token.important, .token.variable { color: #e36209; }

/* ── Blockquotes / Notes ── */
blockquote, .note {
  background: var(--bg-secondary); border-left: 3px solid var(--border);
  padding: 12px 16px; margin: 12px 0 20px; border-radius: 0 6px 6px 0;
  color: var(--text-secondary); font-size: 0.9rem;
}
blockquote strong, .note strong { color: var(--text); }
.note.warning { border-left-color: var(--orange); background: var(--orange-light); }
.note.danger { border-left-color: var(--red); background: var(--red-light); }
.note.success { border-left-color: var(--green); background: var(--green-light); }

/* ── Quiz ── */
.quiz-section {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; margin: 20px 0; overflow: hidden;
}
.quiz-header {
  padding: 12px 16px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  font-weight: 600; font-size: 0.9rem;
}
.quiz-question { padding: 16px; }
.quiz-question p { margin-bottom: 10px; }
.quiz-options { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.quiz-option {
  padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--border-light); border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; transition: border-color 0.15s;
}
.quiz-option:hover { border-color: var(--accent); }
.quiz-option .option-letter {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-secondary); display: flex;
  align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.75rem; flex-shrink: 0;
}
.quiz-option.correct { border-color: var(--green); background: var(--green-light); }
.quiz-option.correct .option-letter { background: var(--green); color: #fff; }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-light); }
.quiz-option.incorrect .option-letter { background: var(--red); color: #fff; }
.quiz-explanation {
  display: none; padding: 12px 16px; background: var(--green-light);
  border-top: 1px solid var(--border-light); font-size: 0.875rem;
}
.quiz-explanation.show { display: block; }

/* ── Reveal / Collapsible ── */
.reveal-section { margin: 16px 0; }
.reveal-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent); cursor: pointer; font-size: 0.85rem;
  transition: background 0.15s;
}
.reveal-btn:hover { background: var(--accent-light); }
.reveal-btn .arrow { transition: transform 0.2s; font-size: 0.7em; }
.reveal-btn.open .arrow { transform: rotate(90deg); }
.reveal-content {
  display: none; margin-top: 8px; padding: 16px;
  background: var(--bg-secondary); border-radius: 6px;
  border: 1px solid var(--border-light);
}
.reveal-content.show { display: block; }

/* ── Predict ── */
.predict-section {
  background: var(--bg); border: 1px solid var(--purple);
  border-radius: 8px; margin: 20px 0; overflow: hidden;
}
.predict-header {
  padding: 12px 16px; background: #f5f0ff;
  border-bottom: 1px solid #e8daff;
  font-weight: 600; font-size: 0.9rem; color: var(--purple);
}
.predict-content { padding: 16px; }

/* ── Exercise ── */
.exercise-section {
  background: var(--bg); border: 1px solid var(--green);
  border-radius: 8px; margin: 20px 0; overflow: hidden;
}
.exercise-header {
  padding: 12px 16px; background: var(--green-light);
  border-bottom: 1px solid #aceebb;
  font-weight: 600; font-size: 0.9rem; color: var(--green);
}
.exercise-content { padding: 16px; }

/* ── Pitfall ── */
.pitfall-section {
  background: var(--bg); border: 1px solid var(--red);
  border-radius: 8px; margin: 20px 0; overflow: hidden;
}
.pitfall-header {
  padding: 12px 16px; background: var(--red-light);
  border-bottom: 1px solid #ffcecb;
  font-weight: 600; font-size: 0.9rem; color: var(--red);
}
.pitfall-content { padding: 16px; }

/* ── Diagrams ── */
.diagram-container {
  margin: 20px 0; padding: 20px;
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: 8px; overflow-x: auto; text-align: center;
}
.diagram-container svg { max-width: 100%; height: auto; }
.diagram-container img { max-width: 100%; height: auto; }
.diagram-caption {
  text-align: center; font-size: 0.8rem;
  color: var(--text-muted); margin-top: 8px;
}

/* ── Lesson nav (bottom) ── */
.lesson-nav {
  display: flex; justify-content: space-between;
  margin-top: 48px; padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.lesson-nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent); cursor: pointer; font-size: 0.85rem;
  text-decoration: none; transition: background 0.15s;
}
.lesson-nav-btn:hover { background: var(--accent-light); text-decoration: none; }
.lesson-nav-btn.disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* ── Lists ── */
ul, ol { margin: 6px 0 12px 20px; color: var(--text); }
li { margin-bottom: 4px; }

/* ── Flow steps ── */
.flow-step {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 8px 0; padding: 12px; background: var(--bg-secondary);
  border-radius: 6px; border-left: 3px solid var(--accent);
}
.flow-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.flow-step-content { flex: 1; }
.flow-step-content h4 { margin: 0 0 2px; }
.flow-step-content p { margin: 0; font-size: 0.875rem; color: var(--text-secondary); }

/* ── Tabs ── */
.tab-container {
  border: 1px solid var(--border-light); border-radius: 8px;
  overflow: hidden; margin: 16px 0;
}
.tab-headers {
  display: flex; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}
.tab-header {
  padding: 10px 16px; cursor: pointer; font-size: 0.85rem;
  font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; transition: color 0.15s;
}
.tab-header:hover { color: var(--text); }
.tab-header.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; padding: 16px; }
.tab-content.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
  .main-content { margin-left: 0; }
  .lesson-container { padding: 20px 16px 60px; }
  .menu-toggle { display: block; }
  .lesson-meta { flex-direction: column; gap: 4px; }
}

@media print {
  .sidebar, .site-header, .lesson-nav, .menu-toggle { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .lesson-container { max-width: none; padding: 0; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
