body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background-color: var(--custom-1);
  color: var(--custom-12);
}

h1 {
  border-bottom: 2px solid var(--custom-6);
  padding-bottom: 0.5rem;
  color: var(--custom-12);
}

h2 {
  color: var(--custom-12);
}

h3 {
  color: var(--custom-11);
}

a {
  color: var(--custom-11);
  text-decoration: none;
}

a:hover {
  color: var(--custom-9);
  text-decoration: underline;
}

code {
  background-color: var(--custom-3);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: var(--custom-12);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

/* Code blocks with syntax highlighting */
pre.hljs {
  background-color: var(--custom-2);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

pre.hljs code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--custom-10);
  font-size: 0.95em;
  line-height: 1.5;
}

.citation {
  color: var(--custom-9);
  cursor: help;
  position: relative;
  font-weight: 500;
}

.citation:hover {
  color: var(--custom-10);
  text-decoration: underline;
}

/* Custom tooltip for citations */
.citation-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 12px 16px;
  background-color: var(--custom-2);
  border: 1px solid var(--custom-6);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 500px;
  font-size: 0.9em;
  line-height: 1.4;
}

.citation:hover .citation-tooltip,
.citation-tooltip:hover {
  opacity: 1;
  pointer-events: auto;
}

/* Bridge the gap between citation and tooltip so hover doesn't break */
.citation-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

.citation-tooltip-content {
  color: var(--custom-12);
}

.citation-tooltip-doi {
  display: inline-block;
  margin-left: 8px;
  color: var(--custom-11);
  text-decoration: none;
  font-weight: 500;
}

.citation-tooltip-doi:hover {
  color: var(--custom-9);
  text-decoration: underline;
}

/* Tooltip arrow */
.citation-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--custom-2);
}

.bibliography {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--custom-6);
}

.bibliography h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--custom-12);
}

.csl-entry {
  color: var(--custom-11);
  margin-bottom: 0.5rem;
}

blockquote {
  border-left: 4px solid var(--custom-6);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background-color: var(--custom-2);
  color: var(--custom-11);
  border-radius: 0 4px 4px 0;
}

blockquote p {
  margin: 0;
}

/* Table styling */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.95em;
}

thead tr {
  background-color: var(--custom-4);
}

th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--custom-12);
  letter-spacing: 0.02em;
}

td {
  padding: 0.5rem 1rem;
  color: var(--custom-11);
}

tbody tr:hover {
  background-color: var(--custom-3);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Mermaid diagram styling */
.mermaid {
  padding: 1.5rem;
}
