/**
 * Theme-wide scroll offset.
 *
 * theme.json custom.scrollOffset is one calc of everything that can pin to the
 * top: the admin bar, a sticky header, the anchor nav. Each term is a variable
 * with a 0px fallback, so the token is right on every page; a pinned thing
 * sets its own variable on :root when it is there (anchor-nav/style.css sets
 * --anchor-nav-height; a sticky header would set --sticky-header-height).
 * --scroll-offset-extra is the child theme's term: set it on :root, as a
 * value or a calc of its own, for anything site-specific that pins.
 *
 * The two consumers live here. Fragment links land flush under the pinned
 * chrome (sections carry their own top padding). Sticky groups sit one gap
 * below it, full-width ones flush; the rule replaces core's per-block `top` (one class, from the
 * Position panel's fixed "0px"), so no markup ever carries a `top` value.
 */
html {
	scroll-padding-top: var(--wp--custom--scroll-offset);
}

/* Fragment links glide rather than jump, unless the reader has asked the OS
   for less motion. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

.wp-block-group.is-position-sticky {
	top: calc(var(--wp--custom--scroll-offset) + var(--wp--preset--spacing--l));
}

/* A full-width band (a search strip, a filter bar) pins flush: its own
   background is the edge, and a gap above it would show content scrolling
   past through the slot. */
.wp-block-group.alignfull.is-position-sticky {
	top: var(--wp--custom--scroll-offset);
}
