.prose {
  --prose-body: var(--color-text-day);
  --prose-headings: var(--color-text-day);
  --prose-lead: rgba(25, 24, 22, 0.7);
  --prose-links: var(--color-text-day);
  --prose-bold: var(--color-text-day);
  --prose-counters: rgba(25, 24, 22, 0.5);
  --prose-bullets: rgba(25, 24, 22, 0.35);
  --prose-hr: rgba(39, 37, 34, 0.18);
  --prose-quotes: var(--color-text-day);
  --prose-quote-borders: rgba(39, 37, 34, 0.18);
  --prose-captions: rgba(25, 24, 22, 0.6);
  --prose-kbd: var(--color-text-day);
  --prose-kbd-shadows: rgb(28 27 26 / 10%);
  --prose-code: var(--color-text-day);
  --prose-pre-code: rgba(244, 242, 238, 0.9);
  --prose-pre-bg: #1c1b1a;
  --prose-th-borders: rgba(39, 37, 34, 0.3);
  --prose-td-borders: rgba(39, 37, 34, 0.14);

  color: var(--prose-body);
  line-height: var(--leading-body, 1.6);
}

.theme-night .prose {
  --prose-body: rgba(240, 240, 240, 0.8);
  --prose-headings: #fff;
  --prose-lead: rgba(240, 240, 240, 0.6);
  --prose-links: #fff;
  --prose-bold: #fff;
  --prose-counters: rgba(240, 240, 240, 0.5);
  --prose-bullets: rgba(240, 240, 240, 0.3);
  --prose-hr: rgba(244, 242, 238, 0.18);
  --prose-quotes: rgba(240, 240, 240, 0.9);
  --prose-quote-borders: rgba(244, 242, 238, 0.18);
  --prose-captions: rgba(240, 240, 240, 0.6);
  --prose-kbd: #fff;
  --prose-kbd-shadows: rgb(255 255 255 / 10%);
  --prose-code: #fff;
  --prose-pre-code: rgba(240, 240, 240, 0.8);
  --prose-pre-bg: rgb(0 0 0 / 50%);
  --prose-th-borders: rgba(244, 242, 238, 0.3);
  --prose-td-borders: rgba(244, 242, 238, 0.14);
}

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

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

.prose [class~="lead"] {
  color: var(--prose-lead);
  font-size: var(--font-size-xl, 1.25rem);
  line-height: var(--leading-body, 1.6);
  margin-top: 1.2em;
  margin-bottom: 1.2em;
}

.prose a {
  color: var(--prose-links);
  text-decoration: underline;
  font-weight: 500;
}

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

.prose a strong,
.prose blockquote strong,
.prose thead th strong {
  color: inherit;
}

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

.prose ol {
  list-style-type: decimal;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-inline-start: 1.625em;
}

.prose ol[type="A"],
.prose ol[type="A" s] {
  list-style-type: upper-alpha;
}

.prose ol[type="a"],
.prose ol[type="a" s] {
  list-style-type: lower-alpha;
}

.prose ol[type="I"],
.prose ol[type="I" s] {
  list-style-type: upper-roman;
}

.prose ol[type="i"],
.prose ol[type="i" s] {
  list-style-type: lower-roman;
}

.prose ol[type="1"] {
  list-style-type: decimal;
}

.prose ul {
  list-style-type: disc;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-inline-start: 1.625em;
}

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

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

/* The site's legacy letter lists use a custom "•" ::before; prose uses
   native markers instead, so the pseudo-bullet must be suppressed. */
.prose li::before {
  content: none;
}

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

.prose ol > li,
.prose ul > li {
  padding-inline-start: 0.375em;
}

.prose > ul > li p {
  margin-top: 0.75em;
  margin-bottom: 0.75em;
}

.prose > ul > li > p:first-child,
.prose > ol > li > p:first-child {
  margin-top: 1.25em;
}

.prose > ul > li > p:last-child,
.prose > ol > li > p:last-child {
  margin-bottom: 1.25em;
}

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

