/* MAS Portfolio Core v2 — reversible presentation layer for six exact domains. */
:root {
	--masnc-primary: #0b2b40;
	--masnc-secondary: #2f6686;
	--masnc-accent: #d66836;
	--masnc-ink: #071c24;
	--masnc-surface: #f2f5f6;
	--masnc-radius: 18px;
	--masnc-hero-overlay: 0.3;
	--masnc-shadow-sm: 0 12px 30px rgba(7, 28, 36, 0.1);
	--masnc-shadow-lg: 0 28px 70px rgba(7, 28, 36, 0.18);
	--masnc-section-space: clamp(5rem, 8vw, 8rem);
	--masnc-content: 1240px;
}

.masnc-active {
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

.masnc-density-compact {
	--masnc-section-space: clamp(4rem, 6vw, 6rem);
}

.masnc-density-generous {
	--masnc-section-space: clamp(6rem, 10vw, 10rem);
}

.masnc-active :where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid color-mix(in srgb, var(--masnc-accent) 82%, white);
	outline-offset: 3px;
}

.masnc-active :where(img, svg) {
	max-width: 100%;
}

.masnc-managed-media,
.masnc-managed-feature {
	display: block;
}

.masnc-media-attribution {
	position: absolute;
	z-index: 4;
	right: 0.65rem;
	bottom: 0.65rem;
	max-width: calc(100% - 1.3rem);
	padding: 0.3rem 0.48rem;
	border-radius: 4px;
	background: rgba(4, 18, 27, 0.78);
	color: #fff;
	font: 600 0.65rem/1.35 ui-sans-serif, system-ui, sans-serif;
	letter-spacing: 0.01em;
}

.masnc-attribution-parent {
	position: relative;
}

/* Shared component finish for the four MAS Portfolio Core layouts. */
.masnc-active .maspc-shell {
	--masnc-copy-width: 68ch;
}

.masnc-active .maspc-shell .maspc-container {
	width: min(calc(100% - 3rem), var(--masnc-content));
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) {
	min-height: min(880px, calc(100svh - 64px));
	overflow: clip;
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.03fr) minmax(420px, 0.97fr);
	align-items: center;
	gap: clamp(2.5rem, 5.5vw, 5.5rem);
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) h1 {
	max-width: 13ch;
	margin-block: 0.45rem 1.4rem;
	font-size: clamp(3.25rem, 5vw, 4.9rem);
	letter-spacing: -0.048em;
	line-height: 0.95;
	text-wrap: balance;
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-lede {
	max-width: var(--masnc-copy-width);
	font-size: clamp(1.08rem, 1.5vw, 1.35rem);
	line-height: 1.65;
}

.masnc-active .maspc-shell .maspc-eyebrow {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.18em;
}

.masnc-active .maspc-shell .maspc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.85rem;
	margin-top: 2rem;
}

.masnc-active .maspc-shell .maspc-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding-inline: 1.25rem;
	border-radius: 4px;
	font-weight: 800;
	transition: transform 180ms ease, box-shadow 180ms ease;
}

