/*
Theme Name: TechBlog
Theme URI: https://example.com
Author: Emeka
Description: Custom theme for Beyond the Racks — a technical blog covering networking, infrastructure, cloud, AI, cybersecurity, DevOps, and career/leadership lessons.
Version: 0.2.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: techblog
*/

/* ---------------------------------------------
   Design tokens
--------------------------------------------- */

:root {
	--font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	--bg: #f2f3f7;
	--bg-elevated: #ffffff;
	--bg-hover: #e7e9ef;
	--text: #14161a;
	--text-muted: #5b6270;
	--border: #e1e3ea;

	--accent: #6366f1;
	--accent-hover: #4f46e5;
	--accent-tint: #eef0fe;
	--accent-contrast: #ffffff;

	--radius-sm: 8px;
	--radius: 14px;
	--radius-lg: 20px;
	--shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.06);
	--shadow: 0 6px 20px rgba(20, 22, 26, 0.08);
	--shadow-hover: 0 12px 28px rgba(20, 22, 26, 0.14);

	--hero-grad: linear-gradient(120deg, #4338ca 0%, #6366f1 45%, #0ea5e9 100%);
	--hero-text: #ffffff;
	--hero-text-muted: rgba(255, 255, 255, 0.82);

	--transition: 180ms ease;
}

:root[data-theme="dark"] {
	--bg: #0b0d10;
	--bg-elevated: #14171c;
	--bg-hover: #1c2027;
	--text: #edeef0;
	--text-muted: #9aa1ad;
	--border: #262b33;

	--accent: #818cf8;
	--accent-hover: #a5b4fc;
	--accent-tint: rgba(129, 140, 248, 0.14);
	--accent-contrast: #0b0d10;

	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
	--shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
	--shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.5);

	--hero-grad: linear-gradient(120deg, #312e81 0%, #4f46e5 45%, #0369a1 100%);
	--hero-text: #f5f6ff;
	--hero-text-muted: rgba(245, 246, 255, 0.78);
}

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

/* ---------------------------------------------
   Base
--------------------------------------------- */

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--font-sans);
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	transition: background var(--transition), color var(--transition);
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	color: var(--accent-hover);
}

img {
	max-width: 100%;
	display: block;
}

h1, h2, h3, h4 {
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 1.6rem + 1.8vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem); }
h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); }

.container {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

.site-main {
	padding-top: 1.5rem;
	padding-bottom: 4rem;
}

::selection {
	background: var(--accent-tint);
	color: var(--text);
}

/* ---------------------------------------------
   Header
--------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 85%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}

.site-branding {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding: 0.9rem 0;
}

.site-branding__title a {
	color: var(--text);
	font-weight: 700;
	font-size: 1.15rem;
}

.header-collapse {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.primary-nav ul {
	display: flex;
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.primary-nav a {
	position: relative;
	color: var(--text);
	font-weight: 500;
	font-size: 0.95rem;
	padding: 0.25rem 0;
}

.primary-nav a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 2px;
	background: var(--accent);
	transition: width var(--transition);
}

.primary-nav a:hover::after {
	width: 100%;
}

.header-search input,
.listing-search input {
	font-family: inherit;
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	color: var(--text);
	border-radius: var(--radius-sm);
	padding: 0.5rem 0.85rem;
	font-size: 0.9rem;
	transition: border-color var(--transition);
}

.header-search input:focus,
.listing-search input:focus {
	outline: none;
	border-color: var(--accent);
}

.theme-toggle,
.nav-toggle {
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	color: var(--text);
	border-radius: var(--radius-sm);
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	cursor: pointer;
	transition: background var(--transition), transform var(--transition);
}

.theme-toggle:hover,
.nav-toggle:hover {
	background: var(--bg-hover);
}

.theme-toggle:active {
	transform: scale(0.92);
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

.nav-toggle {
	display: none;
}

/* ---------------------------------------------
   Footer
--------------------------------------------- */

.site-footer {
	border-top: 1px solid var(--border);
	margin-top: 4rem;
	padding: 2rem 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.footer-nav ul {
	display: flex;
	gap: 1.25rem;
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

.footer-nav a {
	color: var(--text-muted);
}

/* ---------------------------------------------
   Hero
--------------------------------------------- */

.hero {
	text-align: center;
	animation: fade-up 600ms ease both;
}

.hero.wireframe-block {
	padding: 2.25rem 2rem 2rem;
	background: var(--hero-grad);
	border: none;
	box-shadow: var(--shadow);
}

.hero__avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	border: 2px solid rgba(255, 255, 255, 0.55);
	margin: 0 auto 0.85rem;
}

.hero h1 {
	margin: 0 0 0.6rem;
	font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
	color: var(--hero-text);
}

.hero__tagline {
	display: inline-block;
	max-width: 640px;
	color: var(--hero-text-muted);
	font-size: 1rem;
	padding-bottom: 0.35rem;
	border-bottom: 2px solid rgba(255, 255, 255, 0.55);
}

@keyframes fade-up {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------------------------------------------
   Sections
--------------------------------------------- */

section {
	margin: 2.25rem 0;
}

section > h2 {
	margin-bottom: 1.5rem;
}

/* ---------------------------------------------
   Cards
--------------------------------------------- */

.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.5rem;
}

.card {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.1rem;
	box-shadow: var(--shadow-sm);
	transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-hover);
	border-color: var(--accent);
}

.card__link {
	color: var(--text);
	display: block;
}

.card__thumb {
	width: 100%;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, var(--accent-tint), var(--bg-hover));
	border-radius: var(--radius-sm);
	margin-bottom: 0.9rem;
	overflow: hidden;
}

