/* 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; /* No bottom margin */
  margin-top: 0.5em; /* Consistent top margin for all headings */
}

/* 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.5em; /* Consistent bottom margin */
  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 */

/* Ensure list markers stay aligned */
.prose-terminal ol > li {
  list-style-position: outside;
  padding-left: 0.25em; /* Minimal padding to separate from number */
}

/* Nested lists - minimal indent, no extra spacing */
.prose-terminal li > ul,
.prose-terminal li > ol {
  margin-top: 0;
  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;
}

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

/* 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 */
}

.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;
}
