/* ── Docs / Wiki layout ─────────────────────────────────── */

/* Suppress the gradient mesh + noise overlay from shared.css */
body:has(.docs-page)::before,
body:has(.docs-page)::after {
	display: none;
}

/* Override translucent backgrounds for a flat uniform look */
[data-theme='dark'] .docs-page {
	--bg-card: #0d1117;
	--bg-card-solid: #0d1117;
	--bg-secondary: #0d1117;
	--bg-hover: rgba(255, 255, 255, 0.04);
	--bg-input: rgba(255, 255, 255, 0.06);
}

[data-theme='light'] .docs-page {
	--bg-card: #ffffff;
	--bg-card-solid: #ffffff;
	--bg-secondary: #f7f4ef;
	--bg-hover: rgba(0, 0, 0, 0.03);
	--bg-input: rgba(0, 0, 0, 0.04);
}

.docs-page {
	min-height: 60vh;
}

.docs-layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	grid-template-rows: auto 1fr;
	gap: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--bg-card);
	overflow: hidden;
	min-height: 70vh;
}

/* ── Top search bar ───────────────────────────────────── */

.docs-top-bar {
	grid-column: 1 / -1;
	border-bottom: 1px solid var(--border);
	background: var(--bg-secondary);
	display: flex;
	align-items: center;
	padding: 10px 24px;
	position: sticky;
	top: 0;
	z-index: 10;
}

.docs-top-bar-left {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
}

.docs-top-bar-center {
	flex: 1;
	max-width: 480px;
	margin: 0 auto;
	position: relative;
}

.docs-top-bar-right {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

/* ── Search results dropdown ──────────────────────────── */

.docs-search-results {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 4px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	max-height: 360px;
	overflow-y: auto;
	z-index: 100;
}

.docs-search-results.open {
	display: block;
}

.docs-search-result-item {
	display: block;
	padding: 10px 14px;
	color: var(--text-primary);
	text-decoration: none;
	font-size: 13px;
	cursor: pointer;
	border-bottom: 1px solid var(--border);
	transition: background var(--transition);
}

.docs-search-result-item:last-child {
	border-bottom: none;
}

.docs-search-result-item:hover,
.docs-search-result-item.focused {
	background: var(--bg-hover);
}

.docs-search-result-section {
	font-size: 11px;
	color: var(--text-muted);
	margin-bottom: 2px;
}

.docs-search-result-title {
	font-weight: 500;
}

.docs-search-result-snippet {
	font-size: 12px;
	color: var(--text-muted);
	margin-top: 3px;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.docs-search-no-results {
	padding: 16px;
	text-align: center;
	color: var(--text-muted);
	font-size: 13px;
}

/* ── Sidebar ───────────────────────────────────────────── */

.docs-sidebar {
	border-right: 1px solid var(--border);
	background: var(--bg-secondary);
	overflow-y: auto;
	max-height: 80vh;
	position: sticky;
	top: 80px;
}


.docs-search-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: var(--radius);
	background: var(--bg-input);
	border: 1px solid var(--border);
	transition: border-color var(--transition);
}

.docs-search-wrap:focus-within {
	border-color: var(--border-focus);
}

.docs-search-wrap svg {
	color: var(--text-muted);
	flex-shrink: 0;
}

.docs-search-input {
	all: unset;
	flex: 1;
	font-size: 13px;
	color: var(--text-primary);
}

.docs-search-input::placeholder {
	color: var(--text-muted);
}

/* ── Navigation ────────────────────────────────────────── */

.docs-nav {
	padding: 8px 0;
}

.docs-nav-section-toggle {
	all: unset;
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 10px 16px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	cursor: pointer;
	transition: color var(--transition);
	box-sizing: border-box;
}

.docs-nav-section-toggle:hover {
	color: var(--text-primary);
}

.docs-nav-chevron {
	transition: transform var(--transition);
	flex-shrink: 0;
}

.docs-nav-section-toggle.open .docs-nav-chevron {
	transform: rotate(90deg);
}

.docs-nav-count {
	margin-left: auto;
	font-size: 11px;
	font-weight: 500;
	color: var(--text-muted);
	background: var(--bg-input);
	padding: 1px 6px;
	border-radius: 10px;
}

.docs-nav-items {
	display: none;
	padding-bottom: 4px;
}

.docs-nav-items.open {
	display: block;
}

.docs-nav-item {
	display: block;
	padding: 7px 16px 7px 38px;
	font-size: 13px;
	color: var(--text-secondary);
	text-decoration: none;
	border-left: 2px solid transparent;
	transition: all var(--transition);
}

.docs-nav-item:hover {
	color: var(--text-primary);
	background: var(--bg-hover);
}

.docs-nav-item.active {
	color: var(--accent);
	border-left-color: var(--accent);
	background: rgba(0, 184, 148, 0.06);
	font-weight: 500;
}

.docs-nav-group-header {
	display: flex;
	align-items: center;
}

.docs-nav-group-header .docs-nav-item {
	flex: 1;
}

.docs-nav-group-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px 10px;
	color: var(--text-muted);
	transition: transform 0.15s ease;
	display: flex;
	align-items: center;
}

