/* ==========================================================================
   Flavor Theme - Prose / Article Typography
   Scoped under the .prose class for article content.
   All colors reference design tokens via hsl(var(--token)).
   ========================================================================== */

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

@media (min-width: 1024px) {
  .prose {
    font-size: 1.125rem;
  }
}

/* --------------------------------------------------------------------------
   Headings
   -------------------------------------------------------------------------- */

.prose h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.prose h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.prose h3 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: hsl(var(--foreground));
}

.prose h4 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.4;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

/* Remove top margin when heading is the first child */
.prose > :first-child {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Paragraphs
   -------------------------------------------------------------------------- */

.prose p {
  line-height: 1.75;
}

.prose p + p {
  margin-top: 1.75rem;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

.prose a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: var(--transition-colors);
}

.prose a:hover {
  text-decoration-color: hsl(var(--primary) / 0.6);
}

/* --------------------------------------------------------------------------
   Blockquotes
   -------------------------------------------------------------------------- */

.prose blockquote {
  border-left: 2px solid hsl(var(--primary));
  padding-left: 1.5rem;
  font-style: italic;
  color: hsl(var(--muted-foreground));
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.prose blockquote p {
  margin-top: 0;
}

.prose blockquote p + p {
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */

.prose ul {
  margin-left: 1.5rem;
  list-style-type: disc;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.prose ol {
  margin-left: 1.5rem;
  list-style-type: decimal;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   Inline Code
   -------------------------------------------------------------------------- */

.prose :not(pre) > code {
  background-color: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* --------------------------------------------------------------------------
   Code Blocks (pre > code)
   -------------------------------------------------------------------------- */

.prose pre {
  background-color: hsl(var(--code-bg));
  color: hsl(var(--code-fg));
  border-radius: 0.875rem;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: inherit;
  font-weight: normal;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.prose th {
  border-bottom: 2px solid hsl(var(--border));
  font-weight: 500;
  padding: 0.5rem;
  text-align: left;
  color: hsl(var(--foreground));
}

.prose td {
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.5rem;
  color: hsl(var(--foreground));
}

.prose tr:hover {
  background-color: hsl(var(--muted) / 0.5);
}

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */

.prose img {
  border-radius: 0.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Figures
   -------------------------------------------------------------------------- */

.prose figure {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.prose figure img {
  margin-top: 0;
  margin-bottom: 0;
}

.prose figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* --------------------------------------------------------------------------
   Horizontal Rule
   -------------------------------------------------------------------------- */

.prose hr {
  border: none;
  height: 1px;
  background-color: hsl(var(--border));
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* --------------------------------------------------------------------------
   Strong & Emphasis
   -------------------------------------------------------------------------- */

.prose strong {
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* --------------------------------------------------------------------------
   Highlighted / Marked Text
   -------------------------------------------------------------------------- */

.prose mark {
  background-color: #fef9c3;
  padding: 0.125rem 0.25rem;
  border-radius: 0.125rem;
}

.dark .prose mark {
  background-color: #854d0e;
  color: #fef9c3;
}
