:root {
	color-scheme: light dark;
	--bg-paper: #f4f2ec;
	--bg-paper-alt: #ece9e0;
	--bg-card: #faf9f5;
	--bg-input: #ffffff;
	--bg-pill: #e6e2d6;
	--pastel-blue: #dce5f7;
	--pastel-sage: #dfece6;
	--pastel-amber: #f3e5c8;
	--on-sage: #1e5242;
	--on-amber: #6b420f;
	--pastel-rose: #f8dcdc;
	--on-rose: #8a1c1c;
	--ink-blue: #1f45c6;
	--ink-blue-dark: #173499;
	--on-blue: #ffffff;
	--ink-primary: #1a1d24;
	--ink-secondary: #3f4654;
	--ink-muted: #565d6c;
	--rule-color: #a9a498;
	--border-subtle: #d2cec2;
	--backdrop: rgba(26, 29, 36, 0.55);
	--radius: 4px;
	--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
	--font-mono: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg-paper: #16181d;
		--bg-paper-alt: #1b1e25;
		--bg-card: #21252d;
		--bg-input: #14161a;
		--bg-pill: #2d323c;
		--pastel-blue: #25345e;
		--pastel-sage: #1f3a31;
		--pastel-amber: #45361a;
		--on-sage: #a9dcc7;
		--on-amber: #f0cf94;
		--pastel-rose: #4d2424;
		--on-rose: #f3b4b4;
		--ink-blue: #9db4ff;
		--ink-blue-dark: #b9caff;
		--on-blue: #10142a;
		--ink-primary: #eceae4;
		--ink-secondary: #c6c8cf;
		--ink-muted: #a2a7b3;
		--rule-color: #4a505c;
		--border-subtle: #363b45;
		--backdrop: rgba(0, 0, 0, 0.65);
	}
}

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

[hidden] {
	display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

html {
	scroll-padding-top: 76px;
}

body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: 1rem;
	background-color: var(--bg-paper);
	color: var(--ink-primary);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--ink-blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover {
	text-decoration-thickness: 2px;
}

:focus-visible {
	outline: 3px solid var(--ink-blue);
	outline-offset: 2px;
}

code,
pre,
kbd {
	font-family: var(--font-mono);
	font-size: 0.9em;
}

kbd {
	display: inline-block;
	padding: 1px 6px;
	line-height: 1.3;
	color: var(--ink-primary);
	background: var(--bg-card);
	border: 1px solid var(--rule-color);
	border-bottom-width: 2px;
	border-radius: var(--radius);
}

.container {
	max-width: 1140px;
	margin: 0 auto;
	padding: 0 28px;
}

.skip-link {
	position: absolute;
	left: 8px;
	top: -60px;
	z-index: 60;
	padding: 8px 14px;
	background: var(--ink-blue);
	color: var(--on-blue);
	border-radius: var(--radius);
}

.skip-link:focus {
	top: 8px;
}

/* HEADER */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--bg-paper);
	border-bottom: 1px solid var(--rule-color);
}

.header-inner {
	display: flex;
	align-items: center;
	min-height: 60px;
	gap: 24px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}

.brand-logo {
	width: 26px;
	height: 26px;
}

.brand-name {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--ink-blue);
}

.main-nav {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.main-nav a {
	color: var(--ink-secondary);
	font-size: 0.95rem;
	text-decoration: none;
	padding: 8px 10px;
	border-radius: var(--radius);
	white-space: nowrap;
}

.main-nav a:hover {
	color: var(--ink-blue);
	background: var(--pastel-blue);
}

.lang-switch {
	display: inline-flex;
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	overflow: hidden;
}

.lang-switch a {
	font-size: 0.85rem;
	font-weight: 600;
	padding: 6px 10px;
	color: var(--ink-secondary);
	background: var(--bg-card);
	text-decoration: none;
}

.lang-switch a.active {
	background: var(--ink-blue);
	color: var(--on-blue);
}

/* BUTTONS */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	padding: 8px 16px;
	border-radius: var(--radius);
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}

