/*
Theme Name: TechProMaster
Theme URI: https://example.com/techpromaster
Author: TechProMaster Team
Author URI: https://example.com
Description: A production-grade WordPress theme for technology education platforms and digital template marketplaces, featuring full WooCommerce integration, dark mode, dynamic platform statistics, and a complete content publishing system.
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 8.1
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: techpromaster
Tags: e-commerce, education, blog, one-column, two-columns, right-sidebar, custom-menu, featured-images, translation-ready, dark-mode, accessibility-ready
*/

/* =========================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   Consumed by: assets/css/components.css, woocommerce.css,
   admin.css, and assets/js/main.js (customizer preview reads
   these via getComputedStyle where needed).
   ========================================================= */
:root {
	/* Brand */
	--tpm-color-primary: #2563eb;
	--tpm-color-primary-dark: #1d4ed8;
	--tpm-color-primary-light: #60a5fa;

	/* Neutrals (light mode) */
	--tpm-color-bg: #ffffff;
	--tpm-color-bg-alt: #f8fafc;
	--tpm-color-surface: #ffffff;
	--tpm-color-border: #e2e8f0;
	--tpm-color-text: #0f172a;
	--tpm-color-text-muted: #64748b;

	/* Status */
	--tpm-color-success: #16a34a;
	--tpm-color-danger: #dc2626;

	/* Hero gradient (per SCREENSHOT_BUILD.md) */
	--tpm-hero-gradient: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);

	/* Type */
	--tpm-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--tpm-font-heading: var(--tpm-font-body);

	/* Spacing scale */
	--tpm-space-1: 4px;
	--tpm-space-2: 8px;
	--tpm-space-3: 16px;
	--tpm-space-4: 24px;
	--tpm-space-5: 32px;
	--tpm-space-6: 48px;
	--tpm-space-7: 72px;

	/* Radius / shadow */
	--tpm-radius: 8px;
	--tpm-radius-lg: 16px;
	--tpm-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);

	/* Layout */
	--tpm-container-width: 1200px;
	--tpm-header-height: 72px;
}

[data-theme="dark"] {
	--tpm-color-bg: #0f172a;
	--tpm-color-bg-alt: #111827;
	--tpm-color-surface: #1e293b;
	--tpm-color-border: #334155;
	--tpm-color-text: #f1f5f9;
	--tpm-color-text-muted: #94a3b8;
	--tpm-hero-gradient: linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

/* =========================================================
   2. RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--tpm-font-body);
	color: var(--tpm-color-text);
	background: var(--tpm-color-bg);
	line-height: 1.6;
	transition: background-color .2s ease, color .2s ease;
}

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

a { color: var(--tpm-color-primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
/*
 * Default link color (--tpm-color-primary, #2563eb) measures ~3.45:1 against
 * the dark-mode background (#0f172a) — below WCAG AA's 4.5:1 for text.
 * --tpm-color-primary-light (#60a5fa) measures ~7.02:1 on the same background.
 * :where() keeps this at the same specificity as the plain `a` rule above, so
 * it only affects links that don't already have their own color (body content,
 * footer nav, social links) — every component class (.tpm-menu-link,
 * .tpm-mega-link, .tpm-card-title a, buttons, etc.) already sets its own
 * explicit color and continues to win the cascade unchanged.
 */
:where([data-theme="dark"]) a {
	color: var(--tpm-color-primary-light);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--tpm-font-heading);
	line-height: 1.2;
	margin: 0 0 var(--tpm-space-3);
	color: var(--tpm-color-text);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.screen-reader-text:focus {
	position: static !important;
	width: auto; height: auto;
	clip: auto;
}

.tpm-container {
	max-width: var(--tpm-container-width);
	margin: 0 auto;
	padding: 0 var(--tpm-space-4);
}

/* =========================================================
   3. BUTTONS
   ========================================================= */
.tpm-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--tpm-space-2);
	padding: var(--tpm-space-2) var(--tpm-space-4);
	border-radius: var(--tpm-radius);
	font-weight: 600;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
}
.tpm-btn-primary {
	background: var(--tpm-color-primary);
	color: #fff;
}
.tpm-btn-primary:hover, .tpm-btn-primary:focus {
	background: var(--tpm-color-primary-dark);
	text-decoration: none;
	color: #fff;
}
.tpm-btn-secondary {
	background: transparent;
	border-color: var(--tpm-color-border);
	color: var(--tpm-color-text);
}
.tpm-btn-secondary:hover, .tpm-btn-secondary:focus {
	border-color: var(--tpm-color-primary);
	text-decoration: none;
}

