/**
 * Shared page shell — one width for header, main (incl. sidebars), footer.
 * Cap = Bootstrap 5 container-xxl (82.5rem / 1320px at 16px root).
 */
:root {
	--rt-gutter: clamp(1rem, 2.5vw, 2rem);
	--rt-shell: min(100% - 2 * var(--rt-gutter), 82.5rem);
	--rt-sidebar: 18rem;
}

/* Stock Cassiopeia chrome stays in the parent index.php (so core updates keep it).
   The Rivertickets shell replaces it visually. */
body.has-rt-site-header > header.container-header,
body.has-rt-site-footer > footer.container-footer {
	display: none;
}

.rt-site-header__toolbar,
.rt-site-header__navbar-inner,
.rt-site-footer__inner,
body.has-rt-site-header .site-grid {
	width: var(--rt-shell);
	max-width: none;
	margin-inline: auto;
	box-sizing: border-box;
}

/* Cassiopeia page-grid would re-constrain the main column and break header alignment,
   especially when a sidebar is present. Keep modules, drop the 6-track layout. */
body.has-rt-site-header .site-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"banner"
		"top-a"
		"top-b"
		"comp"
		"side-r"
		"side-l"
		"bot-a"
		"bot-b";
	column-gap: 0;
	row-gap: 0;
}

body.has-rt-site-header .site-grid > .grid-child,
body.has-rt-site-header .site-grid > [class^="container-"],
body.has-rt-site-header .site-grid > [class*=" container-"] {
	width: 100%;
	max-width: none;
	margin-inline: 0;
	padding-inline: 0;
	min-width: 0;
}

body.has-rt-site-header .site-grid .container-component,
body.has-rt-site-header:not(.has-sidebar-left) .site-grid .container-component,
body.has-rt-site-header:not(.has-sidebar-right) .site-grid .container-component {
	grid-column-start: auto;
	grid-column-end: auto;
}

/* Cassiopeia sizes sidebars as 25% of the row; fill our shell tracks instead. */
body.has-rt-site-header .site-grid .container-sidebar-left,
body.has-rt-site-header .site-grid .container-sidebar-right {
	width: 100%;
	max-width: none;
	order: 0;
}

@media (min-width: 992px) {
	body.has-rt-site-header.has-sidebar-right:not(.has-sidebar-left) .site-grid {
		grid-template-columns: minmax(0, 1fr) var(--rt-sidebar);
		grid-template-areas:
			"banner banner"
			"top-a top-a"
			"top-b top-b"
			"comp side-r"
			"bot-a bot-a"
			"bot-b bot-b";
		column-gap: 1.5rem;
	}

	body.has-rt-site-header.has-sidebar-left:not(.has-sidebar-right) .site-grid {
		grid-template-columns: var(--rt-sidebar) minmax(0, 1fr);
		grid-template-areas:
			"banner banner"
			"top-a top-a"
			"top-b top-b"
			"side-l comp"
			"bot-a bot-a"
			"bot-b bot-b";
		column-gap: 1.5rem;
	}

	body.has-rt-site-header.has-sidebar-left.has-sidebar-right .site-grid {
		grid-template-columns: var(--rt-sidebar) minmax(0, 1fr) var(--rt-sidebar);
		grid-template-areas:
			"banner banner banner"
			"top-a top-a top-a"
			"top-b top-b top-b"
			"side-l comp side-r"
			"bot-a bot-a bot-a"
			"bot-b bot-b bot-b";
		column-gap: 1.5rem;
	}
}
