/* OwnStack docs — hand-rolled, no framework. Dark by default, pink as identity. */

:root {
	--bg: #0a0a10;
	--bg-elev: #14141d;
	--bg-soft: #1a1a25;
	--bg-code: #11111a;
	--border: #25252f;
	--border-strong: #3a3a45;

	--text: #e8e8ee;
	--text-soft: #b0b0bc;
	--text-mute: #7a7a88;
	--text-faint: #50505a;

	--accent: #ec4899;
	--accent-bright: #f472b6;
	--accent-soft: #831843;
	--accent-faint: #4a0d2c;

	--success: #34d399;
	--warning: #fbbf24;
	--danger: #f87171;
	--info: #60a5fa;

	--radius: 6px;
	--radius-lg: 10px;

	--font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
	--font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
	--font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif Pro", Georgia, serif;

	--max-content: 760px;
	--header-h: 60px;
	--sidebar-w: 280px;
	--toc-w: 240px;
}

@media (prefers-color-scheme: light) {
	:root:not([data-theme="dark"]) {
		--bg: #ffffff;
		--bg-elev: #fafafa;
		--bg-soft: #f4f4f6;
		--bg-code: #f8f8fa;
		--border: #e5e5ea;
		--border-strong: #c5c5cd;
		--text: #18181b;
		--text-soft: #44444c;
		--text-mute: #6a6a72;
		--text-faint: #a8a8b0;
		--accent: #be185d;
		--accent-bright: #ec4899;
		--accent-soft: #fce7f3;
		--accent-faint: #fdf2f8;
	}
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	font-family: var(--font-sans);
	font-size: 16px;
	line-height: 1.65;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-feature-settings: "ss01", "cv11";
}

a {
	color: var(--accent-bright);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 120ms ease;
}
a:hover { border-bottom-color: currentColor; }

::selection { background: var(--accent); color: #fff; }

/* ===== Header ===== */

.site-header {
	height: var(--header-h);
	border-bottom: 1px solid var(--border);
	background: var(--bg);
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	padding: 0 24px;
	gap: 24px;
}
.site-header::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -1px;
	height: 2px;
	background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent-bright) 70%, transparent 100%);
	opacity: 0.6;
	pointer-events: none;
}

.site-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	font-weight: 600;
	font-size: 16px;
	letter-spacing: -0.01em;
	border: 0;
}
.site-brand:hover { border: 0; color: var(--text); }
.site-brand svg { color: var(--accent); width: 24px; height: 24px; }
.site-brand .wordmark { font-weight: 700; }
.site-brand .wordmark .accent { color: var(--accent); }

.site-nav {
	display: flex;
	gap: 20px;
	margin-left: auto;
	align-items: center;
}
.site-nav a {
	color: var(--text-soft);
	font-size: 14px;
	font-weight: 500;
	border: 0;
	padding: 6px 0;
}
.site-nav a:hover { color: var(--text); border: 0; }
.site-nav a.active { color: var(--accent-bright); }

.search-box {
	position: relative;
	width: 240px;
}
.search-box input {
	width: 100%;
	height: 32px;
	padding: 0 12px 0 32px;
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 13px;
	outline: none;
	transition: border-color 120ms, background 120ms;
}
.search-box input:focus {
	border-color: var(--accent);
	background: var(--bg);
}
.search-box::before {
	content: "";
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 14px;
	height: 14px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0b0bc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
}

