/*
Theme Name: One
Description: 一个现代、简洁、响应式的WordPress主题
Version: 2.1.9
Author: Your Name
License: GPL v2 or later
Text Domain: one
*/

/* ==========================================================================
   首页 Widgets - 天气/时间/一言 (深色卡片)
   ========================================================================== */

.home-widgets {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    flex-shrink: 0;
}

.widget-box {
    width: 128px;
    height: 128px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* 深色卡片：局部强制暗色变量，不跟随全局主题 */
    --w-bg: #181a1c;
    --w-fg: #e0e0e6;
    --w-muted: #8e9092;
    --w-text: #ababb4;
    --w-accent1: #1c1e20;
    --w-accent2: #242628;
    background: var(--w-bg);
    color: var(--w-fg);
}

/* 天气 */
.widget-weather {
    padding: 14px;
}

.widget-weather-top {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--w-muted);
    text-transform: uppercase;
    line-height: 1;
}

.widget-weather-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.widget-weather-temp {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.widget-weather-icon {
    font-size: 28px;
    line-height: 1;
}

.widget-weather-forecast {
    display: flex;
    justify-content: space-around;
    padding: 0 10px 10px;
    font-size: 10px;
    color: var(--w-muted);
    font-variant-numeric: tabular-nums;
    gap: 4px;
}

.widget-weather-forecast span {
    text-align: center;
    flex: 1;
}

.weather-fc-low {
    color: var(--w-muted);
    margin-left: 2px;
}

/* 时间 */
.widget-time {
    display: flex;
    flex-direction: column;
}

.widget-time-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
}

.widget-time-clock {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.widget-time-date {
    font-size: 10px;
    color: var(--w-muted);
    font-variant-numeric: tabular-nums;
}

/* 一言 */
.widget-hitokoto {
    padding: 14px;
    justify-content: center;
}

.widget-hitokoto-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--w-text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    width: 100%;
}

.widget-hitokoto-from {
    font-size: 11px;
    color: var(--w-muted);
    margin-top: 6px;
    text-align: right;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-hitokoto-refresh {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--w-accent1);
    color: var(--w-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.3s;
}

.widget-hitokoto-refresh:hover {
    background: var(--w-accent2);
    color: var(--w-fg);
}

.widget-hitokoto-refresh.spinning svg {
    animation: spin 0.6s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 首页容器 */
.site-main .container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-list {
    flex: 1;
    overflow-y: auto;
}

.post-item {
    border-bottom: none;
}

.post-link {
    display: block;
    padding: 16px 0;
    text-decoration: none;
    color: inherit;
}

.post-item .post-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--headingColor);
    transition: color 0.15s ease;
}

.post-link:hover .post-title {
    color: var(--primary);
}

.post-excerpt {
    font-size: var(--p);
    letter-spacing: .017em;
    color: var(--textColor);
    line-height: 1.7;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-date {
    font-size: 13px;
    color: var(--accent5);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   文章详情
   ========================================================================== */

.single-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--headingColor);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.single-meta {
    font-size: 13px;
    color: var(--textSecondaryColor);
    margin-bottom: 28px;
}

.single-content {
    font-size: var(--p);
    letter-spacing: .017em;
    color: var(--textColor);
    line-height: 1.8;
}

.single-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--headingColor);
    margin: 2em 0 0.8em;
}

.single-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--headingColor);
    margin: 1.8em 0 0.6em;
}

.single-content p {
    margin-bottom: 1.2em;
}

.single-content ul,
.single-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.2em;
}

.single-content li {
    margin-bottom: 0.4em;
}

.single-content a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid var(--accent4);
    transition: border-color 0.15s ease;
}

.single-content a:hover {
    border-bottom-color: var(--primary);
}

.single-content code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    background: var(--accent2);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--headingColor);
}

.single-content pre {
    background: var(--accent0);
    border: 1px solid var(--border-light);
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5em;
    position: relative;
}

.single-content pre code {
    display: block;
    padding: 2.8em 1.2em 1.2em 3.5em;
    background: none;
    border-radius: 0;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    color: var(--textColor);
    counter-reset: codeline;
}

.single-content pre code .line {
    display: block;
}

.single-content pre::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 18px 0 0 #febc2e, 36px 0 0 #28c840;
    z-index: 1;
}

/* 代码块语言标签 */
.single-content pre[class*="language-"]::after,
.single-content code[class*="language-"]::after {
    content: none;
}

.single-content .wp-block-code code {
    padding-left: 1.2em;
}

.single-content pre code::-webkit-scrollbar {
    height: 4px;
}

.single-content pre code::-webkit-scrollbar-thumb {
    background: var(--accent4);
    border-radius: 2px;
}

.single-content blockquote {
    border-left: 3px solid var(--accent4);
    padding: 0.8em 1em;
    background: var(--accent1);
    border-radius: 0 8px 8px 0;
    color: var(--textSecondaryColor);
    margin-bottom: 1.5em;
    font-style: italic;
}

.single-content blockquote p {
    margin-bottom: 0.4em;
}

