/* ------------------------------------------------------------ */
/* Animated home-page engineering header — enhanced version */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* Global Tech For Talk page-layout system */
/* ------------------------------------------------------------ */

:root {
	--tft-page-max-width: 1200px;
	--tft-page-gutter: clamp(1rem, 3vw, 2rem);
}

/* Final protection against accidental horizontal overflow */
html,
body {
	max-width: 100%;
	overflow-x: clip;
}

/* Allow the WordPress content/sidebar layout to shrink correctly */
.site,
.site-content,
.content-area,
.site-main,
.entry-content,
.wp-block-post-content {
	min-width: 0;
	max-width: 100%;
}

/*
 * Standard wrapper for every custom Tech For Talk page.
 * The higher-specificity selectors also correct older page wrappers.
 */
html body .site-content .tft-page-shell,
html body .site-content .tft-landing,
html body .site-content .tfc,
html body .site-content .tft-book-page {
	display: block !important;
	position: relative !important;

	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;

	left: auto !important;
	right: auto !important;
	inset-inline: auto !important;
	transform: none !important;

	margin-left: auto !important;
	margin-right: auto !important;
	padding: 0 !important;

	float: none !important;
	clear: both !important;

	overflow: hidden;
	overflow: clip;

	box-sizing: border-box;
	container-name: tft-page;
	container-type: inline-size;
}

/* Standard inner content container */
.tft-page-inner,
.tft-wrap,
.tfc-wrap {
	width: 100%;
	max-width: var(--tft-page-max-width);
	min-width: 0;
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--tft-page-gutter);
	padding-right: var(--tft-page-gutter);
	box-sizing: border-box;
}

/* Prevent grid and flex children from forcing page overflow */
.tft-page-shell *,
.tft-landing *,
.tfc *,
.tft-book-page * {
	box-sizing: border-box;
	min-width: 0;
}

/* Responsive images and media */
.tft-page-shell img,
.tft-page-shell video,
.tft-page-shell iframe,
.tft-landing img,
.tft-landing video,
.tft-landing iframe,
.tfc img,
.tfc video,
.tfc iframe,
.tft-book-page img,
.tft-book-page video,
.tft-book-page iframe {
	max-width: 100%;
	height: auto;
}

/* Allow long links, commands and headings to wrap */
.tft-page-shell h1,
.tft-page-shell h2,
.tft-page-shell h3,
.tft-page-shell p,
.tft-page-shell a,
.tft-page-shell li,
.tft-landing h1,
.tft-landing h2,
.tft-landing h3,
.tft-landing p,
.tft-landing a,
.tft-landing li,
.tfc h1,
.tfc h2,
.tfc h3,
.tfc p,
.tfc a,
.tfc li,
.tft-book-page h1,
.tft-book-page h2,
.tft-book-page h3,
.tft-book-page p,
.tft-book-page a,
.tft-book-page li {
	overflow-wrap: anywhere;
	word-break: normal;
}

/* Standard two-column layout */
.tft-layout-two-column {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
	gap: clamp(1.25rem, 3vw, 2.5rem);
	align-items: start;
}

/* Standard card grid */
.tft-layout-card-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

/*
 * Container queries respond to the actual WordPress content width.
 * This works correctly when a sidebar reduces the available space.
 */
@container tft-page (max-width: 820px) {
	.tft-layout-two-column,
	.tft-layout-card-grid {
		grid-template-columns: 1fr;
	}
}

/* Fallback for browsers without container-query support */
@media (max-width: 900px) {
	.tft-layout-two-column,
	.tft-layout-card-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 560px) {
	.tft-page-inner,
	.tft-wrap,
	.tfc-wrap {
		padding-left: 1rem;
		padding-right: 1rem;
	}
}
body.home header#masthead {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background:
		radial-gradient(
			circle at 18% 50%,
			rgba(32, 80, 245, 0.16),
			transparent 28%
		),
		radial-gradient(
			circle at 72% 45%,
			rgba(61, 220, 151, 0.08),
			transparent 30%
		),
		#0c1117 !important;
}