.docs-nav-group-toggle:hover {
	color: var(--text-primary);
}

.docs-nav-group-toggle.open .docs-nav-chevron {
	transform: rotate(90deg);
}

.docs-nav-group-children {
	display: none;
	border-left: 1px solid var(--border);
	margin-left: 28px;
}

.docs-nav-group-children.open {
	display: block;
}

.docs-nav-group-children .docs-nav-item {
	padding-left: 16px;
}

/* ── Content area ──────────────────────────────────────── */

.docs-content {
	padding: 32px 40px;
	overflow-y: auto;
	max-height: 80vh;
}

.docs-mobile-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	margin-bottom: 16px;
	background: var(--bg-input);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-secondary);
	font-size: 13px;
	cursor: pointer;
	transition: all var(--transition);
}

.docs-mobile-toggle:hover {
	background: var(--bg-hover);
	color: var(--text-primary);
}

/* ── Article ───────────────────────────────────────────── */

.docs-article {
	margin-bottom: 48px;
	padding-bottom: 48px;
	border-bottom: 1px solid var(--border);
}

.docs-article:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.docs-breadcrumb {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: 8px;
}

.docs-breadcrumb-section {
	color: var(--accent);
}

.docs-article-title {
	font-size: 28px;
	font-weight: 700;
	color: var(--text-primary);
	margin: 0 0 8px;
	line-height: 1.3;
}

.docs-article-subtitle {
	font-size: 16px;
	color: var(--text-secondary);
	margin: 0 0 12px;
	line-height: 1.5;
}

.docs-article-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 24px;
}

.docs-meta-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-muted);
}

/* ── Article body (rendered HTML content) ──────────────── */

.docs-article-body {
	font-size: 14px;
	line-height: 1.75;
	color: var(--text-secondary);
}

.docs-article-body h2 {
	font-size: 20px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 32px 0 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border-subtle);
}

.docs-article-body h3 {
	font-size: 16px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 24px 0 8px;
}

.docs-article-body h4 {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 20px 0 8px;
}

.docs-article-body p {
	margin: 0 0 16px;
}

.docs-article-body a {
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color var(--transition);
}

.docs-article-body a:hover {
	border-bottom-color: var(--accent);
}

.docs-article-body ul,
.docs-article-body ol {
	margin: 0 0 16px;
	padding-left: 24px;
}

.docs-article-body li {
	margin-bottom: 6px;
}

.docs-article-body code {
	font-family: var(--font-mono);
	font-size: 13px;
	background: var(--bg-input);
	padding: 2px 6px;
	border-radius: 4px;
	border: 1px solid var(--border-subtle);
}

.docs-article-body pre {
	margin: 0 0 16px;
	padding: 16px;
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow-x: auto;
}

.docs-article-body pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: 13px;
	line-height: 1.6;
}

