/**
 * Lumo: micro-interactions, motion, a11y, mobile dock (loads after main.css).
 */

/* -------------------------------------------------------------------------- */
/* Page enter                                                                  */
/* -------------------------------------------------------------------------- */

body.leafs-page-enter {
	animation: lumoPageIn 0.35s ease-out;
}

@keyframes lumoPageIn {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------------------------------- */
/* Ripple (Material-style): hosts need overflow hidden                         */
/* -------------------------------------------------------------------------- */

.leafs-btn--primary,
.leafs-icon-btn {
	position: relative;
	overflow: hidden;
}

span.leafs-ripple {
	position: absolute;
	left: 0;
	top: 0;
	width: 14px;
	height: 14px;
	margin-left: -7px;
	margin-top: -7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.42);
	transform: scale(0);
	animation: lumoRipple 0.55s ease-out forwards;
	pointer-events: none;
	z-index: 2;
}

html[data-leafs-theme="dark"] span.leafs-ripple {
	background: rgba(255, 255, 255, 0.22);
}

@keyframes lumoRipple {
	to {
		transform: scale(32);
		opacity: 0;
	}
}

/* -------------------------------------------------------------------------- */
/* Card hover: thumb scale + title transition                                  */
/* -------------------------------------------------------------------------- */

.leafs-card__thumb-link img {
	transition: transform 0.35s ease;
}

.leafs-card:hover .leafs-card__thumb-link img {
	transform: scale(1.02);
}

.leafs-card__title a {
	transition: color 0.25s ease;
}

.leafs-card:hover .leafs-card__title a {
	color: var(--leafs-link);
}

/* -------------------------------------------------------------------------- */
/* Featured card: visible gradient border + sweep                              */
/* -------------------------------------------------------------------------- */

.leafs-card--featured::before {
	opacity: 0.42;
	transition: opacity 0.28s ease;
	background: linear-gradient(
		135deg,
		var(--leafs-brand),
		var(--leafs-mint),
		color-mix(in srgb, var(--leafs-warm) 70%, transparent)
	);
	background-size: 200% 200%;
	animation: lumoFeaturedBorder 8s ease-in-out infinite;
}

.leafs-card--featured:hover::before {
	opacity: 1;
}

