/*
Theme Name: pjkui UIKit Theme
Theme URI: https://blog.pjkui.com
Author: pjkui
Author URI: https://pjkui.com
Description: A clean, modern WordPress blog theme built entirely with UIkit 3. Features responsive layout, Markdown support, UIkit-wrapped widgets and block patterns. Designed to be reusable by others. Based on the pjkui.com design system.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: pjkui-uikit-theme
Tags: blog, uikit, markdown, two-columns, custom-colors, custom-logo, featured-images, sticky-post, threaded-comments, translation-ready
*/

/* =====================================================
   CSS 自定义属性（设计令牌）
   ===================================================== */
:root {
    --uk-primary:        #1e87f0;
    --uk-primary-dark:   #0f6fd4;
    --uk-secondary:      #222;
    --uk-text-muted:     #999;
    --uk-border-color:   #e5e5e5;
    --uk-bg-default:     #fff;
    --uk-bg-muted:       #f8f8f8;
    --uk-radius:         4px;
    --uk-font-size:      16px;
    --uk-line-height:    1.8;
    --content-max-width: 1200px;
    --sidebar-width:     280px;
}

/* =====================================================
   全局基础
   ===================================================== */
html { scroll-behavior: smooth; }

body {
    font-size: var(--uk-font-size);
    line-height: var(--uk-line-height);
    color: #333;
    background: rgba(255, 255, 255, 0);
}

a { color: var(--uk-primary); transition: color .15s; }
a:hover { color: var(--uk-primary-dark); text-decoration: none; }

img { max-width: 100%; height: auto; }

/* =====================================================
   布局容器
   ===================================================== */
.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
}

.content-area {
    background: transparent;
    padding: 0;
}

/* =====================================================
   导航栏
   ===================================================== */
#site-header {
    position: sticky;
    top: 0;
    z-index: 980;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    background: #222 !important;
}

.site-nav-logo {
    height: 32px;
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.uk-navbar-subtitle {
    font-size: 10px;
    opacity: .6;
    display: block;
    line-height: 1;
    margin-top: 2px;
    letter-spacing: .5px;
}

/* =====================================================
   首页幻灯片（UIKit Slideshow 增强）
   ===================================================== */
.uk-slideshow-items {
    min-height: 512px !important;
    max-height: 512px !important;
}

.uk-slideshow-items > li {
    background-color: #222;
}

/* 幻灯片背景图优化 */
.uk-slideshow-items img[uk-cover] {
    object-fit: cover;
    object-position: center;
}

/* 幻灯片overlay文本样式增强 */
.uk-overlay {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.uk-overlay-primary {
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0.8) 100%);
    padding: 24px 20px !important;
}

