/*
 Theme Name:   Twenty Twelve Child
 Theme URI:    https://imzl.top/
 Description:  Twenty Twelve 子主题 — 优化移动端导航体验
 Author:       imzl.top
 Author URI:   https://imzl.top/
 Template:     twentytwelve
 Version:      1.0.1
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         blog, two-columns, right-sidebar, responsive-layout, custom-menu
 Text Domain:  twentytwelve-child
*/

/*
 * 父主题样式通过 functions.php 用 wp_enqueue_style 加载，
 * 不在此处 @import，避免性能损失与加载顺序问题。
 */

/* 页脚：桌面端隐藏移动换行 */
.mobile-br {
	display: none;
}

/* 桌面端 body 背景透明（覆盖父主题 #e6e6e6） */
@media screen and (min-width: 960px) {
	body {
		background-color: transparent;
	}
}

/* 页面主容器背景透明（覆盖父主题 #fff） */
.site {
	background-color: transparent;
}

/* ==========================================================================
   移动端导航优化（< 600px）
   桌面端（≥ 600px）完全不触及父主题原有样式。
   ========================================================================== */
@media screen and (max-width: 599px) {

	/* ==================================================================
	   1. Header 布局：标题居左 + 汉堡按钮居右（同一行）
	   ================================================================== */
	.site-header {
		position: relative;
		padding-top: 16px;
		padding-top: 1.142857143rem;
		padding-bottom: 16px;
		padding-bottom: 1.142857143rem;
	}

	.site-header h1,
	.site-header h2 {
		text-align: left;
	}

	/* ==================================================================
	   2. 菜单切换按钮：汉堡图标（与主标题字高匹配）
	   ================================================================== */
	.menu-toggle {
		position: relative;
		display: inline-block;
		width: 30px;
		height: 30px;
		padding: 5px;
		background: #333;
		border: none;
		border-radius: 3px;
		box-shadow: none;
		cursor: pointer;
		text-indent: -9999px;
		overflow: hidden;
	vertical-align: middle;
		transition: background-color 0.25s ease;
	}

	.menu-toggle:hover,
	.menu-toggle:focus {
		background: #555;
	}

	.menu-toggle:active,
	.menu-toggle.toggled-on {
		background: #111;
		box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
	}

	/* 汉堡图标三条线 */
	.menu-toggle::before,
	.menu-toggle::after {
		content: '';
		position: absolute;
		left: 6px;
		right: 6px;
		height: 2px;
		background: #fff;
		border-radius: 1px;
		transition: transform 0.3s ease, top 0.3s ease;
	}

	.menu-toggle::before {
		top: 8px;
		box-shadow: 0 6px 0 #fff;
	}

	.menu-toggle::after {
		top: 20px;
	}

	/* 激活态：汉堡变 X */
	.menu-toggle.toggled-on::before {
		top: 14px;
		transform: rotate(45deg);
		box-shadow: none;
	}

	.menu-toggle.toggled-on::after {
		top: 14px;
		transform: rotate(-45deg);
	}

	/* ==================================================================
	   3. 导航菜单容器
	   ================================================================== */
	.main-navigation {
		position: absolute;
		top: 16px;
		right: 0;
		margin-top: 0;
		z-index: 9999;
	}

	/* ==================================================================
	   4. 菜单列表：浮动弹出，不推动页面
	   ================================================================== */
	.main-navigation ul.nav-menu,
	.main-navigation div.nav-menu > ul {
		display: block;
		position: absolute;
		top: 100%;
		right: 0;
		width: max-content;
		min-width: 100px;
		margin: 0;
		padding: 4px 0;
		background: #fff;
		border: none;
		border-radius: 6px;
		box-shadow: 0 2px 16px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
		opacity: 0;
		transform: translateY(-4px);
		pointer-events: none;
		transition: opacity 0.2s ease, transform 0.2s ease;
	}

	.main-navigation ul.nav-menu.toggled-on {
		opacity: 1;
		transform: translateY(0);
		pointer-events: auto;
		margin-top: 4px;
	}

	/* ==================================================================
	   5. 菜单项
	   ================================================================== */
	.main-navigation li {
		margin: 0;
		padding: 0;
		font-size: 15px;
		font-size: 1.071428571rem;
		line-height: 1.4;
		border-bottom: none;
		position: relative;
	}

	.main-navigation li:last-child {
		border-bottom: none;
	}

	.main-navigation li a {
		display: block;
		padding: 8px 16px;
		color: #333;
		text-decoration: none;
		transition: background-color 0.15s ease, color 0.15s ease;
	}

	.main-navigation li a:hover,
	.main-navigation li a:focus {
		background-color: #f0f0f0;
		color: #111;
	}

	/* 当前菜单项高亮 */
	.main-navigation .current-menu-item > a,
	.main-navigation .current-menu-ancestor > a,
	.main-navigation .current_page_item > a,
	.main-navigation .current_page_ancestor > a {
		color: #111;
		font-weight: 600;
		background-color: #f0f0f0;
		border-left: none;
	}

	/* ==================================================================
	   6. 子菜单
	   ================================================================== */
	.main-navigation li ul {
		margin: 0;
		padding: 0;
		max-height: 0;
		overflow: hidden;
		opacity: 0;
		transition: max-height 0.35s ease, opacity 0.3s ease;
		background: #fafafa;
		border-top: 1px solid #eee;
	}

	.main-navigation .focus > ul {
		max-height: 1000px;
		opacity: 1;
	}

	.main-navigation li ul li {
		border-bottom: 1px solid #eee;
	}

	.main-navigation li ul li a {
		padding-left: 28px;
		padding-left: 2rem;
		font-size: 13px;
		font-size: 0.928571429rem;
		color: #666;
	}

	.main-navigation li ul li a:hover,
	.main-navigation li ul li a:focus {
		padding-left: 34px;
		padding-left: 2.428571429rem;
	}

	/* 子菜单展开箭头 */
	.main-navigation .menu-item-has-children > a::after,
	.main-navigation .page_item_has_children > a::after {
		content: '\25BC';
		float: right;
		font-size: 10px;
		margin-left: 8px;
		transition: transform 0.3s ease;
		opacity: 0.5;
	}

	.main-navigation .menu-item-has-children.focus > a::after,
	.main-navigation .page_item_has_children.focus > a::after {
		transform: rotate(180deg);
	}

	/* 页脚：移动端换行 + 居中 */
	.mobile-br {
		display: block;
	}

	footer[role="contentinfo"] .site-info {
		text-align: center;
	}

	.pc-only {
		display: none;
	}

}
