/* Reduce the unused space above the custom home-page landing section. */
@media (min-width: 1025px) {
    body.home .site-header .header-inner.container {
        padding-top: 48px !important;
    }
}

/* ------------------------------------------------------------ */
/* 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;
	}
}

/* ------------------------------------------------------------ */
/* Header animation performance fix */
/* ------------------------------------------------------------ */

/*
 * Preserve the engineering grid as a static background.
 * Remove the oversized rotated animated layer.
 */
body.home header#masthead::before {
	inset: 0 !important;
	transform: none !important;
	animation: none !important;

	background-position:
		0 0,
		0 0,
		50% 0 !important;

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

	opacity: 0.5 !important;
}

/*
 * Remove the continuously moving scanner and its expensive shadows.
 */
body.home header#masthead::after {
	content: none !important;
	display: none !important;
	animation: none !important;
	box-shadow: none !important;
}

/* ------------------------------------------------------------ */
/* WordPress category archive background — theme-compatible */
/* ------------------------------------------------------------ */

/* Category archive canvas */
body.category #content,
body.category #primary,
body.category #main,
body.category main,
body.category .site-content,
body.category .content-area,
body.category .site-main {
	background-image: none !important;
	background-color: #f7f9fb !important;
}

/* Target the category introduction header regardless of theme class */
body.category main > header:first-child,
body.category #main > header:first-child,
body.category .site-main > header:first-child,
body.category .content-area > header:first-child,
body.category .page-header,
body.category .archive-header,
body.category .taxonomy-header {
	background-image:
		linear-gradient(
			135deg,
			rgba(32, 80, 245, 0.09),
			rgba(27, 170, 111, 0.05)
		) !important;
	background-color: #f7f9fb !important;

	border: 1px solid #dde3ec !important;
	border-radius: 12px !important;
	padding: clamp(2.5rem, 6vw, 4.5rem)
		clamp(1.25rem, 4vw, 2.5rem) !important;
	margin-bottom: 2rem !important;
	box-sizing: border-box !important;
}

/* Category title */
body.category main > header:first-child h1,
body.category #main > header:first-child h1,
body.category .site-main > header:first-child h1,
body.category .content-area > header:first-child h1,
body.category .page-title,
body.category .archive-title {
	color: #0e1726 !important;
	text-shadow: none !important;
}

/* Category description */
body.category main > header:first-child p,
body.category #main > header:first-child p,
body.category .site-main > header:first-child p,
body.category .content-area > header:first-child p,
body.category .taxonomy-description,
body.category .taxonomy-description p,
body.category .archive-description,
body.category .archive-description p {
	color: #46536b !important;
	text-shadow: none !important;
}

/* Line underneath the category title */
body.category main > header:first-child::after,
body.category #main > header:first-child::after,
body.category .site-main > header:first-child::after,
body.category .page-header::after,
body.category .archive-header::after {
	background-color: #2050f5 !important;
	opacity: 0.45 !important;
}

/* ------------------------------------------------------------ */
/* Dropdown fix v2 — REPLACE the previous "Fix: dropdown menus"  */
/* section at the end of Additional CSS with this whole block    */
/* ------------------------------------------------------------ */

/* Keep the whole header above any page content that follows it */
header#masthead {
	position: relative;
	z-index: 90;
}

body.home header#masthead {
	overflow: visible;
}

/*
 * KEY FIX: the nav usually sits inside intermediate wrapper divs.
 * The earlier rule `header#masthead > * { z-index: 5 }` puts every
 * direct child of the header at the same level, so a LATER sibling
 * (e.g. the tall header/cover region) paints over the wrapper that
 * contains the menu — trapping the dropdown underneath no matter
 * how high its own z-index is.
 *
 * This raises the menu's entire ancestor chain inside the header,
 * so the branch containing the nav always sits on top.
 */
header#masthead :is(:has(nav#site-navigation), nav#site-navigation) {
	position: relative;
	z-index: 40;
}

/* Dropdown panels above everything within that raised branch */
nav#site-navigation ul.sub-menu {
	z-index: 99;
}

/*
 * Never clip a dropdown inside intermediate header wrappers.
 * Desktop-only so mobile hamburger menus that rely on overflow
 * for their collapse animation are untouched.
 */
@media (min-width: 769px) {
	header#masthead :has(nav#site-navigation) {
		overflow: visible;
	}
}

