/* Components of the site's scripts (moved out of _quarto.yml). */
/* Lightbox overlay */
.image-lightbox {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.image-lightbox-content {
  max-width: 95%;
  max-height: 95%;
  margin: auto;
  display: block;
  object-fit: contain;
  cursor: default;
}

.image-lightbox-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  line-height: 1;
  transition: color 0.2s;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus {
  color: #fff;
  text-decoration: none;
}

/* Make figures and images clickable */
.quarto-figure,
figure,
.cell-output-display img,
.cell-output-display svg,
.quarto-plot img,
img[src*=".png"],
img[src*=".jpg"],
img[src*=".jpeg"],
img[src*=".svg"] {
  cursor: pointer;
  transition: opacity 0.2s;
}

.quarto-figure:hover,
figure:hover,
.cell-output-display img:hover,
.cell-output-display svg:hover,
.quarto-plot img:hover,
img[src*=".png"]:hover,
img[src*=".jpg"]:hover,
img[src*=".jpeg"]:hover,
img[src*=".svg"]:hover {
  opacity: 0.9;
}

/* Exclude icons and small images */
.navbar img,
.nav-footer img,
img[width][width<100],
img[height][height<100] {
  cursor: default;
}

/* Related Notes Section */
.related-notes-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--bs-border-color);
}

.related-notes-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--bs-body-color);
}

.related-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-notes-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.related-notes-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--bs-secondary);
}

.related-notes-list a {
  color: #1a1a1a !important;  /* Subtle, matches body text */
  text-decoration: none;
  transition: color 0.2s;
}

.related-notes-list a:hover {
  color: #20B2AA !important;  /* Teal on hover for interactivity */
  text-decoration: underline;
}

/* Back to top button */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  background: var(--bs-primary);
  color: var(--bs-body-bg);
  border-color: var(--bs-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .back-to-top-btn {
    bottom: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }
}

/* Hide in print */
@media print {
  .back-to-top-btn {
    display: none !important;
  }
}

/* Collapsible Code Blocks - Global */
.code-block-wrapper {
  margin: 1.5rem 0;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background: #f8f8f8;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #f0f0f0;
  border-bottom: 1px solid var(--bs-border-color);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.code-block-header:hover {
  background: #e8e8e8;
}

.code-block-title {
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.code-block-toggle {
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.2s ease;
  display: inline-block;
}

.code-block-wrapper.expanded .code-block-toggle {
  transform: rotate(180deg);
}

.code-block-content {
  display: none;
  overflow: hidden;
}

.code-block-wrapper.expanded .code-block-content {
  display: block;
}

.code-block-wrapper pre,
.code-block-wrapper code {
  margin: 0;
  border-radius: 0;
}

/* Ensure outputs are always visible - never collapse them */
.cell-output,
.cell-output-stdout,
.cell-output-stderr,
.cell-output-display,
.cell-output pre,
.cell-output code {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure unwrapped code blocks are visible until JavaScript wraps them */
/* Shown code blocks stay visible; hidden ones (echo: false) stay hidden. */
pre.sourceCode:not(.code-block-wrapper pre.sourceCode):not(.hidden pre.sourceCode),
.cell-code:not(.code-block-wrapper .cell-code):not(.hidden) {
  display: block !important;
}

