/*
Theme Name: TekOnline Workbench
Template: twentytwentythree
Version: 1.0.0
Author: Jon
Author URI: https://www.tekonline.com.au
Description: Software meets hardware. A blue-and-white engineering workshop theme for TekOnline. Child theme of Twenty Twenty-Three.
Requires at least: 6.2
Tested up to: 6.8
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tekonline-workbench
*/

/* ------------------------------------------------------------------ */
/* 1. Design tokens                                                    */
/* ------------------------------------------------------------------ */

:root {
	--tek-navy: #0b2253;
	--tek-blue: #155eef;
	--tek-blue-strong: #064bc7;
	--tek-pale: #f2f8ff;
	--tek-border: #b9d4f5;
	--tek-muted: #52647a;
	--tek-grid: rgba(21, 94, 239, 0.08);
	--tek-content: 1400px;
	--tek-reading: 760px;
	--tek-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--tek-font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* ------------------------------------------------------------------ */
/* 2. Base                                                             */
/* ------------------------------------------------------------------ */

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	color: var(--tek-navy);
	background: #fff;
	font-family: var(--tek-font);
	font-size: 17px;
	line-height: 1.65;
}

/* Remove parent theme's global content padding so the header sits flush. */

.wp-site-blocks,
.wp-site-blocks.has-global-padding {
	padding: 0 !important;
}

.wp-site-blocks > * + * {
	margin-block-start: 0 !important;
}

a {
	color: var(--tek-blue-strong);
	text-underline-offset: 0.18em;
}

a:hover {
	color: var(--tek-blue);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--tek-blue);
	outline-offset: 3px;
}

.tek-container {
	width: min(calc(100% - 40px), var(--tek-content));
	margin-inline: auto;
}

/* ------------------------------------------------------------------ */
/* 3. Header                                                           */
/* ------------------------------------------------------------------ */

.tek-header {
	position: relative;
	z-index: 10;
	background: #fff;
	border-bottom: 1px solid var(--tek-border);
}

.tek-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 32px;
	min-height: 76px;
	padding-block: 0;
}

.tek-brand {
	display: flex;
	align-items: center;
}

.tek-brand__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--tek-navy);
	text-decoration: none;
}

.tek-brand__link:hover {
	color: var(--tek-blue-strong);
}

.tek-brand__icon {
	display: block;
}

.tek-brand__word {
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.tek-nav {
	flex: 1;
}

.tek-nav__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tek-nav__list a {
	display: inline-block;
	padding: 6px 2px;
	color: var(--tek-navy);
	font-weight: 600;
	text-decoration: none;
}

.tek-nav__list a:hover,
.tek-nav__list a:focus-visible {
	color: var(--tek-blue);
}

/* Search control in header */

.wp-block-search.tek-search {
	width: 220px;
}

.wp-block-search.tek-search .wp-block-search__inside-wrapper {
	border: 1px solid var(--tek-border);
	border-radius: 6px;
	background: #fff;
}

.wp-block-search.tek-search .wp-block-search__input {
	border: 0;
	border-radius: 6px;
	padding: 9px 12px;
	font-family: var(--tek-font);
	font-size: 0.95rem;
	color: var(--tek-navy);
	background: #fff;
}

.wp-block-search.tek-search .wp-block-search__button {
	margin: 0;
	padding: 9px 14px;
	border: 0;
	border-left: 1px solid var(--tek-border);
	border-radius: 0 6px 6px 0;
	background: var(--tek-pale);
	color: var(--tek-navy);
	font-family: var(--tek-font);
	font-weight: 600;
	cursor: pointer;
}

.wp-block-search.tek-search .wp-block-search__button:hover {
	background: #e3f0ff;
	color: var(--tek-blue-strong);
}

/* ------------------------------------------------------------------ */
/* 4. Skip link + screen-reader helpers                                */
/* ------------------------------------------------------------------ */

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	padding: 12px 18px;
	border: 2px solid var(--tek-blue);
	border-radius: 6px;
	background: #fff;
	color: var(--tek-navy);
	font-weight: 700;
}

.skip-link:focus {
	left: 8px;
	top: 8px;
}

/* ------------------------------------------------------------------ */
/* 5. Hero                                                             */
/* ------------------------------------------------------------------ */

.tek-hero {
	position: relative;
	min-height: 460px;
	overflow: hidden;
	border-bottom: 1px solid var(--tek-border);
	background-color: var(--tek-pale);
	background-image:
		linear-gradient(var(--tek-grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--tek-grid) 1px, transparent 1px);
	background-size: 24px 24px;
}