.prose dl {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.prose dt {
  color: var(--prose-headings);
  font-weight: 600;
  margin-top: 1.25em;
}

.prose dd {
  margin-top: 0.5em;
  padding-inline-start: 1.625em;
}

/* --- Rules & quotes ------------------------------------------------------ */

.prose hr {
  margin-top: 3em;
  margin-bottom: 3em;
  border: 0;
  border-top: 1px solid var(--prose-hr);
}

.prose blockquote {
  font-weight: 500;
  font-style: italic;
  color: var(--prose-quotes);
  border-inline-start: 0.25rem solid var(--prose-quote-borders);
  quotes: "\201C""\201D""\2018""\2019";
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  padding-inline-start: 1em;
}

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

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

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

.prose h1 {
  color: var(--prose-headings);
  font-weight: 800;
  font-size: var(--font-size-3xl, 2rem);
  margin-top: 0;
  margin-bottom: 0.8888889em;
  line-height: 1.1111111;
}

.prose h1 strong {
  font-weight: 900;
  color: inherit;
}

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

.prose h2 strong {
  font-weight: 800;
  color: inherit;
}

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

.prose h3 strong {
  font-weight: 700;
  color: inherit;
}

.prose h4 {
  color: var(--prose-headings);
  font-weight: 600;
  font-size: var(--font-size-lg, 1.125rem);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.5;
}

.prose h4 strong {
  font-weight: 700;
  color: inherit;
}

/* --- Media --------------------------------------------------------------- */

.prose img,
.prose video {
  margin-top: 2em;
  margin-bottom: 2em;
}

.prose picture {
  display: block;
  margin-top: 2em;
  margin-bottom: 2em;
}

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

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

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

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

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

.prose kbd {
  font-weight: 500;
  font-family: inherit;
  color: var(--prose-kbd);
  box-shadow:
    0 0 0 1px var(--prose-kbd-shadows),
    0 3px 0 var(--prose-kbd-shadows);
  font-size: 0.875em;
  border-radius: 0.3125rem;
  padding-top: 0.1875em;
  padding-inline-end: 0.375em;
  padding-bottom: 0.1875em;
  padding-inline-start: 0.375em;
}

.prose code {
  color: var(--prose-code);
  font-weight: 600;
  font-size: var(--text-meta, 0.9375rem);
  font-family: var(--mono-font);
}

.prose code::before {
  content: "`";
}

.prose code::after {
  content: "`";
}

.prose a code,
.prose h1 code,
.prose h2 code,
.prose h3 code,
.prose h4 code,
.prose blockquote code,
.prose thead th code {
  color: inherit;
}

.prose h2 code {
  font-size: 0.875em;
}

.prose h3 code {
  font-size: 0.9em;
}

.prose pre {
  color: var(--prose-body);
  background: transparent;
  overflow-x: auto;
  scrollbar-width: thin;
  font-weight: 400;
  font-size: var(--text-meta, 0.9375rem);
  line-height: 1.7142857;
  font-family: var(--mono-font);
  margin-top: 1.7142857em;
  margin-bottom: 1.7142857em;
  padding-block: 1.5rem;
  padding-inline: 0;
  border-block: 1px solid var(--prose-hr);
  border-radius: 0;
}

.prose pre::-webkit-scrollbar {
  height: 4px;
}

.prose pre::-webkit-scrollbar-track {
  background: transparent;
}

.prose pre::-webkit-scrollbar-thumb {
  background: var(--prose-hr);
}

.prose pre code {
  background-color: transparent;
  border-width: 0;
  border-radius: 0;
  padding: 0;
  font-weight: inherit;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
}

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

/* --- Marked code reveals ------------------------------------------------- */

/* A fenced code block containing ◊ markers is rendered with this class.
   Its presentation matches ordinary prose code; only the viewport-triggered
   reveal differs. */

.code-reveal__step {
  opacity: 1;
}

.code-reveal.is-reveal-ready {
  opacity: 0;
}

.code-reveal.is-reveal-ready .code-reveal__step {
  opacity: 0;
}

.code-reveal.is-reveal-ready.is-revealed {
  opacity: 1;
  transition: opacity 540ms ease-out;
}

/* Each ◊-delimited chunk appears as a unit. The build step assigns the delay;
   there is no typewriter timer mutating the code one character at a time. */
.code-reveal.is-revealed .code-reveal__step {
  opacity: 1;
  transition: opacity 1ms steps(1, end) var(--reveal-delay);
}

@media print, (prefers-reduced-motion: reduce) {
  .code-reveal.is-reveal-ready,
  .code-reveal.is-reveal-ready .code-reveal__step {
    opacity: 1;
    transition: none;
  }
}

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

.prose table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  margin-top: 2em;
  margin-bottom: 2em;
  font-size: 0.875em;
  line-height: 1.7142857;
}

.prose thead {
  border-bottom: 1px solid var(--prose-th-borders);
}

.prose thead th {
  color: var(--prose-headings);
  font-weight: 600;
  vertical-align: bottom;
  padding-inline-end: 0.5714286em;
  padding-bottom: 0.5714286em;
  padding-inline-start: 0.5714286em;
}

.prose thead th:first-child {
  padding-inline-start: 0;
}

.prose thead th:last-child {
  padding-inline-end: 0;
}

.prose tbody tr {
  border-bottom: 1px solid var(--prose-td-borders);
}

.prose tbody tr:last-child {
  border-bottom-width: 0;
}

.prose tbody td {
  vertical-align: baseline;
}

.prose tbody td,
.prose tfoot td {
  padding-top: 0.5714286em;
  padding-inline-end: 0.5714286em;
  padding-bottom: 0.5714286em;
  padding-inline-start: 0.5714286em;
}

.prose tbody td:first-child,
.prose tfoot td:first-child {
  padding-inline-start: 0;
}

.prose tbody td:last-child,
.prose tfoot td:last-child {
  padding-inline-end: 0;
}

.prose tfoot {
  border-top: 1px solid var(--prose-th-borders);
}

.prose tfoot td {
  vertical-align: top;
}

.prose :is(th, td) {
  text-align: start;
}

/* --- Rhythm guards --------------------------------------------------------
   Collapse double spacing: nothing above the first child, nothing below
   the last, and no top margin on whatever follows a heading or rule. */

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

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

.prose :is(hr, h2, h3, h4) + * {
  margin-top: 0;
}
