/**
 * Obsidian Press 前端 + 后台样式。
 * 自动适配亮/暗模式（跟随系统），并尽量使用主题继承的字体与配色。
 */

:root {
	--op-border: #e2e8f0;
	--op-bg: #ffffff;
	--op-muted: #64748b;
	--op-accent: #7c6ff0;
	--op-mark: rgba(124, 111, 240, 0.14);
}
@media (prefers-color-scheme: dark) {
	:root {
		--op-border: #334155;
		--op-bg: #0f172a;
		--op-muted: #94a3b8;
		--op-accent: #9b8cff;
		--op-mark: rgba(155, 140, 255, 0.22);
	}
}

/* ---------- 双链 ---------- */

a.op-wikilink {
	text-decoration: none;
	border-bottom: 1px dashed rgba(124, 111, 240, 0.65);
	color: inherit;
}
a.op-wikilink:hover {
	color: var(--op-accent);
	border-bottom-style: solid;
}
a.op-wikilink.op-unresolved {
	opacity: 0.78;
	border-bottom: 1px dotted #94a3b8;
}

/* ---------- 行内标签 ---------- */

a.op-inline-tag {
	display: inline-block;
	text-decoration: none;
	background: rgba(52, 211, 153, 0.14);
	color: #0f9d76;
	border-radius: 999px;
	padding: 0.05em 0.55em;
	font-size: 0.9em;
	line-height: 1.5;
	vertical-align: baseline;
}
a.op-inline-tag:hover {
	background: rgba(52, 211, 153, 0.26);
}
@media (prefers-color-scheme: dark) {
	a.op-inline-tag {
		color: #34d399;
	}
}

/* ---------- 嵌入 ---------- */

.op-embed {
	margin: 1.4em 0;
	padding: 0.9em 1.2em;
	border: 1px solid var(--op-border);
	border-left: 3px solid var(--op-accent);
	border-radius: 10px;
	background: var(--op-bg);
}
.op-embed-title {
	margin-bottom: 0.5em;
	font-weight: 600;
}
.op-embed-title a {
	color: var(--op-accent);
	text-decoration: none;
}
.op-embed-body > *:last-child {
	margin-bottom: 0;
}

/* ---------- 反向链接 / 出链卡片 ---------- */

.op-backlinks,
.op-outgoing {
	margin-top: 2.6em;
	padding: 1em 1.3em;
	border: 1px solid var(--op-border);
	border-radius: 10px;
	background: var(--op-bg);
	font-size: 0.95em;
}
.op-backlinks-title {
	font-weight: 600;
	margin-bottom: 0.5em;
	color: var(--op-accent);
}
.op-backlinks-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.op-backlinks-list li {
	padding: 0.5em 0;
	border-top: 1px dashed var(--op-border);
}
.op-backlinks-list li:first-child {
	border-top: 0;
}
.op-backlink-source,
.op-backlinks-list a {
	text-decoration: none;
	font-weight: 500;
}
.op-backlink-source:hover {
	color: var(--op-accent);
}
.op-backlink-context {
	display: block;
	margin-top: 0.15em;
	color: var(--op-muted);
	font-size: 0.92em;
}
.op-backlink-context mark {
	background: var(--op-mark);
	color: var(--op-accent);
	font-weight: 600;
	padding: 0 2px;
}
.op-backlinks-empty,
.op-empty-note {
	color: var(--op-muted);
	margin: 0.2em 0 0;
}

/* ---------- 标签云 / 孤立笔记 ---------- */

.op-tag-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 0.8em;
	align-items: baseline;
}
a.op-tag {
	text-decoration: none;
	color: inherit;
}
a.op-tag:hover {
	color: var(--op-accent);
}
.op-tag-count {
	color: var(--op-muted);
	font-size: 0.8em;
	margin-left: 2px;
}
ul.op-orphans {
	list-style: disc;
	padding-left: 22px;
	columns: 2;
	column-gap: 3em;
}
@media (max-width: 640px) {
	ul.op-orphans {
		columns: 1;
	}
}

/* ---------- 知识图谱容器 ---------- */

.op-graph {
	position: relative;
	border: 1px solid var(--op-border);
	border-radius: 12px;
	overflow: hidden;
	background: var(--op-bg);
}
.op-graph canvas {
	display: block;
	touch-action: none;
	user-select: none;
}
.op-graph-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--op-muted);
}
.op-graph-tooltip {
	position: absolute;
	z-index: 10;
	pointer-events: none;
	background: #0f172a;
	color: #f8fafc;
	padding: 4px 9px;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.4;
	opacity: 0;
	transition: opacity 0.12s;
	max-width: 280px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.op-graph-legend {
	position: absolute;
	left: 12px;
	bottom: 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	font-size: 12px;
	color: var(--op-muted);
	pointer-events: none;
}
.op-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.op-legend-item i {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
}

/* ---------- 后台：统计卡片 ---------- */

.op-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	max-width: 780px;
	margin: 12px 0 20px;
}
.op-stat {
	padding: 14px 16px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.op-stat-num {
	font-size: 24px;
	font-weight: 700;
	color: #7c6ff0;
}
.op-stat-label {
	font-size: 13px;
	color: #64748b;
}
@media (prefers-color-scheme: dark) {
	.op-stat {
		background: #0f172a;
		border-color: #334155;
	}
	.op-stat-num {
		color: #9b8cff;
	}
	.op-stat-label {
		color: #94a3b8;
	}
}