.tek-hero__inner {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(340px, 0.8fr) minmax(480px, 1.2fr);
	align-items: center;
	min-height: 460px;
	gap: 48px;
}

.tek-hero__copy {
	padding-block: 56px;
}

.tek-hero__title {
	max-width: 650px;
	margin: 0 0 22px;
	color: var(--tek-navy);
	font-size: clamp(3.2rem, 6vw, 6.2rem);
	font-weight: 800;
	line-height: 0.96;
	letter-spacing: -0.055em;
}

.tek-hero__intro {
	max-width: 520px;
	margin: 0 0 14px;
	color: var(--tek-navy);
	font-size: clamp(1.2rem, 2vw, 1.65rem);
	font-weight: 500;
	line-height: 1.35;
}

.tek-hero__sub {
	margin: 0;
	color: var(--tek-muted);
	font-size: 1.05rem;
}

/* PCB artwork: decorative, faded toward the left */

.tek-hero__art {
	position: absolute;
	inset: 0 0 0 38%;
	z-index: 1;
	width: 62%;
	height: 100%;
	background-image: url("assets/hero-pcb.png");
	background-repeat: no-repeat;
	background-position: center right;
	background-size: contain;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 42%);
	mask-image: linear-gradient(to right, transparent, #000 42%);
	pointer-events: none;
}

/* Code editor window: decorative secondary element */

.tek-code-window {
	position: absolute;
	left: 42%;
	bottom: 36px;
	z-index: 3;
	width: 300px;
	border: 1px solid var(--tek-border);
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 8px 20px rgba(11, 34, 83, 0.12);
}

.tek-code-window__title {
	padding: 7px 12px;
	border-bottom: 1px solid var(--tek-border);
	border-radius: 4px 4px 0 0;
	background: linear-gradient(90deg, #d9eaff, #edf5ff);
	color: var(--tek-navy);
	font-family: var(--tek-font-mono);
	font-size: 0.8rem;
	font-weight: 600;
}

.tek-code-window__body {
	margin: 0;
	padding: 14px;
	overflow: hidden;
	background: var(--tek-navy);
	color: #fff;
	font-family: var(--tek-font-mono);
	font-size: 0.78rem;
	line-height: 1.6;
	border-radius: 0 0 4px 4px;
	white-space: pre;
}

/* ------------------------------------------------------------------ */
/* 6. Category navigation bar                                          */
/* ------------------------------------------------------------------ */

.tek-category-nav {
	overflow-x: auto;
	border-bottom: 1px solid var(--tek-border);
	background: #fff;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.tek-category-nav__list {
	display: flex;
	gap: 12px;
	width: max-content;
	min-width: 100%;
	margin: 0;
	padding: 14px 0;
	list-style: none;
}

.tek-category-nav__list a {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 7px 13px;
	border-radius: 6px;
	color: var(--tek-navy);
	font-weight: 650;
	text-decoration: none;
	white-space: nowrap;
}

.tek-category-nav__list a:hover,
.tek-category-nav__list a:focus-visible {
	color: var(--tek-blue-strong);
	background: var(--tek-pale);
}

.tek-folder-icon {
	flex: 0 0 auto;
}

/* ------------------------------------------------------------------ */
/* 7. Homepage layout: feed + sidebar                                  */
/* ------------------------------------------------------------------ */

.tek-home-layout {
	display: grid;
	grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.9fr);
	gap: 48px;
	padding-block: 54px 80px;
}

.tek-feed {
	min-width: 0;
}

.tek-feed__title {
	margin: 0 0 10px;
	color: var(--tek-navy);
	font-size: clamp(2rem, 3.5vw, 2.6rem);
	font-weight: 800;
	letter-spacing: -0.02em;
}

/* Post rows */

.tek-post-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tek-post-list > .wp-block-post {
	margin: 0;
}

.tek-post-row {
	display: grid;
	grid-template-columns: minmax(180px, 32%) minmax(0, 1fr);
	gap: 28px;
	padding-block: 24px;
	border-bottom: 1px solid var(--tek-border);
}

.tek-post-row--bare {
	grid-template-columns: 1fr;
}

.tek-post-row .wp-block-post-featured-image {
	margin: 0;
	border-radius: 4px;
	overflow: hidden;
}

