/* Reset ALL browser defaults first */
.prose-terminal * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base settings */
.prose-terminal {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.2; /* Tighter line height for more compact display */
}

/* Typography - ultra minimal spacing */
.prose-terminal p {
  margin-bottom: 0.5em; /* Consistent bottom margin for all paragraphs */
}

/* Last paragraph in any context should have no bottom margin */
.prose-terminal > p:last-child,
.prose-terminal li > p:last-child {
  margin-bottom: 0;
}

/* Headings - minimal distinguishing space */
.prose-terminal h1,
.prose-terminal h2,
.prose-terminal h3,
.prose-terminal h4,
.prose-terminal h5,
.prose-terminal h6 {
  font-weight: 600;
  margin-bottom: 0.5em;
  margin-top: 0;
}

/* Code blocks */
.prose-terminal pre {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
  padding: 0.25em;
  font-size: 0.875rem;
  line-height: 1.2; /* Match the tighter line height */
}

/* Lists - fix alignment and spacing */
.prose-terminal ul,
.prose-terminal ol {
  margin-top: 0; /* No top margin */
  margin-bottom: 0.25em; /* Reduced bottom margin to prevent double spacing */
  padding-left: 1.5em; /* Reduced indent */
}

/* Last list should have no bottom margin */
.prose-terminal > ul:last-child,
.prose-terminal > ol:last-child {
  margin-bottom: 0;
}

/* List items - no extra spacing */
.prose-terminal li {
  margin: 0;
  padding: 0;
  /* Tighter line height for more compact look */
  line-height: 1.2;
}

/* Even tighter spacing between list items */
.prose-terminal li + li {
  margin-top: 0; /* No extra space between consecutive items */
}

/* Fix numbered list alignment */
.prose-terminal li > p {
  margin: 0; /* No margins on paragraphs inside lists */
  /* Display is handled by the component override */
}

/* Display for list paragraphs is handled by component */

/* Nested lists - minimal indent, reduced spacing */
.prose-terminal li > ul,
.prose-terminal li > ol {
  margin-top: 0.25em; /* Reduced spacing between parent item and nested list */
  margin-bottom: 0;
  padding-left: 1.5em; /* Slightly less indent for nested */
}

/* Remove bottom margin from last child */
.prose-terminal > *:last-child,
.prose-terminal li > *:last-child {
  margin-bottom: 0;
}

/* Custom bullets for unordered lists */
.prose-terminal ul {
  list-style: none;

  /* This is slightly a hack, we're making heavy use of `pre-wrap`
  and we can potentially remove this in the future. For now it helps
  make sure we're not rendering extra space around list items */
  white-space: normal;
}

.prose-terminal ul > li {
  display: block;
  position: relative;
}

/* Add spacing between unordered list items */
.prose-terminal ul > li + li {
  margin-top: 0.25em; /* Small spacing between list items */
}

/* Space between block-level children within list items */
/* Exclude nested lists as they handle their own spacing with margin-top */
.prose-terminal ul > li > *:not(:last-child):not(ul):not(ol) {
  margin-bottom: 0.25em; /* Reduced to prevent large gaps */
}

.prose-terminal ul > li::before {
  content: '•';
  position: absolute;
  margin-left: -1em;
  color: var(--terminal-accent);
}

/* Preserve inline behavior for code elements within list items */
.prose-terminal li code {
  display: inline;
}

/* Keep existing theme colors for headings */
.prose-terminal h1 {
  font-size: 0.875rem; /* Same as base text */
  color: var(--terminal-accent);
}

/* First heading should have no top margin */
.prose-terminal > h1:first-child,
.prose-terminal > h2:first-child,
.prose-terminal > h3:first-child,
.prose-terminal > h4:first-child,
.prose-terminal > h5:first-child,
.prose-terminal > h6:first-child {
  margin-top: 0;
}

/* Content immediately after headings already has proper spacing from element margins */

.prose-terminal h2 {
  font-size: 0.875rem; /* Same as base text */
  color: var(--terminal-accent);
}

.prose-terminal h3 {
  font-size: 0.875rem; /* Same as base text */
  color: var(--terminal-accent-alt);
}

.prose-terminal h4,
.prose-terminal h5,
.prose-terminal h6 {
  font-size: 0.875rem; /* Same as base text */
  color: var(--terminal-accent-alt);
}

/* Typography colors */
.prose-terminal strong {
  color: var(--terminal-warning);
  font-weight: 600;
}

.prose-terminal em {
  color: var(--terminal-accent-alt);
  font-style: italic;
}

/* Code */
.prose-terminal code {
  font-size: 0.875rem;
  font-family: inherit;
}

/* Numbered lists */
.prose-terminal ol {
  list-style-type: decimal;
  color: inherit; /* Don't color the whole list */
}

.prose-terminal ol > li {
  list-style-position: outside; /* Ensure number is outside */
  display: list-item; /* Ensure list markers are shown */
  position: relative;
}

/* Add spacing between ordered list items */
.prose-terminal ol > li + li {
  margin-top: 0.25em; /* Small spacing between list items */
}

/* Space between block-level children within ordered list items */
/* Exclude nested lists as they handle their own spacing with margin-top */
.prose-terminal ol > li > *:not(:last-child):not(ul):not(ol) {
  margin-bottom: 0.25em; /* Reduced to prevent large gaps */
}

.prose-terminal ol li::marker {
  color: var(--terminal-accent);
}

/* Blockquotes */
.prose-terminal blockquote {
  border-left: 2px solid var(--terminal-accent);
  padding-left: 1rem;
  margin-bottom: 0.5em;
  color: var(--terminal-fg-dim);
  font-style: italic;
}

/* Tables */
.prose-terminal table {
  width: 100%;
  margin-bottom: 0.5em;
  border-collapse: collapse;
}

.prose-terminal th {
  padding: 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--terminal-accent);
  border-bottom: 1px solid var(--terminal-border);
}

.prose-terminal td {
  padding: 0.5rem;
  border-bottom: 1px dotted var(--terminal-border);
}

/* Horizontal rules */
.prose-terminal hr {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  border: none;
  border-top: 1px dashed var(--terminal-border);
}

/* Images */
.prose-terminal img {
  max-width: 100%;
  height: auto;
  margin-bottom: 0.5em;
}

.prose-terminal code.language-plaintext {
  color: var(--terminal-accent);
}

pre:has(> code.language-plaintext) {
  background-color: color-mix(in oklab, var(--terminal-accent) 20%, transparent) !important;
}

pre.prismjs {
  border: none;
}
