/* ── Layout ────────────────────────────────────── */
.content {
  max-width: 740px;
  margin: 0 auto;
}

/* ── Section accent ───────────────────────────── */
.section-highlight {
  border-left: 4px solid #0d6efd;
  padding-left: 1rem;
}

/* ── Hero diagram (first mermaid on each page) ── */
.mermaid {
  text-align: center;
}

div.cell[data-engine="mermaid"]:first-of-type .cell-output-display {
  background: linear-gradient(135deg, #f0f4ff 0%, #f8f9fa 100%);
  padding: 1.5rem 2rem;
  border-radius: 10px;
  border: 2px solid #c5d1e8;
  margin: 0 0 2rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

div.cell[data-engine="mermaid"]:first-of-type .cell-output-display svg {
  max-width: 100%;
  height: auto;
  min-height: 80px;
}

div.cell[data-engine="mermaid"] .cell-output-display {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  margin: 1rem 0;
}

/* ── Panel tabsets ────────────────────────────── */
.panel-tabset .nav-tabs {
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 1.25rem;
}

.panel-tabset .nav-tabs .nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  color: #495057;
  padding: 0.6rem 1.1rem;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.panel-tabset .nav-tabs .nav-link:hover {
  color: #0d6efd;
  border-bottom-color: #adb5bd;
}

.panel-tabset .nav-tabs .nav-link.active {
  color: #0d6efd;
  border-bottom-color: #0d6efd;
  background: transparent;
}

/* ── Quiz widget ──────────────────────────────── */
.quiz {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.quiz p:first-child,
.quiz strong {
  margin-top: 0;
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.quiz label.quiz-opt {
  display: block;
  padding: 0.5rem 0.75rem;
  margin: 0.35rem 0;
  border-radius: 5px;
  border: 1px solid #dee2e6;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 0.95rem;
}

.quiz label.quiz-opt:hover {
  background: #e9ecef;
}

.quiz label.correct-selected {
  background: #d4edda;
  border-color: #28a745;
  font-weight: 600;
}

.quiz label.incorrect-selected {
  background: #f8d7da;
  border-color: #dc3545;
}

.quiz label.correct-reveal {
  background: #d4edda;
  border-color: #28a745;
}

.quiz .quiz-check {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.4rem 1.25rem;
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.quiz .quiz-check:hover {
  background: #0b5ed7;
}

.quiz .quiz-check:disabled {
  background: #6c757d;
  cursor: default;
}

.quiz .quiz-feedback {
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.quiz .quiz-feedback.correct {
  color: #28a745;
}

.quiz .quiz-feedback.incorrect {
  color: #dc3545;
}

/* ── Solution reveals ─────────────────────────── */
details {
  margin: 0.5rem 0 1.5rem;
}

details summary {
  cursor: pointer;
  color: #0d6efd;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0;
}

details summary:hover {
  color: #0b5ed7;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

/* ── webR cells ───────────────────────────────── */
.qwebr-button-run {
  font-size: 0.95rem !important;
  padding: 0.4rem 1.1rem !important;
  font-weight: 600 !important;
}

.qwebr-editor {
  min-height: 60px;
  max-height: 350px;
}

/* ── Callout tip labels for exercises ─────────── */
.callout-tip {
  margin-bottom: 0.25rem !important;
  border-left-color: #0d6efd !important;
}

.callout-tip .callout-title {
  font-size: 0.9rem;
}

/* ── Tables (responsive) ─────────────────────── */
table {
  width: 100%;
  overflow-x: auto;
  display: block;
}

/* ── Responsive tweaks ────────────────────────── */
@media (max-width: 768px) {
  .panel-tabset .nav-tabs .nav-link {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }

  .qwebr-editor {
    max-height: 250px;
  }
}
