/* ============================================================
   Moe 动效 + 看板娘
   纯本地实现，无外部请求。所有动画尊重 prefers-reduced-motion。
   ============================================================ */

/* ---------- 樱花飘落 ---------- */
#moe-sakura {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 9990;
	opacity: .9;
}

/* ---------- 阅读进度条 ---------- */
#moe-progress {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	background: linear-gradient(90deg, #ffb3c6, #a8c8f0 60%, #9fe3d4);
	box-shadow: 0 0 10px rgba(255, 179, 198, .55);
	z-index: 10000;
	pointer-events: none;
	transition: width .08s linear;
	opacity: 0;
}

#moe-progress.on { opacity: 1; }

/* ---------- 内容进入动画 ---------- */
.moe-reveal {
	opacity: 0;
	transform: translateY(26px);
	transition: opacity .7s cubic-bezier(.22, .61, .36, 1),
	            transform .7s cubic-bezier(.22, .61, .36, 1);
	will-change: opacity, transform;
}

.moe-reveal.moe-in {
	opacity: 1;
	transform: none;
}

/* 文章卡片悬停 */
.kratos-hentry {
	transition: transform .38s cubic-bezier(.22, .61, .36, 1),
	            box-shadow .38s ease;
}

.kratos-hentry:hover {
	transform: translateY(-5px);
	box-shadow: 0 16px 38px rgba(118, 138, 178, .18);
}

/* 顶部导航滚动后变毛玻璃 */
#kratos-header-section.moe-scrolled {
	backdrop-filter: blur(14px) saturate(1.4);
	-webkit-backdrop-filter: blur(14px) saturate(1.4);
	background: rgba(255, 255, 255, .72) !important;
	box-shadow: 0 2px 18px rgba(118, 138, 178, .12);
}

/* 正文里的链接下划线生长 */
.kratos-entry-content a:not(.btn):not(.more-link) {
	background-image: linear-gradient(currentColor, currentColor);
	background-size: 0 1px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size .3s ease;
}

.kratos-entry-content a:not(.btn):not(.more-link):hover {
	background-size: 100% 1px;
}

/* ---------- 宠物容器 ---------- */
#moe-pet {
	position: fixed;
	right: 20px;
	bottom: 18px;
	width: 138px;
	height: 168px;
	z-index: 9995;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	cursor: grab;
	touch-action: none;
	transition: opacity .3s ease;
}

#moe-pet.moe-hidden { opacity: 0; pointer-events: none; }
#moe-pet.moe-dragging { cursor: grabbing; }

#moe-pet svg.moe-body {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
	filter: drop-shadow(0 10px 18px rgba(118, 138, 178, .26));
	transform-origin: 50% 92%;
	animation: moe-bob 3.4s ease-in-out infinite;
}

@keyframes moe-bob {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50%      { transform: translateY(-7px) rotate(.8deg); }
}

#moe-pet.moe-hop svg.moe-body { animation: moe-hop .55s cubic-bezier(.3, 1.6, .5, 1); }

@keyframes moe-hop {
	0%   { transform: translateY(0) scale(1); }
	35%  { transform: translateY(-22px) scale(1.05, .95); }
	70%  { transform: translateY(0) scale(.96, 1.04); }
	100% { transform: translateY(0) scale(1); }
}

/* 尾巴 */
#moe-pet .moe-tail {
	transform-origin: 84px 96px;
	animation: moe-tail 2.6s ease-in-out infinite;
}

@keyframes moe-tail {
	0%, 100% { transform: rotate(-7deg); }
	50%      { transform: rotate(9deg); }
}

/* 呆毛 */
#moe-pet .moe-ahoge {
	transform-origin: 60px 20px;
	animation: moe-ahoge 2.2s ease-in-out infinite;
}

@keyframes moe-ahoge {
	0%, 100% { transform: rotate(-5deg); }
	50%      { transform: rotate(6deg); }
}

/* 眨眼：由 JS 加 .moe-blink 类触发一次 */
#moe-pet .moe-eyes {
	transform-box: fill-box;
	transform-origin: center center;
}

#moe-pet.moe-blink .moe-eyes {
	animation: moe-blink .16s ease-in-out;
}

@keyframes moe-blink {
	0%, 100% { transform: scaleY(1); }
	50%      { transform: scaleY(.08); }
}

/* 害羞：腮红加深、身体左右晃 */
#moe-pet.moe-shy .moe-blush { opacity: .95; }
#moe-pet.moe-shy svg.moe-body { animation: moe-shy .5s ease-in-out 3; }

