/* ==========================================================================
   Chapters (extension) — frontend styles
   --------------------------------------------------------------------------
   Enqueued when a chapters container or chapter renders. Snap is native
   CSS scroll-snap on the document scroller (proximity, never mandatory:
   scrolling stays free, it only settles on chapter starts).
   Theme hooks: --ch-chapters-offset (space above a chapter start, e.g. a
   sticky header height; default 0).
   ========================================================================== */

.ch-chapter {
	scroll-margin-top: var(--ch-chapters-offset, 0px);
}

.ch-chapters--snap .ch-chapter {
	scroll-snap-align: start;
}

html:has(.ch-chapters--snap) {
	scroll-snap-type: y proximity;
}

/* Forced snap («one chapter per gesture»): view.js adds the html class
   only while a forced container fills the viewport; scroll-snap-stop
   keeps a fling from skipping a chapter. */
html.ch-chapters-snapping {
	scroll-snap-type: y mandatory;
}

.ch-chapters--snap-forced .ch-chapter {
	scroll-snap-stop: always;
}

@media (prefers-reduced-motion: reduce) {
	html:has(.ch-chapters--snap),
	html.ch-chapters-snapping {
		scroll-snap-type: none;
	}
}

/* Chapters from a Query Loop: the post template is a plain stack (no
   gap between chapters); each list item is just a wrapper. */
.ch-chapters .wp-block-post-template {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ch-chapters .wp-block-post-template > .wp-block-post {
	margin: 0;
}