.tek-post-row .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 4px;
	object-fit: cover;
	transition: transform 0.2s ease;
}

.tek-post-row .wp-block-post-featured-image a:hover img {
	transform: scale(1.02);
}

/* Decorative fallback thumb (no featured image set) */

.tek-thumb-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 9;
	background: var(--tek-pale);
	border: 1px dashed var(--tek-border);
	border-radius: 4px;
}

.tek-thumb-fallback__inner {
	display: flex;
}

.tek-post-row__body {
	min-width: 0;
}

.tek-post-row__category {
	margin: 0 0 6px;
	color: var(--tek-blue-strong);
	font-family: var(--tek-font-mono);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.tek-post-row__category a {
	color: inherit;
	text-decoration: none;
}

.tek-post-row__category a:not(:first-child) {
	display: none;
}

.tek-post-row__category a:hover {
	color: var(--tek-blue);
}

.tek-post-row__title {
	margin: 4px 0 7px;
	font-size: clamp(1.35rem, 2vw, 1.85rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.tek-post-row__title a {
	color: var(--tek-navy);
	text-decoration: none;
}

.tek-post-row__title a:hover {
	color: var(--tek-blue-strong);
	text-decoration: underline;
	text-decoration-thickness: 2px;
}

.tek-post-row__excerpt {
	margin: 0 0 10px;
	color: var(--tek-muted);
}

.tek-post-row__excerpt p {
	margin: 0;
}

.tek-post-row__date {
	margin: 0;
	color: var(--tek-muted);
	font-size: 0.9rem;
}

/* ------------------------------------------------------------------ */
/* 8. Sidebar windows                                                  */
/* ------------------------------------------------------------------ */

.tek-window {
	margin-bottom: 26px;
	border: 1px solid var(--tek-border);
	border-radius: 4px;
	background: #fff;
}

.tek-window__title {
	padding: 7px 12px;
	border-bottom: 1px solid var(--tek-border);
	border-radius: 4px 4px 0 0;
	background: linear-gradient(90deg, #d9eaff, #edf5ff);
	color: var(--tek-navy);
	font-family: var(--tek-font-mono);
	font-size: 0.86rem;
	font-weight: 600;
}

.tek-window__content {
	padding: 22px 24px;
}

.tek-window__content p {
	margin: 0 0 10px;
}

.tek-window__lead {
	color: var(--tek-navy);
	font-size: 1.15rem;
	font-weight: 700;
}

.tek-window__muted {
	color: var(--tek-muted);
}

.tek-project-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tek-project-list li {
	border-bottom: 1px solid var(--tek-pale);
}

.tek-project-list li:last-child {
	border-bottom: 0;
}

.tek-project-list a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 0;
	color: var(--tek-navy);
	font-weight: 600;
	text-decoration: none;
}

.tek-project-list a:hover {
	color: var(--tek-blue-strong);
}

.tek-project-list__arrow {
	margin-left: auto;
	color: var(--tek-blue);
}

/* ------------------------------------------------------------------ */
/* 9. Footer                                                           */
/* ------------------------------------------------------------------ */

.tek-footer {
	border-top: 1px solid var(--tek-border);
	background: var(--tek-pale);
}

.tek-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
	padding-block: 26px;
}

.tek-footer__copy {
	margin: 0;
	color: var(--tek-muted);
	font-size: 0.95rem;
}

.tek-footer__nav {
	display: flex;
	gap: 22px;
}

.tek-footer__nav a {
	color: var(--tek-navy);
	font-weight: 600;
	text-decoration: none;
}

.tek-footer__nav a:hover {
	color: var(--tek-blue);
}

/* ------------------------------------------------------------------ */
/* 10. Single post + page reading column                               */
/* ------------------------------------------------------------------ */

.tek-article {
	max-width: var(--tek-reading);
	margin-inline: auto;
	padding-block: 48px 80px;
}

.tek-article__title {
	margin: 0 0 12px;
	color: var(--tek-navy);
	font-size: clamp(2rem, 4.5vw, 3rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.tek-article__meta {
	margin: 0 0 28px;
	color: var(--tek-muted);
	font-size: 0.95rem;
}

.tek-article__figure {
	margin: 0 0 28px;
}

.tek-article__figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.tek-article__meta {
	gap: 6px 14px;
	color: var(--tek-muted);
	font-size: 0.95rem;
}

.tek-article__meta a {
	color: var(--tek-blue-strong);
}

.tek-article__body {
	font-size: 18px;
	line-height: 1.7;
}

.tek-article__body p {
	margin: 0 0 1.2em;
}

.tek-article__body h2,
.tek-article__body h3 {
	margin: 1.6em 0 0.6em;
	color: var(--tek-navy);
	line-height: 1.25;
}

.tek-article__body img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
}

.tek-article__body pre,
.tek-article__body code {
	font-family: var(--tek-font-mono);
}

.tek-article__body pre {
	padding: 16px;
	overflow-x: auto;
	border: 1px solid var(--tek-border);
	border-radius: 6px;
	background: var(--tek-pale);
}

.tek-post-nav {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	margin-top: 40px;
	padding-top: 24px;
	border-top: 1px solid var(--tek-border);
	font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* 11. Archives, index, search                                         */
/* ------------------------------------------------------------------ */

.tek-archive,
.tek-page {
	padding-block: 44px 80px;
}

.tek-archive__head {
	margin-bottom: 12px;
}

.tek-archive__title {
	margin: 0 0 8px;
	color: var(--tek-navy);
	font-size: clamp(2rem, 4vw, 2.8rem);
	font-weight: 800;
	letter-spacing: -0.02em;
}

.tek-archive__desc {
	margin: 0;
	color: var(--tek-muted);
}

.tek-searchform {
	display: flex;
	gap: 10px;
	max-width: 480px;
	margin-bottom: 32px;
}

.tek-searchform input[type="search"] {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid var(--tek-border);
	border-radius: 6px;
	font-family: var(--tek-font);
	font-size: 1rem;
	color: var(--tek-navy);
}

.tek-searchform button {
	padding: 10px 18px;
	border: 1px solid var(--tek-blue-strong);
	border-radius: 6px;
	background: var(--tek-blue-strong);
	color: #fff;
	font-family: var(--tek-font);
	font-weight: 600;
	cursor: pointer;
}

.tek-searchform button:hover {
	background: var(--tek-blue);
}

.tek-empty {
	padding: 40px 0;
	color: var(--tek-muted);
}

/* Pagination */

.tek-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 40px;
}

.tek-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	padding: 6px 12px;
	border: 1px solid var(--tek-border);
	border-radius: 4px;
	color: var(--tek-navy);
	text-decoration: none;
	font-weight: 600;
}

.tek-pagination .page-numbers.current {
	border-color: var(--tek-blue-strong);
	background: var(--tek-blue-strong);
	color: #fff;
}

.tek-pagination .page-numbers:hover:not(.current) {
	background: var(--tek-pale);
	color: var(--tek-blue-strong);
}

/* ------------------------------------------------------------------ */
/* 12. Responsive                                                      */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
	.tek-hero {
		min-height: auto;
	}

	.tek-hero__inner {
		display: block;
		min-height: 400px;
	}

	.tek-hero__copy {
		max-width: 72%;
	}

	.tek-hero__art {
		inset: 0 0 0 45%;
		width: 55%;
		opacity: 0.45;
	}

	.tek-code-window {
		left: 48%;
		bottom: 24px;
		width: 260px;
	}

	.tek-home-layout {
		grid-template-columns: 1fr;
	}

	.wp-block-search.tek-search {
		width: 100%;
		flex-basis: 100%;
		order: 3;
	}
}

@media (max-width: 650px) {
	body {
		font-size: 16px;
	}

	.tek-container {
		width: min(calc(100% - 28px), var(--tek-content));
	}

	.tek-header__inner {
		min-height: 64px;
		gap: 12px;
	}

	.tek-nav__list {
		justify-content: flex-start;
		gap: 6px 20px;
	}

	.tek-hero__inner {
		min-height: 360px;
	}

	.tek-hero__copy {
		max-width: 100%;
		padding-block: 44px;
	}

	.tek-hero__title {
		font-size: clamp(2.6rem, 11vw, 3rem);
	}

	.tek-hero__art {
		inset: 0;
		width: 100%;
		opacity: 0.15;
	}

	.tek-code-window {
		display: none;
	}

	.tek-post-row {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.tek-home-layout {
		gap: 32px;
		padding-block: 36px 60px;
	}

	.tek-article__body {
		font-size: 17px;
	}

	.tek-post-nav {
		flex-direction: column;
		gap: 12px;
	}
}

/* ------------------------------------------------------------------ */
/* 13. Reduced motion                                                  */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