/* The custom page sections must never rise above the header */
.tft-landing,
.tfc,
.tft-page-shell,
.tft-book-page {
	z-index: 0 !important;
}

/* Keep the Tech For Talk identity with the desktop Latest Articles rail. */
@media (min-width: 1600px) and (min-height: 700px) {
    body.home .site-branding {
        position: fixed !important;
        top: 62px;
        left: clamp(
            1rem,
            calc((100vw - 1200px) / 4),
            3rem
        );
        width: clamp(
            240px,
            calc((100vw - 1100px) / 2 - 3rem),
            330px
        );
        z-index: 80;
        text-align: left;
    }

    /* Leave room for the WordPress toolbar while signed in. */
    body.home.admin-bar .site-branding {
        top: 94px;
    }
}

/* Wide-desktop vertical navigation rail. */
@media (min-width: 1600px) and (min-height: 700px) {
    body.home #site-navigation {
        position: fixed !important;
        top: 62px !important;
        right: clamp(
            1rem,
            calc((100vw - 1200px) / 4),
            3rem
        ) !important;
        left: auto !important;
        width: clamp(
            220px,
            calc((100vw - 1200px) / 2 - 2rem),
            300px
        ) !important;
        padding: 14px !important;
        border: 1px solid rgba(111, 168, 255, 0.22);
        border-radius: 12px;
        background:
            linear-gradient(
                145deg,
                rgba(20, 31, 45, 0.94),
                rgba(9, 15, 23, 0.97)
            );
        box-shadow:
            0 18px 45px rgba(0, 0, 0, 0.26),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 90;
    }

    /* Keep the same alignment below the WordPress toolbar. */
    body.home.admin-bar #site-navigation {
        top: 94px !important;
    }

    body.home #site-navigation::before {
        content: "NAVIGATION";
        display: block;
        margin: 2px 4px 12px;
        color: #82b5ff;
        font-family: "IBM Plex Mono", monospace;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.12em;
    }

    body.home #site-navigation .nav-menu {
        display: flex !important;
        flex-direction: column;
        gap: 10px;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.home #site-navigation .nav-menu > li {
        float: none !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
    }

    body.home #site-navigation .nav-menu > li > a {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        padding: 13px 16px !important;
        border: 1px solid rgba(111, 168, 255, 0.2);
        border-radius: 8px;
        background:
            linear-gradient(
                135deg,
                rgba(32, 49, 70, 0.88),
                rgba(17, 27, 40, 0.94)
            );
        color: #eef5ff !important;
        font-size: 13px !important;
        font-weight: 600;
        letter-spacing: 0.055em;
        line-height: 1.4 !important;
        text-align: left;
        text-transform: uppercase;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.06),
            0 5px 14px rgba(0, 0, 0, 0.16);
        transition:
            border-color 180ms ease,
            background 180ms ease,
            transform 180ms ease;
    }

    body.home #site-navigation .nav-menu > li > a:hover,
    body.home #site-navigation .nav-menu > li > a:focus {
        border-color: rgba(111, 168, 255, 0.72);
        background:
            linear-gradient(
                135deg,
                rgba(38, 66, 104, 0.96),
                rgba(20, 35, 54, 0.98)
            );
        transform: translateX(-3px);
        outline: none;
    }

    /* Open TheFour dropdowns towards the centre of the page. */
    body.home #site-navigation .nav-menu > li > .sub-menu {
        top: 0 !important;
        right: calc(100% + 12px) !important;
        left: auto !important;
        width: 240px !important;
        border: 1px solid rgba(111, 168, 255, 0.3);
        border-radius: 9px;
        background: rgba(10, 17, 26, 0.98);
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
        overflow: hidden;
    }

    body.home #site-navigation .sub-menu a {
        padding: 11px 14px !important;
        color: #dce8f7 !important;
        line-height: 1.35 !important;
        text-align: left;
    }

    body.home #site-navigation .sub-menu a:hover,
    body.home #site-navigation .sub-menu a:focus {
        background: #17263a !important;
        color: #ffffff !important;
    }
}

