/* Layout v1 is opt-in. Keep the existing shell and all legacy page rules. */
body.gfd-layout-v1 {
	--gfd-layout-header-height: var(--gfd-header-height);
	--gfd-layout-anchor-gap: 24px;
	--gfd-layout-page-top: 56px;
	--gfd-layout-content-max: 1120px;
	--gfd-layout-content-wide: 1240px;
	--gfd-layout-section-space: 72px;
	--gfd-layout-gutter: 24px;
}

body.gfd-layout-v1 :is(#content, #content [id]:target, #content h2[id], #content h3[id]) {
	scroll-margin-top: calc(var(--gfd-layout-header-height) + var(--gfd-layout-anchor-gap));
}

/* WP 850 owns its copy in post_content. Only its outer page rhythm changes. */
body.gfd-page-type-utility main.gfd-thankyou {
	padding-top: var(--gfd-layout-page-top);
}
body.gfd-page-type-utility .gfd-thankyou__container {
	max-width: var(--gfd-layout-content-max);
	width: calc(100% - var(--gfd-layout-gutter) - var(--gfd-layout-gutter));
}
body.gfd-page-type-utility .gfd-thankyou__section {
	padding-top: var(--gfd-layout-section-space);
}

/* The posts index is generated by WordPress/Astra, not its saved page body. */
body.gfd-page-type-blog-index .ast-archive-entry-banner {
	padding-top: var(--gfd-layout-page-top);
}
body.gfd-page-type-blog-index .ast-archive-entry-banner[data-post-type="post"] .ast-container h1 {
	color: var(--gfd-deep);
	font-size: clamp(28px, 3vw, 40px);
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
}
body.gfd-page-type-blog-index #content > .ast-container {
	max-width: var(--gfd-layout-content-wide);
	padding-inline: var(--gfd-layout-gutter);
}
body.gfd-page-type-blog-index .ast-archive-entry-banner > .ast-container {
	padding-inline: var(--gfd-layout-gutter);
}

/* The native Contact template adds Astra's entry-content wrapper. Restore
 * the page-owned hero heading's original type scale in that wrapper. */
body.gfd-page-type-contact .entry-content .hero h1 {
	font-size: clamp(36px, 5vw, 58px);
	line-height: 1.18;
	letter-spacing: -0.04em;
}

/* Contact headings keep the capitalization already present in page content. */
body.gfd-page-type-contact .entry-content :is(h1, h2, h3) {
	text-transform: none;
}

/* The About page keeps its wide company sections. On narrow screens, show
 * the semantic page heading before the resource cards and workshop photo. */
@media (max-width: 720px) {
	body.gfd-page-type-company .gfd-c2-visual .hero-grid .hero-side {
		order: 0;
	}
}

@media (max-width: 960px) {
	body.gfd-layout-v1 {
		--gfd-layout-anchor-gap: 20px;
		--gfd-layout-page-top: 40px;
		--gfd-layout-section-space: 56px;
		--gfd-layout-gutter: 20px;
	}
}

@media (max-width: 480px) {
	body.gfd-layout-v1 {
		--gfd-layout-anchor-gap: 16px;
		--gfd-layout-page-top: 32px;
		--gfd-layout-section-space: 40px;
		--gfd-layout-gutter: 16px;
	}
}

/* Reserve the Home hero's right lane for the fixed contact controls. */
@media (max-width: 960px) {
	body.gfd-page-type-home .gfd-hero-content {
		padding-right: calc(74px + max(20px, env(safe-area-inset-right)));
	}
}
@media (max-width: 767px) {
	body.gfd-page-type-home .gfd-hero-content {
		padding-right: calc(64px + max(12px, env(safe-area-inset-right)));
	}
}
@media (max-width: 370px) {
	body.gfd-page-type-home .gfd-hero-content {
		padding-right: calc(60px + max(9px, env(safe-area-inset-right)));
	}
}