.single-content blockquote p:last-child {
    margin-bottom: 0;
}

.single-content img {
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    margin: 1.5em 0;
    display: block;
    background: var(--accent1);
    /* width/height 属性由 PHP 自动注入，浏览器据此提前预留正确高度，消除 CLS */
}

.single-content .wp-block-image {
    margin: 1.5em 0;
}

.single-content .wp-block-image img {
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.single-content .wp-block-image figcaption {
    font-size: 12px;
    color: var(--textSecondaryColor);
    text-align: center;
    margin-top: 8px;
}

/* 表格 */
.single-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    font-size: 14px;
}

.single-content th,
.single-content td {
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    text-align: left;
}

.single-content th {
    background: var(--accent1);
    font-weight: 600;
    color: var(--headingColor);
}

.single-content tr:nth-child(even) td {
    background: var(--accent1);
}

/* 分隔线 */
.single-content hr {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: 2em 0;
}

/* 标记/高亮 */
.single-content mark {
    background: var(--selection);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    color: var(--selection-text);
}

/* ====== GLightbox 图片预览覆盖 ====== */
.goverlay {
    background: rgba(0, 0, 0, 0.85) !important;
}

.gslide {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.gslide-image {
    background: none !important;
    box-shadow: none !important;
}

.gslide-image img {
    border-radius: 8px;
    max-height: 90vh;
    max-width: 90vw;
    object-fit: contain;
}

/* 关闭按钮样式 */
.gclose,
.gprev,
.gnext {
    opacity: 0.6;
    transition: opacity 0.15s;
}

.gclose:hover,
.gprev:hover,
.gnext:hover {
    opacity: 1;
}

.gslide-inline,
.gslide-external {
    background: transparent !important;
}

/* 上下篇导航 */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0;
    border-top: none;
    margin-top: 48px;
    margin-bottom: 24px;
}

.post-nav a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-light);
    background: var(--accent0);
    color: var(--headingColor);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.post-nav a:hover {
    background: var(--accent1);
    border-color: var(--accent4);
    transform: translateY(-1px);
}

.post-nav-prev,
.post-nav-next {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-nav-next {
    margin-left: auto;
    text-align: right;
    align-items: flex-end;
}

.post-nav-prev {
    align-items: flex-start;
}

.post-nav-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-nav-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--headingColor);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.single-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.back-home,
.go-comment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    padding: 7px 16px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.back-home {
    color: var(--textSecondaryColor);
    background: var(--accent0);
    border: 1px solid var(--border-light);
}

.back-home:hover {
    background: var(--accent1);
    color: var(--headingColor);
    border-color: var(--accent4);
    transform: translateX(-2px);
}

.go-comment {
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.go-comment:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.dark .go-comment {
    color: var(--accent8);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dark .go-comment:hover {
    color: var(--accent8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ac-border);
    border-radius: 50%;
    background: var(--bg);
    color: var(--headingColor);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s, border-color 0.15s;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent1);
    border-color: var(--accent4);
}

.dark .back-to-top {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 分页 */
.pagination {
    flex-shrink: 0;
    padding: 16px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pagination .nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    color: var(--text-color);
    background: transparent;
    transition: all 0.15s ease;
}

.pagination .page-numbers:hover:not(.current):not(.dots) {
    background: var(--accent2);
    color: var(--heading-color);
}

.pagination .page-numbers.current {
    background: var(--primary);
    color: var(--bg);
    font-weight: 500;
}

/* 无文章 */
.no-posts {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

/* ==========================================================================
   留言板
   ========================================================================== */

/* ==========================================================================
   留言板
   ========================================================================== */

.guestbook-wrap {
    width: 100%;
    margin: 0 auto;
    padding: 24px 0 64px;
}

.guestbook-header {
    margin-bottom: 20px;
}

.guestbook-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--headingColor);
    margin-bottom: 4px;
}

.guestbook-desc {
    font-size: 13px;
    color: var(--textSecondaryColor);
    line-height: 1.6;
}

/* 留言表单卡片 */
.guestbook-form-card {
    background: var(--accent1);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 20px;
}

.guestbook-form-card {
    margin-bottom: 30px;
}

.guestbook-form-card .comment-reply-title,
#respond .comment-reply-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--headingColor);
    margin-bottom: 20px;
}

.guestbook-form-card .comment-form,
#respond .comment-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.guestbook-form-card .comment-form-author,
.guestbook-form-card .comment-form-email,
#respond .comment-form-author,
#respond .comment-form-email {
    margin: 0;
}

.guestbook-form-card .comment-form-comment,
.guestbook-form-card .form-submit,
.guestbook-form-card .comment-notes,
.guestbook-form-card .logged-in-as,
.guestbook-form-card .comment-form-cookies-consent,
#respond .comment-form-comment,
#respond .form-submit,
#respond .comment-notes,
#respond .logged-in-as,
#respond .comment-form-cookies-consent {
    grid-column: 1 / -1;
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.guestbook-form-card .comment-form-cookies-consent input[type="checkbox"],
#respond .comment-form-cookies-consent input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.guestbook-form-card .comment-form-cookies-consent label,
#respond .comment-form-cookies-consent label {
    display: inline !important;
    margin-bottom: 0;
    font-size: 13px;
}

