/* Rounded clean UI tokens: raw values, then the semantic names the page uses. */
:root {
	--raw-ink: #101614;
	--raw-ink-60: #5b6660;
	--raw-green: #0e653f;
	--raw-green-deep: #094c2f;
	--raw-lime: #d6f24e;
	--raw-tint: #e3e9d9;
	--raw-paper: #eff2e9;
	--raw-white: #ffffff;
	--raw-line: #dce2d2;
	--raw-on-dark: #f3f6ef;
	--raw-red: #b42318;
	--raw-red-tint: #fdecea;

	--surface-page: var(--raw-paper);
	--surface-card: var(--raw-white);
	--surface-sunken: var(--raw-tint);
	--surface-dark: var(--raw-ink);
	--surface-accent: var(--raw-lime);
	--text-primary: var(--raw-ink);
	--text-secondary: var(--raw-ink-60);
	--text-brand: var(--raw-green);
	--text-on-dark: var(--raw-on-dark);
	--text-on-accent: var(--raw-ink);
	--border-subtle: var(--raw-line);
	--status-error: var(--raw-red);
	--status-error-tint: var(--raw-red-tint);

	--radius-pill: 999px;
	--radius-card: 24px;
	--radius-inner: 16px;

	--lift-card: 0 1px 2px rgb(16 22 20 / 0.04), 0 8px 20px -6px rgb(16 22 20 / 0.05);

	--font-display: "Funnel Display", "Wix Madefor Display", "Host Grotesk", system-ui, sans-serif;
	--font-body: "Funnel Sans", "Wix Madefor Text", "Host Grotesk", system-ui, sans-serif;
	--font-mono: "JetBrains Mono", ui-monospace, monospace;

	--topbar: 72px;
}

* {
	box-sizing: border-box;
}

html {
	scroll-padding-top: calc(var(--topbar) + 16px);
}

body {
	margin: 0;
	background: var(--surface-page);
	color: var(--text-primary);
	font: 400 16px/1.6 var(--font-body);
}

a {
	color: var(--text-brand);
	text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--text-brand);
	outline-offset: 2px;
	border-radius: 6px;
}

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

:not(pre) > code,
kbd {
	background: var(--surface-sunken);
	border-radius: 6px;
	padding: 0.1em 0.4em;
}

/* Top bar */
.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	height: var(--topbar);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 24px;
	background: rgb(239 242 233 / 0.9);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border-subtle);
}

.logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font: 800 19px var(--font-display);
	letter-spacing: -0.02em;
	color: var(--text-primary);
	text-decoration: none;
	margin-right: auto;
}

.logo-docs {
	font: 500 13px var(--font-body);
	letter-spacing: 0;
	color: var(--text-secondary);
	background: var(--surface-card);
	border-radius: var(--radius-pill);
	padding: 3px 10px;
	box-shadow: var(--lift-card);
}

.logo-mark {
	display: inline-flex;
	align-items: flex-end;
	gap: 3px;
	width: 30px;
	height: 30px;
	padding: 7px;
	border-radius: 50%;
	background: var(--surface-dark);
}

.logo-mark i {
	flex: 1;
	border-radius: 2px;
	background: var(--surface-accent);
}

.logo-mark i:nth-child(1) { height: 45%; }
.logo-mark i:nth-child(2) { height: 100%; }
.logo-mark i:nth-child(3) { height: 70%; }

.btn {
	display: inline-flex;
	align-items: center;
	border-radius: var(--radius-pill);
	padding: 9px 18px;
	font: 600 14px/1.4 var(--font-body);
	text-decoration: none;
}

.btn-ink {
	background: var(--surface-dark);
	color: var(--text-on-dark);
}

.menu {
	display: none;
	font: 600 14px var(--font-body);
	color: var(--text-primary);
	background: var(--surface-card);
	border: 0;
	border-radius: var(--radius-pill);
	padding: 9px 18px;
	box-shadow: var(--lift-card);
	cursor: pointer;
}

/* Three columns: sidebar, page, on this page */
.shell {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr) 220px;
	gap: 40px;
	max-width: 1400px;
	margin: 0 auto;
	padding: 32px 24px 80px;
	align-items: start;
}

.sidebar,
.toc {
	position: sticky;
	top: calc(var(--topbar) + 32px);
	max-height: calc(100vh - var(--topbar) - 48px);
	overflow-y: auto;
}

.sidebar {
	background: var(--surface-card);
	border-radius: var(--radius-card);
	box-shadow: var(--lift-card);
	padding: 16px 12px;
}

.nav-section + .nav-section {
	margin-top: 16px;
}

.nav-section p {
	margin: 0 0 4px;
	padding: 0 12px;
	font-weight: 600;
	font-size: 13px;
	color: var(--text-brand);
}

.nav-section ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-section a {
	display: block;
	padding: 7px 12px;
	border-radius: var(--radius-pill);
	color: var(--text-secondary);
	text-decoration: none;
	font-weight: 500;
	font-size: 15px;
}

.nav-section a:hover {
	color: var(--text-primary);
	background: var(--surface-page);
}

.nav-section a[aria-current="page"] {
	background: var(--surface-accent);
	color: var(--text-on-accent);
	font-weight: 600;
}

.more {
	display: block;
	margin: 16px 4px 4px;
	padding: 12px;
	border-radius: var(--radius-inner);
	background: var(--surface-sunken);
	color: var(--text-primary);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
}

