/*
Theme Name: PennyZ
Theme URI: https://example.com/pennyz-theme/
Author: Cascade AI
Author URI: https://example.com/
Description: A custom WordPress theme featuring a minimalist design with focus on photography and portfolio presentation.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pennyz
Tags: minimalist, photography, portfolio, custom-colors, custom-menu, editor-style, featured-images, flexible-header, translation-ready
*/

/* Base Styles */
:root {
    --background-color: #f7f7f7;
    --text-color: #333333;
    --light-text-color: #666666;
    --accent-color: #000000;
    --border-color: #dddddd;
    --menu-active-color: #000000;
    --menu-inactive-color: #666666;
}

html, body {
    overflow-x: hidden; /* 防止水平滚动 */
    width: 100%;
    position: relative;
}

body {
    font-family: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout Structure */
.site-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    max-width: 100%;
    overflow-x: hidden;
}

/* 隐藏所有页面标题 */
.entry-title,
.page-title {
    display: none !important;
}

/* 移动端相关样式暂时移除 */

/* 菜单按钮样式 */
.menu-toggle {
    display: none; /* 隐藏移动菜单按钮 */
}

/* 菜单图标样式暂时移除 */

.site-navigation {
    width: 220px;
    padding: 2rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    z-index: 100;
    background-color: var(--background-color);
}

.site-content {
    width: calc(100% - 220px);
    margin-left: 220px;
    padding: 0;
    box-sizing: border-box;
    overflow: visible; /* 允许内容溢出，以支持全宽图片 */
    position: relative;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
    margin-top: 0;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

/* Navigation Styles */
.site-title {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 3px;
    margin: 0 0 3rem 0;
    white-space: nowrap; /* 防止标题折行 */
}

.site-title a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: #000;
}

.main-navigation ul {
    list-style: none;
    padding: 0 0 0 0.5rem;
    margin: 0 0 2rem 0;
}

.main-navigation li {
    margin-bottom: 0.5rem;
    position: relative;
}

/* 移除菜单顶部的图标 */
.menu-toggle,
.dashicons-admin-appearance,
.wp-menu-image,
.menu-icon {
    display: none !important;
}

.main-navigation a {
    text-decoration: none;
    color: var(--menu-inactive-color);
    font-size: 0.9rem;
}

.main-navigation .current-menu-item > a,
.main-navigation .current-menu-ancestor > a {
    color: var(--menu-active-color);
}

.main-navigation a:hover {
    color: var(--menu-active-color);
}

/* Submenu Styles */
.main-navigation .sub-menu {
    list-style: none;
    padding-left: 0.5rem;
    margin: 0.5rem 0 1.5rem 0;
    display: block !important; /* 确保子菜单显示 */
}

.main-navigation .sub-menu li {
    margin-bottom: 0.3rem;
    position: relative;
}

.main-navigation .sub-menu a {
    font-size: 0.85rem;
    color: #666; /* 浅色子菜单项 */
    font-weight: normal;
}

.main-navigation .sub-menu a:hover,
.main-navigation .sub-menu .current-menu-item > a {
    color: var(--text-color); /* 鼠标悬停或激活时变成深色 */
}

/* 自定义菜单样式 */
.main-navigation ul li {
    position: relative;
    display: block;
    width: 100%;
}

/* 主菜单项使用粗体 */
.main-navigation > ul > li > a {
    font-weight: 500;
}

/* 菜单样式 */
/* Elementor将用于创建二级菜单 */

/* 作品系列缩略图展示样式 */
.series-thumbnails-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 2rem 2rem 2rem 0;
    max-width: calc(100% - 220px); /* 减去主菜单的宽度 */
    margin-left: 220px; /* 主菜单的宽度 */
    margin-top: 2rem;
}

.series-thumbnail {
    position: relative;
    margin-bottom: 0.5rem;
    transition: opacity 0.3s ease;
    max-width: 85%;
}