.btn:active {
	transform: translateY(1px);
}

.btn-primary {
	background: var(--ink-blue);
	color: var(--on-blue);
	border-color: var(--ink-blue);
}

.btn-primary:hover {
	background: var(--ink-blue-dark);
	border-color: var(--ink-blue-dark);
}

.btn-secondary {
	background: var(--bg-card);
	color: var(--ink-primary);
	border-color: var(--rule-color);
}

.btn-secondary:hover {
	background: var(--pastel-blue);
	border-color: var(--ink-blue);
}

.btn-outline {
	background: transparent;
	color: var(--ink-primary);
	border-color: var(--rule-color);
}

.btn-outline:hover {
	border-color: var(--ink-blue);
	color: var(--ink-blue);
}

.btn-sm {
	min-height: 32px;
	padding: 4px 12px;
	font-size: 0.85rem;
}

/* SECTIONS */
.section {
	padding: 52px 0;
	border-bottom: 1px solid var(--border-subtle);
}

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

.section-title {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--ink-blue);
	margin: 0 0 14px;
}

.section-desc,
.section-note {
	margin: 0 0 22px;
	color: var(--ink-secondary);
	max-width: 68ch;
}

.section-note {
	margin: 26px 0 0;
}

/* INTRO */
.intro-grid {
	display: grid;
	grid-template-columns: 1fr 1.1fr;
	gap: 44px;
	align-items: center;
}

.intro-title {
	font-size: clamp(1.9rem, 4vw, 2.6rem);
	font-weight: 800;
	line-height: 1.12;
	color: var(--ink-primary);
	margin: 0 0 16px;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.intro-text {
	font-size: 1.1rem;
	margin: 0 0 22px;
	max-width: 52ch;
}

.intro-sub {
	font-size: 0.9rem;
	color: var(--ink-muted);
	margin: 18px 0 0;
	max-width: 52ch;
}

.intro-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* COMMAND TABLE */
.spec-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg-card);
	border: 1px solid var(--rule-color);
	font-size: 0.95rem;
}

.spec-table caption {
	text-align: left;
	padding: 0 0 8px;
	font-size: 0.9rem;
	color: var(--ink-secondary);
}

.spec-table th,
.spec-table td {
	text-align: left;
	padding: 11px 14px;
	border-bottom: 1px solid var(--border-subtle);
	vertical-align: top;
	font-weight: 400;
}

.spec-table thead th {
	background: var(--pastel-blue);
	color: var(--ink-primary);
	font-weight: 600;
	font-size: 0.85rem;
}

.spec-table tbody th {
	white-space: nowrap;
}

.spec-table tbody tr:last-child th,
.spec-table tbody tr:last-child td {
	border-bottom: 0;
}

.cmd-code {
	display: inline-block;
	background: var(--pastel-blue);
	color: var(--ink-primary);
	padding: 1px 6px;
	border-radius: var(--radius);
	font-weight: 600;
}

/* HOW TO USE */
.steps {
	list-style: none;
	counter-reset: step;
	margin: 0;
	padding: 0;
	max-width: 78ch;
}

.steps li {
	counter-increment: step;
	position: relative;
	padding: 0 0 22px 52px;
}

.steps li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: 0;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--ink-blue);
	border-radius: 50%;
	color: var(--ink-blue);
	font-weight: 700;
	background: var(--bg-card);
}

.steps h3 {
	margin: 0 0 4px;
	font-size: 1.1rem;
	line-height: 34px;
}

.steps p {
	margin: 0;
	color: var(--ink-secondary);
}

.screenshot {
	margin: 30px 0 0;
}

.screenshot img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
}

.screenshot figcaption {
	margin-top: 10px;
	font-size: 0.9rem;
	color: var(--ink-secondary);
	max-width: 78ch;
}

