How to control whitespace before and after run-in headings

The trick in How can I prevent indent on paragraphs with run-in headings? - #2 by ensko breaks the other trick to suppress space between adjacent headings, so I am sticking with negative indentation. New code, which also adds negative space to address my complaint of the unwanted space after the heading’s supplement:

#set par(justify: true, first-line-indent: (amount: 1em, all: false), spacing: 0.6em)

#let body-size = 11pt
#set text(font: "New Computer Modern", size: body-size)

#set heading(numbering: "1.1." + sym.space.quad)

#show heading.where(level: 1): smallcaps
#show heading.where(level: 1): set align(center)
#show heading.where(level: 1): set text(size: 13pt, weight: "regular")

#let space-above-inline-heads = 1em

#show heading.where(level: 2): set text(size: body-size)
#show heading.where(level: 2): it => {
  v(space-above-inline-heads)
  h(-par.first-line-indent.amount)
  counter(heading).display()
  it.body
  if it.body.text.last() not in (".", "?", "!") { "." }
  "---"
  h(-0.2em)
}

#show heading.where(level: 3): set text(size: body-size, weight: "regular")
#show heading.where(level: 3): it => {
  v(space-above-inline-heads)
  h(-par.first-line-indent.amount)
  // The alternative to negative h() is the trick from https://forum.typst.app/t/how-can-i-prevent-indent-on-paragraphs-with-run-in-headings/3214/2 which breaks the other trick to reduce space between consecutive headings.
  emph({
    counter(heading).display()
    it.body
    if it.body.text.last() not in (".", "?", "!") { "." }
    "---"
    h(-0.2em)
  })
}

// Clever trick to reduce spacing between consecutive headings
// See https://github.com/typst/typst/issues/2953#issuecomment-3187505828
#show heading: it => {
  let previous-headings = query(selector(heading).before(here(), inclusive: false))
  if previous-headings.len() > 0 {
    let ploc = previous-headings.last().location().position()
    let iloc = it.location().position()
    if (iloc.page == ploc.page and iloc.x == ploc.x and iloc.y - ploc.y < 30pt) { // Threshold
      v(-10pt) // Amount to reduce spacing, could make this dependent on it.level
    }
  }
  it
}

= Introduction
#lorem(25)

#lorem(15)

== Motivation
#lorem(20)

=== Subsubsection
#lorem(15)

== Etc.
=== Subsubsection
#lorem(10)

This has a strange result: different spacing after the level-3 heading’s supplement in the two instances of the H3. Screenshot with box highlighting to prove that there is misalignment:

I do not understand why “1.1.1. Subsubsection.—” and “1.2.1. Subsubsection.—” would not have the same spacing after each since their supplements are generated by the same show rule.