.guestbook-form-card label,
#respond label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--textSecondaryColor);
    margin-bottom: 6px;
}

.guestbook-form-card input,
.guestbook-form-card textarea,
#respond input,
#respond textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--headingColor);
    background: var(--bg);
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.guestbook-form-card input:focus,
.guestbook-form-card textarea:focus,
#respond input:focus,
#respond textarea:focus {
    border-color: var(--accent4);
    box-shadow: 0 0 0 3px var(--accent2);
}

.guestbook-form-card textarea,
#respond textarea {
    min-height: 100px;
    resize: vertical;
}

.guestbook-form-card .form-submit,
#respond .form-submit {
    margin: 4px 0 0;
    text-align: right;
}

.guestbook-form-card .submit-btn,
#respond .submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--bg);
    background: var(--headingColor);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    font-family: inherit;
}

.guestbook-form-card .submit-btn:hover,
#respond .submit-btn:hover {
    opacity: 0.85;
}

.guestbook-form-card .submit-btn:active,
#respond .submit-btn:active {
    transform: scale(0.98);
}

/* 内联回复表单 */
.inline-reply {
    display: none;
    margin-top: 12px;
}

.inline-reply-form {
    background: var(--bg);
    border: 1px solid var(--ac-border);
    border-radius: 16px;
    padding: 16px;
}

.inline-reply-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.inline-field {
    margin: 0 0 12px;
}

.inline-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--textSecondaryColor);
    margin-bottom: 4px;
}

.inline-field input,
.inline-field textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--headingColor);
    background: var(--accent1);
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.inline-field input:focus,
.inline-field textarea:focus {
    border-color: var(--accent4);
    box-shadow: 0 0 0 3px var(--accent2);
}

.inline-field textarea {
    min-height: 80px;
    resize: vertical;
}

.inline-submit-row {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.inline-submit-row .submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--bg);
    background: var(--headingColor);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    font-family: inherit;
}

.inline-submit-row .submit-btn:hover {
    opacity: 0.85;
}

.inline-submit-row .submit-btn:active {
    transform: scale(0.98);
}

.cancel-inline-reply {
    font-size: 13px;
    color: var(--textSecondaryColor);
    text-decoration: none;
    transition: color 0.15s;
}

.cancel-inline-reply:hover {
    color: var(--headingColor);
}

/* 评论标题 */
.comments-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--headingColor);
    margin-bottom: 20px;
}

/* 评论列表 */
.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list .children {
    list-style: none;
    margin: 12px 0 0 44px;
    padding: 0;
}

.comment-item {
    margin-bottom: 0;
    padding: 20px 0;
}

.comment-list > .comment-item:first-child {
    padding-top: 0;
}

.comment-list .children .comment-item {
    border-bottom: none;
    padding: 16px;
    border-radius: 14px;
    background: var(--accent2);
    margin-bottom: 8px;
}

.comment-list .children .comment-item:last-child {
    margin-bottom: 0;
}

/* 评论内容行 */
.comment-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
    margin-top: 2px;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-meta-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--headingColor);
    line-height: 1.3;
}

.comment-author-name a {
    color: var(--headingColor);
    text-decoration: none;
}

.comment-author-name a:hover {
    text-decoration: underline;
}

.comment-time {
    font-size: 12px;
    color: var(--textSecondaryColor);
    line-height: 1.3;
}

.comment-body {
    font-size: 14px;
    color: var(--textColor);
    line-height: 1.7;
    word-break: break-word;
}

.comment-body p {
    margin: 0 0 0.6em;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

.comment-pending {
    font-size: 12px;
    color: var(--textSecondaryColor);
    margin-bottom: 6px;
    font-style: italic;
}

.comment-footer {
    margin-top: 8px;
    font-size: 12px;
}

.comment-footer a {
    color: var(--textSecondaryColor);
    text-decoration: none;
    transition: color 0.15s;
}

.comment-footer a:hover {
    color: var(--headingColor);
}

#pjax-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--accent4);
    width: 0%;
    z-index: 9999;
    transition: width 0.2s ease, opacity 0.2s;
    pointer-events: none;
}

@keyframes pjaxFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pjax-animate {
    animation: pjaxFadeIn 0.35s ease;
}

/* 评论分页 */
.comment-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 28px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.comment-nav a,
.comment-nav span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: var(--textColor);
    background: transparent;
    transition: all 0.15s ease;
}

.comment-nav a:hover {
    background: var(--accent2);
    color: var(--headingColor);
}

.comment-nav .current {
    background: var(--headingColor);
    color: var(--bg);
    font-weight: 500;
}

.no-comments {
    font-size: 14px;
    color: var(--textSecondaryColor);
    text-align: center;
    padding: 32px 0;
}
