/* Prose Typography - Replaces @tailwindcss/typography plugin */
/* Compatible with dark mode and accent color system */

.prose {
  color: var(--text-primary);
  max-width: 65ch;
  line-height: 1.75;
  font-size: 1.0625rem;
}

/* Headings */
.prose h1 {
  font-size: 2.25em;
  margin-top: 0;
  margin-bottom: 0.8888889em;
  font-weight: 800;
  line-height: 1.1111111;
  color: var(--text-primary);
}

.prose h2 {
  font-size: 1.5em;
  margin-top: 2em;
  margin-bottom: 1em;
  font-weight: 700;
  line-height: 1.3333333;
  color: var(--text-primary);
}

.prose h3 {
  font-size: 1.25em;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
}

.prose h4 {
  font-size: 1em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Paragraphs */
.prose p {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

/* Strong and emphasis */
.prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

/* Links */
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: var(--accent-hover);
}

/* Lists */
.prose ul,
.prose ol {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose ul > li {
  padding-left: 0.375em;
}

.prose ul > li::marker {
  color: var(--text-secondary);
}

.prose ol > li::marker {
  color: var(--text-secondary);
  font-weight: 400;
}

.prose ul ul,
.prose ul ol,
.prose ol ul,
.prose ol ol {
  margin-top: 0.75em;
  margin-bottom: 0.75em;
}

/* Blockquotes */
.prose blockquote {
  font-style: italic;
  border-left: 4px solid var(--accent);
  padding-left: 1em;
  margin: 1.6em 0;
  color: var(--text-secondary);
  background: var(--prose-blockquote-bg, transparent);
}

.prose blockquote p:first-of-type::before {
  content: none;
}

.prose blockquote p:last-of-type::after {
  content: none;
}

/* Code */
.prose code {
  font-size: 0.875em;
  font-weight: 600;
  background: var(--bg-surface-hover);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  border: var(--prose-inline-code-border, none);
  box-shadow: var(--prose-inline-code-shadow, none);
}

.prose code::before,
.prose code::after {
  content: none;
}

.prose pre {
  background: var(--bg-surface);
  border-radius: 0.5rem;
  padding: 1em;
  overflow-x: auto;
  margin: 1.5em 0;
  border: var(--prose-code-block-border, 1px solid var(--border-default));
  box-shadow: var(--prose-code-block-shadow, none);
}

.prose pre code {
  background: transparent;
  padding: 0;
  font-weight: 400;
  font-size: 0.875em;
  line-height: 1.7142857;
  border: none;
  box-shadow: none;
}

/* Horizontal rule */
.prose hr {
  border-color: var(--border-default);
  border-top-width: 1px;
  margin-top: 3em;
  margin-bottom: 3em;
}

/* Tables */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 0.875em;
  line-height: 1.7142857;
}

.prose thead {
  border-bottom-width: 1px;
  border-bottom-color: var(--border-default);
}

.prose thead th {
  padding: 0.75em 1em;
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
  background: var(--prose-table-header-bg, var(--bg-surface-hover));
  color: var(--text-primary);
}

.prose tbody tr {
  border-bottom-width: 1px;
  border-bottom-color: var(--border-default);
}

.prose tbody tr:hover {
  background: var(--prose-table-row-hover-bg, var(--bg-surface-hover));
}

.prose tbody td {
  padding: 0.75em 1em;
  vertical-align: top;
}

.prose th,
.prose td {
  border: 1px solid var(--border-default);
}

/* Images */
.prose img {
  margin-top: 2em;
  margin-bottom: 2em;
}

.prose figure {
  margin-top: 2em;
  margin-bottom: 2em;
}

.prose figcaption {
  font-size: 0.875em;
  line-height: 1.4285714;
  margin-top: 0.8571429em;
  color: var(--text-secondary);
}

/* Video */
.prose video {
  margin-top: 2em;
  margin-bottom: 2em;
}

/* Dark mode variant */
.dark .prose,
.prose.dark\:prose-invert {
  color: var(--text-primary);
}

/* Size variants */
.prose-sm {
  font-size: 0.9375rem;
  line-height: 1.7142857;
}

.prose-sm h1 { font-size: 2em; }
.prose-sm h2 { font-size: 1.4285714em; }
.prose-sm h3 { font-size: 1.2857143em; }

.prose-lg {
  font-size: 1.1875rem;
  line-height: 1.7777778;
}

.prose-lg h1 { font-size: 2.6666667em; }
.prose-lg h2 { font-size: 1.6666667em; }
.prose-lg h3 { font-size: 1.3333333em; }

.prose-xl {
  font-size: 1.375rem;
  line-height: 1.8;
}

/* Max width override */
.prose.max-w-none {
  max-width: none;
}

/* First element margin fix */
.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}
