/* Custom styles for better lightbox integration */
figure {
  text-align: center;
  margin: 2em 0 3em 0;
}

figure img {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

figure img:hover {
  opacity: 0.85;
}

figcaption {
  margin-top: 0.5em;
  font-style: italic;
  color: #666;
}

/* Table caption styling - match figure captions */
table {
  caption-side: bottom;
}

table caption {
  margin-top: 0.5em;
  margin-bottom: 0;
  font-style: italic;
  color: #666;
}

/* Center wide tables in the viewport */
div[id^="tab:"] {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2em;
}

/* Prevent text wrapping in table cells */
div[id^="tab:"] table td,
div[id^="tab:"] table th {
  white-space: nowrap;
}

/* Enhanced code block styles */
.sourceCode {
  position: relative;
  background-color: #f5f5f5;
  border-radius: 6px;
  padding: 1em;
  margin: 1em 0;
  overflow-x: auto;
}

pre.sourceCode {
  margin: 0;
  padding: 0;
  background-color: transparent;
}

code.sourceCode {
  background-color: transparent;
  padding: 0;
}

/* Styles for code blocks wrapped in figures (auto-generated structure) */
figure.float.listing {
  text-align: left;
  margin: 2em 0;
}

div.float-body.listing {
  position: relative;
  background-color: #f5f5f5;
  border-radius: 6px;
  padding: 1em;
  margin: 0;
  overflow-x: auto;
}

figure.float.listing pre {
  margin: 0;
  padding: 0;
  background-color: transparent;
  overflow: visible;
}

figure.float.listing code {
  background-color: transparent;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  line-height: 1.5;
}

/* Make sure syntax highlighting applies to code in figures */
figure.float.listing pre > code {
  white-space: pre;
  position: relative;
}

/* Copy button styles */
.code-copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px;
  background-color: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  color: #333;
  transition: all 0.2s ease;
  z-index: 10;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-copy-button:hover {
  background-color: #e8e8e8;
  border-color: #b0b0b0;
}

.code-copy-button:active {
  background-color: #d8d8d8;
}

.code-copy-button.copied {
  background-color: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.csl-entry {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5em; /* optional: adds space between entries */
}

.csl-left-margin {
  width: 2.5em;       /* adjust for number width, e.g. [10] */
  flex-shrink: 0;     /* don't let the number area shrink */
}

.csl-right-inline {
  flex: 1;
  padding-left: 0.5em;  /* small gap between number and text */
  text-indent: -0.5em;  /* hanging indent effect */
  margin-left: 0.5em;   /* pushes the block right a bit */
}

/* Article content hyphenation */
.content {
  hyphens: auto;
}

/* References section left-aligned */
.references.csl-bib-body {
  text-align: left;
}