.search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 6px;
	max-height: 60vh;
	overflow-y: auto;
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: 0 12px 32px rgba(0,0,0,0.4);
	display: none;
	z-index: 60;
	padding: 6px;
	width: 360px;
}
.search-results.open { display: block; }
.search-result {
	display: block;
	padding: 10px 12px;
	border-radius: var(--radius);
	border: 0;
	color: var(--text);
}
.search-result:hover, .search-result.selected {
	background: var(--bg-soft);
	border: 0;
}
.search-result .title {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 2px;
}
.search-result .breadcrumb {
	font-size: 12px;
	color: var(--text-mute);
}
.search-result .snippet {
	font-size: 12px;
	color: var(--text-soft);
	margin-top: 4px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.search-result mark {
	background: var(--accent-faint);
	color: var(--accent-bright);
	padding: 0 2px;
	border-radius: 2px;
}
.search-empty {
	padding: 18px;
	color: var(--text-mute);
	font-size: 13px;
	text-align: center;
}

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

.layout {
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
	gap: 0;
	max-width: 1400px;
	margin: 0 auto;
	min-height: calc(100vh - var(--header-h));
}

.sidebar {
	border-right: 1px solid var(--border);
	padding: 28px 24px 60px;
	overflow-y: auto;
	position: sticky;
	top: var(--header-h);
	max-height: calc(100vh - var(--header-h));
}
.sidebar-section {
	margin-bottom: 28px;
}
.sidebar-section h3 {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-mute);
	margin: 0 0 8px 0;
	font-weight: 600;
}
.sidebar-section ul { list-style: none; padding: 0; margin: 0; }
.sidebar-section li { margin: 0; }
.sidebar-section a {
	display: block;
	padding: 4px 8px;
	color: var(--text-soft);
	border: 0;
	font-size: 14px;
	border-radius: var(--radius);
	margin-left: -8px;
	line-height: 1.4;
}
.sidebar-section a:hover {
	color: var(--text);
	background: var(--bg-soft);
	border: 0;
}
.sidebar-section a.active {
	color: var(--accent-bright);
	background: var(--accent-faint);
	font-weight: 500;
}

.content {
	padding: 32px 56px 80px;
	min-width: 0;
	max-width: calc(var(--max-content) + 112px);
}

.toc {
	border-left: 1px solid var(--border);
	padding: 32px 24px 60px;
	position: sticky;
	top: var(--header-h);
	max-height: calc(100vh - var(--header-h));
	overflow-y: auto;
	font-size: 13px;
}
.toc h4 {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-mute);
	margin: 0 0 10px 0;
	font-weight: 600;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc li.h3 { padding-left: 12px; }
.toc a {
	display: block;
	padding: 3px 0;
	color: var(--text-mute);
	border: 0;
	line-height: 1.4;
}
.toc a:hover { color: var(--text); border: 0; }
.toc a.active { color: var(--accent-bright); }

/* ===== Article typography ===== */

.breadcrumb {
	font-size: 13px;
	color: var(--text-mute);
	margin: 0 0 16px 0;
	display: flex;
	gap: 8px;
	align-items: center;
}
.breadcrumb a { color: var(--text-mute); border: 0; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-faint); }

.article h1 {
	font-size: 36px;
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 12px 0;
	font-weight: 700;
}
.article .lede {
	font-size: 18px;
	line-height: 1.6;
	color: var(--text-soft);
	margin: 0 0 32px 0;
	font-weight: 400;
}
.article .meta {
	font-size: 13px;
	color: var(--text-mute);
	display: flex;
	gap: 20px;
	margin-bottom: 32px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--border);
}

.article h2 {
	font-size: 24px;
	line-height: 1.3;
	margin: 48px 0 12px;
	letter-spacing: -0.015em;
	font-weight: 700;
	scroll-margin-top: calc(var(--header-h) + 16px);
}
.article h2::before {
	content: "";
	display: block;
	width: 24px;
	height: 2px;
	background: var(--accent);
	margin-bottom: 14px;
	border-radius: 2px;
}
.article h3 {
	font-size: 18px;
	line-height: 1.35;
	margin: 32px 0 8px;
	font-weight: 600;
	scroll-margin-top: calc(var(--header-h) + 16px);
}
.article h4 {
	font-size: 15px;
	line-height: 1.4;
	margin: 24px 0 6px;
	font-weight: 600;
	color: var(--text);
}

.article p {
	margin: 0 0 16px;
}
.article p, .article li { color: var(--text); }

.article ul, .article ol {
	padding-left: 24px;
	margin: 0 0 16px;
}
.article li { margin: 4px 0; }
.article li > p { margin: 4px 0; }

.article hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 32px 0;
}

.article :where(p, li) code,
.article :where(td, th) code {
	font-family: var(--font-mono);
	font-size: 0.88em;
	padding: 2px 6px;
	background: var(--bg-soft);
	border: 1px solid var(--border);
	border-radius: 4px;
	color: var(--accent-bright);
}

.article a {
	color: var(--accent-bright);
	border-bottom: 1px solid var(--accent-faint);
}
.article a:hover { border-bottom-color: var(--accent-bright); }

.article blockquote {
	margin: 16px 0;
	padding: 12px 18px;
	border-left: 3px solid var(--text-faint);
	color: var(--text-soft);
	font-style: italic;
}

/* ===== Tables ===== */