.card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card__title {
	margin: 0 0 0.5rem;
	font-size: 1.1rem;
}

.card__meta {
	font-size: 0.82rem;
	color: var(--text-muted);
	margin-bottom: 0.5rem;
}

.card__category {
	display: inline-block;
	background: var(--accent-tint);
	color: var(--accent);
	border-radius: 999px;
	padding: 0.15rem 0.6rem;
	font-weight: 600;
}

.card__excerpt {
	color: var(--text-muted);
	font-size: 0.92rem;
	margin: 0;
}

/* ---------------------------------------------
   Categories
--------------------------------------------- */

.category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 1rem;
}

.category-chip {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1rem;
	text-align: center;
	color: var(--text);
	transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.category-chip:hover {
	transform: scale(1.04);
	border-color: var(--accent);
	background: var(--accent-tint);
	color: var(--text);
}

.category-chip__emoji {
	display: block;
	font-size: 1.6rem;
	margin-bottom: 0.35rem;
}

.category-chip__name {
	font-weight: 600;
	font-size: 0.92rem;
}

/* ---------------------------------------------
   Newsletter
--------------------------------------------- */

.newsletter {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	text-align: center;
}

.newsletter-form {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
	justify-content: center;
	margin-top: 1rem;
}

.newsletter-form input[type="email"] {
	flex: 1;
	min-width: 220px;
	max-width: 320px;
	padding: 0.7rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
}

.newsletter-form input[type="email"]:focus {
	outline: none;
	border-color: var(--accent);
}

.newsletter-form button {
	padding: 0.7rem 1.5rem;
	border: none;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-contrast);
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--transition);
}

.newsletter-form button:hover {
	background: var(--accent-hover);
}

.newsletter-message {
	margin-top: 0.75rem;
	font-size: 0.9rem;
	color: var(--accent);
	min-height: 1.2em;
}

.newsletter-message.is-error {
	color: #dc2626;
}

/* ---------------------------------------------
   Blog listing / archive
--------------------------------------------- */

.listing-search {
	display: flex;
	gap: 0.6rem;
	margin-bottom: 1.5rem;
}

.listing-search button {
	border: none;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-contrast);
	padding: 0 1.25rem;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
}

.filters {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin-bottom: 2rem;
}

.filters a {
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 0.4rem 0.9rem;
	font-size: 0.88rem;
	color: var(--text);
	transition: background var(--transition), border-color var(--transition);
}

.filters a:hover {
	background: var(--accent-tint);
	border-color: var(--accent);
	color: var(--accent);
}

.pagination {
	margin-top: 2.5rem;
	display: flex;
	gap: 0.5rem;
	justify-content: center;
}

.pagination .page-numbers {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.4rem 0.85rem;
	color: var(--text);
}

.pagination .page-numbers.current {
	background: var(--accent);
	color: var(--accent-contrast);
	border-color: var(--accent);
}

/* ---------------------------------------------
   Single post
--------------------------------------------- */

.post-cover {
	width: 100%;
	aspect-ratio: 21 / 9;
	background: linear-gradient(135deg, var(--accent-tint), var(--bg-hover));
	border-radius: var(--radius-lg);
	margin-bottom: 1.5rem;
	overflow: hidden;
}

.post-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.post-title {
	margin-bottom: 0.75rem;
}

.post-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	color: var(--text-muted);
	font-size: 0.92rem;
	margin-bottom: 1.25rem;
}

.post-meta img {
	border-radius: 50%;
	vertical-align: middle;
}

.post-taxonomies {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-bottom: 2rem;
}

.tag-chip {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 0.2rem 0.7rem;
	font-size: 0.82rem;
	color: var(--text-muted);
}

.post-interactions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	margin: 2.5rem 0;
	padding: 1.25rem 1.5rem;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
}

.post-reactions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.reaction-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	border: 1px solid var(--border);
	background: var(--bg);
	border-radius: 999px;
	padding: 0.35rem 0.8rem;
	font-family: inherit;
	font-size: 0.95rem;
	cursor: pointer;
	transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.reaction-btn:hover {
	transform: translateY(-2px);
	border-color: var(--accent);
}

.reaction-btn.is-active {
	background: var(--accent-tint);
	border-color: var(--accent);
}

.reaction-btn__count {
	font-size: 0.82rem;
	color: var(--text-muted);
	font-weight: 600;
}

.post-share {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	font-size: 0.9rem;
}

.post-share__label {
	color: var(--text-muted);
}

