/**
 * 侧边栏样式表（独立文件，仅在侧边栏启用时由 wp_enqueue_style 加载）。
 *
 * 只作用于 .hc-sidebar 内部，所以不会影响页脚小工具与正文；
 * 全部颜色取自 --hc-* 变量，随 324 套配色同步切换。
 */

/* ---------- 卡片与标题 ---------- */
.hc-sidebar .widget {
	margin: 0 0 22px;
	padding: 0 0 18px;
	background: var(--hc-surface);
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius);
	box-shadow: var(--hc-shadow);
	overflow: hidden;
}
.hc-sidebar .widget:last-child { margin-bottom: 0; }

/* 标题条：左侧竖条 + 下划线，纸条本身不写死颜色 */
.hc-sidebar .widget-title,
.hc-sidebar .widget .wtitle {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 13px 16px 12px 18px;
	background: var(--hc-bg-alt);
	border-bottom: 1px solid var(--hc-border);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.5px;
	color: var(--hc-heading);
}
.hc-sidebar .widget-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 12px;
	bottom: 12px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--hc-primary);
}
.hc-sidebar .widget-title::after {
	content: "";
	position: absolute;
	left: 18px;
	bottom: 0;
	width: 46px;
	height: 2px;
	background: var(--hc-accent);
}
.hc-sidebar .widget-title span { display: inline-block; }
/* 没有标题时不显示空标题条（核心部件留空标题的情况） */
.hc-sidebar .widget-title:empty,
.hc-sidebar .widget-title span:empty,
.hc-sidebar .widget h3:empty,
.hc-sidebar .widget h2:empty { display: none; }

/* ---------- 通用列表 ---------- */
.hc-sidebar .widget > ul,
.hc-sidebar .widget .menu,
.hc-sidebar .widget .sub-menu {
	margin: 0;
	padding: 8px 16px 2px;
	list-style: none;
}
.hc-sidebar .widget > ul li,
.hc-sidebar .widget .menu li {
	position: relative;
	border-bottom: 1px dashed var(--hc-border);
}
.hc-sidebar .widget > ul li:last-child,
.hc-sidebar .widget .menu li:last-child { border-bottom: 0; }
.hc-sidebar .widget > ul li a,
.hc-sidebar .widget .menu li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 2px 9px 0;
	font-size: 13.5px;
	line-height: 1.65;
	color: var(--hc-text);
	transition: color var(--hc-transition), padding-left var(--hc-transition);
}
.hc-sidebar .widget > ul li a:hover,
.hc-sidebar .widget .menu li a:hover { color: var(--hc-primary); padding-left: 4px; }
.hc-sidebar .widget .sub-menu { padding: 0 0 4px 14px; }
.hc-sidebar .widget .sub-menu li { border-bottom: 0; }
.hc-sidebar .widget .sub-menu li a { font-size: 13px; color: var(--hc-muted); }

/* 分类 / 归档的条目数量 */
.hc-sidebar .widget_categories li,
.hc-sidebar .widget_archive li { font-size: 13.5px; }
.hc-sidebar .widget_categories li a,
.hc-sidebar .widget_archive li a { display: inline-flex; }
.hc-sidebar .widget_categories .count,
.hc-sidebar .widget_archive .count {
	font-size: 12px;
	color: var(--hc-muted);
	background: var(--hc-bg-alt);
	border-radius: var(--hc-radius-pill);
	padding: 0 8px;
	line-height: 20px;
}
.hc-sidebar .widget_categories li:hover .count { background: var(--hc-primary-light); color: var(--hc-primary-dark); }

/* ---------- 最近文章 / 最近评论 ---------- */
.hc-sidebar .widget_recent_entries li a,
.hc-sidebar .widget_recent_comments li a { font-weight: 500; }
.hc-sidebar .widget_recent_entries .post-date,
.hc-sidebar .widget_recent_comments .comment-author-link { display: block; font-size: 12px; color: var(--hc-muted); }
.hc-sidebar .widget_recent_comments li { padding: 9px 0; font-size: 13px; line-height: 1.7; color: var(--hc-muted); }

/* ---------- 标签云：圆角胶囊，自动换行、间距均匀 ---------- */
.hc-sidebar .widget_tag_cloud .tagcloud,
.hc-sidebar .wp-block-tag-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 16px 16px;
}
.hc-sidebar .widget_tag_cloud .tagcloud a,
.hc-sidebar .wp-block-tag-cloud a {
	display: inline-flex;
	align-items: center;
	padding: 5px 13px;
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius-pill);
	background: var(--hc-bg-alt);
	color: var(--hc-text);
	font-size: 12.5px !important;
	line-height: 1.6;
	text-decoration: none;
	white-space: nowrap;
	transition: background var(--hc-transition), color var(--hc-transition), border-color var(--hc-transition), transform var(--hc-transition);
}
.hc-sidebar .widget_tag_cloud .tagcloud a:hover,
.hc-sidebar .wp-block-tag-cloud a:hover {
	background: var(--hc-primary);
	border-color: var(--hc-primary);
	color: #fff;
	transform: translateY(-2px);
}