.series-thumbnail img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.series-title {
    position: relative;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.series-thumbnail:hover {
    opacity: 0.8;
}

/* 隐藏Works归档页面的作品网格，只展示系列缩略图 */
.works-archive .works-grid {
    display: none;
}

.main-navigation ul.sub-menu,
.main-navigation ul.children {
    padding-left: 0.5rem;
    display: block !important;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* 移除菜单箭头 */
.main-navigation .page_item_has_children > a::after,
.main-navigation .menu-item-has-children > a::after,
.main-navigation .page_item_has_children > a::after {
    content: '';
    display: none;
}

/* 确保子菜单显示为嵌套结构 */
.main-navigation .children {
    list-style: none;
    padding-left: 1rem;
}

.main-navigation .page_item_has_children,
.main-navigation .menu-item-has-children {
    position: relative;
}

/* 添加美观的层级标记 */
.main-navigation .children li::before,
.main-navigation .sub-menu li::before {
    content: '-';
    position: absolute;
    left: -0.8rem;
    color: var(--light-text-color);
}



/* 文章内容样式 */
.entry-content {
    margin: 1.5rem 0;
}

.page-content {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    position: relative;
}

/* Footer */
.site-footer {
    font-size: 0.8rem;
    color: var(--light-text-color);
    margin-top: auto; /* 将页脚推到导航栏底部 */
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
}

/* Works Grid */
.works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    margin: 0;
    width: calc(100% - 2rem);
}

/* 首页全屏图片样式 */
.home .entry-content > figure.wp-block-image:first-child,
.home .entry-content > .wp-block-image:first-child,
.home .entry-content > figure.alignfull:first-child,
.home .entry-content > figure.alignwide:first-child,
.home .home-content > figure.wp-block-image:first-child,
.home .home-content > .wp-block-image:first-child,
.home .home-content > figure.alignfull:first-child,
.home .home-content > figure.alignwide:first-child {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: calc(100% - 200px - 2rem) !important;
    height: calc(100vh - 2rem) !important;
    position: fixed !important;
    left: 200px !important;
    right: 2rem !important;
    top: 1rem !important;
    bottom: 1rem !important;
    overflow: hidden !important;
}

.home .entry-content > figure.wp-block-image:first-child img,
.home .entry-content > .wp-block-image:first-child img,
.home .entry-content > figure.alignfull:first-child img,
.home .entry-content > figure.alignwide:first-child img,
.home .home-content > figure.wp-block-image:first-child img,
.home .home-content > .wp-block-image:first-child img,
.home .home-content > figure.alignfull:first-child img,
.home .home-content > figure.alignwide:first-child img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    max-height: calc(100vh - 2rem) !important;
    max-width: 100% !important;
}

.work-item {
    margin-bottom: 2rem;
}

.work-item img {
    width: 100%;
    height: auto;
    display: block;
}

.work-item-title {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Single Work */
.work-single .work-image-container {
    width: calc(100% - 200px - 2rem);
    margin-left: 200px;
    height: calc(100vh - 2rem);
    position: fixed;
    top: 1rem;
    left: 0;
    right: 2rem;
    bottom: 1rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.work-main-image {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    width: 100%;
    height: 100%;
}

.work-info {
    position: absolute;
    bottom: 2rem;
    left: 220px;
    z-index: 2;
    max-width: 400px;
}

.work-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.work-meta {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--light-text-color);
}

.work-description {
    font-size: 0.9rem;
}

.work-navigation {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 3;
    display: flex;
    gap: 1rem;
}

.work-navigation a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.5rem;
}

/* Gallery Layout */
.work-gallery-container {
    margin-top: 2rem;
}

.gallery-item {
    margin-bottom: 2rem;
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
}

/* 页面内容样式 */
.entry-content {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    position: relative;
}

.page-content {
    width: calc(100% - 200px - 2rem);
    max-width: 100%;
    overflow: visible;
    position: relative;
    margin: 0 0 2rem 200px;
    padding: 0;
}

/* 传记页面样式 */
.page-template-default .entry-content {
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
    width: calc(100% - 200px - 2rem);
    margin-left: 200px;
}

/* 添加页面内图片样式，使其垂直排列 */
.page-template-default .entry-content figure.wp-block-image,
.page-template-default .entry-content .wp-block-image {
    margin: 0 0 2rem 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.page-template-default .entry-content figure.wp-block-image img,
.page-template-default .entry-content .wp-block-image img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}

/* Elementor Compatibility */
.elementor-section {
    padding-left: 0;
    padding-right: 0;
}

/* 自定义Elementor固定侧边栏支持 */
.pennyz-fixed-sidebar {
    position: fixed !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    z-index: 10 !important;
    background-color: var(--background-color) !important;
}

.pennyz-content-area {
    min-height: 100vh !important;
}

/* 两列布局支持 */
.pennyz-two-column-layout {
    display: flex !important;
    width: 100% !important;
}

.pennyz-sidebar-column {
    width: 200px !important;
    flex-shrink: 0 !important;
    padding-left: 0.5rem !important;
}

.pennyz-main-column {
    width: calc(100% - 200px) !important;
    margin-left: 200px !important;
}

/* 自定义菜单样式 */
.pennyz-custom-menu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.pennyz-custom-menu li {
    margin-bottom: 10px !important;
}

.pennyz-custom-menu a {
    text-decoration: none !important;
    color: var(--menu-inactive-color) !important;
    transition: color 0.3s ease !important;
}

.pennyz-custom-menu a:hover,
.pennyz-custom-menu .current-menu-item > a {
    color: var(--menu-active-color) !important;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .site-navigation {
        width: 200px;
    }
    
    .site-content {
        width: calc(100% - 200px);
        margin-left: 200px;
    }
    
    .work-single .work-image-container {
        width: calc(100% - 200px);
        margin-left: 200px;
    }
    
    .work-info {
        left: 220px;
    }
    
    /* 首页全屏图片样式 - 平板电脑 */
    .home .entry-content > figure.wp-block-image:first-child,
    .home .entry-content > .wp-block-image:first-child,
    .home .entry-content > figure.alignfull:first-child,
    .home .entry-content > figure.alignwide:first-child,
    .home .home-content > figure.wp-block-image:first-child,
    .home .home-content > .wp-block-image:first-child,
    .home .home-content > figure.alignfull:first-child,
    .home .home-content > figure.alignwide:first-child {
        width: calc(100% - 200px - 2rem) !important;
        left: 200px !important;
        right: 2rem !important;
        height: calc(100vh - 2rem) !important;
        top: 1rem !important;
        bottom: 1rem !important;
    }
}

