/* Inspiration: https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js */

.prose {
  --prose-border-color: #e5e7eb;
  --prose-code-bg-color: #1c1b1b;
}

.prose > :first-child {
  margin-top: 0;
}

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

.prose table {
  width: 100%;
  text-align: left;
}
.prose th,
.prose td {
  padding: 0.125em 0.5em;
  border: 1px solid var(--prose-border-color);
}

.prose > code,
.prose :not(pre) > code,
.prose pre {
  line-height: 1;
  font-size: 0.75em;
  font-weight: 600;
  padding: 0.15em 0.325em;
  background-color: var(--prose-code-bg-color);
  border-radius: 0.5rem;
  outline: 1px solid rgb(255 255 255 / 0.3);
  color: #ccc;
}

.prose pre code,
.prose pre {
  line-height: inherit;
  overflow-x: auto;
  font-weight: 400;
  font-size: 0.9em;
}

.prose pre {
  padding: 0.75em;
}

.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote,
.prose table,
.prose pre {
  margin-top: 1.2em;
  margin-bottom: 1.2em;
}

.rte li,
.prose li {
  margin-bottom: 0.325em;
}

.prose blockquote {
  border-left: 0.25rem solid var(--prose-border-color);
  padding: 0.5em 1.5em;
}

.prose blockquote p {
  margin-bottom: 0.5em;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  border-color: var(--prose-border-color);
  margin-top: 2.8em;
  margin-bottom: 2.8em;
}

:root {
  --prose-h-leading: 1.15;
}

@media screen and (min-width: 1024px) {
  :root {
    --prose-h-leading: 1.1;
  }
}

@media screen and (min-width: 1280px) {
  :root {
    --prose-h-leading: 1.05;
  }
}

@media screen and (min-width: 1536px) {
  :root {
    --prose-h-leading: 1;
  }
}

/* https://www.marcbacon.com/tools/clamp-calculator/ */
/* Viewport min: 640 max: 1280 */
.heading-1,
.prose h1 {
  font-size: clamp(2.25rem, 0.75rem + 3.75vw, 3.75rem);
  line-height: calc(1 * var(--prose-h-leading));
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 0.8em;
}

.heading-2,
.prose h2 {
  font-size: clamp(1.875rem, 0.75rem + 2.813vw, 3rem);
  line-height: calc(1.1 * var(--prose-h-leading));
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.7em;
}

.heading-3,
.prose h3 {
  font-size: clamp(1.5rem, 0.75rem + 1.875vw, 2.25rem);
  line-height: calc(1.2 * var(--prose-h-leading));
  font-weight: 600;
  margin-top: 1.55em;
  margin-bottom: 0.6em;
}

.heading-4,
.prose h4 {
  font-size: clamp(1.25rem, 0.625rem + 1.563vw, 1.875rem);
  line-height: calc(1.3 * var(--prose-h-leading));
  font-weight: 600;
  margin-top: 1.6em;
  margin-bottom: 0.4em;
}

.heading-5,
.prose h5 {
  font-size: clamp(1.125rem, 1rem + 0.313vw, 1.25rem);
  line-height: calc(1.4 * var(--prose-h-leading));
  font-weight: 600;
  margin-top: 1.65em;
  margin-bottom: 0.4em;
}

/* Better relative weights */
/* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#meaning_of_relative_weights */
.heading-2 strong,
.prose h2 strong {
  font-weight: 800;
}
.heading-3 strong,
.prose h3 strong,
.heading-4 strong,
.prose h4 strong,
.heading-5 strong,
.prose h5 strong {
  font-weight: 700;
}

.heading-1,
.prose h1,
.heading-2,
.prose h2,
.heading-3,
.prose h3,
.heading-4,
.prose h4,
.heading-5,
.prose h5 {
  hyphens: auto;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.prose hr + *,
.heading-1 + *,
.prose h1 + *,
.heading-2 + *,
.prose h2 + *,
.heading-3 + *,
.prose h3 + *,
.heading-4 + *,
.prose h4 + *,
.heading-5 + *,
.prose h5 + * {
  margin-top: 0;
}