.docs-article-body blockquote {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-left: 3px solid var(--accent);
	background: rgba(0, 184, 148, 0.05);
	border-radius: 0 var(--radius) var(--radius) 0;
	color: var(--text-secondary);
}

.docs-article-body blockquote p:last-child {
	margin-bottom: 0;
}

.docs-article-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 16px;
	font-size: 13px;
}

.docs-article-body table th,
.docs-article-body table td {
	padding: 10px 14px;
	border: 1px solid var(--border);
	text-align: left;
}

.docs-article-body table th {
	background: var(--bg-secondary);
	font-weight: 600;
	color: var(--text-primary);
}

.docs-article-body table tr:hover td {
	background: var(--bg-hover);
}

.docs-article-body img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	margin: 12px 0;
}

/* Callout boxes */
.docs-callout {
	margin: 0 0 16px;
	padding: 14px 16px;
	border-radius: var(--radius);
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13px;
	line-height: 1.6;
}

.docs-callout-info {
	background: rgba(45, 103, 255, 0.08);
	border: 1px solid rgba(45, 103, 255, 0.2);
	color: var(--text-secondary);
}

.docs-callout-warning {
	background: var(--warning-bg);
	border: 1px solid var(--warning-border);
	color: var(--text-secondary);
}

.docs-callout-danger {
	background: var(--danger-bg);
	border: 1px solid var(--danger-border);
	color: var(--text-secondary);
}

.docs-callout-tip {
	background: var(--success-bg);
	border: 1px solid var(--success-border);
	color: var(--text-secondary);
}

.docs-callout svg {
	flex-shrink: 0;
	margin-top: 2px;
}

/* ── Prev / Next navigation ────────────────────────────── */

.docs-article-nav {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--border-subtle);
}

.docs-nav-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	text-decoration: none;
	transition: all var(--transition);
	max-width: 48%;
}

.docs-nav-link:hover {
	border-color: var(--accent);
	background: rgba(0, 184, 148, 0.04);
}

.docs-nav-link svg {
	color: var(--text-muted);
	flex-shrink: 0;
}

.docs-nav-next {
	margin-left: auto;
	text-align: right;
}

.docs-nav-link-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	margin-bottom: 2px;
}

.docs-nav-link-title {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: var(--accent);
}

/* ── Empty state ───────────────────────────────────────── */

.docs-empty {
	text-align: center;
	padding: 80px 20px;
	color: var(--text-muted);
}

.docs-empty svg {
	margin-bottom: 16px;
	opacity: 0.4;
}

.docs-empty h3 {
	font-size: 18px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0 0 8px;
}

.docs-empty p {
	font-size: 14px;
	max-width: 400px;
	margin: 0 auto 24px;
	line-height: 1.6;
}

.docs-empty-links {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

/* ── Responsive ────────────────────────────────────────── */

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

	.docs-sidebar {
		display: none;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100;
		max-height: 100vh;
		border-right: none;
	}

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

	.docs-content {
		padding: 20px;
		max-height: none;
	}

	.docs-mobile-toggle {
		display: flex;
	}

	.docs-article-title {
		font-size: 22px;
	}

	.docs-article-nav {
		flex-direction: column;
	}

	.docs-nav-link {
		max-width: 100%;
	}
}

@media (max-width: 600px) {
	.docs-content {
		padding: 16px;
	}

	.docs-article-body pre {
		margin-left: -16px;
		margin-right: -16px;
		border-radius: 0;
		border-left: none;
		border-right: none;
	}
}

/* ── Docs footer ─────────────────────────────────────────── */

.docs-footer {
	text-align: center;
	padding: 24px;
	border-top: 1px solid var(--border);
	margin-top: 48px;
	font-size: 12px;
	color: var(--text-muted);
}

.docs-footer-links {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	margin-bottom: 16px;
}

.docs-footer-links a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	transition: color var(--transition);
}

.docs-footer-links a:hover {
	color: var(--text-primary);
}

.docs-footer-legal a {
	color: var(--text-muted);
	text-decoration: none;
	transition: color var(--transition);
}

.docs-footer-legal a:hover {
	color: var(--text-secondary);
}