/* =========================================================
   4. HEADER
   ========================================================= */
.tpm-header {
	height: var(--tpm-header-height);
	display: flex;
	align-items: center;
	background: rgba(255, 255, 255, 0.8);
	border-bottom: 1px solid var(--tpm-color-border);
	position: sticky;
	top: 0;
	z-index: 100;
	backdrop-filter: saturate(180%) blur(12px);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	transition: box-shadow 0.2s ease, background-color 0.2s ease;
}
[data-theme="dark"] .tpm-header {
	background: rgba(15, 23, 42, 0.75);
}
.tpm-header.is-scrolled {
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.tpm-header .tpm-container {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	width: 100%;
	column-gap: var(--tpm-space-4);
}

.tpm-logo {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--tpm-color-text);
	justify-self: start;
}
.tpm-logo .tpm-logo-accent { color: var(--tpm-color-primary); }

/* Primary nav: perfectly centered regardless of logo/actions width. */
.tpm-primary-nav {
	justify-self: center;
}
.tpm-primary-nav ul {
	list-style: none;
	display: flex;
	align-items: center;
	gap: var(--tpm-space-2);
	margin: 0;
	padding: 0;
}
.tpm-menu-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--tpm-color-text);
	font-weight: 500;
	font-size: 0.9375rem;
	padding: 8px 14px;
	border-radius: var(--tpm-radius);
	transition: background-color 0.15s ease, color 0.15s ease;
}
.tpm-menu-link:hover,
.tpm-menu-link:focus-visible {
	background: var(--tpm-color-bg-alt);
	color: var(--tpm-color-primary);
	text-decoration: none;
}
.tpm-menu-link:focus-visible {
	outline: 2px solid var(--tpm-color-primary);
	outline-offset: 2px;
}
.tpm-menu-link[aria-current="page"] {
	color: var(--tpm-color-primary);
	background: var(--tpm-color-bg-alt);
}
.tpm-menu-chevron {
	width: 14px;
	height: 14px;
	transition: transform 0.2s ease;
}
.tpm-menu-item--has-children.is-open .tpm-menu-chevron,
.tpm-menu-link[aria-expanded="true"] .tpm-menu-chevron {
	transform: rotate(180deg);
}

.tpm-header-actions {
	display: flex;
	align-items: center;
	gap: var(--tpm-space-3);
	justify-self: end;
}
.tpm-icon-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--tpm-color-text);
	padding: var(--tpm-space-1);
	display: inline-flex;
	border-radius: var(--tpm-radius);
	transition: background-color 0.15s ease;
}
.tpm-icon-btn:hover,
.tpm-icon-btn:focus-visible {
	background: var(--tpm-color-bg-alt);
}
.tpm-icon-btn:focus-visible {
	outline: 2px solid var(--tpm-color-primary);
	outline-offset: 2px;
}

/* Animated hamburger — hidden on desktop/tablet, shown on mobile (media query below). */
.tpm-hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	border-radius: var(--tpm-radius);
}
.tpm-hamburger:focus-visible {
	outline: 2px solid var(--tpm-color-primary);
	outline-offset: 2px;
}
.tpm-hamburger-line {
	display: block;
	width: 20px;
	height: 2px;
	margin: 0 auto;
	background: var(--tpm-color-text);
	border-radius: 2px;
	transition: transform 0.25s ease, opacity 0.25s ease;
}
.tpm-hamburger[aria-expanded="true"] .tpm-hamburger-line:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.tpm-hamburger[aria-expanded="true"] .tpm-hamburger-line:nth-child(2) {
	opacity: 0;
}
.tpm-hamburger[aria-expanded="true"] .tpm-hamburger-line:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.tpm-nav-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.4);
	z-index: 99;
	opacity: 0;
	transition: opacity 0.2s ease;
}
.tpm-nav-overlay[hidden] { display: none; }
.tpm-nav-overlay.is-visible { opacity: 1; }

