/*
 * Base reset + typography + layout primitives.
 * Consumes tokens.css. No page-specific styles here — see Phase 2.
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

@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;
		scroll-behavior: auto !important;
	}
}

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--fs-base);
	line-height: var(--lh-normal);
	font-weight: var(--fw-regular);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
iframe,
embed,
object {
	max-width: 100%;
	display: block;
}

/* Embedded content (YouTube, CodePen, Gists, etc.) keeps its intrinsic
   aspect ratio instead of collapsing/overflowing on narrow screens. */
.wp-block-embed__wrapper,
.entry-content iframe,
.article-body iframe {
	position: relative;
	aspect-ratio: 16 / 9;
	width: 100%;
	height: auto;
}

/* Tables inside post content scroll horizontally instead of breaking
   the page layout — common with data/comparison tables in tutorials. */
.article-body table,
.entry-content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	margin-block: var(--space-5);
}

.article-body th,
.article-body td,
.entry-content th,
.entry-content td {
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	text-align: left;
}

a {
	color: var(--color-accent);
	text-decoration: none;
	transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
	color: var(--color-accent-hover);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-display);
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
	margin: 0 0 var(--space-4);
	letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
	margin: 0 0 var(--space-4);
	color: var(--color-text);
}

small,
.text-muted {
	color: var(--color-text-muted);
}

code,
pre,
kbd {
	font-family: var(--font-mono);
	font-size: 0.9em;
}

code {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 0.1em 0.4em;
}

pre {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	overflow-x: auto;
}

pre code {
	background: none;
	border: none;
	padding: 0;
}

hr {
	border: none;
	border-top: 1px solid var(--color-border);
	margin: var(--space-6) 0;
}

button,
input,
textarea,
select {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

::selection {
	background: var(--color-accent);
	color: var(--color-accent-ink);
}

/* Focus visibility — accessibility baseline, refined further in Step 22 */
:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/* ---- Layout primitives ---- */
.container {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: -100px;
	left: var(--space-4);
	background: var(--color-accent);
	color: var(--color-accent-ink);
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-sm);
	z-index: 1000;
	transition: top var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
	top: var(--space-4);
}
