/**
 * Board Hub – community list theme
 * Layout inspired by Chinese resource community sites (topic list + boards + rank).
 */

:root {
	--bh-bg: #f2f4f8;
	--bh-surface: #ffffff;
	--bh-primary: #3b6ff5;
	--bh-primary-dark: #2a56d4;
	--bh-accent: #ff6b35;
	--bh-text: #1f2430;
	--bh-muted: #8a93a6;
	--bh-border: #e6eaf2;
	--bh-chip: #eef2ff;
	--bh-radius: 10px;
	--bh-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
	--bh-max: 1100px;
	--bh-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bh-bg);
	color: var(--bh-text);
	font-family: var(--bh-font);
	font-size: 14px;
	line-height: 1.55;
}

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

img { max-width: 100%; height: auto; vertical-align: middle; }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
}

.site { min-height: 100vh; padding-bottom: 64px; }

/* Header */
.site-header {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--bh-surface);
	border-bottom: 1px solid var(--bh-border);
	box-shadow: var(--bh-shadow);
}

.header-bar {
	max-width: var(--bh-max);
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
}

.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.nav-toggle {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.nav-toggle span:not(.screen-reader-text) {
	display: block;
	width: 18px;
	height: 2px;
	background: var(--bh-text);
	border-radius: 1px;
}

.site-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.site-title a { color: var(--bh-text); }
.custom-logo { max-height: 32px; width: auto; }

.header-nav .primary-menu {
	display: flex;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.header-nav .primary-menu a {
	display: block;
	padding: 6px 12px;
	border-radius: 999px;
	color: var(--bh-text);
	font-weight: 500;
}
.header-nav .primary-menu a:hover,
.header-nav .current-menu-item > a {
	background: var(--bh-chip);
	color: var(--bh-primary);
}

.header-right { display: flex; align-items: center; gap: 10px; }
.header-search-btn { color: var(--bh-text); display: inline-flex; }

.desktop-only { display: none; }

.site-notice {
	max-width: var(--bh-max);
	margin: 0 auto;
	padding: 8px 14px;
	background: #fff7ed;
	color: #9a3412;
	font-size: 13px;
	border-bottom: 1px solid #ffedd5;
}
.site-notice a { color: #c2410c; font-weight: 600; }

.board-chips {
	max-width: var(--bh-max);
	margin: 0 auto;
	display: flex;
	gap: 8px;
	padding: 10px 14px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.board-chips::-webkit-scrollbar { display: none; }

.chip {
	flex: 0 0 auto;
	padding: 6px 12px;
	border-radius: 999px;
	background: #f3f5f9;
	color: var(--bh-muted);
	font-size: 13px;
	white-space: nowrap;
}
.chip.is-active,
.chip:hover {
	background: var(--bh-primary);
	color: #fff;
}

/* Drawer */
.drawer[hidden] { display: none !important; }
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 40, 0.45); }
.drawer-panel {
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: min(78vw, 300px);
	background: #fff;
	padding: 20px 16px;
	overflow-y: auto;
	box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
.drawer-title { margin: 0 0 12px; font-weight: 700; font-size: 1.1rem; }
.drawer-menu { list-style: none; margin: 0 0 16px; padding: 0; }
.drawer-menu a { display: block; padding: 10px 0; color: var(--bh-text); border-bottom: 1px solid var(--bh-border); }
.drawer-label { margin: 0 0 8px; color: var(--bh-muted); font-size: 12px; }
.drawer-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drawer-boards a {
	padding: 8px;
	background: #f5f7fb;
	border-radius: 8px;
	color: var(--bh-text);
	text-align: center;
	font-size: 13px;
}

/* Layout */
.site-content {
	max-width: var(--bh-max);
	margin: 0 auto;
	padding: 14px;
}
.content-wrap {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
	align-items: start;
}

.content-area {
	min-width: 0;
	background: var(--bh-surface);
	border-radius: var(--bh-radius);
	box-shadow: var(--bh-shadow);
	border: 1px solid var(--bh-border);
	overflow: hidden;
}
.content-area--full { grid-column: 1 / -1; }

/* 内容页：table 双栏，避免正文大图/表格撑破侧栏位置 */
body.single .content-wrap,
body.singular .content-wrap {
	display: block;
}

table.single-page-layout {
	display: table;
	width: 100%;
	max-width: 100%;
	border: 0;
	border-collapse: separate;
	border-spacing: 14px 0;
	table-layout: fixed;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
table.single-page-layout > tbody > tr > td,
table.single-page-layout > tr > td {
	border: 0;
	padding: 0;
	vertical-align: top;
}
td.single-page-main {
	width: auto;
	min-width: 0;
	overflow: hidden;
	word-wrap: break-word;
	overflow-wrap: break-word;
}
td.single-page-side {
	width: 300px;
	max-width: 300px;
	overflow: hidden;
}
td.single-page-main img,
td.single-page-main iframe,
td.single-page-main video,
td.single-page-main table,
td.single-page-main pre {
	max-width: 100%;
	height: auto;
}
td.single-page-side .sidebar {
	position: sticky;
	top: 120px;
}

.site-main { padding: 0; }

.page-header {
	padding: 14px 16px 8px;
	border-bottom: 1px solid var(--bh-border);
}
.page-title { margin: 0; font-size: 1.15rem; }

/* Breadcrumbs */
.breadcrumbs {
	margin: 0;
	padding: 10px 16px;
	font-size: 12px;
	color: var(--bh-muted);
	background: #f7f9fc;
	border-bottom: 1px solid var(--bh-border);
	line-height: 1.5;
}
.breadcrumbs-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
}
.breadcrumbs-item { display: inline-flex; align-items: center; }
.breadcrumbs-item a { color: var(--bh-muted); }
.breadcrumbs-item a:hover { color: var(--bh-primary); }
.breadcrumbs-sep { margin: 0 6px; color: #cfd5e2; }
.breadcrumbs-item [aria-current="page"] {
	color: var(--bh-text);
	max-width: 240px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Tabs */
.list-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--bh-border);
	padding: 0 8px;
	overflow-x: auto;
}
.list-tab {
	flex: 0 0 auto;
	padding: 12px 14px;
	color: var(--bh-muted);
	font-weight: 600;
	position: relative;
}
.list-tab.is-active { color: var(--bh-primary); }
.list-tab.is-active::after {
	content: "";
	position: absolute;
	left: 14px; right: 14px; bottom: 0;
	height: 2px;
	background: var(--bh-primary);
	border-radius: 2px;
}

/* Topic list */
.topic-list { padding: 0; }
.topic-item {
	padding: 14px 16px;
	border-bottom: 1px solid var(--bh-border);
}
.topic-item:last-child { border-bottom: 0; }
.topic-title {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--bh-text);
}
.topic-link:hover .topic-title-text { color: var(--bh-primary); }

.badge {
	display: inline-block;
	margin-right: 4px;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 700;
	vertical-align: 1px;
	line-height: 1.4;
}
.badge-rec { background: #fff1e8; color: var(--bh-accent); }
.badge-hot { background: #eef2ff; color: var(--bh-primary); }
.badge-new { background: #ecfdf5; color: #059669; }

.topic-meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	color: var(--bh-muted);
}
.topic-meta-left,
.topic-meta-right {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}
.topic-board {
	padding: 1px 6px;
	border-radius: 3px;
	background: #f3f5f9;
	color: var(--bh-primary);
	font-weight: 600;
}
.topic-views,
.topic-replies {
	display: inline-flex;
	align-items: center;
	gap: 3px;
}
.meta-comment { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sidebar */
.sidebar { display: grid; gap: 14px; }
.widget {
	background: var(--bh-surface);
	border: 1px solid var(--bh-border);
	border-radius: var(--bh-radius);
	box-shadow: var(--bh-shadow);
	padding: 14px;
}
.widget-title {
	margin: 0 0 10px;
	font-size: 15px;
}
.intro-logo { margin-bottom: 8px; font-size: 1.05rem; }
.intro-text { margin: 0; color: var(--bh-muted); font-size: 13px; line-height: 1.6; }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	padding: 0 14px;
	border-radius: 8px;
	font-weight: 600;
	font-size: 13px;
	border: 1px solid transparent;
}
.btn-primary { background: var(--bh-primary); color: #fff; }
.btn-primary:hover { background: var(--bh-primary-dark); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--bh-border); color: var(--bh-text); }

.rank-tabs { display: flex; gap: 0; margin-bottom: 10px; border-bottom: 1px solid var(--bh-border); }
.rank-tab {
	flex: 1;
	padding: 8px;
	border: 0;
	background: transparent;
	color: var(--bh-muted);
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
}
.rank-tab.is-active { color: var(--bh-primary); box-shadow: inset 0 -2px 0 var(--bh-primary); }

.rank-list,
.rank-page-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.rank-list li,
.rank-page-list li {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 8px 0;
	border-bottom: 1px dashed var(--bh-border);
	font-size: 13px;
}
.rank-list li:last-child,
.rank-page-list li:last-child { border-bottom: 0; }
.rank-list a,
.rank-page-list a {
	flex: 1;
	min-width: 0;
	color: var(--bh-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.rank-num {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	line-height: 18px;
	text-align: center;
	font-size: 11px;
	font-weight: 700;
	border-radius: 4px;
	background: #d1d5db;
	color: #fff;
}
.rank-num.rank-1 { background: #ef4444; }
.rank-num.rank-2 { background: #f97316; }
.rank-num.rank-3 { background: #eab308; color: #333; }
.rank-views { color: var(--bh-muted); font-size: 12px; }

/* Boards page */
.boards-summary { margin: 6px 0 0; color: var(--bh-muted); font-size: 13px; }
.boards-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	padding: 14px;
}
.board-card {
	display: block;
	padding: 14px;
	border: 1px solid var(--bh-border);
	border-radius: 10px;
	background: #fafbff;
	color: inherit;
}
.board-card:hover { border-color: var(--bh-primary); box-shadow: 0 4px 14px rgba(59,111,245,.1); }
.board-card-name { display: block; font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--bh-text); }
.board-card-meta { display: block; font-size: 12px; color: var(--bh-muted); }
.board-card-meta strong { color: var(--bh-accent); }
.board-card-desc { display: block; margin-top: 6px; font-size: 12px; color: #9aa3b5; }

.rank-page-list { padding: 8px 16px 16px; }

/* Single */
.single-article { padding: 16px; }
.entry-title { margin: 0 0 8px; font-size: 1.25rem; line-height: 1.4; }
.entry-meta { color: var(--bh-muted); font-size: 13px; margin-bottom: 14px; }
.entry-meta .sep { margin: 0 4px; color: #cfd5e2; }
.entry-featured { margin-bottom: 14px; border-radius: 8px; overflow: hidden; }
.entry-content { font-size: 15px; line-height: 1.75; word-break: break-word; }
.entry-content p { margin: 0 0 1em; }
.entry-tags { margin-top: 16px; }
.entry-tags a {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 3px 8px;
	background: #f3f5f9;
	border-radius: 4px;
	font-size: 12px;
	color: var(--bh-muted);
}

.post-navigation { margin: 0 16px 16px; }
.post-navigation .nav-links { display: grid; gap: 8px; }
.post-navigation a {
	display: block;
	padding: 10px 12px;
	background: #f7f9fc;
	border-radius: 8px;
	border: 1px solid var(--bh-border);
	color: var(--bh-text);
}
.post-navigation .nav-label { display: block; font-size: 12px; color: var(--bh-muted); margin-bottom: 2px; }

.search-field {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--bh-border);
	border-radius: 8px;
	font: inherit;
}
.search-form { display: flex; gap: 8px; padding: 16px; }
.search-submit {
	height: 42px;
	padding: 0 16px;
	border: 0;
	border-radius: 8px;
	background: var(--bh-primary);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.pagination { padding: 14px 16px 18px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers {
	min-width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	border: 1px solid var(--bh-border);
	color: var(--bh-text);
	background: #fff;
	padding: 0 8px;
}
.pagination .current,
.pagination a:hover {
	background: var(--bh-primary);
	border-color: var(--bh-primary);
	color: #fff;
}

.no-results,
.error-404 { padding: 24px 16px; }
.empty-hint { margin: 0; color: var(--bh-muted); font-size: 13px; }

/* Footer + bottom nav */
.site-footer {
	max-width: var(--bh-max);
	margin: 0 auto;
	padding: 8px 14px 20px;
	color: var(--bh-muted);
	font-size: 12px;
	text-align: center;
}
.footer-about { margin: 0 0 8px; line-height: 1.6; }
.footer-menu { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.footer-menu a { color: var(--bh-muted); }
.site-info a { color: var(--bh-muted); }

.bottom-nav {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 50;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	background: #fff;
	border-top: 1px solid var(--bh-border);
	padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 8px 4px;
	color: var(--bh-muted);
	font-size: 11px;
}
.bottom-nav-item.is-active,
.bottom-nav-item:hover { color: var(--bh-primary); }

@media (min-width: 900px) {
	.site { padding-bottom: 0; }
	.bottom-nav { display: none; }
	.nav-toggle { display: none; }
	.desktop-only { display: block; }
	body:not(.single):not(.singular) .content-wrap {
		grid-template-columns: minmax(0, 1fr) 300px;
	}
	body:not(.single):not(.singular) .sidebar { position: sticky; top: 120px; }
	.boards-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 899px) {
	table.single-page-layout,
	table.single-page-layout > tbody,
	table.single-page-layout > tbody > tr,
	table.single-page-layout > tr {
		display: block;
		width: 100%;
	}
	td.single-page-main,
	td.single-page-side {
		display: block;
		width: 100%;
		max-width: 100%;
	}
	td.single-page-side {
		margin-top: 14px;
	}
	td.single-page-side .sidebar {
		position: static;
	}
}

@media (min-width: 1100px) {
	.site-content,
	.header-bar,
	.board-chips,
	.site-notice,
	.site-footer {
		padding-left: 0;
		padding-right: 0;
	}
	.site-content { padding-top: 18px; }
	.header-bar,
	.board-chips,
	.site-notice { padding-left: 0; padding-right: 0; }
	.site-header > .header-bar,
	.site-header > .board-chips,
	.site-header > .site-notice {
		padding-left: 0;
		padding-right: 0;
		width: min(100% - 28px, var(--bh-max));
	}
}
