/* Clases — documentation styles.
   Serious, low-saturation, dual dark/light theme. One accent, neutral grays,
   constrained measure. Real Luau highlighting is layered on by Shiki at runtime. */

:root {
	--bg: #0b0e13;
	--bg-elev: #11151c;
	--bg-elev-2: #161b23;
	--code-bg: #0d1117;
	--border: #20262f;
	--border-strong: #2b333d;
	--text: #e6edf3;
	--text-muted: #9aa6b2;
	--text-faint: #7d8b99;
	--accent: #54c98a;
	--accent-soft: rgba(84, 201, 138, 0.12);
	--accent-line: rgba(84, 201, 138, 0.35);
	--accent-contrast: #05130c;
	--warn: #e3b341;
	--warn-soft: rgba(227, 179, 65, 0.1);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
	--radius: 10px;
	--radius-sm: 7px;
	--measure: 70ch;
	--max: 1180px;
	color-scheme: dark;
}

[data-theme="light"] {
	--bg: #ffffff;
	--bg-elev: #f7f8fa;
	--bg-elev-2: #eef1f4;
	--code-bg: #f6f8fa;
	--border: #e4e8ec;
	--border-strong: #d3d9df;
	--text: #1b2027;
	--text-muted: #57636f;
	--text-faint: #565f69;
	--accent: #1a8f52;
	--accent-soft: rgba(26, 143, 82, 0.1);
	--accent-line: rgba(26, 143, 82, 0.28);
	--accent-contrast: #ffffff;
	--warn: #9a6700;
	--warn-soft: rgba(154, 103, 0, 0.08);
	--shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
	color-scheme: light;
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: 84px;
	-webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizelegibility;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Dentro de contenedores con overflow:hidden, dibuja el anillo por dentro. */
.copy:focus-visible,
.faq summary:focus-visible {
	outline-offset: -2px;
}

h1,
h2,
h3 {
	line-height: 1.2;
	letter-spacing: -0.012em;
	font-weight: 680;
}

h2 {
	font-size: clamp(24px, 3.2vw, 32px);
	margin: 0 0 12px;
}

h3 {
	font-size: 18px;
	margin: 0 0 8px;
}

p {
	margin: 0 0 16px;
	max-width: var(--measure);
}

.muted {
	color: var(--text-muted);
}

/* ---------- top bar ---------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	border-bottom: 1px solid var(--border);
	backdrop-filter: saturate(160%) blur(12px);
}

.topbar-inner {
	max-width: var(--max);
	margin: 0 auto;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	gap: 20px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--text);
}

.mark {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: var(--accent);
	color: var(--accent-contrast);
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 15px;
}

.nav {
	display: flex;
	gap: 4px;
	margin-left: 8px;
	font-size: 14px;
}

.nav a {
	color: var(--text-muted);
	padding: 6px 10px;
	border-radius: 6px;
}

.nav a:hover {
	color: var(--text);
	background: var(--bg-elev-2);
	text-decoration: none;
}

.topbar-spacer {
	flex: 1;
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.icon-link,
.theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--bg-elev);
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
}

.icon-link:hover,
.theme-toggle:hover {
	color: var(--text);
	border-color: var(--border-strong);
	text-decoration: none;
}

.theme-toggle .sun {
	display: none;
}

[data-theme="light"] .theme-toggle .sun {
	display: block;
}

[data-theme="light"] .theme-toggle .moon {
	display: none;
}

/* ---------- hero ---------- */

.hero {
	position: relative;
	border-bottom: 1px solid var(--border);
	overflow: hidden;
}

.hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(60% 80% at 78% -10%, var(--accent-soft), transparent 60%);
	pointer-events: none;
}

.hero-inner {
	position: relative;
	max-width: var(--max);
	margin: 0 auto;
	padding: 72px 24px 60px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
	gap: 48px;
	align-items: center;
}

.eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--accent);
	background: var(--accent-soft);
	border: 1px solid var(--accent-line);
	padding: 4px 11px;
	border-radius: 999px;
	margin-bottom: 20px;
}

.hero h1 {
	font-size: clamp(38px, 6vw, 60px);
	line-height: 1.05;
	letter-spacing: -0.02em;
	margin: 0 0 18px;
	font-weight: 720;
}