/* ---------- 搜索 ---------- */
.hc-sidebar .widget_search { padding-bottom: 16px; }
.hc-sidebar .widget_search .hc-searchform { padding: 14px 16px 0; }
.hc-sidebar .widget_search form,
.hc-sidebar .widget_search .search-form { padding: 14px 16px 0; }

/* ---------- 归档下拉、日历、文本 ---------- */
.hc-sidebar .widget_archive select,
.hc-sidebar .widget_categories select {
	width: calc(100% - 32px);
	margin: 14px 16px;
	padding: 8px 10px;
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius);
	background: var(--hc-surface);
	color: var(--hc-text);
	font-size: 13.5px;
}
.hc-sidebar .widget_calendar table { width: calc(100% - 32px); margin: 14px 16px; border-collapse: collapse; font-size: 12.5px; }
.hc-sidebar .widget_calendar th,
.hc-sidebar .widget_calendar td { padding: 4px 2px; text-align: center; border: 1px solid var(--hc-border); }
.hc-sidebar .widget_calendar th { background: var(--hc-bg-alt); color: var(--hc-heading); font-weight: 600; }
.hc-sidebar .widget_calendar caption { padding: 0 0 8px; font-size: 13px; color: var(--hc-muted); }
.hc-sidebar .widget_calendar #today { background: var(--hc-primary-light); color: var(--hc-primary-dark); font-weight: 600; }
.hc-sidebar .widget_text .textwidget { padding: 12px 16px 4px; font-size: 13.5px; line-height: 1.9; color: var(--hc-text); }
.hc-sidebar .widget_text .textwidget p:last-child { margin-bottom: 0; }
.hc-sidebar .widget_nav_menu > div { padding: 6px 16px 2px; }

/* ---------- 联系我们卡片 ---------- */
.hc-sidebar .hc-contact-card { padding: 4px 16px 2px; }
.hc-sidebar .hc-contact-list { margin: 0; }
.hc-sidebar .hc-contact-list__item { padding: 9px 0; font-size: 13.5px; }
.hc-sidebar .hc-contact-card__intro { margin: 8px 0 4px; font-size: 13px; line-height: 1.85; color: var(--hc-muted); }
.hc-sidebar .hc-contact-card__btn { margin: 14px 0 16px; }

/* ---------- 侧栏里的胶囊标签组件（自建小工具） ---------- */
.hc-sidebar .hc-tags { padding: 14px 16px 16px; }

/* ---------- 响应式：≤960px 侧栏落到内容下方 ---------- */
@media (max-width: 960px) {
	.hc-sidebar { margin-top: 30px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
	.hc-sidebar .widget { margin-bottom: 0; }
}
@media (max-width: 640px) {
	.hc-sidebar { grid-template-columns: minmax(0, 1fr); }
	.hc-sidebar .widget-title { font-size: 14px; padding: 11px 14px 10px 16px; }
	.hc-sidebar .widget-title::after { left: 16px; }
}

/* ---------- 文章列表（最新 / 热门） ---------- */
.hc-sidebar .hc-wposts { margin: 0; padding: 8px 16px 6px; list-style: none; }
.hc-sidebar .hc-wposts li { padding: 9px 0; border-bottom: 1px dashed var(--hc-border); }
.hc-sidebar .hc-wposts li:last-child { border-bottom: 0; }
.hc-sidebar .hc-wposts a { display: block; font-size: 13.5px; line-height: 1.65; color: var(--hc-text); }
.hc-sidebar .hc-wposts a:hover { color: var(--hc-primary); }
.hc-sidebar .hc-wposts__meta { display: block; margin-top: 3px; font-size: 12px; color: var(--hc-muted); }

/* ---------- 产品推荐（两列小图） ---------- */
.hc-sidebar .hc-wproducts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 14px 16px 16px; list-style: none; }
.hc-sidebar .hc-wproducts li { min-width: 0; }
.hc-sidebar .hc-wproducts__thumb { position: relative; display: block; padding-bottom: 75%; overflow: hidden; border-radius: 6px; background: var(--hc-bg-alt); }
.hc-sidebar .hc-wproducts__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.hc-sidebar .hc-wproducts li:hover .hc-wproducts__thumb img { transform: scale(1.06); }
.hc-sidebar .hc-wproducts__thumb .hc-thumb-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hc-sidebar .hc-wproducts__title { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--hc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-sidebar .hc-wproducts li:hover .hc-wproducts__title { color: var(--hc-primary); }

/* ---------- 广告位 / 自定义图 ---------- */
.hc-sidebar .hc-wad { padding: 14px 16px 16px; }
.hc-sidebar .hc-wad img { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--hc-border); }

/* ---------- 移动端：按设置折叠侧栏 ---------- */
@media (max-width: 960px) {
	body.hc-sidebar-mobile-hide .hc-sidebar { display: none; }
	body.hc-sidebar-mobile-hide .hc-layout.has-sidebar { grid-template-columns: minmax(0, 1fr); }
}
