/**
 * AION Theme - Global Styles
 *
 * CSS reset, typography, layout utilities, and focus styles.
 * Depends on variables.css being loaded first.
 *
 * @package aion-theme
 * @since   1.0.0
 */

/* =========================================================================
   Modern CSS Reset
   ========================================================================= */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	/* Smooth scrolling — disabled when user prefers reduced motion */
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	tab-size: 4;
}

@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;
	}
}

body {
	font-family: var(--font-primary);
	font-size: var(--text-base);
	font-weight: var(--weight-normal);
	line-height: var(--leading-normal);
	color: var(--color-body-text);
	background-color: var(--color-white);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	min-height: 100vh;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
	border: 0;
}

input,
button,
textarea,
select {
	font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* Remove list styles when list has no role — explicit reset for nav lists */
ul[role='list'],
ol[role='list'] {
	list-style: none;
}

/* =========================================================================
   Typography
   ========================================================================= */

/* -- Headings -- */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-primary);
	color: var(--color-dark-text);
	line-height: var(--leading-tight);
	font-weight: var(--weight-bold);
	margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-3xl); font-weight: var(--weight-bold); }
h3 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); }
h4 { font-size: var(--text-xl);  font-weight: var(--weight-semibold); }
h5 { font-size: var(--text-lg);  font-weight: var(--weight-medium); }
h6 { font-size: var(--text-base); font-weight: var(--weight-medium); }

/* Responsive heading scale */
@media (min-width: 768px) {
	h1 { font-size: var(--text-5xl); }
	h2 { font-size: var(--text-4xl); }
	h3 { font-size: var(--text-3xl); }
	h4 { font-size: var(--text-2xl); }
}

@media (min-width: 1024px) {
	h1 { font-size: var(--text-5xl); }
}

/* -- Paragraphs -- */

p {
	margin-bottom: var(--space-4);
	line-height: var(--leading-relaxed);
}

p:last-child {
	margin-bottom: 0;
}

/* -- Links -- */

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

a:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

a:not([class]):hover {
	color: var(--color-accent-dark);
}

/* -- Inline Elements -- */

strong,
b {
	font-weight: var(--weight-semibold);
}

em,
i {
	font-style: italic;
}

small {
	font-size: var(--text-sm);
}

mark {
	background-color: var(--color-accent-light);
	color: var(--color-dark-text);
	padding: 0 var(--space-1);
	border-radius: var(--radius-sm);
}

/* -- Blockquote -- */

blockquote {
	border-left: 4px solid var(--color-accent);
	padding: var(--space-4) var(--space-6);
	margin: var(--space-6) 0;
	background-color: var(--color-light-bg);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	font-size: var(--text-lg);
	color: var(--color-dark-text);
	font-style: italic;
}

blockquote cite {
	display: block;
	margin-top: var(--space-2);
	font-size: var(--text-sm);
	font-style: normal;
	color: var(--color-body-text);
	font-weight: var(--weight-semibold);
}

/* -- Lists -- */

ul,
ol {
	padding-left: var(--space-6);
	margin-bottom: var(--space-4);
}

ul {
	list-style-type: disc;
}

ol {
	list-style-type: decimal;
}

li {
	margin-bottom: var(--space-2);
	line-height: var(--leading-relaxed);
}

/* Nested lists */
li > ul,
li > ol {
	margin-top: var(--space-2);
	margin-bottom: 0;
}

/* -- Code -- */

code,
kbd,
samp,
pre {
	font-family: 'SF Mono', 'Fira Code', Consolas, 'Courier New', monospace;
	font-size: var(--text-sm);
}

code {
	background-color: var(--color-light-bg);
	padding: 0.125rem var(--space-2);
	border-radius: var(--radius-sm);
	color: var(--color-dark-text);
}

pre {
	background-color: var(--color-dark-text);
	color: var(--color-light-bg);
	padding: var(--space-4) var(--space-6);
	border-radius: var(--radius-md);
	overflow-x: auto;
	margin-bottom: var(--space-4);
}

pre code {
	background: none;
	padding: 0;
	color: inherit;
}

/* -- HR -- */

hr {
	border: 0;
	border-top: 1px solid var(--color-border);
	margin: var(--space-8) 0;
}

/* -- Tables -- */

table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: var(--space-4);
}

th,
td {
	padding: var(--space-3) var(--space-4);
	text-align: left;
	border-bottom: 1px solid var(--color-border);
}

th {
	font-weight: var(--weight-semibold);
	color: var(--color-dark-text);
	background-color: var(--color-light-bg);
}

/* =========================================================================
   Layout Utilities
   ========================================================================= */

/* -- Container -- */

.container {
	width: 100%;
	max-width: var(--container-xl);
	margin-inline: auto;
	padding-inline: var(--space-4);
}

@media (min-width: 768px) {
	.container {
		padding-inline: var(--space-6);
	}
}

@media (min-width: 1024px) {
	.container {
		padding-inline: var(--space-8);
	}
}

@media (min-width: 1280px) {
	.container {
		padding-inline: var(--space-10);
	}
}

/* Container size variants */
.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--lg { max-width: var(--container-lg); }

/* -- Sections -- */