.lead {
	font-size: clamp(17px, 1.6vw, 19px);
	color: var(--text-muted);
	max-width: 46ch;
	margin: 0 0 28px;
}

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

.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 18px;
	border-radius: 9px;
	border: 1px solid var(--border-strong);
	background: var(--bg-elev);
	color: var(--text);
	font-weight: 600;
	font-size: 14.5px;
	cursor: pointer;
}

.btn:hover {
	text-decoration: none;
	border-color: var(--text-faint);
}

.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-contrast);
}

.btn-primary:hover {
	border-color: var(--accent);
	filter: brightness(1.05);
}

.hero-meta {
	display: flex;
	gap: 22px;
	margin-top: 26px;
	font-size: 13px;
	color: var(--text-faint);
	flex-wrap: wrap;
}

.hero-meta strong {
	color: var(--text);
	font-weight: 650;
}

/* ---------- layout ---------- */

main {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 24px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 200px;
	gap: 48px;
	align-items: start;
}

.content {
	min-width: 0;
	padding: 8px 0 48px;
}

.section {
	padding: 44px 0;
	border-bottom: 1px solid var(--border);
}

.section:last-child {
	border-bottom: none;
}

.section > .kicker {
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 10px;
}

.section-lead {
	color: var(--text-muted);
	max-width: var(--measure);
}

/* ---------- table of contents ---------- */

.toc {
	position: sticky;
	top: 96px;
	font-size: 13.5px;
	padding-top: 52px;
}

.toc-title {
	font-size: 11.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-faint);
	margin-bottom: 12px;
	font-weight: 600;
}

.toc a {
	display: block;
	color: var(--text-muted);
	padding: 5px 0 5px 13px;
	border-left: 2px solid var(--border);
	line-height: 1.4;
}

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

.toc a.active {
	color: var(--text);
	border-left-color: var(--accent);
	font-weight: 550;
}

/* ---------- feature cards ---------- */

.grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin-top: 24px;
}

.card {
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
}

.card h3 {
	margin: 0 0 6px;
}

.card p {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
}

.card .card-icon {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	background: var(--accent-soft);
	color: var(--accent);
	margin-bottom: 14px;
}

/* ---------- code blocks ---------- */

.codeblock {
	margin: 18px 0;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
}

.codeblock-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 9px 12px 9px 14px;
	border-bottom: 1px solid var(--border);
	background: color-mix(in srgb, var(--code-bg) 86%, var(--text) 4%);
}

.codeblock-name {
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--text-faint);
}

.copy {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 550;
	padding: 4px 9px;
	border-radius: 6px;
	cursor: pointer;
}

.copy:hover {
	color: var(--text);
	border-color: var(--border-strong);
}

.copy.copied {
	color: var(--accent);
	border-color: var(--accent-line);
}

:root {
	--mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

pre.codeblock-body {
	margin: 0;
	padding: 16px 18px;
	overflow-x: auto;
	background: var(--code-bg);
	font-family: var(--mono);
	font-size: 13.5px;
	line-height: 1.62;
	tab-size: 4;
	color: var(--text);
}

pre.codeblock-body code {
	font-family: inherit;
	white-space: pre;
}

/* Shiki dual-theme: tokens carry --shiki-light / --shiki-dark; pick per theme.
   Los wrappers .line no llevan la variable, asi que caen al color del texto. */
[data-theme="light"] pre.codeblock-body code span {
	color: var(--shiki-light, var(--text));
}

[data-theme="dark"] pre.codeblock-body code span {
	color: var(--shiki-dark, var(--text));
}

/* inline code */
p code,
li code,
td code {
	font-family: var(--mono);
	font-size: 0.88em;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: 1px 5px;
	color: var(--text);
}

/* ---------- split ---------- */

.split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}

/* ---------- callout ---------- */

.callout {
	border: 1px solid var(--border);
	border-left: 3px solid var(--accent);
	background: var(--accent-soft);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	padding: 14px 16px;
	margin: 18px 0;
	max-width: var(--measure);
}

.callout.warn {
	border-left-color: var(--warn);
	background: var(--warn-soft);
}

