/**
 * APSP — page content width (aligned with Cesare Benedetti / footer column).
 * Loads after apsp-modern.css to override full-bleed rules on inner pages.
 */

:root {
	--apsp-content-max: 1200px;
	--apsp-content-gutter: clamp(1rem, 3vw, 2rem);
	--apsp-header-chrome-max: var(--apsp-content-max);
}

/* —— Sticky footer: #content fills viewport below header (short pages too) —— */
body:not(.home) #page {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

body.admin-bar:not(.home) #page {
	min-height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar:not(.home) #page {
		min-height: calc(100vh - 46px);
	}
}

body:not(.home) #page > #content.site-content {
	/* Override style.css margin:auto + display:block (shrink-wraps width & blocks flex growth) */
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	align-self: stretch !important;
	flex: 1 1 0% !important;
	display: flex !important;
	flex-direction: column;
	min-height: 0;
	box-sizing: border-box;
	background-color: #fff;
}

body:not(.home) #page > #content.site-content > .ast-container {
	flex: 1 1 auto;
	width: 100%;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

body:not(.home) #page #content.site-content .apsp-page-wrap {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	width: 100%;
}

body:not(.home) .apsp-page-wrap > .container {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

body:not(.home) .apsp-page-wrap .site-main,
body:not(.home) .apsp-page-wrap article.page-content {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

body:not(.home) .apsp-page-wrap .entry-content {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* Short pages: grow main text column so white band is inside #content, not below it */
body:not(.home) .apsp-page-wrap .entry-content > .page-content-wrapper {
	flex: 1 1 auto;
}

body:not(.home) .apsp-page-wrap .page-content-wrapper,
body:not(.home) .apsp-page-wrap .apsp-at-layout,
body:not(.home) .apsp-page-wrap .apsp-at-layout__main.page-content-wrapper {
	flex: 1 0 auto;
	min-height: 0;
}

/* Single-column pages (page.php → .row > .col-md-12) */
body:not(.home) .apsp-page-wrap > .container > .row {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

body:not(.home) .apsp-page-wrap > .container > .row > [class*="col-"] {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

body.home #content.site-content > .ast-container {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

/* Inner pages: one centered column inside #content (homepage stays full width). */
body:not(.home) #page > #content.site-content > .ast-container {
	max-width: var(--apsp-content-max) !important;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--apsp-content-gutter) !important;
	padding-right: var(--apsp-content-gutter) !important;
	box-sizing: border-box;
}

body:not(.home) .apsp-page-wrap {
	width: 100%;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	overflow-x: hidden;
	box-sizing: border-box;
}

body:not(.home) .apsp-page-wrap > .container {
	max-width: none !important;
	width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

body:not(.home) .col-md-12 .page-content-wrapper,
body:not(.home) .entry-content .apsp-at-layout__main.page-content-wrapper,
body:not(.home) .entry-content .col-md-6 .page-content-wrapper {
	max-width: 100% !important;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

/* —— Align masthead, entry-header (title + breadcrumbs), and body to one column —— */

body:not(.home) .apsp-page-wrap > .container > .row {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

body:not(.home) .apsp-page-wrap > .container > .row > [class*="col-"] {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/*
 * Title / breadcrumb band: full-width background like masthead, text at same gutter as logo.
 * .ast-container has horizontal padding; pull the band edge-to-edge inside the 1200px column.
 */
body:not(.home) .apsp-page-wrap .entry-header {
	margin-left: calc(-1 * var(--apsp-content-gutter)) !important;
	margin-right: calc(-1 * var(--apsp-content-gutter)) !important;
	padding: 1.25rem var(--apsp-content-gutter) !important;
	width: auto;
	max-width: none;
	box-sizing: border-box;
}

body:not(.home) .apsp-page-wrap .entry-content {
	padding-left: 0 !important;
	padding-right: 0 !important;
	padding-top: 1.5rem;
	padding-bottom: 2rem;
	margin-top: 0 !important;
}

/* apsp-modern adds 2rem horizontal pad on .page-content-wrapper — drop it for alignment */
body:not(.home) .apsp-page-wrap .page-content-wrapper,
body:not(.home) .apsp-page-wrap .col-md-12 .page-content-wrapper,
body:not(.home) .apsp-page-wrap .apsp-at-layout__main.page-content-wrapper {
	padding-left: 0 !important;
	padding-right: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 2rem !important;
}

@media (min-width: 768px) {
	body:not(.home) .apsp-page-wrap .col-md-12 .page-content-wrapper {
		padding-bottom: 3rem !important;
	}
}

body:not(.home) .apsp-page-wrap .entry-content > .row {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

body:not(.home) .apsp-page-wrap .page-content h1,
body:not(.home) .apsp-page-wrap .page-content h2,
body:not(.home) .apsp-page-wrap .page-content h3 {
	padding-left: 0;
}

/* WPBakery “full width” rows: keep inside the content column, not viewport. */
body:not(.home) .apsp-page-wrap .vc_row[data-vc-full-width="true"] {
	left: auto !important;
	right: auto !important;
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

body:not(.home) .apsp-page-wrap .vc_row[data-vc-full-width="true"] > .wpb_column,
body:not(.home) .apsp-page-wrap .vc_row[data-vc-full-width="true"] > .vc_column_container {
	padding-left: 15px;
	padding-right: 15px;
}

body:not(.home) .apsp-page-wrap .wpb-content-wrapper,
body:not(.home) .apsp-page-wrap .entry-content > .wpb-content-wrapper {
	max-width: 100%;
	overflow-x: auto;
}