/* Visible moving circuit grid and illumination beam */
body.home header#masthead::before {
	content: "";
	position: absolute;
	inset: -40%;
	z-index: 0;
	pointer-events: none;

	background-image:
		linear-gradient(
			rgba(111, 168, 255, 0.16) 1px,
			transparent 1px
		),
		linear-gradient(
			90deg,
			rgba(111, 168, 255, 0.16) 1px,
			transparent 1px
		),
		linear-gradient(
			115deg,
			transparent 35%,
			rgba(32, 80, 245, 0.08) 42%,
			rgba(111, 168, 255, 0.32) 48%,
			rgba(61, 220, 151, 0.26) 52%,
			rgba(32, 80, 245, 0.08) 58%,
			transparent 65%
		);

	background-size:
		38px 38px,
		38px 38px,
		55% 100%;

	background-position:
		0 0,
		0 0,
		-100% 0;

	opacity: 0.75;
	transform: rotate(-3deg);
	animation: tft-circuit-field 12s linear infinite;
}

/* Bright diagnostic scanning line */
body.home header#masthead::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 10%;
	height: 2px;
	z-index: 1;
	pointer-events: none;

	background: linear-gradient(
		90deg,
		transparent 0%,
		rgba(32, 80, 245, 0.1) 12%,
		#6fa8ff 35%,
		#3ddc97 52%,
		rgba(61, 220, 151, 0.2) 76%,
		transparent 100%
	);

	box-shadow:
		0 0 8px rgba(111, 168, 255, 0.75),
		0 0 18px rgba(61, 220, 151, 0.5),
		0 0 35px rgba(32, 80, 245, 0.35);

	opacity: 0;
	animation: tft-diagnostic-scan 5.5s ease-in-out infinite;
}

/* Keep all actual header content above the animation */
body.home header#masthead > * {
	position: relative;
	z-index: 5;
}

/* Give the branding a restrained technical glow */
body.home header#masthead .site-title a {
	color: #f7f9ff !important;
	text-shadow:
		0 0 12px rgba(111, 168, 255, 0.18),
		0 0 28px rgba(32, 80, 245, 0.12);
	transition:
		color 0.25s ease,
		text-shadow 0.25s ease;
}

body.home header#masthead .site-title a:hover,
body.home header#masthead .site-title a:focus-visible {
	color: #6fa8ff !important;
	text-shadow:
		0 0 10px rgba(111, 168, 255, 0.8),
		0 0 26px rgba(32, 80, 245, 0.55);
}

body.home header#masthead .site-description {
	color: #b9c6da !important;
}

/* Keep menu and dropdowns above all decorative elements */
body.home nav#site-navigation {
	position: relative;
	z-index: 20;
}

body.home nav#site-navigation ul.sub-menu {
	z-index: 30;
}

/* Slowly move both the grid and illuminated beam */
@keyframes tft-circuit-field {
	0% {
		background-position:
			0 0,
			0 0,
			-110% 0;
	}

	100% {
		background-position:
			76px 76px,
			76px 76px,
			210% 0;
	}
}

/* Move the scanner from top to bottom */
@keyframes tft-diagnostic-scan {
	0% {
		top: 8%;
		opacity: 0;
	}

	12% {
		opacity: 0.8;
	}

	50% {
		opacity: 1;
	}

	88% {
		opacity: 0.75;
	}

	100% {
		top: 92%;
		opacity: 0;
	}
}

/* Mobile adjustment */
@media (max-width: 768px) {
	body.home header#masthead::before {
		opacity: 0.55;
		background-size:
			30px 30px,
			30px 30px,
			70% 100%;
	}

	body.home header#masthead::after {
		box-shadow:
			0 0 6px rgba(111, 168, 255, 0.65),
			0 0 14px rgba(61, 220, 151, 0.4);
	}
}

/* Disable movement for visitors who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	body.home header#masthead::before,
	body.home header#masthead::after {
		animation: none !important;
	}

	body.home header#masthead::after {
		display: none;
	}
}