/*
Theme Name: Farallon Child
Theme URI: https://qdu.im
Description: Farallon子主题
Author: exrock
Author URI: https://qdu.im
Template: farallon
Version: 1.0.0
License:
License URI: 
Text Domain: farallon-child
*/

/* 首页样式 */
/* 取消默认的背景颜色，设置主内容区域宽度 */
body {
    --farallon-background-gray: transparent;
    --farallon-main-width: 1200px;
}

/* 确保菜单栏始终使用浅色模式样式 */
.fHeader--content {
    background-color: rgba(255, 255, 255, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 0 #fff, 0 0 0 1px hsla(240, 5%, 96%, 0.1), 0 10px 15px -3px rgba(39, 39, 42, 0.05), 0 4px 6px -4px rgba(39, 39, 42, 0.05) !important;
    color: var(--farallon-text-color) !important;
}

/* 确保深色模式下的样式不会覆盖默认样式 */
.dark .fHeader--content {
    background-color: rgba(255, 255, 255, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 0 #fff, 0 0 0 1px hsla(240, 5%, 96%, 0.1), 0 10px 15px -3px rgba(39, 39, 42, 0.05), 0 4px 6px -4px rgba(39, 39, 42, 0.05) !important;
    color: var(--farallon-text-color) !important;
}

@media (prefers-color-scheme: dark) {
    .fHeader--content {
        background-color: rgba(255, 255, 255, 0.5) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
        box-shadow: 0 0 #fff, 0 0 0 1px hsla(240, 5%, 96%, 0.1), 0 10px 15px -3px rgba(39, 39, 42, 0.05), 0 4px 6px -4px rgba(39, 39, 42, 0.05) !important;
        color: var(--farallon-text-color) !important;
    }
}

/* 取消网站logo的圆形显示并调整尺寸适应菜单栏 */
.avatar {
    border-radius: 0 !important;
    height: auto !important;
    width: auto !important;
    max-height: 48px !important;
    max-width: 100% !important;
    border: none !important;
    box-shadow: none !important;
}

/* 移动端布局调整：将logo、菜单和搜索按钮置于同一层 */
@media screen and (max-width: 768px) {
    .fHeader {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: 15px;
        padding-bottom: 15px;
        min-height: auto;
    }
    
    .fHeader--content {
        position: relative;
        left: 0;
        transform: none;
        top: 0;
        flex: 1;
        margin: 0 10px;
        border-radius: 999rem;
        box-shadow: 0 0 #fff, 0 0 0 1px hsla(240, 5%, 96%, 0.1), 0 10px 15px -3px rgba(39, 39, 42, 0.05), 0 4px 6px -4px rgba(39, 39, 42, 0.05) !important;
    }
    
    .fHeader--content .inner {
        flex-direction: row;
        min-width: auto;
        height: 39px;
    }
    
    .fHeader--menu {
        display: flex !important;
        justify-content: center !important;
        align-items: center;
        flex: 1;
        padding: 0 10px;
        height: 39px;
    }
    
    /* 移动端搜索区域初始隐藏，点击放大镜后显示 */
    .search--area {
        display: none !important;
        position: absolute;
        top: calc(100% + -6px);
        left: 0;
        right: 0;
        background-color: rgba(255, 255, 255, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.5);
        border-radius: 999rem;
        box-shadow: 0 0 #fff, 0 0 0 1px hsla(240, 5%, 96%, 0.1), 0 10px 15px -3px rgba(39, 39, 42, 0.05), 0 4px 6px -4px rgba(39, 39, 42, 0.05);
        padding: 5px;
        z-index: 1000;
    }
    
    /* 点击放大镜后显示搜索区域 */
    .fHeader--content .inner.search--active .search--area {
        display: flex !important;
    }
    
    /* 确保搜索输入框能够接收焦点并匹配菜单栏外框 */
    .search--area .search-field {
        width: 100%;
        padding: 8px 15px;
        border: none;
        border-radius: 999rem;
        background-color: rgba(255, 255, 255, 0.8);
        font-size: 14px;
        outline: none;
        color: var(--farallon-text-color);
    }
    
    /* 确保搜索提交按钮不可见 */
    .search--area .search-submit {
        display: none;
    }
    
    /* 确保深色模式下的搜索区域样式匹配 */
    .dark .search--area {
        background-color: rgba(39, 39, 42, 0.9);
        border-color: rgba(0, 0, 0, 0.5);
        box-shadow: 0 0 #0000, 0 0 0 calc(1px + 0px) hsla(0, 0%, 100%, 0.1), 0 0 #0000;
    }
    
    .dark .search--area .search-field {
        background-color: rgba(255, 255, 255, 0.1);
        color: rgba(228, 228, 231, 1);
    }
    
    .site--url {
        font-size: 16px;
    }
    
    .site--url .avatar {
        margin-right: 8px;
        --farallon-logo-size: 36px !important;
        max-height: 36px !important;
    }
    
    .fHeader--icon {
        margin-left: 0;
    }
}


/* 详情页样式 */
/* 取消默认的背景颜色，设置主内容区域宽度 */
.fArticle--headline {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
}

/* 文章内容最大宽度设置 */
.fArticle {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--farallon-article-width,1200px);
}

/* 编辑按钮样式 */
.fArticle--meta .edit-post-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.fArticle--meta .edit-post-link:hover {
    color: var(--farallon-primary-color, #007bff);
    text-decoration: underline;
}

/* 移动端标题字体大小 */
@media screen and (max-width: 768px) {
    .fArticle--headline {
        font-size: 20px !important;
    }
}

/* 合并meta栏和标签栏 */
.fArticle--meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
    text-align: center;
}

.fArticle--meta .tags-label {
    white-space: nowrap;
}

.fArticle--meta a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.fArticle--meta a:hover {
    text-decoration: underline;
    color: var(--farallon-primary-color, #007bff);
}

/* 标签包装器样式 */
.tags-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .fArticle--meta {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .tags-wrapper {
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }
    
    .tags-wrapper .sep {
        display: none;
    }
}

/* 底部相关文章标题样式 */
.fRelated--heroTitle {
    margin-top: 40px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}

/* 双栏布局样式 */
.fArticle--two-column {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.two-column-left {
    flex: 7;
}

.two-column-right {
    flex: 3;
}

/* 侧边栏样式 */
.single-sidebar {
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.single-sidebar .widget {
    margin-bottom: 25px;
}

.single-sidebar .widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.single-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.single-sidebar ul li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #f0f0f0;
}

.single-sidebar ul li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.single-sidebar ul li a {
    color: var(--farallon-text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.single-sidebar ul li a:hover {
    color: var(--farallon-primary-color, #007bff);
    text-decoration: none;
}

/* 响应式设计 */
@media screen and (max-width: 968px) {
    .fArticle--two-column {
        flex-direction: column;
    }
    
    .two-column-left,
    .two-column-right {
        flex: 1;
    }
}

/* 分类卡片模板控制 */
/* 列数控制 */
body.fCard--columns-1 .fCard--list {
    grid-template-columns: 1fr !important;
}

body.fCard--columns-3 .fCard--list {
    grid-template-columns: repeat(3, 1fr) !important;
}

body.fCard--columns-4 .fCard--list {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* 隐藏文章简述 */
body.fCard--hide-excerpt .fCard--snippet {
    display: none !important;
}

body.fCard--hide-excerpt .fCard--title {
    margin-bottom: 10px !important;
}

/* 卡片标题固定为两行 */
.fCard--title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    height: auto !important;
    min-height: calc(2em * 1.4) !important; /* 行高 * 行数 */
}

/* 确保meta信息始终对齐 */
.fCard--title + .fCard--meta {
    margin-top: 10px !important;
}

/* 响应式列数调整 */
@media (max-width: 1024px) {
    body.fCard--columns-4 .fCard--list {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    body.fCard--columns-3 .fCard--list,
    body.fCard--columns-4 .fCard--list {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 414px) {
    body.fCard--columns-2 .fCard--list,
    body.fCard--columns-3 .fCard--list,
    body.fCard--columns-4 .fCard--list {
        grid-template-columns: 1fr !important;
    }
}