/* ==========================================================================
   Daohang Nav - Main Stylesheet
   简洁导航站主题，无渐变
   ========================================================================== */

:root {
	--dh-accent: #2563eb;
	--dh-bg: #f5f5f5;
	--dh-card: #ffffff;
	--dh-text: #1a1a1a;
	--dh-text-secondary: #666666;
	--dh-text-muted: #999999;
	--dh-border: #e0e0e0;
	--dh-radius: 6px;
	--dh-radius-lg: 10px;
	--dh-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	--dh-shadow-hover: 0 10px 24px rgba(0, 0, 0, 0.10);
	--dh-header-bg: #ffffff;
	--dh-max-width: 1200px;
	--dh-gap: 16px;
	--dh-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--dh-font);
	font-size: 14px;
	line-height: 1.6;
	color: var(--dh-text);
	background-color: var(--dh-bg);
	-webkit-font-smoothing: antialiased;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--dh-accent) 35%, transparent);
	outline-offset: 2px;
	border-radius: 8px;
}

.nav-open body {
	overflow: hidden;
}

a {
	color: var(--dh-accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

.container {
	max-width: var(--dh-max-width);
	margin: 0 auto;
	padding: 0 20px;
}

/* ---- Header ---- */
.site-header {
	background: var(--dh-header-bg);
	border-bottom: 1px solid var(--dh-border);
	position: sticky;
	top: 0;
	z-index: 100;
	backdrop-filter: saturate(1.2) blur(10px);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 56px;
}

.site-branding .custom-logo-link img {
	height: 36px;
	width: auto;
}

.site-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--dh-text);
	text-decoration: none;
}

.site-title:hover {
	color: var(--dh-accent);
	text-decoration: none;
}

.nav-menu {
	display: flex;
	list-style: none;
	gap: 24px;
}

.nav-menu a {
	color: var(--dh-text-secondary);
	font-size: 14px;
	text-decoration: none;
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
	color: var(--dh-accent);
}

.nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	flex-direction: column;
	gap: 4px;
}

.nav-toggle span {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--dh-text);
}

/* ---- Hero ---- */
.hero {
	padding: 48px 0 32px;
	text-align: center;
}

.hero .container {
	position: relative;
}

.hero::before {
	content: "";
	position: absolute;
	left: 50%;
	top: -120px;
	transform: translateX(-50%);
	width: min(920px, 92vw);
	height: 320px;
	background: radial-gradient(closest-side, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.00));
	pointer-events: none;
	filter: blur(0px);
}

.hero-title {
	font-size: 28px;
	font-weight: 700;
	color: var(--dh-text);
	margin-bottom: 8px;
}

.hero-subtitle {
	font-size: 15px;
	color: var(--dh-text-secondary);
	margin-bottom: 24px;
}

/* ---- Search ---- */
.search-box {
	position: relative;
	max-width: 480px;
	margin: 0 auto;
}

.search-input {
	width: 100%;
	height: 44px;
	padding: 0 48px 0 16px;
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius);
	font-size: 14px;
	background: var(--dh-card);
	color: var(--dh-text);
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
	border-color: var(--dh-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--dh-accent) 12%, transparent);
}

.search-btn {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border: none;
	background: none;
	color: var(--dh-text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--dh-radius);
}

.search-btn:hover {
	color: var(--dh-accent);
}

.search-results {
	max-width: 480px;
	margin: 12px auto 0;
	text-align: left;
	background: var(--dh-card);
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius-lg);
	box-shadow: var(--dh-shadow-hover);
	overflow: hidden;
}

.search-results-grid {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.search-results-grid .link-card {
	padding: 10px 12px;
}

.search-empty {
	padding: 16px;
	text-align: center;
	color: var(--dh-text-muted);
	font-size: 13px;
}

/* ---- Category Nav ---- */
.category-nav {
	background: var(--dh-card);
	border-bottom: 1px solid var(--dh-border);
	padding: 12px 0;
	position: sticky;
	top: 56px;
	z-index: 90;
}

.category-nav-list {
	display: flex;
	list-style: none;
	gap: 8px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.category-nav-list::-webkit-scrollbar {
	display: none;
}

.category-nav-item {
	display: inline-block;
	padding: 6px 14px;
	font-size: 13px;
	color: var(--dh-text-secondary);
	background: var(--dh-bg);
	border-radius: var(--dh-radius);
	white-space: nowrap;
	text-decoration: none;
	border: 1px solid transparent;
}

.category-nav-item:hover {
	color: var(--dh-accent);
	border-color: var(--dh-accent);
	text-decoration: none;
}

/* ---- Sections ---- */
.main-content {
	padding: 24px 0 48px;
}

.section {
	margin-bottom: 36px;
}

.section-title {
	font-size: 16px;
	font-weight: 600;
	color: var(--dh-text);
	margin-bottom: 16px;
	padding-left: 10px;
	border-left: 3px solid var(--dh-accent);
	display: flex;
	align-items: center;
	gap: 8px;
}

.section-count {
	font-size: 12px;
	font-weight: 400;
	color: var(--dh-text-muted);
	background: var(--dh-bg);
	padding: 2px 8px;
	border-radius: 10px;
}

.section-desc {
	font-size: 13px;
	color: var(--dh-text-secondary);
	margin: -8px 0 16px 13px;
}

/* ---- Link Grid ---- */
.link-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--dh-gap);
}

.link-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px;
	background: var(--dh-card);
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius-lg);
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.link-card:hover {
	box-shadow: var(--dh-shadow-hover);
	border-color: var(--dh-accent);
	transform: translateY(-2px);
	text-decoration: none;
}