.section {
	padding-block: var(--space-12);
}

@media (min-width: 1024px) {
	.section {
		padding-block: var(--space-16);
	}
}

.section--dark {
	background-color: var(--color-primary);
	color: var(--color-white);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
	color: var(--color-white);
}

.section--dark p {
	color: rgba(255, 255, 255, 0.85);
}

.section--light {
	background-color: var(--color-light-bg);
}

/* -- Grid -- */

.grid {
	display: grid;
	gap: var(--space-6);
}

.grid--2 {
	grid-template-columns: 1fr;
}

.grid--3 {
	grid-template-columns: 1fr;
}

.grid--4 {
	grid-template-columns: 1fr;
}

@media (min-width: 768px) {
	.grid--2 { grid-template-columns: repeat(2, 1fr); }
	.grid--3 { grid-template-columns: repeat(2, 1fr); }
	.grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
	.grid--3 { grid-template-columns: repeat(3, 1fr); }
	.grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* -- Flex -- */

.flex {
	display: flex;
}

.flex--center {
	align-items: center;
	justify-content: center;
}

.flex--between {
	align-items: center;
	justify-content: space-between;
}

.flex--gap {
	gap: var(--space-4);
}

/* =========================================================================
   Accessibility
   ========================================================================= */

/* -- Skip Link -- */

.skip-link {
	position: absolute;
	top: -100%;
	left: var(--space-4);
	z-index: calc(var(--z-nav) + 10);
	background-color: var(--color-accent);
	color: var(--color-white);
	padding: var(--space-3) var(--space-5);
	border-radius: var(--radius-md);
	font-weight: var(--weight-semibold);
	text-decoration: none;
	transition: top var(--transition-fast);
}

.skip-link:focus {
	top: var(--space-4);
}

/* -- Screen Reader Only -- */

.sr-only,
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* -- Focus Styles -- */

:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/* Remove default outline only when using focus-visible */
:focus:not(:focus-visible) {
	outline: none;
}

/* Focus indicators on dark backgrounds */
.section--dark :focus-visible,
.hero :focus-visible,
.cta-banner :focus-visible {
	outline-color: var(--color-white);
}

.section--dark .btn:focus-visible,
.hero .btn:focus-visible,
.cta-banner .btn:focus-visible {
	outline: 2px solid var(--color-white);
	outline-offset: 3px;
}

/* =========================================================================
   Text Utilities
   ========================================================================= */

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }

.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

.text-muted { color: var(--color-body-text); }
.text-light { color: rgba(255, 255, 255, 0.8); }

/* =========================================================================
   Spacing Utilities
   ========================================================================= */

.mt-0  { margin-top: 0; }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.pt-0  { padding-top: 0; }
.pb-0  { padding-bottom: 0; }

/* =========================================================================
   WordPress Core Classes
   ========================================================================= */

/* Alignment classes (WordPress block editor) */
.alignleft {
	float: left;
	margin-right: var(--space-6);
	margin-bottom: var(--space-4);
}

.alignright {
	float: right;
	margin-left: var(--space-6);
	margin-bottom: var(--space-4);
}

.aligncenter {
	display: block;
	margin-inline: auto;
	margin-bottom: var(--space-4);
}

.alignwide {
	max-width: var(--container-lg);
	margin-inline: auto;
}

.alignfull {
	width: 100%;
	max-width: none;
}

/* WordPress caption */
.wp-caption {
	max-width: 100%;
	margin-bottom: var(--space-4);
}

.wp-caption-text {
	font-size: var(--text-sm);
	color: var(--color-body-text);
	margin-top: var(--space-1);
	text-align: center;
}

/* Sticky post */
.sticky {
	border-left: 4px solid var(--color-accent);
	padding-left: var(--space-4);
}

/* Screen reader text (WordPress standard class) */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* Pagination */
.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding-inline: var(--space-3);
	border-radius: var(--radius-md);
	border: 1px solid var(--color-border);
	color: var(--color-body-text);
	font-weight: var(--weight-medium);
	transition: all var(--transition-fast);
}

.page-numbers:hover {
	background-color: var(--color-accent);
	border-color: var(--color-accent);
	color: var(--color-white);
	text-decoration: none;
}

.page-numbers.current {
	background-color: var(--color-primary);
	border-color: var(--color-primary);
	color: var(--color-white);
}

.nav-links {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
	justify-content: center;
	margin-top: var(--space-8);
}

/* =========================================================================
   Utility: Display
   ========================================================================= */

.hidden { display: none !important; }
.is-hidden { display: none !important; }

@media (max-width: 767px) {
	.hidden--mobile { display: none !important; }
}

@media (min-width: 768px) {
	.hidden--desktop { display: none !important; }
}

/* =========================================================================
   Icon Size Utilities (used by aion_get_icon() helper)
   ========================================================================= */

.icon--xs  { width: 14px; height: 14px; }
.icon--sm  { width: 16px; height: 16px; }
.icon--md  { width: 20px; height: 20px; }
.icon--lg  { width: 24px; height: 24px; }
.icon--xl  { width: 32px; height: 32px; }
.icon--2xl { width: 48px; height: 48px; }
.icon--3xl { width: 64px; height: 64px; }