.more:hover {
	background: var(--border-subtle);
}

.toc p {
	margin: 0 0 8px;
	font-weight: 600;
	font-size: 13px;
	color: var(--text-brand);
}

.toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
	border-left: 1px solid var(--border-subtle);
}

.toc a {
	display: block;
	padding: 5px 0 5px 14px;
	margin-left: -1px;
	border-left: 2px solid transparent;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 14px;
}

.toc a:hover {
	color: var(--text-primary);
}

.toc a.is-active {
	color: var(--text-primary);
	border-left-color: var(--text-brand);
	font-weight: 500;
}

/* The page */
.doc {
	background: var(--surface-card);
	border-radius: var(--radius-card);
	box-shadow: var(--lift-card);
	padding: 48px 56px 56px;
}

.doc > * {
	max-width: 720px;
}

.doc h1 {
	font: 800 clamp(2.2rem, 4vw, 2.75rem)/1.06 var(--font-display);
	letter-spacing: -0.025em;
	margin: 0 0 16px;
}

.doc h2 {
	font: 600 1.5rem/1.2 var(--font-display);
	letter-spacing: -0.015em;
	margin: 48px 0 12px;
}

.doc p,
.doc li {
	color: var(--text-secondary);
}

.doc strong {
	color: var(--text-primary);
	font-weight: 600;
}

.lead {
	font-size: 19px;
	line-height: 1.58;
	margin: 0 0 32px;
}

.doc ul,
.doc ol {
	padding-left: 1.3em;
}

.doc li {
	margin-bottom: 6px;
}

.doc ol li::marker {
	color: var(--text-brand);
	font-weight: 600;
}

/* Example: the chart, then the block that drew it */
.example {
	margin: 24px 0 32px;
	background: var(--surface-sunken);
	border-radius: var(--radius-card);
	padding: 8px;
}

.example-chart {
	background: var(--surface-card);
	border-radius: var(--radius-inner);
	overflow: hidden;
}

.example-chart img {
	display: block;
	width: 100%;
	height: auto;
}

.example .code {
	margin: 0;
}

.example pre {
	padding: 16px 16px 10px;
}

.code {
	position: relative;
	margin: 20px 0;
}

pre {
	margin: 0;
	background: var(--surface-sunken);
	border-radius: var(--radius-inner);
	padding: 18px 20px;
	overflow-x: auto;
	font-size: 14px;
	line-height: 1.6;
}

pre.plain {
	margin: 16px 0;
}

.copy {
	position: absolute;
	top: 10px;
	right: 10px;
	font: 600 13px var(--font-body);
	color: var(--text-primary);
	background: var(--surface-card);
	border: 0;
	border-radius: var(--radius-pill);
	padding: 5px 14px;
	cursor: pointer;
	box-shadow: var(--lift-card);
}

/* Tables */
.table-wrap {
	overflow-x: auto;
	margin: 16px 0 24px;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
}

th,
td {
	text-align: left;
	vertical-align: top;
	padding: 10px 14px 10px 0;
	border-bottom: 1px solid var(--border-subtle);
}

th {
	font-weight: 600;
	font-size: 13px;
	color: var(--text-secondary);
}

td {
	color: var(--text-secondary);
}

td:first-child {
	color: var(--text-primary);
}

td:first-child code {
	white-space: nowrap;
}

.matrix th:not(:first-child),
.matrix td:not(:first-child) {
	text-align: center;
	padding-right: 8px;
}

.matrix .yes {
	color: var(--text-brand);
	font-weight: 600;
}

.matrix .no {
	color: var(--text-secondary);
}

/* Messages the plugin shows, styled the way the block shows them */
.message {
	font: 500 14px/1.5 var(--font-mono);
	border-radius: var(--radius-inner);
	padding: 12px 16px;
	margin: 12px 0 24px;
}

.message.error {
	color: var(--status-error);
	background: var(--status-error-tint);
}

.message.notice {
	color: var(--text-secondary);
	background: var(--surface-sunken);
}

/* Previous and next */
.pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 16px;
}

.pager a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 18px 22px;
	background: var(--surface-card);
	border-radius: var(--radius-card);
	box-shadow: var(--lift-card);
	text-decoration: none;
	color: var(--text-primary);
	font: 600 17px var(--font-display);
}

.pager a span {
	font: 500 13px var(--font-body);
	color: var(--text-secondary);
}

.pager-next {
	text-align: right;
}

.pager a:hover {
	background: var(--surface-accent);
}

.footer {
	background: var(--surface-dark);
	color: rgb(243 246 239 / 0.75);
	padding: 28px 24px;
	font-size: 15px;
}

.footer p {
	max-width: 1400px;
	margin: 0 auto;
}

.footer a {
	color: var(--text-on-dark);
}

/* Narrower screens */
@media (max-width: 1180px) {
	.shell {
		grid-template-columns: 240px minmax(0, 1fr);
	}

	.toc {
		display: none;
	}
}

@media (max-width: 860px) {
	.menu {
		display: inline-flex;
	}

	.shell {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
		padding: 16px 16px 64px;
	}

	.sidebar {
		display: none;
		position: static;
		max-height: none;
	}

	.sidebar.is-open {
		display: block;
	}

	.doc {
		padding: 28px 20px 32px;
	}

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

	.logo-docs {
		display: none;
	}
}