.share-link {
	border: 1px solid var(--border);
	background: var(--bg);
	border-radius: var(--radius-sm);
	padding: 0.35rem 0.75rem;
	font-family: inherit;
	font-size: 0.85rem;
	cursor: pointer;
	color: var(--text);
	transition: border-color var(--transition), color var(--transition);
}

.share-link:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.post-content {
	font-size: 1.08rem;
	max-width: 720px;
}

.post-content p {
	margin: 0 0 1.4rem;
}

.post-content img {
	border-radius: var(--radius);
	margin: 1.5rem 0;
}

.post-content pre {
	border-radius: var(--radius);
	overflow: hidden;
	margin: 1.5rem 0;
}

/* Plain (non-highlighted) code blocks still get readable chrome without Prism. */
.post-content pre:not([class*="language-"]) {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	padding: 1.25rem;
	overflow-x: auto;
}

.post-content code {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.9em;
	background: var(--bg-elevated);
	padding: 0.15em 0.4em;
	border-radius: 4px;
}

.post-content pre code {
	background: none;
	padding: 0;
}

.post-content blockquote {
	border-left: 3px solid var(--accent);
	margin: 1.5rem 0;
	padding: 0.25rem 0 0.25rem 1.25rem;
	color: var(--text-muted);
}

.post-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.75rem 0;
	font-size: 0.95rem;
}

.post-content th,
.post-content td {
	border: 1px solid var(--border);
	padding: 0.65rem 0.9rem;
	text-align: left;
	vertical-align: top;
}

.post-content th {
	background: var(--accent);
	color: var(--accent-contrast);
	font-weight: 600;
}

.post-content tr:nth-child(even) td {
	background: var(--bg-elevated);
}

.post-content h2,
.post-content h3 {
	margin: 2.25rem 0 1rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
}

.post-content > h2:first-child,
.post-content > h3:first-child {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

.post-content .wp-block-embed {
	margin: 1.75rem 0;
}

.post-content .wp-embed-responsive iframe,
.post-content .wp-block-embed iframe {
	border-radius: var(--radius);
}

/* ---------------------------------------------
   About page
--------------------------------------------- */

section.wireframe-block,
.author-bio,
.author-timeline,
.author-certifications,
.author-skills,
.author-teaching,
.author-current-role,
.author-interests,
.author-contact {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
}

.related-posts.wireframe-block {
	background: none;
	border: none;
	padding: 0;
}

.timeline,
.cert-list,
.skill-list,
.contact-links {
	list-style: none;
	margin: 0;
	padding: 0;
}

.timeline-item,
.cert-list li {
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--border);
}

.timeline-item:last-child,
.cert-list li:last-child {
	border-bottom: none;
}

.skill-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.skill-list li {
	background: var(--accent-tint);
	color: var(--accent);
	border-radius: 999px;
	padding: 0.3rem 0.9rem;
	font-size: 0.88rem;
	font-weight: 600;
}

.contact-links li {
	padding: 0.3rem 0;
}

/* ---------------------------------------------
   Comments
--------------------------------------------- */

.comments-area {
	background: none;
	border: none;
	padding: 0;
	margin-top: 3rem;
	border-top: 1px solid var(--border);
	padding-top: 2.5rem;
}

.comment-list,
.comment-list .children {
	list-style: none;
	margin: 0;
	padding: 0;
}

.comment-list .children {
	margin-left: 2rem;
	border-left: 2px solid var(--accent-tint);
	padding-left: 1.25rem;
}

.comment-body {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem;
	margin-bottom: 1.25rem;
}

.comment-author {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 600;
	margin-bottom: 0.4rem;
}

.comment-author img {
	border-radius: 50%;
}

.comment-metadata {
	font-size: 0.82rem;
	color: var(--text-muted);
}

.comment-metadata a {
	color: var(--text-muted);
}

.comment-reply-link {
	font-size: 0.85rem;
	font-weight: 600;
}

.comment-respond {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.75rem;
	margin-top: 1.5rem;
}

.comment-form input:not([type="submit"]):not([type="checkbox"]),
.comment-form textarea {
	width: 100%;
	font-family: inherit;
	border: 1px solid var(--border);
	background: var(--bg);
	color: var(--text);
	border-radius: var(--radius-sm);
	padding: 0.6rem 0.85rem;
	margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: var(--accent);
}

.comment-form .form-submit input {
	width: auto;
	background: var(--accent);
	color: var(--accent-contrast);
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--transition);
}

.comment-form .form-submit input:hover {
	background: var(--accent-hover);
}

/* ---------------------------------------------
   Responsive
--------------------------------------------- */

@media (max-width: 720px) {
	.nav-toggle {
		display: inline-flex;
	}

	.header-collapse {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--bg);
		border-bottom: 1px solid var(--border);
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
		padding: 1rem 1.5rem 1.5rem;
		display: none;
	}

	.header-collapse.is-open {
		display: flex;
	}

	.primary-nav ul {
		flex-direction: column;
		gap: 0.75rem;
	}

	.hero {
		padding: 2.5rem 0 2rem;
	}

	.newsletter {
		padding: 1.75rem;
	}
}