.link-card-icon {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--dh-bg);
	display: flex;
	align-items: center;
	justify-content: center;
}

.link-card-icon img {
	width: 40px;
	height: 40px;
	object-fit: cover;
}

.link-card-body {
	flex: 1;
	min-width: 0;
}

.link-card-title {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: var(--dh-text);
	line-height: 1.4;
}

.link-card-desc {
	display: block;
	font-size: 12px;
	color: var(--dh-text-muted);
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.link-card-clicks {
	display: block;
	font-size: 11px;
	color: var(--dh-text-muted);
	margin-top: 4px;
}

/* ---- Tags ---- */
.link-tag {
	display: inline-block;
	font-size: 10px;
	font-weight: 500;
	padding: 1px 4px;
	border-radius: 3px;
	margin-left: 4px;
	vertical-align: middle;
	line-height: 1.4;
}

.link-tag-hot {
	color: #c0392b;
	background: #fdecea;
}

.link-tag-new {
	color: #1a7f4b;
	background: #e8f5ee;
}

/* ---- Archive / Page ---- */
.archive-header {
	margin-bottom: 24px;
}

.archive-title {
	font-size: 22px;
	font-weight: 600;
}

.archive-desc {
	font-size: 14px;
	color: var(--dh-text-secondary);
	margin-top: 8px;
}

.page-article {
	background: var(--dh-card);
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius-lg);
	padding: 32px;
}

.page-desc {
	font-size: 14px;
	color: var(--dh-text-secondary);
	margin-top: 10px;
}

.link-detail-action {
	margin-top: 18px;
}

.page-title {
	font-size: 24px;
	font-weight: 600;
	margin-bottom: 16px;
}

.page-meta {
	font-size: 13px;
	color: var(--dh-text-muted);
	margin-bottom: 20px;
}

.page-content {
	font-size: 15px;
	line-height: 1.8;
}

.page-content p {
	margin-bottom: 16px;
}

.search-article {
	background: var(--dh-card);
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius);
	padding: 20px;
	margin-bottom: 12px;
}

.search-article h3 {
	font-size: 16px;
	margin-bottom: 8px;
}

/* ---- Pagination ---- */
.pagination,
.nav-links {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 32px;
}

.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--dh-border);
	border-radius: var(--dh-radius);
	font-size: 13px;
	color: var(--dh-text-secondary);
	text-decoration: none;
	background: var(--dh-card);
}

.page-numbers.current {
	background: var(--dh-accent);
	color: #fff;
	border-color: var(--dh-accent);
}

.page-numbers:hover {
	border-color: var(--dh-accent);
	color: var(--dh-accent);
	text-decoration: none;
}

.page-numbers.current:hover {
	color: #fff;
}

/* ---- Empty State ---- */
.empty-state {
	text-align: center;
	padding: 64px 20px;
	color: var(--dh-text-secondary);
}

.empty-state-404 .error-code {
	font-size: 64px;
	font-weight: 700;
	color: var(--dh-border);
	margin-bottom: 8px;
}

.btn {
	display: inline-block;
	margin-top: 16px;
	padding: 10px 24px;
	background: var(--dh-accent);
	color: #fff;
	border-radius: var(--dh-radius);
	font-size: 14px;
	text-decoration: none;
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
	opacity: 0.9;
	color: #fff;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.btn:active {
	transform: translateY(0);
	box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

/* ---- Back to top ---- */
.back-to-top {
	position: fixed;
	right: 18px;
	bottom: 18px;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	border: 1px solid var(--dh-border);
	background: var(--dh-card);
	color: var(--dh-text-secondary);
	box-shadow: var(--dh-shadow);
	cursor: pointer;
	display: grid;
	place-items: center;
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.back-to-top.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.back-to-top:hover {
	border-color: var(--dh-accent);
	color: var(--dh-accent);
}

/* ---- Footer ---- */
.site-footer {
	background: var(--dh-card);
	border-top: 1px solid var(--dh-border);
	padding: 24px 0;
	text-align: center;
}

.footer-menu {
	display: flex;
	justify-content: center;
	list-style: none;
	gap: 20px;
	margin-bottom: 12px;
	flex-wrap: wrap;
}

.footer-menu a {
	font-size: 13px;
	color: var(--dh-text-secondary);
	text-decoration: none;
}

.footer-menu a:hover {
	color: var(--dh-accent);
}

.footer-text {
	font-size: 13px;
	color: var(--dh-text-muted);
}

.footer-icp {
	font-size: 12px;
	margin-top: 4px;
}

.footer-icp a {
	color: var(--dh-text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
	.nav-toggle {
		display: flex;
	}

	.main-nav {
		display: none;
		position: absolute;
		top: 56px;
		left: 0;
		right: 0;
		background: var(--dh-card);
		border-bottom: 1px solid var(--dh-border);
		padding: 12px 20px;
		box-shadow: var(--dh-shadow-hover);
	}

	.main-nav.is-open {
		display: block;
	}

	.nav-menu {
		flex-direction: column;
		gap: 0;
	}

	.nav-menu li a {
		display: block;
		padding: 10px 0;
		border-bottom: 1px solid var(--dh-border);
	}

	.hero {
		padding: 32px 0 24px;
	}

	.hero-title {
		font-size: 22px;
	}

	.link-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 10px;
	}

	.link-card {
		padding: 10px;
	}

	.category-nav {
		top: 56px;
	}

	.page-article {
		padding: 20px;
	}
}

@media (max-width: 480px) {
	.link-grid {
		grid-template-columns: 1fr 1fr;
	}

	.link-card-desc {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto !important;
	}
	.link-card,
	.btn,
	.back-to-top {
		transition: none !important;
	}
}
