/* ============================================
   Cang2 Header Styles (Refactored)
   Unified Color: #D4AF37 (Vintage Gold)
   ============================================ */

/* CSS 自定义属性 - Header 高度 */
:root {
    --cang2-header-height: 60px;
}

html {
    /* 使用 scroll-padding-top 防止锚点跳转被遮挡 */
    scroll-padding-top: calc(var(--cang2-header-height) + var(--wp-admin--admin-bar--height, 0px));
}

/* 导航栏基础样式 */
.cang2-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--cang2-header-height);
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    /* Unified Gold */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
}

/* 首页透明头部样式 */
.cang2-header.transparent {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 100%);
    /* Subtle gradient for contrast */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    backdrop-filter: none;
}

.cang2-header.transparent .cang2-logo,
.cang2-header.transparent .cang2-menu-list>li>a,
.cang2-header.transparent .cang2-nav-link,
.cang2-header.transparent .cang2-nav-user {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    /* Stronger shadow for readability */
    font-weight: 600;
}

.cang2-header.transparent .cang2-menu-list>li>a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 滚动后的样式 (保持透明/磨砂感) */
.cang2-header.scrolled {
    background: rgba(0, 0, 0, 0.3);
    /* Dark semi-transparent */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.cang2-header.scrolled .cang2-logo,
.cang2-header.scrolled .cang2-menu-list>li>a,
.cang2-header.scrolled .cang2-nav-link,
.cang2-header.scrolled .cang2-nav-user {
    color: #fff;
    /* Keep text white on dark glass */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.cang2-header.scrolled .cang2-logo {
    color: #D4AF37;
    /* Gold Logo */
}

.cang2-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* LOGO */
.cang2-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #D4AF37;
    /* Unified Gold */
    text-decoration: none;
    transition: all 0.3s;
    font-family: 'Noto Serif SC', serif;
    /* Match Index Font */
}

.cang2-logo:hover {
    color: #B8860B;
    transform: scale(1.05);
}

.cang2-logo-icon {
    width: 32px;
    height: 32px;
}

/* 桌面端菜单 */
.cang2-desktop-menu {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 2rem;
}

.cang2-menu-list {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping */
    justify-content: center;
    /* Center align items */
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cang2-menu-list>li {
    position: relative;
}

.cang2-menu-list>li>a {
    display: inline-block;
    padding: 0.6rem 0.6rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 6px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    font-family: 'Noto Serif SC', serif;
}

.cang2-menu-list>li>a:hover {
    background: rgba(212, 175, 55, 0.1);
    /* Unified Gold Alpha */
    color: #D4AF37;
}

.cang2-menu-list>li.current-menu-item>a,
.cang2-menu-list>li.current_page_item>a {
    background: #D4AF37;
    color: #fff;
    /* Better contrast */
}

/* 二级菜单 */
.cang2-menu-list .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    margin: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 101;
}

.cang2-menu-list>li:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cang2-menu-list .sub-menu li {
    margin: 0;
}

.cang2-menu-list .sub-menu li a {
    display: block;
    padding: 0.6rem 1.25rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.cang2-menu-list .sub-menu li a:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #D4AF37;
    padding-left: 1.5rem;
}

/* 右侧操作区 */
.cang2-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cang2-nav-link {
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.cang2-nav-link:hover {
    color: #D4AF37;
}

.cang2-nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.cang2-nav-user img {
    border-radius: 50%;
}

.cang2-nav-btn {
    background: #D4AF37;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(212, 175, 55, 0.3);
}

.cang2-nav-btn:hover {
    background: #B8860B;
    color: #fff;
    transform: translateY(-1px);
}

/* 汉堡菜单按钮 */
.cang2-hamburger {
    display: none;
    flex-direction: column;
    background: #fff;
}

.cang2-header.scrolled .cang2-hamburger span {
    background: #333;
}

.cang2-hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.cang2-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.cang2-hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* 移动端菜单 */
.cang2-mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.cang2-mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.cang2-mobile-menu-content {
    background: #fff;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 1rem 0;
}

.cang2-mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cang2-mobile-menu-list li {
    border-bottom: 1px solid #f0f0f0;
}

.cang2-mobile-menu-list>li>a {
    display: block;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.cang2-mobile-menu-list>li>a:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #D4AF37;
    padding-left: 2rem;
}

.cang2-mobile-menu-list>li.current-menu-item>a,
.cang2-mobile-menu-list>li.current_page_item>a {
    background: #D4AF37;
    color: #fff;
}

/* 移动端二级菜单 */
.cang2-mobile-menu-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f8f8;
}

.cang2-mobile-menu-list .sub-menu li a {
    display: block;
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.cang2-mobile-menu-list .sub-menu li a:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #D4AF37;
    padding-left: 3rem;
}

/* 移动端操作按钮 */
.cang2-mobile-actions {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 2px solid #f0f0f0;
}

.cang2-mobile-actions a {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.cang2-mobile-actions .login-btn {
    background: #f0f0f0;
    color: #333;
}

.cang2-mobile-actions .publish-btn {
    background: #D4AF37;
    color: #fff;
}

.cang2-mobile-actions .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f8f8;
    border-radius: 8px;
}

/* 响应式 */
@media (max-width: 900px) {
    .cang2-desktop-menu {
        margin: 0 1rem;
    }

    .cang2-menu-list {
        gap: 0.25rem;
    }

    .cang2-menu-list>li>a {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .cang2-hamburger {
        display: flex;
    }

    .cang2-desktop-menu {
        display: none;
    }

    .cang2-mobile-menu {
        display: block;
    }

    .cang2-nav-actions {
        display: none;
    }

    .cang2-nav-container {
        padding: 0.5rem 1rem;
    }

    .cang2-logo {
        font-size: 1.1rem;
    }

    .cang2-logo-icon {
        width: 28px;
        height: 28px;
    }
}

/* 主体内容上边距 - WordPress 标准方式 */
body {
    padding-top: var(--cang2-header-height);
}

/* 首页特殊处理 */
body.home {
    padding-top: 0;
    /* 让Hero背景延伸到顶部 */
}

/* WordPress Admin Bar 兼容处理 */
body.admin-bar {
    padding-top: calc(var(--cang2-header-height) + 32px);
}

/* Admin Bar 在小屏幕时的高度调整 */
@media screen and (max-width: 782px) {
    body.admin-bar {
        padding-top: calc(var(--cang2-header-height) + 46px);
    }
}

/* 给所有标题元素添加 scroll-margin，防止被 header 遮挡 */
h1, h2, h3, h4, h5, h6 {
    scroll-margin-top: calc(var(--cang2-header-height) + 20px);
}