/* INSTALLATION */
.install-grid {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: 20px;
	align-items: start;
}

.install-card {
	background: var(--bg-card);
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	padding: 22px;
}

.install-card h3 {
	margin: 0 0 12px;
	font-size: 1.1rem;
}

.install-steps {
	padding-left: 22px;
	margin: 0;
	color: var(--ink-secondary);
}

.install-steps li {
	margin-bottom: 8px;
}

.install-note {
	margin: 12px 0 0;
	font-size: 0.9rem;
	color: var(--ink-muted);
}

.install-details {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--border-subtle);
	color: var(--ink-secondary);
	font-size: 0.95rem;
}

.install-details summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--ink-primary);
}

.install-details p {
	margin: 10px 0 0;
}

.copy-box {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--bg-input);
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	padding: 8px 10px;
	margin: 8px 0 4px;
}

.copy-box code {
	color: var(--ink-primary);
	overflow-wrap: anywhere;
}

.code-block {
	background: var(--bg-input);
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	padding: 12px;
	overflow-x: auto;
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--ink-primary);
	margin: 10px 0 0;
}

/* CATALOG EXPLORER */
.catalog-controls {
	background: var(--bg-card);
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	padding: 18px;
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.search-box label,
.field label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin-bottom: 4px;
}

.search-box input,
.field select {
	width: 100%;
	min-height: 42px;
	padding: 8px 12px;
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	background: var(--bg-input);
	color: var(--ink-primary);
	font-family: var(--font-sans);
	font-size: 1rem;
}

.search-box input::placeholder {
	color: var(--ink-muted);
}

.category-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 34px;
	padding: 4px 12px;
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
	background: var(--bg-paper);
	color: var(--ink-secondary);
	font-family: inherit;
	font-size: 0.9rem;
	cursor: pointer;
}

.pill img {
	width: 16px;
	height: 16px;
}

.pill-count {
	color: var(--ink-muted);
	font-size: 0.8rem;
}

.pill:hover {
	border-color: var(--ink-blue);
	color: var(--ink-primary);
}

.pill.active {
	background: var(--pastel-blue);
	border-color: var(--ink-blue);
	color: var(--ink-primary);
	font-weight: 600;
	box-shadow: inset 0 -2px 0 var(--ink-blue);
}

.pill.active .pill-count {
	color: var(--ink-primary);
}

.secondary-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-end;
}

.field {
	flex: 1 1 220px;
	max-width: 320px;
}

.eli-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	font-size: 0.9rem;
	color: var(--ink-secondary);
	cursor: pointer;
}

.eli-toggle-label input {
	width: 18px;
	height: 18px;
	accent-color: var(--ink-blue);
}

.catalog-results-bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	min-height: 32px;
	padding-top: 12px;
	border-top: 1px solid var(--border-subtle);
	font-size: 0.9rem;
	color: var(--ink-secondary);
}

.catalog-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
	gap: 14px;
}

/* Grid items default to min-width: auto, which lets one long word widen the whole column. */
.catalog-grid > li {
	min-width: 0;
}

.catalog-empty {
	grid-column: 1 / -1;
	padding: 36px 20px;
	text-align: center;
	background: var(--bg-card);
	border: 1px dashed var(--rule-color);
	border-radius: var(--radius);
	color: var(--ink-secondary);
}

.catalog-empty h3 {
	margin: 0 0 6px;
	color: var(--ink-primary);
}

.catalog-empty p {
	margin: 0 0 14px;
}

.source-card {
	position: relative;
	height: 100%;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.source-card:hover {
	border-color: var(--ink-blue);
}

.source-card-top {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.source-card-icon {
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}

.source-card-top > div {
	min-width: 0;
}

.source-card-title,
.source-card-desc {
	overflow-wrap: anywhere;
}

.source-card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
}

/* The title button stretches over the whole card so the card is one click target. */
.source-card-open {
	all: unset;
	cursor: pointer;
	color: var(--ink-primary);
}

.source-card-open::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: var(--radius);
}

