/**
 * Block layout shell for qterra content in the classic Twig theme.
 *
 * Mirrors the FSE template structure: main.alignfull > .wp-site-blocks.is-root-container
 */

html {
	overflow-x: clip;
}

body {
	overflow-x: clip;
	/* Vite/Tailwind main.css overrides theme.json body size — restore WP preset */
	font-size: var(--wp--preset--font-size--normal);
	line-height: 1.5;
	letter-spacing: normal;
}

/*
 * wp-block-library inline CSS can override theme.json fluid font presets with
 * fixed sizes. Re-assert the same clamps WordPress emits from theme.json.
 */
:root {
	--wp--preset--font-size--small: clamp(13px, 0.813rem + ((1vw - 3.2px) * 0.109), 14px);
	--wp--preset--font-size--normal: clamp(15px, 0.938rem + ((1vw - 3.2px) * 0.326), 18px);
	--wp--preset--font-size--medium: clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.652), 20px);
	--wp--preset--font-size--large: clamp(16px, 1rem + ((1vw - 3.2px) * 0.652), 22px);
	--wp--preset--font-size--extra-large: clamp(20px, 1.25rem + ((1vw - 3.2px) * 0.87), 28px);
	--wp--preset--font-size--huge: clamp(28px, 1.75rem + ((1vw - 3.2px) * 1.304), 40px);
	--wp--preset--font-size--gigantic: clamp(36px, 2.25rem + ((1vw - 3.2px) * 2.174), 56px);
}

.site-main,
.site-footer--template-part {
	overflow-x: clip;
}

.site-header,
.site-header--template-part {
	overflow: visible;
	position: relative;
	z-index: 50;
	padding: 0;
}

.site-main.wp-block-group.alignfull {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

.site-main .wp-site-blocks.is-root-container {
	width: 100%;
	max-width: none;
}

/*
 * Shell wrappers (qterra-single / qterra-archive) sit outside the content width
 * constraint; blocks inside .wp-block-post-content keep FSE alignfull behaviour.
 */
.site-main :is(.qterra-single, .qterra-archive) {
	width: 100%;
	max-width: none;
}

/*
 * FSE post-content layout: matches block theme page/single templates.
 */
.site-main .wp-block-post-content.is-layout-constrained > :where(:not(.alignfull):not(.alignwide):not(.alignright):not(.alignleft):not(.aligncenter)),
.site-main :is(.qterra-single, .qterra-archive) > .wp-block-post-content.is-layout-constrained > :where(:not(.alignfull):not(.alignwide):not(.alignright):not(.alignleft):not(.aligncenter)) {
	max-width: var(--wp--style--global--content-size, 900px);
	margin-left: auto;
	margin-right: auto;
}

.site-main .wp-block-post-content.has-global-padding {
	padding-right: var(--wp--style--root--padding-right, var(--wp--preset--spacing--40));
	padding-left: var(--wp--style--root--padding-left, var(--wp--preset--spacing--40));
}

.site-main .wp-block-post-content.has-global-padding > .alignfull,
.site-main :is(.qterra-single, .qterra-archive) > .wp-block-post-content.has-global-padding > .alignfull {
	margin-right: calc(var(--wp--style--root--padding-right, var(--wp--preset--spacing--40)) * -1);
	margin-left: calc(var(--wp--style--root--padding-left, var(--wp--preset--spacing--40)) * -1);
}

/*
 * Legacy nesting: shell wrapper inside constrained post-content (should not happen
 * after template fix, but prevents cropped alignfull heroes if it does).
 */
.site-main .wp-block-post-content.is-layout-constrained > :is(.qterra-single, .qterra-archive) {
	max-width: none;
	width: 100%;
}

.site-main .wp-block-post-content.is-layout-constrained > :is(.qterra-single, .qterra-archive) > :where(:not(.alignfull):not(.alignwide):not(.alignright):not(.alignleft):not(.aligncenter)) {
	max-width: var(--wp--style--global--content-size, 900px);
	margin-left: auto;
	margin-right: auto;
}

.site-main .wp-block-post-content.has-global-padding > :is(.qterra-single, .qterra-archive) > .alignfull {
	margin-right: calc(var(--wp--style--root--padding-right, var(--wp--preset--spacing--40)) * -1);
	margin-left: calc(var(--wp--style--root--padding-left, var(--wp--preset--spacing--40)) * -1);
}

/* WordPress font-size presets (Tailwind base resets paragraph/heading sizes). */
:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-small-font-size {
	font-size: var(--wp--preset--font-size--small) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-normal-font-size {
	font-size: var(--wp--preset--font-size--normal) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-medium-font-size {
	font-size: var(--wp--preset--font-size--medium) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-large-font-size {
	font-size: var(--wp--preset--font-size--large) !important;
	line-height: 1.5;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-extra-large-font-size,
:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-x-large-font-size {
	font-size: var(--wp--preset--font-size--extra-large) !important;
	line-height: 1.5;
}

/* About-style intro paragraphs — spacing only; size comes from font-size presets */
.site-main .wp-block-post-content > :is(p, .wp-block-paragraph).has-large-font-size {
	margin-top: var(--wp--preset--spacing--50);
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-huge-font-size {
	font-size: var(--wp--preset--font-size--huge) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .has-gigantic-font-size {
	font-size: var(--wp--preset--font-size--gigantic) !important;
}

.site-footer--template-part {
	width: 100%;
	max-width: none;
	margin-top: 0;
}

.site-footer--template-part .wp-block-group.footer,
.site-footer--template-part .wp-block-group.is-style-section-contrast.footer {
	width: 100%;
	max-width: none;
	margin: 0;
	border-radius: 0;
}

/*
 * Footer section padding + nav spacing.
 * Twig may render the footer group outside `.wp-block-template-part`;
 * group.css also targets `.footer` directly — keep explicit fallback here.
 */
.wp-block-group.footer[class*="is-style-section-"],
.site-footer--template-part .wp-block-group.footer {
	margin-top: 0;
	padding-top: var(--wp--custom--global--spacing--padding--section) !important;
	padding-bottom: var(--wp--custom--global--spacing--padding--section) !important;
	padding-left: var(--wp--preset--spacing--40);
	padding-right: var(--wp--preset--spacing--40);
	border-radius: 0;
}

/* Match production vertical nav gap (1.5rem / 24px) */
.wp-block-group.footer .wp-block-navigation .wp-block-navigation__container,
.wp-block-group.footer .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--50) !important;
}

.wp-block-group.footer .wp-block-navigation-item__content {
	line-height: 1.5;
	padding-block: 0;
}

/*
 * Tailwind preflight (main-css) resets h1–h6 to font-size/weight inherit after
 * global-styles load. Restore block heading typography and alignment utilities.
 */
:is(.site-main, .site-header--template-part, .site-footer--template-part) :is(h1, h2, h3, h4, h5, h6).wp-block-heading {
	font-family: var(--wp--custom--global--typography--font-family--heading);
	font-weight: 700;
	line-height: 1.1;
	color: currentColor;
	margin-bottom: 0;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h1.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--gigantic) !important;
	line-height: 1.05;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h2.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--huge) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h3.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--extra-large) !important;
	line-height: 1.15;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h4.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--large) !important;
	line-height: 1.2;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h5.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--normal) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) h6.wp-block-heading:not([class*='-font-size']) {
	font-size: var(--wp--preset--font-size--small) !important;
	text-transform: uppercase;
}