/* Improve contrast inside the home-page vertical navigation submenus. */
@media (min-width: 1600px) and (min-height: 700px) {
    body.home #site-navigation .sub-menu,
    body.home #site-navigation .sub-menu li,
    body.home #site-navigation .sub-menu li a {
        background: #0d1724 !important;
        color: #edf5ff !important;
    }

    body.home #site-navigation .sub-menu li {
        border-bottom: 1px solid rgba(130, 181, 255, 0.16) !important;
    }

    body.home #site-navigation .sub-menu li:last-child {
        border-bottom: 0 !important;
    }

    body.home #site-navigation .sub-menu li a {
        padding: 12px 15px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        text-shadow: none !important;
    }

    body.home #site-navigation .sub-menu li a:hover,
    body.home #site-navigation .sub-menu li a:focus {
        background: #203654 !important;
        color: #ffffff !important;
    }
}

/*
 * TheFour can retain its JavaScript-added .focus class after a menu click.
 * On desktop pointer devices, close the fly-out when the pointer leaves the
 * parent item. Keyboard focus and touch behaviour remain unchanged.
 */
@media (min-width: 1600px) and (min-height: 700px) and (hover: hover) and (pointer: fine) {
    body.home #site-navigation
        .nav-menu
        > li.menu-item-has-children:not(:hover)
        > .sub-menu {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/*
 * Reserve both fixed side rails beside TheFour's theme-generated Recent Posts.
 * The custom landing already respects the rails; the separate blog grid did not.
 */
@media (min-width: 1600px) and (min-height: 700px) {
    body.home main#main.container {
        width: min(1200px, calc(100vw - 820px)) !important;
        max-width: 1200px !important;
        margin-right: auto !important;
        margin-left: auto !important;
    }
}

/* ------------------------------------------------------------ */
/* Scoped article typography — memory-layout post              */
/* Requires the article body to be wrapped in a Group block     */
/* with the class "tft-article". Only applies inside that class.*/
/* ------------------------------------------------------------ */

.tft-article {
	max-width: 720px;
	margin-inline: auto;
}

.tft-article p {
	font-size: 1.05rem;
	line-height: 1.75;
	margin: 0 0 1.4rem;
	color: #2c3742;
}

.tft-article h2,
.tft-article h3 {
	color: #243b53;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	margin: 2.4rem 0 0.9rem;
}

.tft-article h3 {
	font-size: 1.5rem;
	padding-bottom: 0.4rem;
	border-bottom: 2px solid #e3e9f0;
}

.tft-article ul {
	margin: 0 0 1.6rem;
	padding-left: 1.4rem;
	list-style: none;
}

.tft-article ul li {
	position: relative;
	margin-bottom: 0.7rem;
	padding-left: 0.4rem;
	line-height: 1.7;
	color: #2c3742;
}

.tft-article ul li::before {
	content: "";
	position: absolute;
	left: -0.9rem;
	top: 0.62em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #4a90d9;
}

.tft-article ul li strong {
	color: #243b53;
	font-weight: 700;
}

.tft-article code {
	font-family: "IBM Plex Mono", "SF Mono", "Courier New", monospace;
	font-size: 0.9em;
	padding: 0.12em 0.4em;
	border-radius: 4px;
	background: #eef2f7;
	color: #243b53;
}

.tft-article a {
	color: #2c6fb0;
	text-decoration: underline;
	text-decoration-color: #b9d3ec;
	text-underline-offset: 2px;
	transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.tft-article a:hover {
	color: #4a90d9;
	text-decoration-color: #4a90d9;
}

.tft-article figcaption,
.tft-article .wp-element-caption {
	font-family: "IBM Plex Mono", "Courier New", monospace;
	font-size: 0.78rem;
	letter-spacing: 0.02em;
	color: #6b7885;
	text-align: center;
	margin-top: 0.6rem;
}

.tft-article .wp-block-videopress-video,
.tft-article figure {
	margin: 1.8rem 0;
}

@media (prefers-color-scheme: dark) {
	.tft-article p,
	.tft-article ul li {
		color: #cdd6df;
	}
	.tft-article h2,
	.tft-article h3,
	.tft-article ul li strong {
		color: #8ec5ff;
	}
	.tft-article h3 {
		border-bottom-color: #2f4155;
	}
	.tft-article code {
		background: #1f2c3a;
		color: #8ec5ff;
	}
}

/* Remove the large page-title banner only from Professional Training */
body.page-id-8604 header#masthead .header-inner {
    display: none !important;
}

/* Reduce the gap above the Professional Training content */
body.page-id-8604 main#main.container {
    margin-top: 36px !important;
    margin-bottom: 80px !important;
}