/* ==========================================================================
   Long-form content. Everything inside .prose is rendered from Markdown, so
   these styles target plain elements rather than classes.
   ========================================================================== */

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }

/* --- Headings ----------------------------------------------------------- */
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  line-height: 1.25;
  letter-spacing: -.02em;
  scroll-margin-top: 5.5rem;
  overflow-wrap: break-word;
}
.prose h2 {
  margin-top: var(--space-8); margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  font-size: var(--step-3); font-weight: 650;
  border-bottom: 1px solid var(--border);
}
.prose h3 { margin-top: var(--space-6); margin-bottom: var(--space-3); font-size: var(--step-2); font-weight: 620; }
.prose h4 { margin-top: var(--space-5); font-size: var(--step-1); font-weight: 620; }
.prose h5, .prose h6 {
  margin-top: var(--space-5); font-size: var(--step-0); font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
}
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }

/* Anchor links are added by theme.js; hidden until the heading is hovered. */
.heading-anchor {
  margin-left: .4em; color: var(--text-dim); text-decoration: none;
  opacity: 0; font-weight: 400; transition: opacity var(--transition);
}
:is(h2, h3, h4):hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }

/* --- Text --------------------------------------------------------------- */
.prose p { overflow-wrap: break-word; }
.prose strong { font-weight: 650; color: var(--text); }
.prose a { overflow-wrap: anywhere; }

.prose hr {
  border: 0; border-top: 1px solid var(--border);
  margin-block: var(--space-7);
}

/* --- Lists -------------------------------------------------------------- */
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: var(--space-2); }
.prose li > ul, .prose li > ol { margin-top: var(--space-2); }
.prose ul { list-style: none; padding-left: 1.3em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: ""; position: absolute; left: -1em; top: .62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong);
}
.prose ol { list-style: decimal; }
.prose ol::marker, .prose li::marker { color: var(--text-dim); }

/* --- Blockquotes -------------------------------------------------------- */
.prose blockquote {
  margin-inline: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface); border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }

/* --- Alerts (github-markdown-alerts plugin) ------------------------------
   The plugin emits `.markdown-alert.markdown-alert-<type>` with a title span.
   Styled here so > [!WARNING] blocks look native to the theme.             */
.markdown-alert {
  margin-block: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--alert-color, var(--border-strong));
  border-radius: 0 var(--radius) var(--radius) 0;
}
.markdown-alert > :first-child { margin-top: 0; }
.markdown-alert > :last-child { margin-bottom: 0; }
.markdown-alert-title {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: var(--space-2);
  font-weight: 650; font-size: .9rem;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--alert-color, var(--text));
}
.markdown-alert-note      { --alert-color: #3B82F6; }
.markdown-alert-tip       { --alert-color: #3FB950; }
.markdown-alert-important { --alert-color: var(--accent); }
.markdown-alert-warning   { --alert-color: #D29922; }
.markdown-alert-caution   { --alert-color: #F85149; }

/* --- Tables ------------------------------------------------------------- */
/* Wrapped by theme.js so a wide table scrolls itself instead of the page. */
.table-scroll {
  overflow-x: auto;
  margin-block: var(--space-5);
  border: 1px solid var(--border); border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%; border-collapse: collapse;
  font-size: .93rem;
}
.prose thead th {
  position: sticky; top: 0;
  background: var(--surface-2); text-align: left;
  font-weight: 620; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  white-space: nowrap;
}
.prose th, .prose td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--surface); }
.prose td code { white-space: nowrap; }

/* --- Images ------------------------------------------------------------- */
.prose img { border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.prose figure { margin-inline: 0; }
.prose figcaption, .prose img + em {
  display: block; margin-top: var(--space-2);
  font-size: .86rem; color: var(--text-dim); text-align: center;
}

/* --- Footnotes ---------------------------------------------------------- */
.prose .footnotes { margin-top: var(--space-7); padding-top: var(--space-4); border-top: 1px solid var(--border); font-size: .92rem; color: var(--text-muted); }
