/**
 * GUL Block Rhythm — kills stacking white space across all gul/* blocks.
 *
 * THE PROBLEM
 * -----------
 * Every block ships with its own inner-section padding (typically padding: 6rem 0
 * on .gul-faq-section, .gul-hero-section, etc). When five blocks stack, you get
 * 5 × 12rem = 60rem of dead vertical air between sections, because every block
 * pays for its OWN top AND bottom margin. On mobile, where viewports are short,
 * this means the user scrolls past blank space between every meaningful section.
 *
 * THE FIX
 * -------
 * Two scoped rules with no side effects on per-block styling:
 *
 *   1. When TWO gul/* blocks are direct siblings (the common case inside
 *      entry-content / wp-site-blocks), reduce the SECOND block's top padding
 *      by 40%. The shared seam now reads as a single beat, not two.
 *
 *   2. The gul-py-* preset classes (already exposed in the Stackable-parity
 *      inspector under "GUL — Spacing & Width") are rewired to a single
 *      authoritative scale, so authors who explicitly pick a spacing get a
 *      predictable result that survives the seam reduction above.
 *
 * SPECIFICITY NOTES
 * -----------------
 * Per-block style.css files use class selectors with (0,1,0) specificity.
 * The seam-reduction selector below has (0,3,0) because it chains three
 * attribute selectors + a :where() with class selectors that contribute 0.
 * So this file always wins for the seam case, without forcing !important.
 *
 * Enqueued by GUL_Block_Controls AFTER per-block styles so source order
 * also stacks in our favor.
 */

/* ---------- 1. Reduce the shared seam between adjacent GUL blocks ---------- */
[class*="wp-block-gul-"] + [class*="wp-block-gul-"] :where(section, .gul-section, [class*="-section"]) {
	padding-top: clamp(2rem, 4vw, 3.5rem);
}

/* On mobile the issue compounds — tighten further */
@media (max-width: 768px) {
	[class*="wp-block-gul-"] + [class*="wp-block-gul-"] :where(section, .gul-section, [class*="-section"]) {
		padding-top: 1.5rem;
	}
}

/* ---------- 2. Authoritative spacing presets ---------- */
/* These re-define gul-py-* (originally set in block-controls.css with hardcoded
 * px values) onto a single fluid scale that respects viewport size. Same class
 * names, same author flow — but now the rhythm scales with screen size. */
.gul-py-tight  { padding-block: clamp(1rem,   3vw, 1.5rem); }
.gul-py-normal { padding-block: clamp(2rem,   5vw, 3rem); }
.gul-py-lg     { padding-block: clamp(3rem,   7vw, 5rem); }
.gul-py-xl     { padding-block: clamp(4rem,  10vw, 7.5rem); }

/* ---------- 3. Block-edge "first/last" rules ---------- */
/* The first GUL block on a page sits right under the header; its top padding
 * is the visual breathing room. The last one sits above the footer; same idea.
 * No change to first/last. The seam fix above only affects middles. */

/* ---------- 4. Hero exception ---------- */
/* Hero owns a min-height and a bg pattern. Its top padding is part of the
 * design, not seam space. Never reduce hero's top padding. */
.wp-block-gul-hero + [class*="wp-block-gul-"] :where(section, .gul-section, [class*="-section"]) {
	/* Hero's bottom + next block's top together still feel like ONE beat */
	padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

/* ---------- 5. Sections that have a background should keep their own pad ---------- */
/* If a block sets a colored or gradient bg, removing its top padding makes the
 * color band feel cramped. Detect via the GUL color scheme classes (which only
 * exist when the author picked a non-default scheme) and preserve full padding. */
[class*="wp-block-gul-"] + [class*="wp-block-gul-"].gul-scheme-blue   :where(section, .gul-section, [class*="-section"]),
[class*="wp-block-gul-"] + [class*="wp-block-gul-"].gul-scheme-orange :where(section, .gul-section, [class*="-section"]),
[class*="wp-block-gul-"] + [class*="wp-block-gul-"].gul-scheme-dark   :where(section, .gul-section, [class*="-section"]) {
	padding-top: clamp(3rem, 6vw, 5rem);
}
