/**
 * Base Styles
 * CSS Reset, Typography, Colors, and Foundation Styles
 * Implements the 75/25 dark/light design system
 *
 * @package Techtronic_Learning
 * @since 1.0.0
 */

/* ==========================================================================
   Modern CSS Reset
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	-moz-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	font-size: 16px;
	/* Removed overflow-x: hidden to enable position: sticky */
	overflow-y: scroll;  /* Always show vertical scrollbar to prevent layout shift */
}

body {
	min-height: 100vh;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Removed overflow-x: hidden to enable position: sticky */

	/* Design System Colors */
	background-color: var(--surface-0);
	color: var(--text-body-dark);

	/* Typography */
	font-family: var(--font-body);
	font-size: var(--text-base);
	font-weight: var(--weight-regular);
	line-height: var(--leading-loose);
}

/* Prevent FOUC (Flash of Unstyled Content) */
body {
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

body.loaded {
	opacity: 1;
}

/* ==========================================================================
   Typography - Headings
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-display);
	color: var(--text-heading-dark);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	margin-bottom: var(--spacing-lg);
}

h1 {
	font-size: var(--text-5xl);
	font-weight: var(--weight-bold);
	letter-spacing: -0.01em;
}

h2 {
	font-size: var(--text-4xl);
	font-weight: var(--weight-bold);
	letter-spacing: -0.005em;
}

h3 {
	font-size: var(--text-3xl);
	font-weight: var(--weight-semibold);
	letter-spacing: 0;
}

h4 {
	font-size: var(--text-2xl);
	font-weight: var(--weight-semibold);
}

h5 {
	font-size: var(--text-xl);
	font-weight: var(--weight-semibold);
}

h6 {
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

/* ==========================================================================
   Typography - Body Text
   ========================================================================== */

p {
	margin-bottom: var(--spacing-md);
	line-height: var(--leading-loose);
}

p:last-child {
	margin-bottom: 0;
}

/* Large body text */
.text-lg {
	font-size: var(--text-lg);
	line-height: var(--leading-loose);
}

/* Small body text */
.text-sm {
	font-size: var(--text-sm);
	line-height: var(--leading-relaxed);
}

/* Caption text */
.text-caption {
	font-size: var(--text-xs);
	line-height: var(--leading-normal);
	letter-spacing: 0.02em;
}

/* ==========================================================================
   Typography - Text Styles
   ========================================================================== */

strong,
b {
	font-weight: var(--weight-bold);
}

em,
i {
	font-style: italic;
}

small {
	font-size: var(--text-sm);
}

code,
kbd,
samp {
	font-family: var(--font-mono);
	font-size: 0.9em;
	background: var(--surface-2);
	color: var(--primary-500);
	padding: 2px 6px;
	border-radius: var(--radius-sm);
}

pre {
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	background: var(--surface-2);
	color: var(--text-body-dark);
	padding: var(--spacing-lg);
	border-radius: var(--radius-md);
	overflow-x: auto;
	margin-bottom: var(--spacing-lg);
	line-height: var(--leading-relaxed);
}

pre code {
	background: none;
	padding: 0;
	color: inherit;
}

blockquote {
	border-left: 4px solid var(--primary-700);
	padding-left: var(--spacing-lg);
	margin: var(--spacing-xl) 0;
	font-style: italic;
	color: var(--text-secondary-dark);
}

blockquote p {
	margin-bottom: var(--spacing-md);
}

blockquote cite {
	display: block;
	font-size: var(--text-sm);
	color: var(--text-tertiary-dark);
	font-style: normal;
	margin-top: var(--spacing-sm);
}

/* ==========================================================================
   Links
   ========================================================================== */

a {
	color: var(--link-color-dark);
	text-decoration: none;
	transition: color var(--duration-base) var(--ease-out);
}

a:hover {
	color: var(--link-hover-dark);
	text-decoration: underline;
}

a:active {
	color: var(--primary-600);
}

/* Links on light surfaces */
.light-surface a {
	color: var(--link-color-light);
}

.light-surface a:hover {
	color: var(--link-hover-light);
}

/* ==========================================================================
   Lists
   ========================================================================== */

ul,
ol {
	margin-bottom: var(--spacing-lg);
	padding-left: var(--spacing-xl);
}

ul {
	list-style-type: disc;
}

ol {
	list-style-type: decimal;
}

li {
	margin-bottom: var(--spacing-sm);
	line-height: var(--leading-loose);
}

li:last-child {
	margin-bottom: 0;
}

/* Nested lists */
ul ul,
ol ol,
ul ol,
ol ul {
	margin-top: var(--spacing-sm);
	margin-bottom: var(--spacing-sm);
}

/* Unstyled list */
.list-unstyled {
	list-style: none;
	padding-left: 0;
}

.list-unstyled li {
	margin-bottom: var(--spacing-sm);
}

/* Definition lists */
dl {
	margin-bottom: var(--spacing-lg);
}

dt {
	font-weight: var(--weight-semibold);
	color: var(--text-heading-dark);
	margin-bottom: var(--spacing-xs);
}

dd {
	margin-bottom: var(--spacing-md);
	margin-left: var(--spacing-lg);
}

/* ==========================================================================
   Media Elements
   ========================================================================== */

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

figure {
	margin: var(--spacing-xl) 0;
}

figcaption {
	font-size: var(--text-sm);
	color: var(--text-secondary-dark);
	margin-top: var(--spacing-sm);
	text-align: center;
}

/* ==========================================================================
   Form Elements Reset
   ========================================================================== */

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
}

