/* Prose typography (.doc), loaded only by DocLayout, so it ships only with
 * long-form pages (/docs/*, /changelog, /privacy). The home page never loads
 * these rules. Element rules that would restyle a component (lists,
 * paragraphs, tables) skip anything inside `.not-prose`.
 *
 * `.doc pre` rules skip `.not-prose` regions: this file is unlayered, so it
 * beats Tailwind's layered utilities whatever the specificity, and a
 * <CodeBlock> inside the docs keeps its own block only that way. Inline-code
 * rules use normal specificity because no component renders bare <code>
 * inside Markdown.
 */

.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc p:not(.not-prose *),
.doc ul:not(.not-prose *),
.doc ol:not(.not-prose *),
.doc blockquote {
  max-width: 64ch;
}

.doc h1 {
  font-size: 3rem;
  line-height: 1;
  margin: 0 0 1.25rem;
}

.doc h2 {
  font-size: 2rem;
  line-height: 1.1;
  margin: 3.25rem 0 0.9rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--color-line);
}

.doc h1 + h2 {
  border-top: 0;
  padding-top: 0;
  margin-top: 2.5rem;
}

.doc h3 {
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 2.25rem 0 0.5rem;
}

.doc h4 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.4;
  margin: 1.75rem 0 0.35rem;
  color: var(--color-cream-soft);
}

.doc p:not(.not-prose *) {
  margin: 0 0 1.1rem;
  line-height: 1.7;
}

.doc strong {
  font-weight: 600;
  color: var(--color-cream);
}

.doc em {
  font-style: italic;
}

.doc a {
  color: var(--color-cream);
  text-decoration: underline;
  text-decoration-color: var(--color-line-strong);
  text-underline-offset: 3px;
  transition:
    text-decoration-color 0.15s ease,
    color 0.15s ease;
}

.doc a:hover {
  color: var(--color-you);
  text-decoration-color: var(--color-you);
}

.doc ul:not(.not-prose *),
.doc ol:not(.not-prose *) {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.doc ul:not(.not-prose *) {
  list-style: disc;
}

.doc ol:not(.not-prose *) {
  list-style: decimal;
}

.doc li:not(.not-prose *) {
  margin: 0.4rem 0;
  padding-left: 0.25rem;
  line-height: 1.65;
}

.doc li::marker {
  color: var(--color-cream-soft);
}

.doc li > ul,
.doc li > ol {
  margin: 0.4rem 0;
}

.doc :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgb(243 236 224 / 0.09);
  border-radius: 3px;
  padding: 0.05em 0.3em;
  color: var(--color-cream);
  overflow-wrap: anywhere;
}

:where(.doc pre:not(.not-prose *)) {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  background: var(--color-coal-deep);
  border: 1px solid var(--color-line);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

/* Shiki's blocks in Markdown look like the home page's: deep coal, square. */
.doc pre.astro-code {
  background: var(--color-coal-deep) !important;
}

/* github-dark comments (#6A737D) are 3.4:1 on the block; this grey is 5.7:1. */
.doc .astro-code span[style*='#6A737D' i] {
  color: #8b949e !important;
}

:where(.doc pre:not(.not-prose *) code) {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.doc table:not(.not-prose *) {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 2rem;
  font-size: 0.9rem;
}

.doc thead:not(.not-prose *) {
  border-bottom: 1px solid var(--color-line-strong);
}

.doc th:not(.not-prose *),
.doc td:not(.not-prose *) {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-line);
  vertical-align: top;
}

.doc th:not(.not-prose *) {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-cream-soft);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.doc tbody tr:not(.not-prose *):hover {
  background: var(--color-coal);
}

/* A key in a table cell never breaks mid-word; the table scrolls instead. */
.doc td:not(.not-prose *) > code,
.doc th:not(.not-prose *) > code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.doc hr {
  border: 0;
  border-top: 1px solid var(--color-line);
  margin: 2.5rem 0;
}

.doc blockquote {
  border-left: 2px solid var(--color-you);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--color-cream-soft);
  font-style: italic;
}

/* The docs sidebar is a plain list of links, without bullets. */
.doc aside ul:not(.not-prose *) {
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-width: none;
}

.doc aside li:not(.not-prose *) {
  margin: 0;
  padding-left: 0;
}

.doc aside p:not(.not-prose *) {
  margin: 0 0 0.5rem;
}

/* Component grids escape the text measure. */
.doc .not-prose {
  max-width: none;
  margin: 1.5rem 0 2rem;
}

/* Vertical rhythm around <CodeBlock> instances embedded in Markdown. */
.doc .cb-wrap {
  margin: 0 0 1.25rem;
}
