/* General styles for inline code */
code {
  font-family: "Fira Code", "Courier New", monospace;
  background-color: #f4f4f6;
  color: #2d3748;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 90%;
  white-space: nowrap;
}

/* Styling for preformatted code blocks */
pre {
  font-family: "Fira Code", "Courier New", monospace;
  background-color: #1a202c;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 1em;
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  margin-bottom: 1.5em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #2d3748;
  overflow: hidden;
}

/* Add blur effect at the bottom half if there are more than 5 lines */
pre.blurred {
  max-height: 7.5em;
  overflow: hidden;
}

pre.blurred::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

/* Additional styling for code inside pre blocks */
pre code {
  display: block;
  font-size: 85%;
  color: #e2e8f0;
  background: #1a202c;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Styling for the copy button */
pre .copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #2d3748;
  color: #e2e8f0;
  border: 1px solid #4a5568;
  border-radius: 4px;
  padding: 0.2em 0.6em;
  font-size: 0.8em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

pre .copy-button:hover {
  background-color: #4a5568;
}

/* Styling for the expand/show more button */
pre .expand-button {
  position: absolute;
  top: 10px;
  right: 50px;
  background-color: #2d3748;
  color: #e2e8f0;
  border: 1px solid #4a5568;
  border-radius: 4px;
  padding: 0.5em 1em;
  font-size: 0.6em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

pre .expand-button:hover {
  background-color: #4a5568;
}

/* Highlighting (optional, for better contrast) */
pre code span.token.keyword {
  color: #63b3ed;
}
pre code span.token.string {
  color: #68d391;
}
pre code span.token.comment {
  color: #a0aec0;
  font-style: italic;
}

/* Responsive: Ensure pre blocks scale well on mobile */
@media (max-width: 768px) {
  pre {
    padding: 0.8em;
    font-size: 90%;
  }

  pre .copy-button {
    top: 5px;
    right: 5px;
    padding: 0.2em 0.4em;
  }

  pre .expand-button {
    top: 5px;
    right: 60px;
    padding: 0.4em 0.8em;
  }
}
