/* ===== Reset & base ===== */

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

:root {
	--color-bg:        #fff;
	--color-text:      #1a1a1a;
	--color-muted:     #555;
	--color-border:    #ddd;
	--color-brand:     hsl(220, 90%, 52%);
	--color-brand-dim: hsl(220, 90%, 96%);
	--border-radius:   .375rem;
	--max-width:       52rem;
	--font-mono:       ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-bg:        #111;
		--color-text:      #e8e8e8;
		--color-muted:     #999;
		--color-border:    #333;
		--color-brand:     hsl(220, 90%, 65%);
		--color-brand-dim: hsl(220, 30%, 16%);
	}
}

html {
	background: var(--color-bg);
	color: var(--color-text);
	font-family: system-ui, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
}

body {
	margin: 0;
}

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

header {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: .75rem 1.5rem;
	border-bottom: 1px solid var(--color-border);
	position: sticky;
	top: 0;
	background: var(--color-bg);
	z-index: 100;
}

main {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 2rem 1.5rem 4rem;
}

footer {
	border-top: 1px solid var(--color-border);
	padding: 1.5rem;
	text-align: center;
	font-size: .875rem;
	color: var(--color-muted);
}

/* ===== Logo ===== */

#logo {
	display: flex;
	align-items: center;
	gap: .4rem;
	text-decoration: none;
	color: inherit;
	flex-shrink: 0;
}

.logo-key {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border: 2px solid var(--color-brand);
	border-radius: .3rem;
	color: var(--color-brand);
	font-size: 1.25rem;
	line-height: 1;
}

.logo-text {
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: -.01em;
}

/* ===== Main nav ===== */

.nav-main {
	margin-left: auto;
}

.nav-main ul {
	display: flex;
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-main a {
	color: var(--color-muted);
	text-decoration: none;
	font-size: .9rem;
}

.nav-main a:hover,
.nav-main a:focus-visible {
	color: var(--color-brand);
}

/* ===== Search form ===== */

header form {
	display: flex;
	gap: .4rem;
}

header input[type="search"] {
	padding: .35rem .6rem;
	border: 1px solid var(--color-border);
	border-radius: var(--border-radius);
	background: var(--color-bg);
	color: var(--color-text);
	font-size: .875rem;
	width: 10rem;
}

header button {
	padding: .35rem .75rem;
	border: none;
	border-radius: var(--border-radius);
	background: var(--color-brand);
	color: #fff;
	font-size: .875rem;
	cursor: pointer;
}

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

h1, h2 {
	line-height: 1.25;
	font-weight: 700;
}

h1 {
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	margin: 0 0 .75rem;
}

h2 {
	font-size: 1.15rem;
	margin: 2.5rem 0 .5rem;
	padding-bottom: .35rem;
	border-bottom: 1px solid var(--color-border);
}

p {
	margin: 0 0 1rem;
	color: var(--color-text);
}

.lead {
	font-size: 1.05rem;
	color: var(--color-muted);
	margin-bottom: 2rem;
}

a {
	color: var(--color-brand);
}

code {
	font-family: var(--font-mono);
	font-size: .875em;
	background: var(--color-brand-dim);
	padding: .1em .3em;
	border-radius: .2em;
}

pre {
	background: var(--color-brand-dim);
	padding: 1rem 1.25rem;
	border-radius: var(--border-radius);
	overflow-x: auto;
	margin: 0 0 1rem;
}

pre code {
	background: none;
	padding: 0;
	font-size: .875rem;
}

kbd {
	display: inline-block;
	padding: .1em .4em;
	border: 1px solid var(--color-border);
	border-bottom-width: 2px;
	border-radius: .25em;
	font-family: var(--font-mono);
	font-size: .8em;
	background: var(--color-bg);
}

/* ===== Demo nav & form ===== */

.demo-nav {
	margin: 0 0 1.5rem;
}

.demo-nav ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: .3rem;
}

.demo-nav a {
	font-size: .9rem;
}

.demo-form {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin-bottom: 1.5rem;
}

.demo-form label {
	font-size: .9rem;
}

.demo-form input {
	padding: .35rem .6rem;
	border: 1px solid var(--color-border);
	border-radius: var(--border-radius);
	background: var(--color-bg);
	color: var(--color-text);
	font-size: .875rem;
}

.demo-form button {
	padding: .35rem .75rem;
	border: none;
	border-radius: var(--border-radius);
	background: var(--color-brand);
	color: #fff;
	font-size: .875rem;
	cursor: pointer;
}

/* ===== Demo notice ===== */

.debug-notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35rem .6rem;
	padding: .75rem 1rem;
	margin-bottom: 2rem;
	background-color: hsl(45, 100%, 94%);
	border-left: 3px solid hsl(45, 100%, 42%);
	border-radius: 0 var(--border-radius) var(--border-radius) 0;
	font-size: .875rem;
}

@media (prefers-color-scheme: dark) {
	.debug-notice {
		background-color: hsl(45, 20%, 16%);
		border-left-color: hsl(45, 80%, 50%);
	}
}

.badge {
	display: inline-block;
	padding: .1em .45em;
	border-radius: .2em;
	font-size: .85em;
	font-weight: 600;
}

.badge--blue {
	background: hsl(200, 80%, 92%);
	color: hsl(200, 100%, 22%);
	box-shadow: inset 0 0 0 2px hsl(200, 100%, 45%);
}

.badge--orange {
	background: hsl(30, 100%, 92%);
	color: hsl(30, 100%, 22%);
	box-shadow: inset 0 0 0 2px hsl(30, 100%, 50%);
}

@media (prefers-color-scheme: dark) {
	.badge--blue {
		background: hsl(200, 40%, 18%);
		color: hsl(200, 80%, 72%);
	}
	.badge--orange {
		background: hsl(30, 40%, 18%);
		color: hsl(30, 80%, 72%);
	}
}

/* ===== Skip links — demo design layer (mandatory rules are in dist/dynamic-skip-links.min.css) ===== */

#skiplinks a:focus-visible,
#skiplinks a:active {
	display: block;
	padding: .6rem 1.5rem;
	background: var(--color-brand);
	color: #fff;
	font-size: .875rem;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	outline: none;
}