/*
 * Font-size presets on headings must beat the element defaults above
 * (same as theme.json / old qterra theme behaviour).
 */
:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-small-font-size {
	font-size: var(--wp--preset--font-size--small) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-normal-font-size {
	font-size: var(--wp--preset--font-size--normal) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-medium-font-size {
	font-size: var(--wp--preset--font-size--medium) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-large-font-size {
	font-size: var(--wp--preset--font-size--large) !important;
	line-height: 1.5;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-extra-large-font-size,
:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-x-large-font-size {
	font-size: var(--wp--preset--font-size--extra-large) !important;
	line-height: 1.15;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-huge-font-size {
	font-size: var(--wp--preset--font-size--huge) !important;
}

:is(.site-main, .site-header--template-part, .site-footer--template-part) .wp-block-heading.has-gigantic-font-size {
	font-size: var(--wp--preset--font-size--gigantic) !important;
}

/*
 * Flex/grid layouts use gap for spacing. Match global-styles child margin reset so
 * heading margins do not stack on top of layout gap (e.g. USP row on over-qterra).
 */
:is(.site-main, .site-header--template-part, .site-footer--template-part)
	:is(.is-layout-flex, .is-layout-grid)
	> :is(*, div) {
	margin: 0;
}

.wp-block-heading.has-text-align-left,
.wp-block-paragraph.has-text-align-left,
p.has-text-align-left,
.has-text-align-left {
	text-align: left;
}

.wp-block-heading.has-text-align-center,
.wp-block-paragraph.has-text-align-center,
p.has-text-align-center,
.has-text-align-center {
	text-align: center;
}

.wp-block-heading.has-text-align-right,
.wp-block-paragraph.has-text-align-right,
p.has-text-align-right,
.has-text-align-right {
	text-align: right;
}

/* Cover blocks default to centered text; respect explicit alignment classes. */
.wp-block-cover .wp-block-heading.has-text-align-left,
.wp-block-cover .wp-block-paragraph.has-text-align-left,
.wp-block-cover p.has-text-align-left {
	text-align: left;
}

.wp-block-cover .wp-block-heading.has-text-align-center,
.wp-block-cover .wp-block-paragraph.has-text-align-center,
.wp-block-cover p.has-text-align-center {
	text-align: center;
}

.wp-block-cover .wp-block-heading.has-text-align-right,
.wp-block-cover .wp-block-paragraph.has-text-align-right,
.wp-block-cover p.has-text-align-right {
	text-align: right;
}