button:disabled {
	cursor: not-allowed;
}

/* ==========================================================================
   Tables
   ========================================================================== */

table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	margin-bottom: var(--spacing-xl);
}

thead {
	background: var(--surface-2);
}

th {
	font-family: var(--font-display);
	font-weight: var(--weight-semibold);
	text-align: left;
	padding: var(--spacing-md);
	border-bottom: 2px solid var(--gray-700);
	color: var(--text-heading-dark);
}

td {
	padding: var(--spacing-md);
	border-bottom: 1px solid var(--gray-700);
}

tbody tr:hover {
	background: var(--surface-1);
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */

hr {
	border: 0;
	height: 1px;
	background: var(--gray-700);
	margin: var(--spacing-4xl) 0;
}

/* ==========================================================================
   Accessibility Classes
   ========================================================================== */

/* Skip Link - Visible on focus for keyboard navigation */
.skip-link {
	position: absolute;
	top: -9999px;
	left: -9999px;
	z-index: 999999;
	padding: var(--spacing-md) var(--spacing-lg);
	background: var(--surface-4);
	color: var(--text-heading-dark);
	text-decoration: underline;
	font-weight: var(--weight-bold);
	border-radius: var(--radius-base);
}

.skip-link:focus {
	top: var(--spacing-md);
	left: var(--spacing-md);
	clip: auto;
	clip-path: none;
	width: auto;
	height: auto;
	outline: 2px solid var(--primary-500);
	outline-offset: 4px;
}

/* Screen Reader Text - Hidden visually but available to screen readers */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.screen-reader-text:focus {
	position: static;
	width: auto;
	height: auto;
	padding: inherit;
	margin: inherit;
	overflow: visible;
	clip: auto;
	clip-path: none;
	white-space: normal;
}

/* ==========================================================================
   Focus Styles - Keyboard Navigation (WCAG 2.1 AA)
   ========================================================================== */

/* Global focus styles - NEVER remove these */
*:focus-visible {
	outline: 2px solid var(--primary-500);
	outline-offset: 4px;
}

/* Only hide focus for mouse clicks */
*:focus:not(:focus-visible) {
	outline: none;
}

/* Custom focus for specific elements */
a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--primary-500);
	outline-offset: 4px;
}

/* ==========================================================================
   Container System
   ========================================================================== */

.container {
	width: 100%;
	max-width: var(--container-standard);
	margin: 0 auto;
	padding: 0 var(--container-padding-mobile);
}

@media (min-width: 768px) {
	.container {
		padding: 0 var(--container-padding-desktop);
	}
}

.container--wide {
	max-width: var(--container-wide);
}

.container--narrow {
	max-width: var(--container-narrow);
}

.container--compact {
	max-width: var(--container-compact);
}

.container--full {
	max-width: var(--container-full);
	padding: 0;
}

/* ==========================================================================
   Content Wrapper (Dark background)
   ========================================================================== */

.content-wrapper {
	background-color: var(--surface-0);
	min-height: 50vh;
	padding: var(--spacing-4xl) 0;
}

@media (max-width: 767px) {
	.content-wrapper {
		padding: var(--spacing-3xl) 0;
	}
}

/* ==========================================================================
   Light Surface Classes (25% of interface)
   ========================================================================== */

