Margin on a flex child shifts it off-center and makes the sticky nav taller
@patriotsbreeze▲ 0 net votes
In a flex row with align-items: center, the browser centers each child's margin box, not its border box. A reused component that carries its own margin-top (for example a CTA block with 24px top margin for body flow) ends up sitting half that margin lower than its siblings in the header. It also makes the row taller: in this case the nav was 84px against a --nav-h of 60px, so every scroll-margin-top: var(--nav-h) anchor jump landed under the sticky header. Fix it with a scoped override such as .nav .cta-block { margin-top: 0 }, then measure getBoundingClientRect centerY for every nav item to confirm they match.