.masnc-active .maspc-shell .maspc-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(7, 28, 36, 0.18);
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual {
	position: relative;
	min-height: 610px;
	overflow: hidden;
	border-radius: var(--masnc-radius);
	background: color-mix(in srgb, var(--masnc-primary) 9%, white);
	box-shadow: var(--masnc-shadow-lg);
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual::after {
	position: absolute;
	z-index: 2;
	inset: 0;
	pointer-events: none;
	content: "";
	background: linear-gradient(180deg, transparent 45%, rgb(7 28 36 / var(--masnc-hero-overlay)) 100%);
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual > .masnc-media-slot--hero {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: none;
}

.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual img.masnc-managed-media,
.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual > img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.masnc-active .maspc-shell .maspc-code-art[hidden],
.masnc-active .maspc-shell .maspc-hero-visual.masnc-media-ready .maspc-code-art,
.masnc-active .maspc-shell .maspc-hero-visual [data-masnc-placeholder][hidden] {
	display: none !important;
}

.masnc-active .maspc-shell .maspc-section {
	padding-block: var(--masnc-section-space);
}

.masnc-active .maspc-shell :where(.maspc-card, .maspc-path-card, .maspc-step, .maspc-proof-card) {
	border-radius: var(--masnc-radius);
	box-shadow: var(--masnc-shadow-sm);
	transition: transform 180ms ease, box-shadow 180ms ease;
}

.masnc-active .maspc-shell :where(.maspc-card, .maspc-path-card, .maspc-step, .maspc-proof-card):hover {
	transform: translateY(-3px);
	box-shadow: 0 18px 42px rgba(7, 28, 36, 0.14);
}

.masnc-active .maspc-shell .masnc-managed-feature {
	width: 100%;
	height: auto;
	aspect-ratio: 8 / 5;
	border-radius: var(--masnc-radius);
	object-fit: cover;
}

.masnc-active .masnc-editorial-media {
	padding-block: clamp(2rem, 4vw, 4rem);
	background: var(--masnc-surface);
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media {
	padding-block: clamp(3.5rem, 7vw, 6rem);
	background: var(--masnc-surface);
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media__inner {
	width: min(calc(100% - 2rem), var(--masnc-content));
	margin-inline: auto;
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media header {
	max-width: 760px;
	margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media header p {
	margin: 0 0 0.7rem;
	color: var(--masnc-accent);
	font-size: 0.76rem;
	font-weight: 850;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media header h2 {
	margin: 0;
	color: var(--masnc-ink);
	font-size: clamp(2rem, 4vw, 3.6rem);
	line-height: 1.02;
}

.masnc-active.masnc-profile-railchocks .masnc-native-editorial-media header span {
	display: block;
	margin-top: 0.9rem;
	color: color-mix(in srgb, var(--masnc-ink) 70%, white);
	font-size: 1rem;
	line-height: 1.7;
}

.masnc-active .masnc-editorial-media__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(1rem, 2.5vw, 2rem);
}

.masnc-active .masnc-editorial-media__grid:has(> :only-child) {
	grid-template-columns: minmax(0, 1fr);
}

.masnc-active .masnc-media-slot {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: var(--masnc-radius);
	background: color-mix(in srgb, var(--masnc-primary) 8%, white);
	box-shadow: var(--masnc-shadow-sm);
}

.masnc-active .masnc-media-slot img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 8 / 5;
	object-fit: cover;
}

.masnc-active [data-masnc-slot$=".home.feature.secondary"] img,
.masnc-active img[data-masnc-slot$=".home.feature.secondary"] {
	aspect-ratio: 3 / 2;
}

.masnc-active .masnc-cta-has-media {
	position: relative;
	isolation: isolate;
	background-image: linear-gradient(90deg, rgba(7, 28, 36, 0.94), rgba(7, 28, 36, 0.68)), var(--masnc-cta-image) !important;
	background-position: var(--masnc-cta-position, center);
	background-size: cover;
}

.masnc-active .masnc-cta-has-media > *:not(.masnc-media-attribution) {
	position: relative;
	z-index: 2;
}

.masnc-active .maspc-shell main form:not([role="search"]) {
	border-radius: var(--masnc-radius);
}

.masnc-active .maspc-shell main form:not([role="search"]) :where(input:not([type]), input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="search"], input[type="password"], select, textarea) {
	min-height: 48px;
	border: 1px solid color-mix(in srgb, var(--masnc-ink) 24%, white);
	border-radius: 6px;
	background: #fff;
}

.masnc-active .maspc-shell main form:not([role="search"]) textarea {
	min-height: 9rem;
}

.masnc-active .maspc-shell main form:not([role="search"]) :where(input, select, textarea):focus {
	border-color: var(--masnc-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--masnc-accent) 20%, transparent);
}

/* Correct the known dark-on-dark RailYardSafety homepage hero. */
.home.masnc-active.masnc-profile-railyardsafety .maspc-hero h1,
.home.masnc-active.masnc-profile-railyardsafety .maspc-hero .maspc-lede {
	color: #fff !important;
	text-shadow: 0 2px 20px rgba(0, 0, 0, 0.28);
}

/* SafetyGatePro and SpillProTek need controlled headline measure on all viewports. */
.home.masnc-active.masnc-profile-safetygatepro .maspc-hero:not(.maspc-inner-hero) h1 {
	max-width: 14ch;
	font-size: clamp(3.25rem, 4.9vw, 4.8rem);
	line-height: 0.96;
	text-transform: none;
}

.home.masnc-active.masnc-profile-spillprotek .maspc-hero:not(.maspc-inner-hero) h1 {
	max-width: 13ch;
	font-size: clamp(3.25rem, 4.8vw, 4.8rem);
}

/* RackTek retains its signal-grid identity while sharing the system rhythm. */
.masnc-active.masnc-profile-racktek .rt-hero__inner {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
	align-items: center;
	gap: clamp(2.5rem, 5vw, 5rem);
}

.masnc-active.masnc-profile-racktek .rt-display {
	max-width: 14ch;
	font-size: clamp(3.4rem, 5.4vw, 5.5rem);
	letter-spacing: -0.048em;
	line-height: 0.94;
	text-wrap: balance;
}

.masnc-active.masnc-profile-racktek .rt-hero__visual {
	position: relative;
	min-height: 620px;
	overflow: hidden;
	border-radius: var(--masnc-radius);
	box-shadow: var(--masnc-shadow-lg);
}

.masnc-active.masnc-profile-racktek .rt-hero__visual::after {
	position: absolute;
	z-index: 2;
	inset: 0;
	pointer-events: none;
	content: "";
	background: linear-gradient(180deg, transparent 48%, rgb(7 28 36 / var(--masnc-hero-overlay)) 100%);
}

.masnc-active.masnc-profile-racktek .rt-hero__visual img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.masnc-active.masnc-profile-racktek :where(.rt-section, .rt-band) {
	padding-block: var(--masnc-section-space);
}

.masnc-active.masnc-profile-racktek :where(.rt-card, .rt-panel, .rt-media-card) {
	border-radius: var(--masnc-radius);
	box-shadow: var(--masnc-shadow-sm);
}

/* The legacy child theme gives this grid a 92vw wide-canvas width even when it
   sits inside the newer 1180px shell. Constrain the grid to its real parent so
   all three columns remain visible without clipping or horizontal scrolling. */
.masnc-active.masnc-profile-racktek .rt-system-grid {
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.masnc-active.masnc-profile-racktek :where(.rt-button, .rt-btn) {
	min-height: 48px;
	border-radius: 4px;
}

/* RailChocks keeps a commerce-first visual structure. */
.masnc-active.masnc-profile-railchocks .hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

.masnc-active.masnc-profile-railchocks .hero-media {
	max-width: 100%;
	overflow: hidden;
}

.masnc-active.masnc-profile-railchocks .hero-media::after {
	position: absolute;
	z-index: 1;
	inset: 0;
	pointer-events: none;
	content: "";
	background: linear-gradient(90deg, rgb(7 28 36 / calc(var(--masnc-hero-overlay) + 0.24)), rgba(7, 28, 36, 0.22) 58%, rgb(7 28 36 / var(--masnc-hero-overlay)));
}

/* Keep the native RailChocks homepage copy and actions above its governed
   media treatment without changing inner routes or WooCommerce surfaces. */
body.home.masnc-active.masnc-profile-railchocks:not(.maspc-rendered) #rc-onepage .hero .hero-inner {
	position: relative;
	z-index: 2;
}

body.masnc-active.masnc-profile-railchocks #rc-onepage .hero-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform: none;
}

.masnc-active.masnc-profile-railchocks .hero-card {
	border-radius: var(--masnc-radius);
	box-shadow: var(--masnc-shadow-lg);
}

.masnc-active.masnc-profile-railchocks .hero h1 {
	max-width: 13ch;
	font-size: clamp(3.2rem, 6vw, 6.5rem);
	letter-spacing: -0.05em;
	line-height: 0.94;
	text-wrap: balance;
}

.masnc-active.masnc-profile-railchocks :where(.product-card, .featured-card, .woocommerce ul.products li.product) {
	border-radius: var(--masnc-radius);
	box-shadow: var(--masnc-shadow-sm);
}

.masnc-active.masnc-profile-railchocks :where(.product-card, .featured-card, .woocommerce ul.products li.product) img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

.masnc-active.masnc-profile-railchocks main > section:not(.hero) {
	padding-block: var(--masnc-section-space);
}

/* Shared MAS endorsement and canonical handoff module. */
.masnc-network,
.masnc-network *,
.masnc-network *::before,
.masnc-network *::after {
	box-sizing: border-box;
}

.masnc-network {
	position: relative;
	z-index: 2;
	margin: 0;
	padding: clamp(3rem, 6vw, 5.5rem) 0;
	border-top: 5px solid var(--masnc-accent);
	background:
		linear-gradient(125deg, color-mix(in srgb, var(--masnc-secondary) 26%, transparent), transparent 46%),
		var(--masnc-primary);
	color: #fff;
	font-family: Inter, "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

.masnc-network__inner {
	display: grid;
	grid-template-columns: minmax(270px, 0.82fr) minmax(0, 1.18fr);
	gap: clamp(2.5rem, 6vw, 6rem);
	width: min(calc(100% - 3rem), var(--masnc-content));
	margin-inline: auto;
}

.masnc-network__endorsement {
	align-self: start;
}

.masnc-network__eyebrow {
	margin: 0 0 0.75rem !important;
	color: color-mix(in srgb, var(--masnc-accent) 78%, white);
	font-size: 0.7rem !important;
	font-weight: 800;
	letter-spacing: 0.17em;
	line-height: 1.4 !important;
	text-transform: uppercase;
}

.masnc-network h2 {
	max-width: 17ch;
	margin: 0 0 1rem;
	color: #fff;
	font-size: clamp(2rem, 3vw, 3.4rem);
	font-weight: 800;
	letter-spacing: -0.045em;
	line-height: 1.02;
	text-wrap: balance;
}

.masnc-network__endorsement > p:not(.masnc-network__eyebrow) {
	max-width: 58ch;
	margin: 0;
	color: rgba(255, 255, 255, 0.72);
	font-size: 0.98rem;
	line-height: 1.65;
}

.masnc-network__home {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin-top: 1.35rem;
	color: #fff !important;
	font-size: 0.86rem;
	font-weight: 800;
	text-decoration: none;
}

.masnc-network__home:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.masnc-network__routes {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1px;
	align-self: stretch;
	background: rgba(255, 255, 255, 0.14);
}

.masnc-network__routes a {
	position: relative;
	display: grid;
	align-content: center;
	gap: 0.45rem;
	min-height: 136px;
	padding: 1.35rem 3.2rem 1.35rem 1.35rem;
	background: color-mix(in srgb, var(--masnc-primary) 94%, white);
	color: #fff !important;
	text-decoration: none;
	transition: background 160ms ease, transform 160ms ease;
}

.masnc-network__routes a:hover {
	z-index: 2;
	background: color-mix(in srgb, var(--masnc-secondary) 48%, var(--masnc-primary));
	transform: translateY(-2px);
}

.masnc-network__routes strong {
	font-size: 1rem;
	line-height: 1.3;
}

.masnc-network__routes span {
	color: rgba(255, 255, 255, 0.67);
	font-size: 0.78rem;
	line-height: 1.5;
}

.masnc-network__routes i {
	position: absolute;
	top: 1.2rem;
	right: 1.2rem;
	font-size: 1rem;
	font-style: normal;
}

@media (max-width: 1050px) {
	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-grid,
	.masnc-active.masnc-profile-racktek .rt-hero__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) h1,
	.masnc-active.masnc-profile-racktek .rt-display {
		max-width: 13ch;
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual,
	.masnc-active.masnc-profile-racktek .rt-hero__visual {
		min-height: 520px;
	}

	.masnc-network__inner {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 720px) {
	/* RailYardSafety's captured mobile hero resolves to a light theme surface,
	   unlike its dark desktop hero. Keep the managed-home copy readable without
	   changing the desktop treatment or any inner-page hero. */
	.home.masnc-active.masnc-profile-railyardsafety .maspc-hero:not(.maspc-inner-hero) h1,
	.home.masnc-active.masnc-profile-railyardsafety .maspc-hero:not(.maspc-inner-hero) .maspc-lede {
		color: #071c24 !important;
		text-shadow: none;
	}

	/* Astra's zero-count pseudo badge extends six pixels beyond the 390px
	   RailChocks canvas. Hide only the empty badge; real cart counts remain. */
	body.masnc-active.masnc-profile-railchocks i.astra-icon[data-cart-total="0"]::after {
		display: none;
		content: none;
	}

	/* Astra positions the closed 460px cart drawer at left:100%. Collapse only
	   that hidden state; the active drawer retains its complete controls and is
	   bounded to the viewport. */
	.masnc-active.masnc-profile-railchocks #astra-mobile-cart-drawer.astra-cart-drawer:not(.active) {
		display: none;
		width: 0;
		max-width: 0;
		overflow: hidden;
	}

	.masnc-active.masnc-profile-railchocks #astra-mobile-cart-drawer.astra-cart-drawer.active {
		width: min(460px, 100vw);
		max-width: 100vw;
	}

	.masnc-active .maspc-shell .maspc-container,
	.masnc-network__inner {
		width: min(calc(100% - 2rem), var(--masnc-content));
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) {
		min-height: 0;
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-grid {
		gap: 2.4rem;
		padding-block: 4rem;
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) h1,
	.home.masnc-active.masnc-profile-safetygatepro .maspc-hero:not(.maspc-inner-hero) h1,
	.home.masnc-active.masnc-profile-spillprotek .maspc-hero:not(.maspc-inner-hero) h1 {
		max-width: none;
		font-size: clamp(2.75rem, 13vw, 3.75rem);
		line-height: 0.96;
	}

	.home.masnc-active .maspc-shell .maspc-hero:not(.maspc-inner-hero) .maspc-hero-visual,
	.masnc-active.masnc-profile-racktek .rt-hero__visual {
		min-height: 24rem;
	}

	.masnc-active .maspc-shell .maspc-actions {
		align-items: stretch;
		flex-direction: column;
	}

	.masnc-active .maspc-shell .maspc-button {
		width: 100%;
	}

	.masnc-active.masnc-profile-racktek .rt-display {
		max-width: none;
		font-size: clamp(2.75rem, 12vw, 3.55rem);
	}

	.masnc-active.masnc-profile-railchocks .hero h1 {
		font-size: clamp(2.3rem, 10vw, 3rem);
	}

	.masnc-network {
		padding-block: 3.5rem;
	}

	.masnc-network__routes {
		grid-template-columns: minmax(0, 1fr);
	}

	.masnc-active .masnc-editorial-media__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.masnc-network__routes a {
		min-height: 118px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.masnc-active *,
	.masnc-active *::before,
	.masnc-active *::after,
	.masnc-network *,
	.masnc-network *::before,
	.masnc-network *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}