.article table {
	width: 100%;
	border-collapse: collapse;
	margin: 16px 0 24px;
	font-size: 14px;
}
.article th, .article td {
	border-bottom: 1px solid var(--border);
	padding: 10px 12px;
	text-align: left;
	vertical-align: top;
}
.article th {
	background: var(--bg-soft);
	font-weight: 600;
	color: var(--text);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.article tr:hover td { background: var(--bg-soft); }

/* ===== Code blocks (terminal-styled for $ prompts) ===== */

.article pre {
	font-family: var(--font-mono);
	font-size: 13.5px;
	line-height: 1.6;
	background: var(--bg-code);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	margin: 16px 0 24px;
	overflow: hidden;
	position: relative;
}
.article pre code {
	display: block;
	padding: 16px 20px;
	overflow-x: auto;
	color: var(--text);
	background: transparent;
	border: 0;
	font-size: inherit;
}
.article pre.terminal {
	border-color: var(--accent-faint);
}
.article pre.terminal::before {
	content: "";
	display: block;
	height: 28px;
	background: var(--bg-soft);
	border-bottom: 1px solid var(--border);
	background-image: radial-gradient(circle at 12px 14px, #ff5f57 5px, transparent 5.5px),
		radial-gradient(circle at 32px 14px, #febc2e 5px, transparent 5.5px),
		radial-gradient(circle at 52px 14px, #28c840 5px, transparent 5.5px);
}
.article pre.terminal code { padding-top: 12px; }
.article pre.terminal code .prompt {
	color: var(--accent);
	user-select: none;
	margin-right: 8px;
}
.article pre.terminal code .out {
	color: var(--text-mute);
	display: block;
}

.copy-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--bg-soft);
	border: 1px solid var(--border);
	color: var(--text-soft);
	font-family: var(--font-sans);
	font-size: 11px;
	padding: 4px 8px;
	border-radius: 4px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 120ms;
}
.article pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--bg); color: var(--text); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* Tokens for syntax (extremely light coloring; doesn't try to be full lexer) */
.tok-kw { color: var(--accent-bright); }
.tok-str { color: #fbbf24; }
.tok-num { color: #34d399; }
.tok-com { color: var(--text-mute); font-style: italic; }
.tok-var { color: #60a5fa; }
.tok-fn  { color: #c084fc; }

/* ===== Callouts ===== */

.callout {
	margin: 20px 0;
	padding: 14px 16px 14px 16px;
	border-radius: var(--radius-lg);
	border-left: 3px solid;
	background: var(--bg-soft);
	font-size: 14.5px;
	line-height: 1.55;
	display: flex;
	gap: 12px;
	align-items: flex-start;
}
.callout strong { display: block; margin-bottom: 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.callout p:last-child { margin-bottom: 0; }
.callout-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 2px;
}
.callout.note     { border-left-color: var(--info);    background: rgba(96,165,250,0.06);  }
.callout.note strong     { color: var(--info); }
.callout.tip      { border-left-color: var(--success); background: rgba(52,211,153,0.06);  }
.callout.tip strong      { color: var(--success); }
.callout.warning  { border-left-color: var(--warning); background: rgba(251,191,36,0.06);  }
.callout.warning strong  { color: var(--warning); }
.callout.danger   { border-left-color: var(--danger);  background: rgba(248,113,113,0.06); }
.callout.danger strong   { color: var(--danger); }

/* ===== Footer / next-prev / related ===== */

.next-prev {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 56px;
	padding-top: 24px;
	border-top: 1px solid var(--border);
}
.next-prev a {
	display: block;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	color: var(--text);
	border-bottom: 1px solid var(--border);
	transition: border-color 120ms;
}
.next-prev a:hover {
	border-color: var(--accent);
	border-bottom-color: var(--accent);
}
.next-prev .label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-mute);
	margin-bottom: 4px;
}
.next-prev .title { font-weight: 600; font-size: 14px; }
.next-prev .next { text-align: right; }

.related {
	margin-top: 40px;
	padding: 16px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--bg-soft);
}
.related h4 {
	margin: 0 0 8px 0;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-mute);
	font-weight: 600;
}
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: 3px 0; font-size: 14px; }

.site-footer {
	border-top: 1px solid var(--border);
	padding: 32px 24px;
	color: var(--text-mute);
	font-size: 13px;
	text-align: center;
	margin-top: 80px;
}

/* ===== Homepage ===== */

.home {
	padding: 0;
	max-width: 1100px;
	margin: 0 auto;
}
.home-hero {
	padding: 100px 32px 72px;
	text-align: center;
	position: relative;
}
.home-hero::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 32px;
	transform: translateX(-50%);
	width: 80px;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.home-hero h1 {
	font-size: 56px;
	line-height: 1.05;
	letter-spacing: -0.03em;
	margin: 0 0 18px;
	font-weight: 700;
	color: var(--text);
}
.home-hero h1 .gradient {
	background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.home-hero .lede {
	font-size: 19px;
	line-height: 1.55;
	color: var(--text-soft);
	max-width: 640px;
	margin: 0 auto 32px;
}
.home-hero .cta {
	display: inline-flex;
	gap: 12px;
}
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: var(--radius);
	font-size: 14px;
	font-weight: 500;
	border: 1px solid var(--border);
	color: var(--text);
	background: var(--bg-elev);
	cursor: pointer;
	transition: all 120ms;
}
.btn:hover { border-color: var(--accent); border-bottom-color: var(--accent); }
.btn.primary {
	background: var(--accent);
	color: #fff;
	border-color: var(--accent);
}
.btn.primary:hover {
	background: var(--accent-bright);
	border-color: var(--accent-bright);
}

.home-stack {
	width: 280px;
	height: 200px;
	margin: 0 auto 48px;
	position: relative;
}
.home-stack .layer {
	position: absolute;
	left: 50%;
	border-radius: 14px;
	border: 1px solid var(--border);
	background: var(--bg-elev);
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	color: var(--text-soft);
	font-family: var(--font-mono);
	letter-spacing: 0.02em;
}
.home-stack .layer.l1 { width: 240px; height: 50px; top: 0;   background: rgba(236,72,153,0.04); border-color: rgba(236,72,153,0.18); }
.home-stack .layer.l2 { width: 200px; height: 50px; top: 60px; background: rgba(236,72,153,0.08); border-color: rgba(236,72,153,0.28); }
.home-stack .layer.l3 { width: 160px; height: 50px; top: 120px; background: rgba(236,72,153,0.14); border-color: rgba(236,72,153,0.40); color: var(--accent-bright); }

.home-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	padding: 0 32px 80px;
}
.home-card {
	display: block;
	padding: 24px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--bg-elev);
	color: var(--text);
	border-bottom: 1px solid var(--border);
	transition: all 160ms;
	min-height: 160px;
}
.home-card:hover {
	border-color: var(--accent);
	border-bottom-color: var(--accent);
	transform: translateY(-2px);
}
.home-card .eyebrow {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--accent);
	font-weight: 600;
	margin-bottom: 8px;
}
.home-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.home-card p { color: var(--text-soft); font-size: 13.5px; line-height: 1.5; margin: 0; }