.callout p {
	margin: 0;
	font-size: 14.5px;
	color: var(--text);
}

.callout strong {
	font-weight: 650;
}

/* ---------- comparison matrix ---------- */

.matrix-wrap {
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-top: 22px;
}

table.matrix {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.8px;
	min-width: 640px;
}

table.matrix th,
table.matrix td {
	text-align: left;
	padding: 11px 14px;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}

table.matrix thead th {
	color: var(--text-muted);
	font-weight: 600;
	font-size: 12.5px;
	letter-spacing: 0.01em;
	background: var(--bg-elev);
}

table.matrix tbody th {
	font-weight: 550;
	color: var(--text);
}

table.matrix th.highlight {
	background: var(--accent-soft);
}

table.matrix td.highlight {
	background: var(--accent-soft);
}

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

.yes {
	color: var(--accent);
	font-weight: 600;
}

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

.partial {
	color: var(--warn);
}

/* ---------- FAQ ---------- */

.faq details {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	margin-bottom: 10px;
	background: var(--bg-elev);
	overflow: hidden;
}

.faq summary {
	cursor: pointer;
	padding: 14px 16px;
	font-weight: 600;
	font-size: 15px;
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.faq summary::-webkit-details-marker {
	display: none;
}

.faq summary::after {
	content: "+";
	color: var(--text-faint);
	font-size: 18px;
	font-weight: 400;
}

.faq details[open] summary::after {
	content: "–";
}

.faq details[open] summary {
	border-bottom: 1px solid var(--border);
}

.faq .answer {
	padding: 14px 16px;
	color: var(--text-muted);
	font-size: 14.5px;
}

.faq .answer p {
	margin: 0;
	max-width: none;
}

/* ---------- doc links ---------- */

.doclinks {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin-top: 20px;
}

.doclink {
	display: flex;
	flex-direction: column;
	gap: 2px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 13px 15px;
	background: var(--bg-elev);
	color: var(--text);
}

.doclink:hover {
	border-color: var(--border-strong);
	text-decoration: none;
}

.doclink .t {
	font-weight: 600;
	font-size: 14.5px;
}

.doclink .d {
	font-size: 13px;
	color: var(--text-faint);
}

/* ---------- footer ---------- */

.footer {
	border-top: 1px solid var(--border);
	background: var(--bg-elev);
}

.footer-inner {
	max-width: var(--max);
	margin: 0 auto;
	padding: 32px 24px 48px;
	display: flex;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	color: var(--text-muted);
	font-size: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
	main {
		grid-template-columns: minmax(0, 1fr);
	}

	.toc {
		display: none;
	}

	.hero-inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
		padding: 56px 24px 48px;
	}

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

@media (max-width: 720px) {
	.nav {
		display: none;
	}

	.split,
	.doclinks {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ===================== docs site (sidebar + rendered markdown) ===================== */

.docs-shell {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 24px;
	display: grid;
	grid-template-columns: 232px minmax(0, 1fr) 196px;
	gap: 40px;
	align-items: start;
}

.sidebar {
	position: sticky;
	top: 80px;
	padding: 28px 0;
	max-height: calc(100vh - 80px);
	overflow-y: auto;
}

.sidebar-title {
	font-size: 11.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-faint);
	font-weight: 600;
	margin-bottom: 12px;
	padding-left: 12px;
}

#sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

#sidebar-nav a {
	display: block;
	color: var(--text-muted);
	font-size: 14px;
	padding: 7px 12px;
	border-radius: 7px;
	border-left: 2px solid transparent;
}

#sidebar-nav a:hover {
	color: var(--text);
	background: var(--bg-elev);
	text-decoration: none;
}

#sidebar-nav a.active {
	color: var(--accent);
	background: var(--accent-soft);
	border-left-color: var(--accent);
	font-weight: 600;
}

.doc-main {
	min-width: 0;
	padding: 36px 0 64px;
}

.doc-toc {
	position: sticky;
	top: 80px;
	padding: 38px 0;
	font-size: 13px;
}

.doc-toc .toc-title {
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-faint);
	font-weight: 600;
	margin-bottom: 10px;
}