.source-card-open:focus-visible::after {
	outline: 3px solid var(--ink-blue);
	outline-offset: 2px;
}

.source-card-provider {
	font-size: 0.85rem;
	color: var(--ink-muted);
	margin-top: 2px;
}

.source-card-desc {
	margin: 0;
	font-size: 0.9rem;
	color: var(--ink-secondary);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.source-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: auto;
}

.badge {
	max-width: 100%;
	overflow-wrap: anywhere;
	font-size: 0.8rem;
	padding: 2px 8px;
	border-radius: var(--radius);
	background: var(--bg-pill);
	color: var(--ink-secondary);
}

.badge-type {
	background: var(--pastel-blue);
	color: var(--ink-primary);
	font-weight: 600;
}

.badge-country {
	background: var(--pastel-sage);
	color: var(--on-sage);
}

.badge-eli {
	background: var(--pastel-amber);
	color: var(--on-amber);
}

.badge-dead {
	background: var(--pastel-rose);
	color: var(--on-rose);
	font-weight: 600;
}

.catalog-load-more-wrap {
	text-align: center;
	margin-top: 22px;
}

/* CONTRIBUTE */
.contribute-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 44px;
}

.contribute-grid p {
	margin: 0 0 18px;
	color: var(--ink-secondary);
}

.build-line {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	font-size: 0.9rem;
	color: var(--ink-muted);
}

/* LAYER DETAILS DIALOG */
.modal-dialog {
	width: min(700px, calc(100vw - 32px));
	max-height: min(84vh, 760px);
	padding: 0;
	background: var(--bg-card);
	color: var(--ink-primary);
	border: 1px solid var(--rule-color);
	border-radius: var(--radius);
}

.modal-dialog[open] {
	display: flex;
	flex-direction: column;
}

.modal-dialog::backdrop {
	background: var(--backdrop);
}

.modal-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--rule-color);
	background: var(--bg-paper);
}

.modal-title-wrap {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.modal-icon {
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}

.modal-header h2 {
	margin: 0;
	font-size: 1.1rem;
	line-height: 1.3;
}

.modal-id {
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--ink-muted);
}

.modal-close {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius);
	color: var(--ink-secondary);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.modal-close:hover {
	border-color: var(--rule-color);
	color: var(--ink-primary);
}

.modal-body {
	padding: 18px;
	overflow-y: auto;
	color: var(--ink-secondary);
}

.modal-body > p:first-child {
	margin-top: 0;
}

.modal-body h3 {
	margin: 20px 0 6px;
	font-size: 0.95rem;
	color: var(--ink-primary);
}

.modal-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 6px 16px;
	margin: 14px 0 0;
	font-size: 0.95rem;
}

.modal-facts dt {
	color: var(--ink-muted);
}

.modal-facts dd {
	margin: 0;
	color: var(--ink-primary);
	overflow-wrap: anywhere;
}

.modal-body details {
	margin-top: 20px;
}

.modal-body summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--ink-primary);
}

/* FOOTER */
.site-footer {
	padding: 24px 0;
	font-size: 0.9rem;
	color: var(--ink-muted);
}

.footer-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
}

@media (max-width: 860px) {
	.container {
		padding: 0 16px;
	}

	.section {
		padding: 36px 0;
	}

	.intro-grid,
	.install-grid,
	.contribute-grid {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	/* The section links move to their own scrollable row under the brand. */
	.header-inner {
		flex-wrap: wrap;
		gap: 0 16px;
		padding-top: 8px;
	}

	.lang-switch {
		margin-left: auto;
	}

	.main-nav {
		order: 3;
		width: 100%;
		margin: 4px -10px 0;
		overflow-x: auto;
	}

	html {
		scroll-padding-top: 110px;
	}

	.spec-table tbody th {
		white-space: normal;
	}

	.field {
		max-width: none;
	}
}
