/* Typography: fonts and prose text. Loaded after the theme and before dokk.css. */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* Primary is a button fill; as text it can be too light or too dark. Clamp its lightness for links. */
  --dk-link: var(--primary);
  --dk-link: oklch(from var(--primary) min(l, 0.55) c h);
}
.dark {
  --dk-link: oklch(from var(--primary) max(l, 0.72) c h);
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prose */
.dk-prose {
  line-height: 1.75;
  overflow-wrap: break-word;
  hanging-punctuation: first allow-end;
}

.dk-prose > :first-child { margin-top: 0; }
.dk-prose h1 { font-size: 2.25rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 1.5rem; }
.dk-prose h2 { font-size: 1.5rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; margin: 2.5rem 0 1rem; padding-bottom: 0.375rem; border-bottom: 1px solid var(--border); }
.dk-prose h3 { font-size: 1.25rem; line-height: 1.4; font-weight: 600; margin: 2rem 0 0.75rem; }
.dk-prose h4 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.dk-prose :is(h1, h2, h3, h4) { text-wrap: balance; }
.dk-prose :is(h2, h3) { scroll-margin-top: calc(var(--dk-header-height) + 1rem); }
.dk-prose .header-anchor { margin-left: 0.25rem; color: var(--muted-foreground); text-decoration: none; opacity: 0; }
.dk-prose :is(h2, h3):hover .header-anchor, .dk-prose .header-anchor:focus { opacity: 1; }

.dk-prose :is(p, ul, ol, dl, blockquote, .dk-code, .table-container) { margin: 0 0 1.25rem; }
.dk-prose :is(p, li, dd) { text-wrap: pretty; }
.dk-prose :is(ul, ol) { padding-left: 1.5rem; }
.dk-prose ul { list-style: disc; }
.dk-prose ol { list-style: decimal; }
.dk-prose li + li { margin-top: 0.25rem; }
.dk-prose li > :is(ul, ol) { margin: 0.25rem 0 0; }
.dk-prose ul.contains-task-list { list-style: none; padding-left: 0.25rem; }
.dk-prose .task-list-item-checkbox { margin-right: 0.5rem; vertical-align: middle; }

.dk-prose a:not(.btn) { color: var(--dk-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.dk-prose a:not(.btn):hover { text-decoration-thickness: 2px; }
.dk-prose strong { font-weight: 600; }
.dk-prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.dk-prose hr:not([role="separator"]) { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; } /* leave Basecoat button-group separators alone */
.dk-prose blockquote { border-left: 3px solid var(--border); padding-left: 1rem; color: var(--muted-foreground); }
/* Definition lists read like a reference: term, then its description under a guide line. */
.dk-prose dt { font-weight: 600; margin-top: 1rem; }
.dk-prose dt:first-child { margin-top: 0; }
.dk-prose dd { margin: 0.25rem 0 0; padding-left: 1rem; border-left: 2px solid var(--border); }
.dk-prose dd > p:last-child { margin-bottom: 0; }

/* Code */
.dk-prose code { font-family: var(--font-mono); font-size: 0.875em; }
.dk-prose :not(pre) > code { background: var(--muted); border-radius: calc(var(--radius) - 4px); padding: 0.15em 0.35em; }
.dk-prose pre {
  margin: 0 0 1.25rem;
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
}
.dk-prose pre code { font-size: inherit; }

/* Tables (Basecoat .table inside .table-container) */
.dk-prose .table { border-collapse: collapse; }
.dk-prose .table :is(th, td) { white-space: normal; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; font-variant-numeric: tabular-nums; }

/* Footnotes */
.dk-prose .footnotes-sep { margin-top: 3rem; }
.dk-prose .footnotes { font-size: 0.875rem; line-height: 1.6; color: var(--muted-foreground); }
.dk-prose .footnote-ref a, .dk-prose .footnote-backref { text-decoration: none; }