#toc-nav a {
	display: block;
	color: var(--text-muted);
	padding: 5px 0 5px 12px;
	border-left: 2px solid var(--border);
	line-height: 1.35;
}

#toc-nav a:hover {
	color: var(--text);
	text-decoration: none;
}

#toc-nav a.active {
	color: var(--text);
	border-left-color: var(--accent);
	font-weight: 550;
}

/* ---- rendered markdown (prose) ---- */

.prose {
	min-width: 0;
}

.doc-loading,
.doc-error {
	color: var(--text-faint);
}

.prose h1 {
	font-size: clamp(28px, 4vw, 36px);
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 24px;
	font-weight: 720;
}

.prose h2 {
	font-size: 22px;
	margin: 40px 0 14px;
	padding-top: 28px;
	border-top: 1px solid var(--border);
	scroll-margin-top: 80px;
	font-weight: 660;
}

.prose h3 {
	font-size: 17px;
	margin: 28px 0 10px;
	scroll-margin-top: 80px;
	font-weight: 620;
}

.prose p,
.prose li {
	color: var(--text-muted);
	max-width: var(--measure);
}

.prose p {
	margin: 0 0 16px;
}

.prose strong {
	color: var(--text);
	font-weight: 640;
}

.prose ul,
.prose ol {
	margin: 0 0 16px;
	padding-left: 22px;
}

.prose li {
	margin: 4px 0;
}

.prose li::marker {
	color: var(--text-faint);
}

.prose a {
	color: var(--accent);
	font-weight: 500;
}

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

.prose blockquote {
	margin: 18px 0;
	padding: 12px 16px;
	border-left: 3px solid var(--accent);
	background: var(--accent-soft);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	color: var(--text);
	max-width: var(--measure);
}

.prose blockquote p {
	margin: 0;
	color: var(--text);
}

.prose table {
	width: 100%;
	border-collapse: collapse;
	margin: 18px 0;
	font-size: 14px;
	display: block;
	overflow-x: auto;
}

.prose th,
.prose td {
	text-align: left;
	padding: 9px 13px;
	border: 1px solid var(--border);
	vertical-align: top;
}

.prose th {
	background: var(--bg-elev);
	color: var(--text);
	font-weight: 600;
}

.prose td {
	color: var(--text-muted);
}

/* code in prose: reuse the codeblock look, with an inset copy button */
.prose pre.doc-pre {
	position: relative;
	margin: 18px 0;
	padding: 16px 18px;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow-x: auto;
	font-family: var(--mono);
	font-size: 13.5px;
	line-height: 1.62;
	tab-size: 4;
	color: var(--text);
	box-shadow: var(--shadow);
}

.prose pre.doc-pre code {
	font-family: inherit;
	white-space: pre;
	background: none;
	border: none;
	padding: 0;
	font-size: inherit;
	color: inherit;
}

.prose pre.doc-pre .copy {
	position: absolute;
	top: 8px;
	right: 8px;
	background: color-mix(in srgb, var(--code-bg) 80%, transparent);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.12s ease;
}

.prose pre.doc-pre:hover .copy,
.prose pre.doc-pre .copy:focus-visible {
	opacity: 1;
}

[data-theme="light"] .prose pre.doc-pre code span {
	color: var(--shiki-light, var(--text));
}

[data-theme="dark"] .prose pre.doc-pre code span {
	color: var(--shiki-dark, var(--text));
}

.prose :not(pre) > code {
	font-family: var(--mono);
	font-size: 0.88em;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: 1px 5px;
	color: var(--text);
}

@media (max-width: 980px) {
	.docs-shell {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.doc-toc {
		display: none;
	}

	.sidebar {
		position: static;
		max-height: none;
		overflow: visible;
		padding: 16px 0 0;
		border-bottom: 1px solid var(--border);
	}

	.sidebar-title {
		padding-left: 0;
	}

	#sidebar-nav {
		flex-direction: row;
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 4px;
		padding-bottom: 12px;
	}

	#sidebar-nav a {
		white-space: nowrap;
		border-left: none;
		border-bottom: 2px solid transparent;
		border-radius: 6px;
	}

	#sidebar-nav a.active {
		border-left: none;
	}

	.doc-main {
		padding: 24px 0 48px;
	}
}
