/* 模块：主题变量与全局设置 / Theme variables and global resets. */
:root {
	--bg-color: #ffffff;
	--text-color: #111111;
	--text-muted: #6b7280;
	--secondary-bg: #f7f9fb;
	--border-color: #dfe3eb;
	--shadow-color: rgba(15, 23, 42, 0.12);
	--overlay-bg: rgba(255, 255, 255, 0.5);
	--card-bg: rgba(255, 255, 255, 0.95);
	--wallpaper-image: url('/resource/img/shell/bg/bg-light-1.png');
	--view-switch-bg: #f4f7fa;
	--view-switch-active-bg: var(--card-bg);
	--view-switch-hover-bg: #e5eaf1;
	--hover-bg: #eef1f5;
	--active-bg: #e2e6ed;
	--input-focus-bg: #ffffff;
	--content-max-width: 1440px; /* 主内容最大宽度（不含侧栏） */
	--layout-gap: 1rem; /* 侧栏与主内容间距 */
	--layout-offset: 0px; /* 侧栏贴边：不再为整体居中预留偏移 */
	--sidebar-current-width: var(--sidebar-width); /* 侧栏当前宽度，折叠时被覆盖 */
	--header-height: 60px;
	--header-action-size: 40px;
	--header-logo-size: 26px;
	--sidebar-width: 220px;
	--sidebar-offset: 0px; /* 侧边栏偏移，由 JS 写入 */
	--sidebar-button-space: 0.75rem; /* 侧栏顶部内边距，保持轻微间隔 */
	--icon-size: 32px;     /* 默认：页眉/Logo 图标大小 */
	--icon-small: 20px;    /* 页脚/地址等小图标的较小尺寸 */
}

/* particle image overlay: makes per-image overlay canvas align and ignore pointer events */
.particle-image-overlay {
	image-rendering: auto;
	pointer-events: none;
	/* original blend for particle overlays */
	mix-blend-mode: screen;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	display: block;
	z-index: 1401;
}

.particle-image-wrapper {
	display: inline-block;
	position: relative;
	overflow: hidden; /* ensure overlay clipped to image bounds */
}

/* 右下角浮动 aside 栈容器（全局浮层，与页眉按钮相关） */
#aside-stack {
	position: fixed;
	right: 16px;
	bottom: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 120;
	max-width: min(380px, 40vw);
}

#aside-stack aside {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 10px;
	box-shadow: 0 12px 30px var(--shadow-color);
	padding: 0.75rem 0.9rem;
	color: var(--text-color);
	max-height: 40vh;
	overflow: auto;
	backdrop-filter: saturate(1.1) blur(2px);
	position: relative;
	transition: transform 200ms ease, opacity 180ms ease;
}

#aside-stack aside.closing {
	opacity: 0;
	transform: translateX(120%);
}

.aside-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border-color);
	border-radius: 6px;
	background: var(--secondary-bg);
	color: inherit;
	cursor: pointer;
	font-size: 1rem;
	padding: 0;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
	transition: background 0.15s ease, border 0.15s ease, transform 0.15s ease;
}

.aside-close:hover {
	background: var(--hover-bg);
	border-color: var(--border-color);
}

.aside-close:active {
	transform: scale(0.97);
	background: var(--active-bg);
	border-color: var(--border-color);
}

#aside-stack aside a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--secondary-bg);
	border: 1px solid var(--border-color);
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
	color: inherit;
	text-decoration: none;
	line-height: 1.25;
	font-size: 1rem;
	transition: background 0.18s ease, border 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#aside-stack aside a:hover {
	background: var(--hover-bg);
	border-color: var(--border-color);
}

#aside-stack aside a:active {
	transform: scale(0.98);
	background: var(--active-bg);
	border-color: var(--border-color);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

