/**
 * LAM Thinking — Layer 2: reset, elements, typography, a11y utilities.
 * Depends on assets/css/tokens.css.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--lam-header-h) + var(--lam-space-4));
}

body {
	margin: 0;
	background-color: var(--lam-bg);
	color: var(--lam-fg);
	font-family: var(--lam-body);
	font-size: var(--lam-text-base);
	line-height: var(--lam-leading-body);
	font-synthesis-weight: none;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-wrap: break-word;
}

/* Ambient depth — one paint, no extra elements. */
body.lam-theme {
	background-image:
		radial-gradient(60rem 32rem at 78% -8%, rgba(52, 120, 255, 0.16), transparent 65%),
		radial-gradient(48rem 28rem at 4% 12%, rgba(255, 140, 0, 0.08), transparent 60%);
	background-repeat: no-repeat;
	background-attachment: scroll;
}

h1,
h2,
h3,
h4,
h5,
h6,
.site-title {
	font-family: var(--lam-display);
	line-height: var(--lam-leading-tight);
	letter-spacing: var(--lam-tracking-tight);
	font-weight: 600;
	text-wrap: balance;
	margin: 0 0 var(--lam-space-4);
}

h1 { font-size: var(--lam-text-4xl); }
h2 { font-size: var(--lam-text-3xl); }
h3 { font-size: var(--lam-text-2xl); }
h4 { font-size: var(--lam-text-xl); }

p,
ul,
ol,
dl,
figure,
blockquote,
pre,
table {
	margin: 0 0 var(--lam-space-4);
}

p { text-wrap: pretty; }

a {
	color: var(--lam-primary);
	text-decoration-color: rgba(52, 120, 255, 0.4);
	text-underline-offset: 0.22em;
	transition: color var(--lam-dur-fast) var(--lam-ease);
}

a:hover { color: var(--lam-primary-hover); }

/* Visible, consistent keyboard focus everywhere. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--lam-focus);
	outline-offset: 3px;
	border-radius: var(--lam-radius-sm);
}

:where(a, button, input, select, textarea):focus:not(:focus-visible) {
	outline: none;
}

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

img,
video {
	height: auto;
}

strong,
b { font-weight: 600; }

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

code,
kbd,
pre {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.9em;
}

pre {
	overflow-x: auto;
	padding: var(--lam-space-4);
	background: var(--lam-bg-deep);
	border: 1px solid var(--lam-border);
	border-radius: var(--lam-radius-sm);
}

table {
	width: 100%;
	border-collapse: collapse;
}

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

/* ---- Accessibility utilities ---- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	inset-inline-start: var(--lam-space-4);
	inset-block-start: var(--lam-space-2);
	z-index: 999;
}

.skip-link:focus {
	position: fixed;
	width: auto;
	height: auto;
	margin: 0;
	clip: auto;
	clip-path: none;
	padding: var(--lam-space-3) var(--lam-space-4);
	background: var(--lam-primary);
	color: #fff;
	border-radius: var(--lam-radius-sm);
	white-space: normal;
}

/* Respect motion preferences globally. */
@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;
	}
}

@media (prefers-contrast: more) {
	:root {
		--lam-muted: #cbd7e8;
		--lam-border: rgba(234, 240, 250, 0.34);
	}
}
