:root {
	--bg: #f5f1e8;
	--bg-strong: #ece4d4;
	--panel: rgba(255, 252, 245, 0.9);
	--panel-solid: #fffdf8;
	--ink: #1b1b18;
	--muted: #5f5a52;
	--line: rgba(35, 33, 28, 0.12);
	--accent: #0f766e;
	--accent-strong: #0b4f4a;
	--accent-soft: rgba(15, 118, 110, 0.12);
	--shadow: 0 24px 60px rgba(34, 31, 23, 0.14);
	--sidebar-width: 20rem;
	--content-width: 52rem;
	--radius-lg: 1.5rem;
	--radius-md: 1rem;
	--radius-sm: 0.75rem;
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: "IBM Plex Sans", sans-serif;
	color: var(--ink);
	background:
		radial-gradient(circle at top left, rgba(15, 118, 110, 0.15), transparent 28rem),
		linear-gradient(180deg, #f7f3eb 0%, #f3eee4 100%);
}

body.nav-open {
	overflow: hidden;
}

a {
	color: inherit;
}

img {
	max-width: 100%;
}

code,
pre {
	font-family: "IBM Plex Mono", monospace;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.site-shell {
	min-height: 100vh;
	display: grid;
	grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.mobile-backdrop {
	display: none;
}

.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	padding: 1.25rem;
	border-right: 1px solid var(--line);
	background: rgba(244, 239, 228, 0.88);
	backdrop-filter: blur(18px);
}

.sidebar__inner {
	height: 100%;
	padding: 1.25rem;
	border-radius: var(--radius-lg);
	background: linear-gradient(180deg, rgba(255, 252, 245, 0.94), rgba(247, 241, 229, 0.94));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
	display: flex;
	flex-direction: column;
	gap: 2rem;
	overflow: auto;
}

.brand-block__title {
	display: inline-block;
	font-family: "Source Serif 4", serif;
	font-size: 1.75rem;
	font-weight: 700;
	text-decoration: none;
}

.brand-block__copy,
.sidebar__section-label,
.nav-group__children a,
.meta-list {
	color: var(--muted);
}

.eyebrow,
.panel-card__eyebrow,
.hero__kicker {
	margin: 0 0 0.5rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--accent);
}

.sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.sidebar__section-label {
	font-size: 0.85rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.nav-group {
	display: grid;
	gap: 0.35rem;
}

.nav-group__topic {
	display: block;
	width: 100%;
	padding: 0.8rem 0.9rem;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	text-align: left;
	font-weight: 600;
	font: inherit;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-group__topic:hover,
.nav-group__topic:focus-visible,
.nav-group__children a:hover,
.nav-group__children a:focus-visible,
.button:hover,
.button:focus-visible,
.topic-tile:hover,
.topic-tile:focus-visible {
	outline: none;
	transform: translateY(-1px);
}

.nav-group__topic.is-active,
.nav-group__topic:hover,
.nav-group__topic:focus-visible {
	background: var(--accent-soft);
	color: var(--accent-strong);
}

.nav-group__children {
	display: none;
	gap: 0.15rem;
	padding-left: 0.85rem;
	border-left: 1px solid rgba(15, 118, 110, 0.16);
	margin-left: 0.9rem;
}

.nav-group__children.is-open {
	display: grid;
}

.nav-group__children a {
	padding: 0.45rem 0.75rem;
	border-radius: 0.65rem;
	font-size: 0.95rem;
	text-decoration: none;
	transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-group__children a.is-active,
.nav-group__children a:hover,
.nav-group__children a:focus-visible {
	background: rgba(255, 255, 255, 0.78);
	color: var(--ink);
}

.main-panel {
	min-width: 0;
}

.topbar {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	background: transparent;
}

.topbar__title h1 {
	margin: 0;
	font-family: "Source Serif 4", serif;
	font-size: clamp(1.6rem, 2vw, 2rem);
}

.menu-button {
	display: none;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.7);
	cursor: pointer;
	flex-shrink: 0;
}

.menu-button span:not(.sr-only) {
	display: block;
	width: 1rem;
	height: 2px;
	margin: 2px 0;
	background: var(--ink);
}

.content {
	width: min(100%, calc(var(--content-width) + 6rem));
	margin: 0 auto;
	padding: 2rem 1.5rem 4rem;
}

.hero,
/* .article, */
.panel-card,
.topic-tile,
.note-callout {
	background: var(--panel);
	border: 1px solid rgba(255, 255, 255, 0.72);
	box-shadow: var(--shadow);
}

.hero {
	padding: clamp(1.5rem, 3vw, 3rem);
	border-radius: calc(var(--radius-lg) + 0.25rem);
}

.hero h2 {
	margin: 0;
	font-family: "Source Serif 4", serif;
	font-size: clamp(2.4rem, 5vw, 4.1rem);
	line-height: 0.96;
	max-width: 12ch;
}

.hero__body {
	max-width: 46rem;
	font-size: 1.08rem;
	line-height: 1.75;
	color: var(--muted);
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.85rem;
	margin-top: 1.5rem;
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	padding: 0.8rem 1.1rem;
	border-radius: 999px;
	border: 1px solid transparent;
	font-weight: 600;
	text-decoration: none;
	transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button--primary {
	background: var(--accent);
	color: #f7fffe;
}

.button--ghost {
	background: rgba(255, 255, 255, 0.72);
	border-color: rgba(15, 118, 110, 0.16);
}

.panel-grid,
.topic-list__grid {
	display: grid;
	gap: 1rem;
}

.panel-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin-top: 1.5rem;
}

.panel-card,
.topic-tile {
	padding: 1.25rem;
	border-radius: var(--radius-md);
	text-decoration: none;
	transition: transform 160ms ease, border-color 160ms ease;
}

.panel-card h3,
.topic-tile h3,
.section-heading h2,
.article h2,
.article h3 {
	margin: 0 0 0.75rem;
	font-family: "Source Serif 4", serif;
}

.topic-list {
	margin-top: 2.5rem;
}

.section-heading {
	margin-bottom: 1rem;
}

.topic-list__grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.topic-tile p,
.panel-card p,
.article p,
.article li,
.article blockquote {
	line-height: 1.75;
}

.article {
	/* padding: clamp(1.3rem, 3vw, 2.3rem); */
	/* border-radius: calc(var(--radius-lg) + 0.15rem); */
}

.article__header {
	padding-bottom: 1.5rem;
	margin-bottom: 1.5rem;
	border-bottom: 1px solid var(--line);
}

.article__lede {
	max-width: 42rem;
	color: var(--muted);
	font-size: 1.05rem;
}

.article section + section {
	margin-top: 2.5rem;
	padding-top: 2rem;
	border-top: 1px solid rgba(35, 33, 28, 0.08);
}

.meta-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	padding: 0;
	margin: 1rem 0 0;
	list-style: none;
	font-size: 0.95rem;
}

.note-callout {
	padding: 1rem 1.1rem;
	border-radius: var(--radius-md);
	margin: 1.25rem 0;
}

pre {
	overflow-x: auto;
	padding: 1rem;
	border-radius: var(--radius-md);
	background: #1f2937;
	color: #f9fafb;
}

pre code {
	font-size: 0.92rem;
	background: transparent;
}

:not(pre) > code {
	padding: 0.18rem 0.45rem;
	border-radius: 999px;
	background: rgba(15, 118, 110, 0.1);
	color: var(--accent-strong);
}

blockquote {
	margin: 1.25rem 0;
	padding: 0.1rem 0 0.1rem 1rem;
	border-left: 3px solid rgba(15, 118, 110, 0.42);
	color: var(--muted);
}

.mermaid-card {
	padding: 1rem;
	border-radius: var(--radius-md);
	background: var(--panel-solid);
	border: 1px solid var(--line);
	overflow-x: auto;
}

.mermaid {
	min-width: 18rem;
}

.footer-note {
	margin-top: 2rem;
	color: var(--muted);
	font-size: 0.95rem;
}

@media (max-width: 1080px) {
	.panel-grid,
	.topic-list__grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 900px) {
	.site-shell {
		grid-template-columns: 1fr;
	}

	.mobile-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(26, 24, 20, 0.4);
		backdrop-filter: blur(2px);
		opacity: 0;
		pointer-events: none;
		transition: opacity 160ms ease;
		z-index: 25;
		display: block;
	}

	body.nav-open .mobile-backdrop {
		opacity: 1;
		pointer-events: auto;
	}

	.sidebar {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		width: min(88vw, 22rem);
		height: auto;
		z-index: 30;
		transform: translateX(-100%);
		transition: transform 180ms ease;
	}

	body.nav-open .sidebar {
		transform: translateX(0);
	}

	.menu-button {
		display: inline-flex;
	}

	.content {
		padding-inline: 1rem;
	}

	.hero h2 {
		max-width: 100%;
	}
}

@media (max-width: 640px) {
	.topbar {
		padding-inline: 1rem;
	}

	.hero,
	/* .article, */
	.panel-card,
	.topic-tile {
		border-radius: 1.15rem;
	}

	.hero__actions,
	.meta-list {
		flex-direction: column;
		align-items: flex-start;
	}
}