@media (max-width: 760px) {
	#aside-stack {
		max-width: min(320px, 70vw);
		right: 12px;
		bottom: 12px;
	}
	#aside-stack aside {
		max-height: 50vh;
	}
}
body.dark-mode {
	--bg-color: #000000;
	--text-color: #e5e5e5;
	--text-muted: #9ca3af;
	--secondary-bg: #2a2a2a;
	--border-color: #3a3a3a;
	--shadow-color: rgba(0, 0, 0, 0.3);
	--overlay-bg: rgba(0, 0, 0, 0.6);
	--card-bg: rgba(42, 42, 42, 0.95);
	--view-switch-bg: rgba(255, 255, 255, 0.03);
	--view-switch-active-bg: rgba(255, 255, 255, 0.08);
	--view-switch-hover-bg: rgba(255, 255, 255, 0.05);
	--hover-bg: #333333;
	--active-bg: #3d3d3d;
	--input-focus-bg: rgba(255, 255, 255, 0.12);
}

/* Fluent System Icons font (from microsoft/fluentui-system-icons) */
@font-face {
	font-family: 'FluentSystemIcons';
	src: url('/resource/font/FluentSystemIcons-Regular.woff2') format('woff2'),
		 url('/resource/font/FluentSystemIcons-Regular.woff') format('woff'),
		 url('/resource/font/FluentSystemIcons-Regular.ttf') format('truetype');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

/* Utility to show icon from font: use an inline element with class .fluent-font to display glyphs */
.fluent-font {
	font-family: 'FluentSystemIcons', 'Segoe Fluent Icons', 'Segoe MDL2 Assets', sans-serif;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* 全局布局：重置 body 默认 margin，使用 flex 列布局保证 footer 在视口底部
   （当内容不足时 footer 贴底；当内容过多时 footer 跟随内容） */
html, body {
	height: 100%;
}
html {
	/* 为锚点跳转添加顶部偏移，避免被固定页眉遮挡 */
	scroll-padding-top: calc(var(--header-height, 60px) + 16px);
}
	body {
	margin: 0;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	box-sizing: border-box;
	background-color: var(--bg-color);
	color: var(--text-color);
	/* 页面背景：底层图片 + 顶层半透明覆盖层，提升正文可读性 */
	background-image: linear-gradient(var(--overlay-bg), var(--overlay-bg)), var(--wallpaper-image, url('/resource/img/shell/bg/bg-light-1.png'));
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	background-attachment: fixed;
	transition: background-color 0.3s ease, color 0.3s ease;
}

/* 自定义滚动条，贴合浅/深色主题 */
* {
	scrollbar-width: thin;
	scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

*::-webkit-scrollbar-track {
	background: transparent;
}

*::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, var(--border-color), var(--hover-bg));
	border-radius: 8px;
	border: 2px solid transparent;
	background-clip: padding-box;
	box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}

*::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, var(--hover-bg), var(--active-bg));
}

*::-webkit-scrollbar-corner {
	background: transparent;
}

/* Prevent Android's blue tap highlight on interactive elements */
button,
a,
input,
textarea,
select,
[role="button"] {
	-webkit-tap-highlight-color: transparent;
	tap-highlight-color: transparent;
}

/* 所有图片统一圆角裁切 */
img {
	border-radius: 10px;
	overflow: hidden;
}

/* 限制图片与视频的最大宽度，防止超出容器或屏幕 */
img, picture, figure, main img, #aside-stack img, .post-content img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* 视频也应限制宽度以避免横向溢出 */
video, .video-as-image {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: 10px;
	overflow: hidden;
}

/* Make videos look like images when shown inline: rounded corners and clipped content */
.video-as-image {
	border-radius: 10px;
	overflow: hidden;
	display: block;
	max-width: 100%;
	height: auto;
}

/* 隐藏作为图片标题的段落 */
.image-caption-hidden {
	display: none !important;
}


/* 可点击图片的缩放与按压反馈 */
.zoomable-img {
	cursor: zoom-in;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.zoomable-img:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.zoomable-img:active {
	transform: scale(0.97);
}

/* 小屏幕下微调图标变量 */
@media (max-width: 480px) {
	:root { --icon-size: 28px; --icon-small: 18px; }
}
