/* Image Zoom Lightbox, Linked Images & Missing Image Fallback */
#reading-view a.external-image-link {
  border-bottom: none;
  display: inline-block;
}

#reading-view img.zoomable-image {
  cursor: zoom-in;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

#reading-view img.zoomable-image:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.md-image-error-fallback {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0.8em 0;
  background: rgba(239, 68, 68, 0.08);
  border: 1px dashed rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
}

.md-image-error-fallback .icon-svg {
  width: 18px;
  height: 18px;
  color: var(--color-red);
  flex-shrink: 0;
}

.md-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 14, 0.86);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.md-lightbox-content {
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.md-lightbox-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.md-lightbox-caption {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

#reading-view .note {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-blue);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 1em 0;
}

/* Definition Lists */
#reading-view dl.markdown-dl {
  margin: 1.2em 0;
}

#reading-view dl.markdown-dl dt {
  font-weight: 600;
  color: var(--text-normal);
  margin-top: 0.9em;
}

#reading-view dl.markdown-dl dt:first-child {
  margin-top: 0;
}

#reading-view dl.markdown-dl dd {
  margin-left: 1.5em;
  margin-top: 0.25em;
  color: var(--text-muted);
  position: relative;
}

#reading-view dl.markdown-dl dd::before {
  content: "—";
  position: absolute;
  left: -1.1em;
  color: var(--text-faint);
}

/* Footnotes */
.footnote-ref a {
  color: var(--text-accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0 2px;
}

.footnote-ref a:hover {
  text-decoration: underline;
}

.footnotes-section {
  margin-top: 3em;
  font-size: 13.5px;
  color: var(--text-muted);
}

.footnotes-sep {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 1em;
}

.footnotes-list {
  padding-left: 1.5em;
}

.footnote-item {
  margin-bottom: 0.5em;
}

.footnote-backref {
  margin-left: 6px;
  color: var(--text-accent);
  text-decoration: none;
}

.footnote-backref:hover {
  text-decoration: underline;
}

/* ==========================================================================
   CSS Custom Highlight API (In-Note Find Bar) & Source Line Jump Flash
   ========================================================================== */
::highlight(mdv-find-hit) {
  background-color: rgba(250, 204, 21, 0.35);
  color: inherit;
}

::highlight(mdv-find-current) {
  background-color: rgba(249, 115, 22, 0.72);
  color: #ffffff;
}

.md-line-anchor {
  display: inline;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

@keyframes searchLineFlash {
  0% {
    background-color: rgba(124, 58, 237, 0.36);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.22);
  }
  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
  }
}

.search-line-flash {
  animation: searchLineFlash 1.5s ease-out;
  border-radius: 4px;
}