.uk-overlay-primary h3 {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.uk-overlay-primary p {
    font-size: 0.9rem;
    color: #ddd;
    margin: 8px 0 0 0;
}

/* 诗句overlay */
.uk-overlay:not(.uk-overlay-primary) {
    background: rgba(0,0,0,0.35);
    padding: 20px !important;
    border-radius: 4px;
}

.uk-overlay p {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.uk-overlay p:last-child {
    margin-bottom: 0;
}

/* 头像圆形优化 */
.uk-border-circle {
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 幻灯片导航点样式 */
.uk-dotnav > li > a {
    background-color: rgba(255,255,255,0.4);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.uk-dotnav > li > a:hover,
.uk-dotnav > li.uk-active > a {
    background-color: rgba(255,255,255,0.9);
    transform: scale(1.1);
}

/* 幻灯片左右箭头 */
a[uk-slidenav-previous],
a[uk-slidenav-next] {
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

a[uk-slidenav-previous]:hover,
a[uk-slidenav-next]:hover {
    background: rgba(0,0,0,0.6);
}

/* 响应式：移动端隐藏头像 */
@media (max-width: 640px) {
    .uk-slideshow-items {
        min-height: 320px !important;
        max-height: 320px !important;
    }
    
    .uk-overlay-primary h3 {
        font-size: 1rem;
    }
    
    .uk-border-circle {
        width: 60px !important;
    }
}

/* =====================================================
   文章列表项（Article Item - 简洁 uk-article 风格）
   ===================================================== */
.article-card {
    display: none;
}

.uk-article {
    padding: 20px 0;
}

/* =====================================================
   文章详情页
   ===================================================== */
.article-single {
    line-height: var(--uk-line-height);
}

.article-single .article-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--uk-border-color);
}

.article-single .article-title {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 12px;
}

.article-single .article-meta {
    font-size: .875rem;
    color: var(--uk-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.article-single .article-meta a { color: var(--uk-text-muted); }

/* ——— 正文内容区 ——— */
.article-body {
    font-size: 1rem;
    line-height: var(--uk-line-height);
}

.article-body h1, .article-body h2,
.article-body h3, .article-body h4,
.article-body h5, .article-body h6 {
    margin-top: 1.6em;
    margin-bottom: .5em;
    font-weight: 600;
    line-height: 1.3;
}

.article-body h2 {
    font-size: 1.5rem;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--uk-border-color);
}

.article-body h3 { font-size: 1.25rem; }

.article-body p { margin: 0 0 1em; }

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--uk-radius);
    display: block;
    margin: 1em auto;
}

.article-body pre {
    background: #f8f8f8;
    color: #333;
    border: 1px solid #ddd;
    border-radius: var(--uk-radius);
    padding: 18px 20px;
    overflow-x: auto;
    margin: 1.2em 0;
    font-size: .88rem;
    line-height: 1.6;
}

.article-body code {
    background: #f0f0f0;
    color: #333;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: .875em;
}

.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.article-body blockquote {
    border-left: 4px solid var(--uk-primary);
    margin: 1.2em 0;
    padding: 12px 20px;
    background: #f0f7ff;
    color: #444;
    border-radius: 0 var(--uk-radius) var(--uk-radius) 0;
}

.article-body blockquote p { margin: 0; }

.article-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.2em 0;
    font-size: .9rem;
}

.article-body th, .article-body td {
    border: 1px solid var(--uk-border-color);
    padding: 8px 14px;
}

.article-body th {
    background: var(--uk-bg-muted);
    font-weight: 600;
    text-align: left;
}

.article-body tr:hover td { background: #fafbfc; }

.article-body a {
    color: var(--uk-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body ul, .article-body ol {
    padding-left: 1.6em;
    margin-bottom: 1em;
}

.article-body li { margin-bottom: .3em; }

.article-body hr {
    border: none;
    border-top: 1px solid var(--uk-border-color);
    margin: 2em 0;
}

/* ——— 标签 ——— */
.article-tags {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--uk-border-color);
}

.article-tags .tag-label {
    display: inline-block;
    padding: 2px 8px;
    background: var(--uk-primary);
    color: #fff;
    border-radius: var(--uk-radius);
    font-size: .8rem;
    margin: 2px 4px 2px 0;
    text-decoration: none;
    transition: background .15s;
}

.article-tags .tag-label:hover {
    background: var(--uk-primary-dark);
    color: #fff;
}

/* ——— 上下篇 ——— */
.article-nav {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--uk-border-color);
}

.article-nav-item {
    padding: 12px 16px;
    background: var(--uk-bg-muted);
    border-radius: var(--uk-radius);
    border: 1px solid var(--uk-border-color);
    transition: border-color .2s, background .2s;
}

.article-nav-item:hover {
    background: #e8f0fe;
    border-color: var(--uk-primary);
}

.article-nav-item .nav-label {
    font-size: .75rem;
    color: var(--uk-text-muted);
    display: block;
    margin-bottom: 4px;
}

.article-nav-item a { text-decoration: none; color: #333; font-size: .9rem; }
.article-nav-item:hover a { color: var(--uk-primary); }

/* =====================================================
   侧边栏 Widget 卡片
   ===================================================== */
.sidebar-widget-card {
    background: var(--uk-bg-default);
    border-radius: var(--uk-radius);
    border: 1px solid var(--uk-border-color);
    margin-bottom: 16px;
    overflow: hidden;
}

.sidebar-widget-card .widget-title {
    font-size: .95rem;
    font-weight: 600;
    margin: 0;
    padding: 12px 16px;
    background: var(--uk-bg-muted);
    border-bottom: 1px solid var(--uk-border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-widget-card .widget-body {
    padding: 12px 16px;
}

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

.sidebar-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: .88rem;
}

.sidebar-list li:last-child { border-bottom: none; }

.sidebar-list a {
    color: #333;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}

.sidebar-list a:hover { color: var(--uk-primary); }

/* 标签云 */
.tag-cloud-item {
    display: inline-block;
    padding: 3px 9px;
    background: #f0f0f5;
    color: #555;
    border-radius: 20px;
    font-size: .8rem;
    margin: 3px 3px 3px 0;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.tag-cloud-item:hover {
    background: var(--uk-primary);
    color: #fff;
}

/* =====================================================
   分页
   ===================================================== */
.pagination-wrap {
    margin: 24px 0;
    text-align: center;
}

.pagination-wrap .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 2px;
    border: 1px solid var(--uk-border-color);
    border-radius: var(--uk-radius);
    color: #555;
    text-decoration: none;
    font-size: .875rem;
    transition: all .15s;
}

.pagination-wrap .page-numbers.current,
.pagination-wrap .page-numbers:hover {
    background: var(--uk-primary);
    color: #fff;
    border-color: var(--uk-primary);
}

.pagination-wrap .page-numbers.dots {
    border: none;
    width: auto;
}

/* =====================================================
   搜索表单
   ===================================================== */
.uk-search-form .uk-search-input {
    border: 1px solid var(--uk-border-color);
    border-radius: var(--uk-radius);
    padding: 8px 12px;
    width: 100%;
    font-size: .875rem;
}

/* =====================================================
   面包屑
   ===================================================== */
.breadcrumbs-wrap {
    padding: 8px 0;
    margin-bottom: 16px;
    font-size: .85rem;
}

/* =====================================================
   评论区
   ===================================================== */
.comments-area {
    margin-top: 32px;
}

.comment-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--uk-border-color);
}

.comment-item:last-child { border-bottom: none; }

.comment-avatar { border-radius: 50%; }

.comment-meta { font-size: .8rem; color: var(--uk-text-muted); }

/* =====================================================
   页脚
   ===================================================== */
.site-footer {
    background: var(--uk-secondary);
    color: rgba(255,255,255,.7);
    margin-top: 40px;
    padding: 32px 0 20px;
}

.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: #fff; }

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    margin: 0 4px;
    transition: background .15s, border-color .15s;
    color: rgba(255,255,255,.7);
}

.footer-social a:hover {
    background: var(--uk-primary);
    border-color: var(--uk-primary);
    color: #fff;
}

.footer-divider {
    border-color: rgba(255,255,255,.1);
    margin: 16px 0;
}

.footer-copyright {
    font-size: .8rem;
    color: rgba(255,255,255,.5);
}

/* =====================================================
   回到顶部
   ===================================================== */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: var(--uk-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(30,135,240,.4);
    z-index: 100;
    transition: opacity .2s, transform .2s;
    text-decoration: none;
    opacity: .85;
}

.back-to-top:hover {
    opacity: 1;
    transform: translateY(-2px);
    color: #fff;
}

/* =====================================================
   工具类
   ===================================================== */
.hidden-notice {
    color: #f0506e;
    font-style: italic;
    font-size: .8rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--uk-primary), #7b61ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   3D 地球背景样式
   ===================================================== */

/* 地球容器（全屏背景，z-index 最低） */
#earth_div {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    position: fixed !important;
    z-index: -1;
    width: 100%;
    height: 100%;
}

/* 地球工具栏（底部左角） */
#earth_tools {
    bottom: 20px;
    left: 20px;
    position: fixed !important;
    z-index: 999;
    background: rgba(204, 204, 204, 0.8);
    padding: 0 10px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 地球工具栏按钮 */
#earth_tools .pjkui-earth-btn {
    font-size: 12px;
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid #0e509e;
    cursor: pointer;
    color: #0e509e;
    background: #fff;
    margin: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

#earth_tools .pjkui-earth-btn:hover {
    background: #0e509e;
    color: #fff;
}

/* 星空模式：调整文本颜色以适应深色背景 */
body.earth-sky-mode article,
body.earth-sky-mode .uk-card {
    color: #fff;
}

body.earth-sky-mode article h1,
body.earth-sky-mode article h2,
body.earth-sky-mode article h3,
body.earth-sky-mode article h4,
body.earth-sky-mode article h5,
body.earth-sky-mode article h6 {
    color: #fff;
}

body.earth-sky-mode .uk-card-default {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

body.earth-sky-mode .uk-card-default .uk-card-header,
body.earth-sky-mode .uk-card-default .uk-card-footer {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

body.earth-sky-mode .uk-card-default:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.earth-sky-mode a {
    color: #64b5f6;
}

body.earth-sky-mode a:hover {
    color: #bbdefb;
}

/* =====================================================
   响应式
   ===================================================== */
@media (max-width: 960px) {
    .content-area { padding: 16px; }
    .article-single .article-title { font-size: 1.5rem; }
    
    /* 移动端隐藏地球工具栏 */
    #earth_tools {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .article-card { padding: 14px 16px; }
    .article-single .article-title { font-size: 1.3rem; }
}