@keyframes moe-shy {
	0%, 100% { transform: translateX(0) rotate(0deg); }
	25%      { transform: translateX(-4px) rotate(-2deg); }
	75%      { transform: translateX(4px) rotate(2deg); }
}

/* 说话气泡 */
#moe-pet .moe-bubble {
	position: absolute;
	right: 6px;
	bottom: calc(100% - 4px);
	max-width: 210px;
	min-width: 96px;
	background: #fff;
	border: 1px solid #e8eef8;
	border-radius: 15px;
	padding: 11px 13px;
	font-size: 13px;
	line-height: 1.55;
	color: #3b4657;
	text-align: left;
	box-shadow: 0 10px 26px rgba(118, 138, 178, .2);
	opacity: 0;
	transform: translateY(8px) scale(.94);
	transition: opacity .22s ease, transform .22s cubic-bezier(.3, 1.5, .5, 1);
	pointer-events: none;
	white-space: pre-wrap;
	word-break: break-word;
}

#moe-pet .moe-bubble.show {
	opacity: 1;
	transform: none;
}

#moe-pet .moe-bubble::after {
	content: "";
	position: absolute;
	right: 26px;
	bottom: -7px;
	width: 12px;
	height: 12px;
	background: #fff;
	border-right: 1px solid #e8eef8;
	border-bottom: 1px solid #e8eef8;
	transform: rotate(45deg);
}

/* 收起按钮 */
#moe-pet .moe-close {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .96);
	border: 1px solid #e8eef8;
	color: #9aa7bb;
	font-size: 13px;
	line-height: 20px;
	text-align: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity .2s ease;
	box-shadow: 0 2px 8px rgba(118, 138, 178, .18);
}

#moe-pet:hover .moe-close { opacity: 1; }

/* 收起来后的小圆点 */
#moe-pet-restore {
	position: fixed;
	right: 18px;
	bottom: 18px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid #e8eef8;
	color: #ff8fab;
	font-size: 16px;
	line-height: 32px;
	text-align: center;
	cursor: pointer;
	z-index: 9995;
	box-shadow: 0 6px 18px rgba(118, 138, 178, .22);
	display: none;
	transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}

#moe-pet-restore:hover { transform: scale(1.12) rotate(-8deg); }
#moe-pet-restore.show { display: block; }

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
	#moe-pet {
		width: 96px;
		height: 118px;
		right: 10px;
		bottom: 10px;
		opacity: .92;
	}
	#moe-pet .moe-bubble {
		max-width: 160px;
		font-size: 12px;
		padding: 9px 11px;
	}
	#moe-progress { height: 2px; }
}

/* ---------- 关闭动画 ---------- */
@media (prefers-reduced-motion: reduce) {
	.moe-reveal { opacity: 1 !important; transform: none !important; }
	#moe-pet svg.moe-body,
	#moe-pet .moe-tail,
	#moe-pet .moe-ahoge { animation: none !important; }
	.kratos-hentry:hover { transform: none; }
}

/* ---------- 菜单里的「登录 / 注册」做成按钮 ---------- */
/* 用属性选择器直接命中链接，不依赖 PHP 那边加 class */
#kratos-primary-menu > li > a[href*="wp-login.php"],
#kratos-primary-menu > li > a[href*="wp-admin"] {
	display: inline-block;
	padding: 7px 18px !important;
	margin-top: -2px;
	border-radius: 20px;
	background: linear-gradient(135deg, #ffb3c6 0%, #a8c8f0 100%);
	color: #fff !important;
	font-weight: 500;
	text-shadow: none;
	box-shadow: 0 4px 12px rgba(255, 179, 198, .38);
	transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), box-shadow .25s ease;
}

#kratos-primary-menu > li > a[href*="wp-login.php"]:hover,
#kratos-primary-menu > li > a[href*="wp-admin"]:hover {
	transform: translateY(-2px);
	box-shadow: 0 7px 18px rgba(255, 179, 198, .5);
	color: #fff !important;
}

/* 顶部菜单项之间稍微收一点，避免挤 */
#kratos-primary-menu > li > a {
	padding-left: 12px !important;
	padding-right: 12px !important;
}

@media (max-width: 768px) {
	#kratos-primary-menu > li > a[href*="wp-login.php"],
	#kratos-primary-menu > li > a[href*="wp-admin"] {
		display: block;
		text-align: center;
		margin: 8px 0 0;
	}
}
