/* Course page layout styles */

.course-index {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.course-index h1 {
  color: var(--heading, #9cdcfe);
  font-size: 1.8rem;
  margin-bottom: 24px;
}

.chapter-card {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-card, #252526);
  border: 1px solid var(--border, #3c3c3c);
  border-radius: 8px;
}

.chapter-card h2 {
  color: var(--accent, #569cd6);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.chapter-card ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.chapter-card li {
  font-size: 0.9rem;
}

.page-list {
  padding-left: 24px;
}

.page-list li {
  margin: 8px 0;
  font-size: 1rem;
}

/* Course page */

.course-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--dim, #808080);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--dim, #808080);
}

.breadcrumb a:hover {
  color: var(--link, #4ec9b0);
}

.course-page h1 {
  color: var(--heading, #9cdcfe);
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.course-page .subtitle {
  color: var(--dim, #808080);
  font-size: 1rem;
  margin-bottom: 16px;
}

.course-page .description {
  color: var(--fg, #d4d4d4);
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-card, #252526);
  border-left: 3px solid var(--accent, #569cd6);
  border-radius: 4px;
}

.course-section {
  margin-bottom: 32px;
}

.course-section h2 {
  color: var(--accent, #569cd6);
  font-size: 1.2rem;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border, #3c3c3c);
  padding-bottom: 6px;
}

.section-text {
  margin-bottom: 16px;
  line-height: 1.7;
}

.section-text p {
  margin-bottom: 8px;
}

/* Embedded visualization */

.execvis-embed {
  margin: 16px 0;
  border: 1px solid var(--border, #3c3c3c);
  border-radius: 6px;
  overflow: hidden;
}

.execvis-controls {
  padding: 8px 12px;
  background: var(--bg-card, #252526);
  border-top: 1px solid var(--border, #3c3c3c);
}

.execvis-missing {
  margin: 16px 0;
  padding: 12px;
  background: var(--bg-card, #252526);
  border: 1px solid var(--border, #3c3c3c);
  border-radius: 6px;
  color: var(--dim, #808080);
  font-style: italic;
}

/* Concept callout */

.concept-box {
  margin: 12px 0;
  padding: 10px 14px;
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  border-radius: 6px;
  font-size: 0.9rem;
}

.concept-box strong {
  color: var(--link, #4ec9b0);
}

/* Diagram */

.diagram {
  margin: 16px 0;
  text-align: center;
}

.diagram svg {
  max-width: 100%;
  height: auto;
}

/* Page navigation */

.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #3c3c3c);
}

.nav-prev, .nav-next {
  padding: 8px 16px;
  background: var(--bg-card, #252526);
  border: 1px solid var(--border, #3c3c3c);
  border-radius: 6px;
  font-size: 0.9rem;
}

.nav-prev:hover, .nav-next:hover {
  background: var(--border, #3c3c3c);
  text-decoration: none;
}

/* === Code Block === */

.ev-code-block {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px 0;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid #2a2a2a;
}

/* === Line === */

.ev-line {
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: relative;
  min-height: 1.6em;
  transition: background-color 0.15s ease;
}

.ev-gutter {
  width: 3em;
  text-align: right;
  color: #5a5a5a;
  padding-right: 16px;
  user-select: none;
  flex-shrink: 0;
  font-size: 0.85em;
}

.ev-heat {
  margin-right: 8px;
  align-self: stretch;
  flex-shrink: 0;
  border-radius: 2px;
  font-size: 0.75em;
  text-align: center;
  color: #9cdcfe;
  line-height: 2.1;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.ev-content {
  white-space: pre;
}

/* === Token Types === */

.ev-variable { color: #9cdcfe; }
.ev-keyword  { color: #569cd6; }
.ev-literal  { color: #b5cea8; }
.ev-string   { color: #ce9178; }

/* === Token Read/Write Marks (persistent) === */

.ev-token-read {
  color: #4ec9b0;
  text-decoration: underline;
  text-decoration-color: rgba(78, 201, 176, 0.4);
  text-underline-offset: 2px;
}

.ev-token-write {
  color: #dcdcaa;
  text-decoration: underline;
  text-decoration-color: rgba(220, 220, 170, 0.4);
  text-underline-offset: 2px;
}

/* === Execution States === */

.ev-line.ev-focus {
  background: rgba(33, 150, 243, 0.18);
  border-left: 3px solid rgba(33, 150, 243, 0.6);
}

.ev-line.ev-focus.ev-executed {
  background: rgba(33, 150, 243, 0.15);
  border-left: 3px solid rgba(33, 150, 243, 0.5);
}

.ev-line.ev-executing {
  background: rgba(255, 235, 59, 0.12);
}

.ev-line.ev-executed {
  /* No persistent background — keep source looking plain at rest */
}

/* Executing overrides focus */
.ev-line.ev-executing.ev-focus {
  background: rgba(255, 235, 59, 0.15);
}

/* === Step Number Freshness === */

.ev-step-current { opacity: 1.0; background: rgba(33, 150, 243, 0.25); }
.ev-step-prev    { opacity: 0.7; }
.ev-step-old     { opacity: 0.4; }
.ev-step-older   { opacity: 0.2; }

/* === End-of-line Comment Annotations === */

.ev-comment {
  color: #6a9955;
  font-style: italic;
  white-space: pre;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ev-comment.ev-comment-visible {
  opacity: 1;
}

.ev-comment.ev-changed {
  color: #dcdcaa;
  transition: color 0.3s ease;
}

/* === Sweep Overlay === */

.ev-sweep-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 235, 59, 0.2), transparent);
  pointer-events: none;
}

/* === Output === */

.ev-output-line {
  padding: 2px 0;
  border-bottom: 1px solid rgba(78, 201, 176, 0.1);
}
.ev-output-line:last-child {
  border-bottom: none;
}