.light-surface {
	background-color: var(--surface-light-0);
	color: var(--text-body-light);
	border-radius: var(--radius-md);
}

.light-surface h1,
.light-surface h2,
.light-surface h3,
.light-surface h4,
.light-surface h5,
.light-surface h6 {
	color: var(--text-heading-light);
}

.light-surface--elevated {
	background-color: var(--surface-light-1);
	box-shadow: var(--shadow-base);
}

/* ==========================================================================
   Text Color Utilities
   ========================================================================== */

.text-heading {
	color: var(--text-heading-dark);
}

.text-body {
	color: var(--text-body-dark);
}

.text-secondary {
	color: var(--text-secondary-dark);
}

.text-tertiary {
	color: var(--text-tertiary-dark);
}

.text-disabled {
	color: var(--text-disabled-dark);
}

/* On light surfaces */
.light-surface .text-heading {
	color: var(--text-heading-light);
}

.light-surface .text-body {
	color: var(--text-body-light);
}

.light-surface .text-secondary {
	color: var(--text-secondary-light);
}

/* Brand colors */
.text-orange {
	color: var(--accent-700);
}

.text-teal {
	color: var(--primary-500);
}

.text-success {
	color: var(--success-500);
}

.text-error {
	color: var(--error-500);
}

.text-warning {
	color: var(--warning-500);
}

/* ==========================================================================
   WordPress Alignment Classes
   ========================================================================== */

.alignleft {
	float: left;
	margin-right: var(--spacing-lg);
	margin-bottom: var(--spacing-lg);
}

.alignright {
	float: right;
	margin-left: var(--spacing-lg);
	margin-bottom: var(--spacing-lg);
}

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

.alignwide {
	max-width: var(--container-wide);
	margin-left: auto;
	margin-right: auto;
}

.alignfull {
	max-width: 100%;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

/* ==========================================================================
   WordPress Core Classes
   ========================================================================== */

.wp-caption {
	max-width: 100%;
}

.wp-caption-text {
	font-size: var(--text-sm);
	color: var(--text-secondary-dark);
	margin-top: var(--spacing-sm);
	text-align: center;
}

.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--spacing-lg);
	margin-bottom: var(--spacing-xl);
}

.gallery-item {
	margin: 0;
}

.gallery-caption {
	font-size: var(--text-sm);
	color: var(--text-secondary-dark);
	margin-top: var(--spacing-sm);
}

.sticky {
	/* Styles for sticky posts - to be defined in theme */
}

.bypostauthor {
	/* Styles for post author comments - to be defined in theme */
}

/* ==========================================================================
   Utility Classes - Spacing
   ========================================================================== */

.mt-0 {
	margin-top: 0;
}

.mt-sm {
	margin-top: var(--spacing-sm);
}

.mt-md {
	margin-top: var(--spacing-md);
}

.mt-lg {
	margin-top: var(--spacing-lg);
}

.mt-xl {
	margin-top: var(--spacing-xl);
}

.mb-0 {
	margin-bottom: 0;
}

.mb-sm {
	margin-bottom: var(--spacing-sm);
}

.mb-md {
	margin-bottom: var(--spacing-md);
}

.mb-lg {
	margin-bottom: var(--spacing-lg);
}

.mb-xl {
	margin-bottom: var(--spacing-xl);
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	*,
	*::before,
	*::after {
		background: transparent !important;
		color: #000 !important;
		box-shadow: none !important;
		text-shadow: none !important;
	}

	body {
		background: #fff !important;
		color: #000 !important;
	}

	a,
	a:visited {
		text-decoration: underline;
		color: #000 !important;
	}

	a[href]::after {
		content: " (" attr(href) ")";
	}

	abbr[title]::after {
		content: " (" attr(title) ")";
	}

	a[href^="#"]::after,
	a[href^="javascript:"]::after {
		content: "";
	}

	pre,
	blockquote {
		border: 1px solid #999;
		page-break-inside: avoid;
	}

	thead {
		display: table-header-group;
	}

	tr,
	img {
		page-break-inside: avoid;
	}

	img {
		max-width: 100% !important;
	}

	p,
	h2,
	h3 {
		orphans: 3;
		widows: 3;
	}

	h2,
	h3 {
		page-break-after: avoid;
	}

	.site-header,
	.site-footer,
	.no-print,
	.skip-link {
		display: none;
	}
}