.home-section {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 32px 64px;
}
.home-section h2 {
	font-size: 22px;
	margin: 0 0 6px;
	font-weight: 700;
	letter-spacing: -0.01em;
}
.home-section .section-lede { color: var(--text-soft); font-size: 14.5px; margin-bottom: 20px; }

.topic-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}
.topic-card {
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	border-bottom: 1px solid var(--border);
	background: var(--bg-elev);
	font-size: 14px;
	transition: border-color 120ms;
}
.topic-card:hover {
	border-color: var(--accent-soft);
	border-bottom-color: var(--accent-soft);
}
.topic-card .topic-title { font-weight: 600; }
.topic-card .topic-desc { font-size: 12.5px; color: var(--text-mute); margin-top: 2px; }

/* ===== Mobile ===== */

@media (max-width: 1100px) {
	.layout { grid-template-columns: var(--sidebar-w) 1fr; }
	.toc { display: none; }
}
@media (max-width: 800px) {
	.layout { grid-template-columns: 1fr; }
	.sidebar {
		position: fixed;
		top: var(--header-h);
		left: 0;
		bottom: 0;
		width: 280px;
		background: var(--bg);
		transform: translateX(-100%);
		transition: transform 200ms;
		z-index: 40;
	}
	.sidebar.open { transform: translateX(0); }
	.menu-toggle { display: block; }
	.search-box { width: 140px; }
	.site-nav { gap: 12px; }
	.content { padding: 24px 20px 60px; }
	.home-grid { grid-template-columns: 1fr; padding: 0 20px 60px; }
	.topic-grid { grid-template-columns: 1fr 1fr; }
	.home-hero h1 { font-size: 38px; }
}
.menu-toggle {
	display: none;
	background: none;
	border: 0;
	color: var(--text);
	cursor: pointer;
	padding: 6px;
}
