/* ── highlight.js light theme ─────────────────────────────────── */
@import 'highlight.js/styles/github.css';

/* ── Reset & base ─────────────────────────────────────────────── */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--color-primary: #0d6efd;
	--color-primary-dark: #0a58ca;
	--color-bg: #ffffff;
	--color-bg-secondary: #f8f9fa;
	--color-text: #212529;
	--color-text-muted: #6c757d;
	--color-border: #dee2e6;
	--color-success: #198754;
	--color-danger: #dc3545;
	--color-warning: #ffc107;
	--radius: 8px;
	--shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	--font-mono: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
}

[data-theme='dark'] {
	--color-bg: #1a1a2e;
	--color-bg-secondary: #16213e;
	--color-text: #e0e0e0;
	--color-text-muted: #a0a0a0;
	--color-border: #2a2a4a;
	--shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── highlight.js dark theme overrides ───────────────────────── */
[data-theme='dark'] .hljs {
	background: #16213e;
	color: #c9d1d9;
}
[data-theme='dark'] .hljs-keyword,
[data-theme='dark'] .hljs-selector-tag {
	color: #ff7b72;
}
[data-theme='dark'] .hljs-string,
[data-theme='dark'] .hljs-attr {
	color: #a5d6ff;
}
[data-theme='dark'] .hljs-comment,
[data-theme='dark'] .hljs-quote {
	color: #8b949e;
}
[data-theme='dark'] .hljs-number,
[data-theme='dark'] .hljs-literal {
	color: #79c0ff;
}
[data-theme='dark'] .hljs-type,
[data-theme='dark'] .hljs-built_in {
	color: #ffa657;
}
[data-theme='dark'] .hljs-title,
[data-theme='dark'] .hljs-function {
	color: #d2a8ff;
}
[data-theme='dark'] .hljs-meta {
	color: #79c0ff;
}
[data-theme='dark'] .hljs-section {
	color: #1f6feb;
	font-weight: bold;
}
[data-theme='dark'] .hljs-symbol,
[data-theme='dark'] .hljs-bullet {
	color: #f2cc60;
}

html {
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	color: var(--color-text);
	background: var(--color-bg);
	line-height: 1.6;
}

body {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

a {
	color: var(--color-primary);
	text-decoration: none;
}
a:hover {
	color: var(--color-primary-dark);
	text-decoration: underline;
}

/* ── Utilities ────────────────────────────────────────────────── */
.container {
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: 1rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	border: none;
	border-radius: var(--radius);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
}
.btn:active {
	transform: scale(0.97);
}
.btn-primary {
	background: var(--color-primary);
	color: #fff;
}
.btn-primary:hover {
	background: var(--color-primary-dark);
}
.btn-success {
	background: var(--color-success);
	color: #fff;
}
.btn-danger {
	background: var(--color-danger);
	color: #fff;
}

/* ── Code blocks (markdown rendered) ─────────────────────────── */
pre code {
	font-family: var(--font-mono);
	font-size: 0.85rem;
}

/* ── Responsive images ───────────────────────────────────────── */
img {
	max-width: 100%;
	height: auto;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}

/* ── Circuit embeds (rendered from ```circuit markdown fences) ── */
.circuit-embed {
	margin: 0.75rem 0;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	position: relative;
	background: var(--color-bg-secondary);
}
.circuit-embed-wrapper {
	display: block;
}
.circuit-embed-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	color: var(--color-text-muted);
	font-size: 0.85rem;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
	.container {
		padding-inline: 0.75rem;
	}
}