/* =========================================================
   5. HERO
   ========================================================= */
.tpm-hero {
	background: var(--tpm-hero-gradient);
	padding: clamp(48px, 10vw, var(--tpm-space-7)) 0;
	text-align: center;
}
.tpm-hero-eyebrow {
	color: var(--tpm-color-primary);
	font-weight: 700;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.tpm-hero h1 {
	font-size: clamp(1.75rem, 4vw, 3.25rem);
	max-width: 720px;
	margin: var(--tpm-space-3) auto;
}
.tpm-hero p {
	color: var(--tpm-color-text-muted);
	max-width: 560px;
	margin: 0 auto var(--tpm-space-4);
}
.tpm-hero-ctas {
	display: flex;
	gap: var(--tpm-space-3);
	justify-content: center;
	margin-bottom: var(--tpm-space-5);
}
.tpm-hero-stats {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpm-space-5);
	justify-content: center;
	color: var(--tpm-color-text-muted);
	font-weight: 600;
}
.tpm-hero-stats strong { color: var(--tpm-color-text); }

/* =========================================================
   6. FOOTER
   ========================================================= */
.tpm-footer {
	background: var(--tpm-color-bg-alt);
	border-top: 1px solid var(--tpm-color-border);
	padding: var(--tpm-space-6) 0 var(--tpm-space-4);
	margin-top: var(--tpm-space-7);
}
.tpm-footer-grid {
	display: grid;
	grid-template-columns: 2fr repeat(3, 1fr);
	gap: var(--tpm-space-5);
}
.tpm-footer-col h3 {
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--tpm-color-text-muted);
}
.tpm-footer-col ul { list-style: none; margin: 0; padding: 0; }
.tpm-footer-col li { margin-bottom: var(--tpm-space-2); }

.tpm-footer-widgets {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--tpm-space-5);
	margin-top: var(--tpm-space-6);
	padding-top: var(--tpm-space-5);
	border-top: 1px solid var(--tpm-color-border);
}

.tpm-footer-bottom {
	margin-top: var(--tpm-space-5);
	padding-top: var(--tpm-space-4);
	border-top: 1px solid var(--tpm-color-border);
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpm-space-2);
	justify-content: space-between;
	color: var(--tpm-color-text-muted);
	font-size: 0.875rem;
}

@media (max-width: 1024px) {
	.tpm-hamburger { display: flex; width: 44px; height: 44px; }
	.tpm-icon-btn { padding: var(--tpm-space-3); }
}

@media (max-width: 782px) {
	.tpm-footer-grid { grid-template-columns: 1fr 1fr; }
	.tpm-footer-widgets { grid-template-columns: 1fr; }

	.tpm-header .tpm-container {
		grid-template-columns: auto auto;
	}
	.tpm-header-actions { order: 2; }

	/* Off-canvas panel: reuses the same <nav>/<ul> markup, no duplication. */
	.tpm-primary-nav {
		position: fixed;
		top: var(--tpm-header-height);
		left: 0;
		bottom: 0;
		width: min(320px, 85vw);
		background: var(--tpm-color-bg);
		border-right: 1px solid var(--tpm-color-border);
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		z-index: 100;
		justify-self: auto;
	}
	.tpm-primary-nav.is-open {
		transform: translateX(0);
	}
	.tpm-primary-nav ul#primary-menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: var(--tpm-space-3);
	}
	.tpm-menu-link {
		width: 100%;
		min-height: 44px;
		padding: 12px 14px;
	}
}

/* =========================================================
   7. SMALL PHONE (~480px and below)
   Nested inside the existing mobile experience above — only
   tightens spacing and stacks a couple of rows that stay
   side-by-side down to 782px but are too cramped below ~480px.
   Nothing here changes desktop or tablet layout.
   ========================================================= */
@media (max-width: 480px) {
	.tpm-container { padding: 0 var(--tpm-space-3); }

	.tpm-hero-ctas {
		flex-direction: column;
		align-items: stretch;
	}
	.tpm-hero-ctas .tpm-btn { justify-content: center; }
	.tpm-hero-stats { gap: var(--tpm-space-4); }

	.tpm-footer-grid { grid-template-columns: 1fr; }
	.tpm-footer-bottom { flex-direction: column; align-items: flex-start; }
}