/* 手机竖屏模式 (portrait) */
@media (max-width: 768px) and (orientation: portrait) {
    .site-container {
        flex-direction: column;
    }
    
    .site-navigation {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        overflow: visible;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* 默认隐藏菜单 */
    .main-navigation {
        display: none;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--background-color);
        padding: 1rem;
        z-index: 1000;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    /* 当菜单打开时显示 */
    .main-navigation.toggled {
        display: block;
    }
    
    .site-content {
        width: 100%;
        margin-left: 0;
        padding: 0;
    }
    

    
    /* 移动端底部版权信息 */
    .mobile-footer {
        position: fixed !important;
        bottom: 10px !important;
        left: 15px !important;
        right: auto !important;
        width: auto !important;
        max-width: 200px !important;
        background-color: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        text-align: left !important;
        z-index: 999;
        font-size: 11px;
        color: rgba(0, 0, 0, 0.5);
    }
    
    .mobile-copyright {
        text-align: left !important;
        width: 100% !important;
        display: block !important;
    }
    
    /* 隐藏原来的版权信息 */
    .site-navigation .site-footer {
        display: none;
    }
    
    /* 手机竖屏模式下的首页图片样式 */
    .home .entry-content > figure.wp-block-image:first-child,
    .home .entry-content > .wp-block-image:first-child,
    .home .entry-content > figure.alignfull:first-child,
    .home .entry-content > figure.alignwide:first-child,
    .home .home-content > figure.wp-block-image:first-child,
    .home .home-content > .wp-block-image:first-child,
    .home .home-content > figure.alignfull:first-child,
    .home .home-content > figure.alignwide:first-child {
        width: calc(100% - 2rem) !important;
        position: fixed !important;
        left: 1rem !important;
        right: 1rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        height: calc(100vh - 8rem) !important;
        top: 6rem !important;
        bottom: 2rem !important;
    }
}

/* 手机横屏模式 (landscape) - 保持桌面布局 */
@media (max-width: 768px) and (orientation: landscape) {
    
    /* 手机横屏模式下的首页图片样式 - 保持桌面布局 */
    .home .entry-content > figure.wp-block-image:first-child,
    .home .entry-content > .wp-block-image:first-child,
    .home .entry-content > figure.alignfull:first-child,
    .home .entry-content > figure.alignwide:first-child,
    .home .home-content > figure.wp-block-image:first-child,
    .home .home-content > .wp-block-image:first-child,
    .home .home-content > figure.alignfull:first-child,
    .home .home-content > figure.alignwide:first-child {
        width: calc(100% - 220px - 2rem) !important;
        position: fixed !important;
        left: 220px !important;
        right: 2rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        height: calc(100vh - 2rem) !important;
        top: 1rem !important;
        bottom: 1rem !important;
    }
    
    .home .entry-content > figure.wp-block-image:first-child img,
    .home .entry-content > .wp-block-image:first-child img,
    .home .entry-content > figure.alignfull:first-child img,
    .home .entry-content > figure.alignwide:first-child img,
    .home .home-content > figure.wp-block-image:first-child img,
    .home .home-content > .wp-block-image:first-child img,
    .home .home-content > figure.alignfull:first-child img,
    .home .home-content > figure.alignwide:first-child img {
        height: 100vh !important;
        object-fit: contain !important;
    }
    
    /* 手机横屏模式下的作品页面 - 保持桌面布局 */
    .work-single .work-image-container {
        width: calc(100% - 220px);
        margin-left: 220px;
        position: fixed;
        height: calc(100vh - 2rem);
        padding: 0;
    }
    
    .work-main-image {
        max-height: 100vh;
        object-fit: contain;
    }
    
    .work-info {
        position: absolute;
        left: 220px;
        bottom: 2rem;
        margin-top: 0;
    }
    
    .work-navigation {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        margin-top: 0;
    }
    
    /* 手机横屏模式下隐藏移动菜单按钮 */
    .menu-toggle {
        display: none;
    }
    
    .main-navigation ul {
        display: block;
    }
}

/* 手机竖屏模式下的菜单按钮 */
@media (max-width: 768px) and (orientation: portrait) {
    .menu-toggle {
        display: block !important;
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 200;
        background: none;
        border: 1px solid #333;
        border-radius: 3px;
        padding: 5px 8px;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-color);
        background-color: rgba(255, 255, 255, 0.8);
    }
    
    .menu-icon {
        display: inline-block;
        line-height: 1;
    }
    
    .main-navigation ul {
        display: none;
    }
    
    .main-navigation.toggled ul {
        display: block;
    }
}

/* Helper Classes */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}