@keyframes lumoFeaturedBorder {
	0%,
	100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

/*
 * 首页中间流（.leafs-card--home-stream）：覆盖 main.css 默认白光 sheen，
 * 与分类归档卡片一致 — 品牌色高光 + 指针离开时缓慢淡出。
 */
.leafs-card.leafs-card--home-stream > * {
	position: relative;
	z-index: 1;
}

.leafs-card.leafs-card--home-stream::after {
	inset: 0;
	left: -40%;
	width: 35%;
	background: linear-gradient(
		105deg,
		transparent,
		color-mix(in srgb, var(--leafs-brand) 14%, transparent),
		transparent
	);
	transform: skewX(-18deg) translateX(-120%);
	opacity: 0;
	z-index: 0;
	transition:
		opacity 0.72s cubic-bezier(0.33, 1, 0.68, 1),
		transform 0.62s cubic-bezier(0.45, 0, 0.55, 1);
	animation: none;
}

.leafs-card.leafs-card--home-stream:hover::after {
	opacity: 1;
	transition:
		opacity 0.22s ease-out,
		transform 0s linear;
	animation: leafs-home-stream-card-sheen 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes leafs-home-stream-card-sheen {
	from {
		transform: skewX(-18deg) translateX(-120%);
	}

	to {
		transform: skewX(-18deg) translateX(380%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.leafs-card.leafs-card--home-stream::after {
		display: none !important;
	}
}

/* -------------------------------------------------------------------------- */
/* Form inputs: bottom bar focus                                               */
/* -------------------------------------------------------------------------- */

.leafs-auth-input,
input[type="search"].leafs-admin-search,
.leafs-uc-field input[type="text"],
.leafs-uc-field input[type="email"],
.leafs-uc-field input[type="password"],
.leafs-uc-field input[type="url"] {
	position: relative;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.leafs-auth-field,
.leafs-uc-field--text {
	position: relative;
}

/* 首页海报搜索为圆角胶囊 + wrap 上 focus ring，勿用底部直条（会与圆角冲突、像横线割裂） */
.leafs-auth-field::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	width: 100%;
	height: 2px;
	max-width: 0;
	background: linear-gradient(90deg, var(--leafs-brand), var(--leafs-mint));
	border-radius: 2px;
	transform: translateX(-50%);
	transition: max-width 0.28s ease;
	pointer-events: none;
	opacity: 0.95;
}

.leafs-auth-field:focus-within::after {
	max-width: 100%;
}

/* -------------------------------------------------------------------------- */
/* Favorite heartbeat (icon card + heart)                                       */
/* -------------------------------------------------------------------------- */

@keyframes lumoHeartBeat {
	0%,
	100% {
		transform: scale(1);
	}
	18% {
		transform: scale(1.28);
	}
	36% {
		transform: scale(0.92);
	}
	54% {
		transform: scale(1.18);
	}
	72% {
		transform: scale(1);
	}
}

.leafs-fav-btn.is-pulse .leafs-icon,
.leafs-fav-btn.is-pulse .leafs-fav-heart__svg,
.leafs-fav-heart.is-pulse .leafs-fav-heart__svg {
	animation: lumoHeartBeat 0.55s ease;
}

.leafs-stat-num.is-tick {
	animation: lumoStatTick 0.38s ease;
}

@keyframes lumoStatTick {
	0%,
	100% {
		transform: translateY(0);
	}
	40% {
		transform: translateY(-4px);
	}
}

/* -------------------------------------------------------------------------- */
/* Skeleton stagger（仅延迟 shimmer，避免与无限动画冲突）                     */
/* -------------------------------------------------------------------------- */

.leafs-uc-skeleton--list .leafs-uc-skeleton__row:nth-child(1) {
	animation-delay: 0s;
}

.leafs-uc-skeleton--list .leafs-uc-skeleton__row:nth-child(2) {
	animation-delay: 0.05s;
}

.leafs-uc-skeleton--list .leafs-uc-skeleton__row:nth-child(3) {
	animation-delay: 0.1s;
}

.leafs-uc-skeleton--list .leafs-uc-skeleton__row:nth-child(4) {
	animation-delay: 0.15s;
}

.leafs-uc-skeleton--list .leafs-uc-skeleton__row:nth-child(5) {
	animation-delay: 0.2s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(1) {
	animation-delay: 0s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(2) {
	animation-delay: 0.05s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(3) {
	animation-delay: 0.1s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(4) {
	animation-delay: 0.15s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(5) {
	animation-delay: 0.2s;
}

.leafs-uc-skeleton--grid .leafs-uc-skeleton__card:nth-child(6) {
	animation-delay: 0.25s;
}

/* -------------------------------------------------------------------------- */
/* Tool card stats icons                                                       */
/* -------------------------------------------------------------------------- */

.leafs-card__views {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px 4px;
}

.leafs-card__stat {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	vertical-align: middle;
}

.leafs-card__stat-icon {
	width: 13px;
	height: 13px;
	flex-shrink: 0;
	opacity: 0.72;
	background: currentColor;
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	-webkit-mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
}

.leafs-card__stat-icon--eye {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z'/%3E%3C/svg%3E");
}

.leafs-card__stat-icon--heart {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
}

/* -------------------------------------------------------------------------- */
/* Article: drop cap + blockquote quote                                        */
/* -------------------------------------------------------------------------- */

.leafs-single-post .leafs-entry-content > p:first-of-type::first-letter {
	float: left;
	font-size: 3rem;
	line-height: 0.92;
	font-weight: 800;
	padding-right: 0.12em;
	margin-top: 0.04em;
	color: var(--leafs-brand);
}

.leafs-single-post .leafs-entry-content blockquote {
	position: relative;
	padding-left: 48px;
	border-radius: 12px;
	border-left-width: 4px;
}

.leafs-single-post .leafs-entry-content blockquote::before {
	content: "";
	position: absolute;
	left: 14px;
	top: 14px;
	width: 22px;
	height: 22px;
	opacity: 0.35;
	background: var(--leafs-brand);
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z'/%3E%3C/svg%3E");
	mask-size: contain;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z'/%3E%3C/svg%3E");
}

/* -------------------------------------------------------------------------- */
/* Section dividers (gradient)                                                 */
/* -------------------------------------------------------------------------- */

.leafs-layout__right .leafs-panel + .leafs-panel,
.leafs-layout__left .leafs-panel + .leafs-panel {
	border-top: none;
	padding-top: 8px;
	margin-top: 8px;
	position: relative;
}

.leafs-layout__right .leafs-panel + .leafs-panel::before,
.leafs-layout__left .leafs-panel + .leafs-panel::before {
	content: "";
	display: block;
	height: 1px;
	margin-bottom: 16px;
	background: linear-gradient(
		90deg,
		transparent,
		color-mix(in srgb, var(--leafs-brand) 35%, transparent),
		color-mix(in srgb, var(--leafs-mint) 25%, transparent),
		transparent
	);
}

/* -------------------------------------------------------------------------- */
/* Footer slow gradient wash                                                   */
/* -------------------------------------------------------------------------- */

.leafs-footer {
	position: relative;
	overflow: hidden;
}

.leafs-footer .leafs-container {
	position: relative;
	z-index: 1;
}

/* 新版页脚自带渐变与光晕；旧版无 --enhanced 时保留缓慢洗光 */
.leafs-footer:not(.leafs-footer--enhanced)::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0.35;
	background: radial-gradient(
		ellipse 80% 50% at 20% 0%,
		color-mix(in srgb, var(--leafs-brand) 18%, transparent),
		transparent 55%
	);
	animation: lumoFooterWash 28s ease-in-out infinite alternate;
}

@keyframes lumoFooterWash {
	from {
		transform: translate(0, 0) scale(1);
	}
	to {
		transform: translate(4%, 2%) scale(1.08);
	}
}

/* -------------------------------------------------------------------------- */
/* Custom scrollbar                                                            */
/* -------------------------------------------------------------------------- */

* {
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--leafs-brand) 55%, var(--leafs-border)) var(--leafs-surface2);
}

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

*::-webkit-scrollbar-track {
	background: var(--leafs-surface2);
	border-radius: 8px;
}

*::-webkit-scrollbar-thumb {
	background: color-mix(in srgb, var(--leafs-brand) 50%, var(--leafs-border));
	border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
	background: var(--leafs-brand);
}

/* -------------------------------------------------------------------------- */
/* Focus visible (keyboard)                                                    */
/* -------------------------------------------------------------------------- */

.leafs-btn:focus-visible,
.leafs-icon-btn:focus-visible,
.leafs-nav a:focus-visible,
.leafs-card__title a:focus-visible,
.leafs-lang-switch__link:focus-visible,
.leafs-theme-toggle:focus-visible,
.leafs-auth-input:focus-visible,
.leafs-mobile-dock__link:focus-visible {
	outline: 2px solid var(--leafs-brand);
	outline-offset: 3px;
	box-shadow: 0 0 0 4px var(--leafs-focus-ring);
}

.leafs-skip-link:focus {
	border-radius: 8px;
	box-shadow: 0 0 0 4px var(--leafs-focus-ring);
}

/* -------------------------------------------------------------------------- */
/* Tooltips [data-tooltip]                                                     */
/* -------------------------------------------------------------------------- */

[data-tooltip] {
	position: relative;
}

[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 50%;
	bottom: calc(100% + 10px);
	transform: translateX(-50%) translateY(4px);
	padding: 6px 10px;
	font-size: 0.72rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	max-width: 240px;
	overflow: hidden;
	text-overflow: ellipsis;
	background: var(--leafs-card);
	color: var(--leafs-text);
	border: 1px solid var(--leafs-border);
	border-radius: 8px;
	box-shadow: var(--leafs-shadow-card-hover);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	pointer-events: none;
	z-index: 200;
}

[data-tooltip]::before {
	content: "";
	position: absolute;
	left: 50%;
	bottom: calc(100% + 4px);
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--leafs-border);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s;
	z-index: 201;
	pointer-events: none;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
	transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------------------- */
/* Scroll reveal                                                               */
/* -------------------------------------------------------------------------- */

.leafs-reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.55s ease, transform 0.55s ease;
}

.leafs-reveal.is-inview {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.leafs-reveal {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}

/* -------------------------------------------------------------------------- */
/* Stream loader: theme dots                                                   */
/* -------------------------------------------------------------------------- */

.leafs-stream-loader__spin {
	width: 8px;
	height: 8px;
	border: none;
	border-radius: 50%;
	background: var(--leafs-brand);
	box-shadow:
		12px 0 0 color-mix(in srgb, var(--leafs-brand) 45%, var(--leafs-muted)),
		-12px 0 0 color-mix(in srgb, var(--leafs-brand) 45%, var(--leafs-muted));
	animation: lumoLoaderDots 0.9s ease-in-out infinite;
}

@keyframes lumoLoaderDots {
	0%,
	100% {
		opacity: 1;
		transform: scale(1);
	}
	33% {
		opacity: 0.45;
		transform: scale(0.85);
	}
	66% {
		opacity: 0.75;
		transform: scale(1.05);
	}
}

/* -------------------------------------------------------------------------- */
/* Lightbox                                                                    */
/* -------------------------------------------------------------------------- */

.leafs-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.88);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s;
}

.leafs-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.leafs-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s;
}

.leafs-lightbox__close:hover {
	background: rgba(255, 255, 255, 0.22);
}

.leafs-lightbox__img {
	max-width: 100%;
	max-height: calc(100vh - 48px);
	object-fit: contain;
	border-radius: 8px;
	transform: scale(0.96);
	transition: transform 0.25s ease;
}

.leafs-lightbox.is-open .leafs-lightbox__img {
	transform: scale(1);
}

/* -------------------------------------------------------------------------- */
/* Header greeting（桌面第一行薄栏）                                              */
/* -------------------------------------------------------------------------- */

.leafs-header-greeting {
	display: none;
	margin: 0;
	min-width: 0;
	max-width: min(480px, 42vw);
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--leafs-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	align-items: center;
	gap: 4px;
}

@media (min-width: 768px) {
	.leafs-header-greeting {
		display: inline-flex;
		font-size: 13px;
		color: var(--leafs-muted, #6c757d);
	}

	.leafs-header-greeting__hello {
		color: var(--leafs-text);
	}
}

.leafs-header-greeting__emoji {
	flex-shrink: 0;
	font-size: 1rem;
	line-height: 1;
}

.leafs-header-greeting__hello {
	font-weight: 700;
	color: var(--leafs-text);
}

/* -------------------------------------------------------------------------- */
/* Mobile dock                                                                 */
/* -------------------------------------------------------------------------- */

.leafs-mobile-dock {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 60;
	padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
	background: color-mix(in srgb, var(--leafs-header-bg) 96%, var(--leafs-card));
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-top: 1px solid var(--leafs-header-border);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

html[data-leafs-theme="dark"] .leafs-mobile-dock {
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 782px) {
	.leafs-mobile-dock {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	body.leafs-has-mobile-dock {
		padding-bottom: 0;
	}
}

.leafs-mobile-dock__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	min-width: 56px;
	padding: 4px 6px;
	font-size: 0.65rem;
	font-weight: 600;
	color: var(--leafs-muted);
	text-decoration: none;
	border: none;
	background: none;
	cursor: pointer;
	font-family: inherit;
	border-radius: 10px;
	transition: color 0.15s, background 0.15s;
}

.leafs-mobile-dock__link:hover,
.leafs-mobile-dock__link.is-active {
	color: var(--leafs-link);
	text-decoration: none;
}

.leafs-mobile-dock__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}

.leafs-mobile-dock__svg {
	display: block;
	width: 23px;
	height: 23px;
	flex-shrink: 0;
	opacity: 0.88;
	color: inherit;
	transition:
		opacity 0.15s ease,
		transform 0.15s ease;
}

.leafs-mobile-dock__link:hover .leafs-mobile-dock__svg,
.leafs-mobile-dock__link.is-active .leafs-mobile-dock__svg {
	opacity: 1;
}

.leafs-mobile-dock__link:active .leafs-mobile-dock__svg {
	transform: scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
	.leafs-mobile-dock__svg {
		transition: none;
	}
}

/* -------------------------------------------------------------------------- */
/* 右下角主题配色（海蓝 / 玫红 / 琥珀，与 leafs-tokens 及后台预设呼应）      */
/* -------------------------------------------------------------------------- */

.leafs-accent-dock {
	position: fixed;
	z-index: 131;
	right: var(--leafs-corner-fab-right, 28px);
	/*
	 * 叠在置顶按钮正上方：back-bottom + 按钮高度 + 间距；
	 * 无 JS 时与 DOM 默认一致；桌面滚动靠近页脚时由 main.js 按置顶实际上边缘抬高。
	 */
	bottom: calc(
		var(--leafs-corner-back-bottom, 30px) + var(--leafs-corner-fab-size, 40px) + var(--leafs-corner-fab-stack-gap, 12px)
	);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	pointer-events: none;
}

.leafs-accent-dock > * {
	pointer-events: auto;
}

.leafs-accent-dock__panel {
	width: min(276px, calc(100vw - 36px));
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--leafs-card);
	border: 1px solid var(--leafs-border);
	box-shadow: var(--leafs-shadow-card-hover);
}

.leafs-accent-dock__panel[hidden] {
	display: none !important;
}

.leafs-accent-dock__hint {
	margin: 0 0 10px;
	font-size: 11px;
	line-height: 1.35;
	color: var(--leafs-muted);
}

@media (min-width: 783px) {
	.leafs-accent-dock__hint {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 100%;
	}
}

@media (max-width: 782px) {
	.leafs-accent-dock__hint {
		font-size: 10px;
		line-height: 1.4;
		max-width: 100%;
	}
}

.leafs-accent-dock__swatches {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px 14px;
	margin-bottom: 10px;
	justify-items: center;
	align-items: center;
}

.leafs-accent-dock__swatch {
	position: relative;
	width: 42px;
	height: 42px;
	min-width: 42px;
	min-height: 42px;
	padding: 0;
	border: 2px solid var(--leafs-border);
	border-radius: 50%;
	cursor: pointer;
	box-sizing: border-box;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.leafs-accent-dock__swatch:hover {
	transform: scale(1.06);
}

.leafs-accent-dock__swatch:focus-visible {
	outline: 2px solid var(--leafs-focus-ring, var(--leafs-brand));
	outline-offset: 2px;
}

.leafs-accent-dock__swatch[aria-pressed="true"] {
	border-color: var(--leafs-text);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--leafs-brand) 45%, transparent);
}

/* 圆点渐变来自各预设 swatch（PHP 内联 style），与后台「推荐方案」色条一致 */

.leafs-accent-dock__swatch .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.leafs-accent-dock__reset {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border-radius: 10px;
	border: 1px dashed var(--leafs-border);
	background: color-mix(in srgb, var(--leafs-surface2) 88%, transparent);
	color: var(--leafs-muted);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.leafs-accent-dock__reset:hover {
	border-color: color-mix(in srgb, var(--leafs-brand) 40%, var(--leafs-border));
	color: var(--leafs-text);
}

.leafs-accent-dock__fab {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--leafs-corner-fab-size, 40px);
	height: var(--leafs-corner-fab-size, 40px);
	min-width: var(--leafs-corner-fab-size, 40px);
	min-height: var(--leafs-corner-fab-size, 40px);
	padding: 0;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	background: linear-gradient(135deg, var(--leafs-brand), var(--leafs-mint));
	color: var(--leafs-on-primary);
	box-shadow:
		0 6px 22px color-mix(in srgb, var(--leafs-brand) 38%, transparent),
		0 1px 0 rgba(255, 255, 255, 0.12) inset;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.leafs-accent-dock__fab--custom-icon {
	overflow: hidden;
	background: var(--leafs-card);
	border: 1px solid color-mix(in srgb, var(--leafs-border) 85%, var(--leafs-brand));
	box-shadow:
		0 6px 22px color-mix(in srgb, var(--leafs-brand) 28%, transparent),
		0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html[data-leafs-theme="dark"] .leafs-accent-dock__fab--custom-icon {
	background: color-mix(in srgb, var(--leafs-card) 92%, var(--leafs-surface));
	border-color: color-mix(in srgb, var(--leafs-border) 75%, var(--leafs-brand));
}

.leafs-accent-dock__fab:hover {
	transform: scale(1.05);
	box-shadow:
		0 8px 26px color-mix(in srgb, var(--leafs-brand) 45%, transparent),
		0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.leafs-accent-dock__fab--custom-icon:hover {
	box-shadow:
		0 8px 26px color-mix(in srgb, var(--leafs-brand) 38%, transparent),
		0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.leafs-accent-dock__fab:focus-visible {
	outline: 2px solid var(--leafs-focus-ring, var(--leafs-brand));
	outline-offset: 3px;
}

.leafs-accent-dock__fab-img {
	display: block;
	width: 24px;
	height: 24px;
	object-fit: contain;
	border-radius: 50%;
	pointer-events: none;
	user-select: none;
}

@media (max-width: 768px) {
	/*
	 * 右下角控件自下而上：底部导航栏 → 返回顶部 → 主题配色 FAB → 分享条，
	 * 避免与 main.css 中同 bottom 值的置顶/分享堆叠错位。
	 */
	:root {
		--leafs-corner-fab-size: 32px;
		--leafs-corner-fab-right: max(14px, env(safe-area-inset-right, 0px));
		--leafs-mdock-clear: calc(56px + env(safe-area-inset-bottom, 0px));
		--leafs-mfab-gap: 10px;
		--leafs-mfab-back: var(--leafs-corner-fab-size);
		--leafs-mfab-accent: var(--leafs-corner-fab-size);
	}

	.leafs-back-top.leafs-back-top--right {
		bottom: calc(var(--leafs-mdock-clear) + var(--leafs-mfab-gap));
		right: var(--leafs-corner-fab-right);
		z-index: 135;
	}

	.leafs-back-top.leafs-back-top--center {
		bottom: calc(var(--leafs-mdock-clear) + var(--leafs-mfab-gap));
		z-index: 135;
	}

	.leafs-accent-dock {
		right: var(--leafs-corner-fab-right);
		bottom: calc(
			var(--leafs-mdock-clear) + var(--leafs-mfab-gap) + var(--leafs-mfab-back) + var(--leafs-mfab-gap)
		);
		gap: 8px;
		z-index: 136;
	}

	.leafs-accent-dock__panel:not([hidden]) {
		max-height: min(280px, 42vh);
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	.leafs-share-rail {
		display: flex;
		flex-direction: column-reverse;
		align-items: flex-end;
		gap: var(--leafs-mfab-gap);
		left: auto;
		right: var(--leafs-corner-fab-right);
		top: auto;
		bottom: calc(
			var(--leafs-mdock-clear) + var(--leafs-mfab-gap) + var(--leafs-mfab-back) + var(--leafs-mfab-gap) +
				var(--leafs-mfab-accent) + var(--leafs-mfab-gap)
		);
		transform: none;
		z-index: 137;
		max-width: calc(100vw - var(--leafs-corner-fab-right) - max(8px, env(safe-area-inset-left, 0px)));
	}

	.leafs-share-rail.is-open .leafs-share-rail__panel {
		max-height: min(320px, calc(100vh - var(--leafs-mdock-clear) - 140px));
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		flex-shrink: 1;
	}

	.leafs-share-rail:not(.is-open) .leafs-share-rail__panel {
		display: none !important;
	}

	.leafs-share-rail.is-open .leafs-share-rail__panel {
		display: flex !important;
	}

	.leafs-accent-dock__fab-img {
		width: 20px;
		height: 20px;
	}

	.leafs-accent-dock__panel {
		padding: 11px 12px;
		border-radius: 12px;
	}

	/* 手机端只展示前 3 个预设，仍为单行三列 */
	.leafs-accent-dock__swatches .leafs-accent-dock__swatch:nth-child(n + 4) {
		display: none;
	}

	.leafs-accent-dock__swatches {
		gap: 10px 12px;
	}

	.leafs-accent-dock__swatch {
		width: 40px;
		height: 40px;
		min-width: 40px;
		min-height: 40px;
	}
}

@media (min-width: 769px) {
	.leafs-share-rail__trigger,
	.leafs-share-rail__close {
		display: none !important;
	}
}

/* -------------------------------------------------------------------------- */
/* Touch feedback (coarse pointers)                                            */
/* -------------------------------------------------------------------------- */

@media (hover: none) and (pointer: coarse) {
	.leafs-card:active {
		transform: translateY(-1px) scale(0.995);
	}

	.leafs-btn--primary:active,
	.leafs-icon-btn:active {
		opacity: 0.92;
	}
}

/* -------------------------------------------------------------------------- */
/* 正文字号（与 data-leafs-text-scale 联动）                                  */
/* -------------------------------------------------------------------------- */

html[data-leafs-text-scale="large"] .leafs-single-post .leafs-entry-content,
html[data-leafs-text-scale="large"] .leafs-single-tool-wrap .leafs-tool-single__content {
	font-size: 1.08em;
}

html[data-leafs-text-scale="larger"] .leafs-single-post .leafs-entry-content,
html[data-leafs-text-scale="larger"] .leafs-single-tool-wrap .leafs-tool-single__content {
	font-size: 1.18em;
}

/* -------------------------------------------------------------------------- */
/* Mobile baseline: text autosize, tap highlight, 300ms delay mitigation     */
/* -------------------------------------------------------------------------- */

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

body.leafs-body {
	-webkit-tap-highlight-color: color-mix(in srgb, var(--leafs-brand) 18%, transparent);
}

@media (hover: none) and (pointer: coarse) {
	body.leafs-body .leafs-btn,
	body.leafs-body .leafs-icon-btn,
	body.leafs-body .leafs-nav-toggle,
	body.leafs-body .leafs-mobile-dock__link,
	body.leafs-body .leafs-mobile-dock__link button {
		touch-action: manipulation;
	}
}

/* -------------------------------------------------------------------------- */
/* 列表性能、空状态操作行、广告位 CLS 预留（设计令牌见 leafs-tokens.css）          */
/* -------------------------------------------------------------------------- */

@media (min-width: 768px) {
	.leafs-stream-block .leafs-card {
		content-visibility: auto;
	}
}

.leafs-empty-state__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	align-items: center;
	margin-top: 8px;
}

.leafs-page-inner__meta.leafs-muted {
	margin: -4px 0 20px;
	font-size: 0.9rem;
}

.leafs-ad-slot__frame {
	min-height: var(--leafs-ad-slot-min-h, 90px);
}

/* 海外访客：底部提示切换英文 */
.leafs-geo-lang-hint {
	position: fixed;
	z-index: 99990;
	left: 50%;
	bottom: max(1rem, env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	width: min(92vw, 36rem);
	padding: 0.85rem 1rem;
	border-radius: 14px;
	border: 1px solid color-mix(in srgb, var(--leafs-border, #d8e2ee) 80%, var(--leafs-brand, #2563eb));
	background: color-mix(in srgb, var(--leafs-card, #fff) 94%, var(--leafs-brand, #2563eb) 6%);
	box-shadow: 0 12px 40px color-mix(in srgb, var(--leafs-text, #0f172a) 18%, transparent);
	color: var(--leafs-text, #0f172a);
	animation: leafs-geo-hint-in 0.35s ease;
}

@keyframes leafs-geo-hint-in {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

.leafs-geo-lang-hint__text {
	flex: 1 1 12rem;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.5;
}

.leafs-geo-lang-hint__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.leafs-geo-lang-hint__dismiss {
	color: var(--leafs-muted, #64748b);
}

@media (prefers-reduced-motion: reduce) {
	.leafs-geo-lang-hint {
		animation: none;
	}
}
