/*
Theme Name: 我的极简站
Theme URI: https://你的域名
Author: 你的名字
Author URI: https://你的域名
Description: 极简三要素主题：顶部主题栏 + 悬浮导航 + 页脚
Version: 1.3
License: GPL v2 or later
Text Domain: mytheme
*/

/* ===== 变量 ===== */
:root {
    --topbar-min-height: 100px;
    --topbar-height: 100px;
    --nav-offset: 24px;
    --sidebar-width: 240px;
    --color-bg: #f8f9fc;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-muted: #6b6b8a;
    --color-accent: #4f6ef7;
    --color-border: #eef2f6;
    --color-note: #fffef8;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-float: 0 12px 40px rgba(26, 26, 46, 0.14), 0 2px 8px rgba(26, 26, 46, 0.06);
    --z-sidebar: 200;
    --z-tab: 250;
    --z-topbar: 300;
    --z-footer: 100;
}

/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    min-height: 100%;
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

body {
    padding-top: var(--topbar-height);
}

body.has-body-bg .main {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    padding-left: 40px;
    padding-right: 40px;
}

body.has-body-bg .site-footer {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== 顶部主题栏 ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--topbar-min-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    z-index: var(--z-topbar);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: var(--topbar-min-height);
    padding: 16px 32px;
    max-width: 100%;
}

.topbar-brand a {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.topbar-brand span { color: var(--color-accent); }

.topbar-info {
    text-align: right;
    max-width: 520px;
}

.topbar-bio {
    font-size: 14px;
    color: var(--color-muted);
    line-height: 1.6;
}

.topbar-email {
    margin-top: 4px;
    font-size: 13px;
}

.topbar-email a {
    color: var(--color-accent);
    text-decoration: none;
}

.topbar-email a:hover {
    text-decoration: underline;
}

/* ===== 最小化半圆标签 ===== */
.sidebar-tab {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    padding: 0;
    border: 1px solid rgba(79, 110, 247, 0.2);
    border-left: none;
    border-radius: 0 32px 32px 0;
    background: var(--color-note);
    color: var(--color-accent);
    box-shadow: var(--shadow-float);
    cursor: pointer;
    z-index: var(--z-tab);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.sidebar-tab:hover {
    width: 38px;
    background: #fff;
    color: var(--color-accent);
}

body.sidebar-minimized .sidebar-tab {
    display: flex;
}

body.sidebar-right .sidebar-tab {
    left: auto;
    right: 0;
    border-left: 1px solid rgba(79, 110, 247, 0.2);
    border-right: none;
    border-radius: 32px 0 0 32px;
}

body.sidebar-right .sidebar-tab svg {
    transform: rotate(180deg);
}

/* ===== 悬浮导航窗（窗口样式） ===== */
.sidebar {
    position: fixed;
    top: calc(var(--topbar-height) + var(--nav-offset));
    left: var(--nav-offset);
    width: var(--sidebar-width);
    max-height: calc(100vh - var(--topbar-height) - var(--nav-offset) * 2 - 72px);
    background: var(--color-note);
    border: 1px solid rgba(79, 110, 247, 0.15);
    border-radius: 12px;
    box-shadow: var(--shadow-float);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                left 0.3s ease,
                right 0.3s ease;
}

body.sidebar-right .sidebar {
    left: auto;
    right: var(--nav-offset);
}

body.sidebar-minimized .sidebar {
    transform: scale(0.85) translateX(calc(-100% - var(--nav-offset)));
    opacity: 0;
    pointer-events: none;
}

body.sidebar-right.sidebar-minimized .sidebar {
    transform: scale(0.85) translateX(calc(100% + var(--nav-offset)));
}

/* 窗口标题栏 */
.sidebar-window-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #f5f6fb 0%, #eef0f8 100%);
    border-bottom: 1px solid rgba(79, 110, 247, 0.1);
    flex-shrink: 0;
}

.sidebar-window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.win-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
}

.win-btn-minimize {
    background: #ffd166;
    color: #8a6d00;
}

.win-btn-minimize:hover {
    background: #ffbe0b;
}

.win-btn-position {
    background: #06d6a0;
    color: #046c4e;
}

.win-btn-position:hover {
    background: #05c090;
}

.win-btn-position[aria-pressed="true"] {
    background: #4f6ef7;
    color: #fff;
}

.sidebar-window-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    text-align: center;
    letter-spacing: 0.05em;
}

/* 搜索栏 */
.sidebar-search-form {
    display: flex;
    align-items: center;
    width: 110px;
    height: 28px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    overflow: hidden;
    transition: width 0.2s, border-color 0.2s;
}

.sidebar-search-form:focus-within {
    width: 130px;
    border-color: var(--color-accent);
}

.sidebar-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 8px 0 10px;
    border: none;
    background: transparent;
    font-size: 12px;
    color: var(--color-text);
    outline: none;
}

.sidebar-search-input::placeholder {
    color: #bbb;
}

.sidebar-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-search-btn:hover {
    color: var(--color-accent);
}

/* 菜单主体 */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px 14px;
}

.sidebar nav .menu,
.sidebar nav ul {
    list-style: none;
}

.sidebar nav a {
    display: block;
    padding: 9px 12px;
    color: var(--color-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar nav a:hover,
.sidebar nav .current-menu-item > a,
.sidebar nav .current-menu-ancestor > a {
    color: var(--color-accent);
    background: rgba(79, 110, 247, 0.08);
}

.sidebar nav > ul > li + li {
    margin-top: 2px;
}

/* 子级菜单 */
.sidebar nav .sub-menu {
    margin: 2px 0 4px 8px;
    padding-left: 10px;
    border-left: 2px solid rgba(79, 110, 247, 0.15);
}

.sidebar nav .sub-menu a {
    font-size: 13px;
    padding: 7px 10px;
    font-weight: 400;
}

.sidebar nav .sub-menu .sub-menu {
    margin-left: 6px;
}

.sidebar nav .sub-menu .sub-menu a {
    font-size: 12px;
    padding: 6px 10px;
    color: #888;
}

/* ===== 主内容区 ===== */
.main {
    padding: 48px 50px 120px;
    min-height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
}

.main h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.main p {
    font-size: 18px;
    color: var(--color-muted);
    max-width: 500px;
    line-height: 1.7;
}

.main .empty-notice {
    font-size: 16px;
    color: #aaa;
    font-style: italic;
    padding: 24px 0;
    border-top: 1px dashed var(--color-border);
    border-bottom: 1px dashed var(--color-border);
    max-width: 100%;
}

.main .post-item { margin-bottom: 30px; }

.main .post-item h2 {
    font-size: 24px;
    font-weight: 600;
}

.main .post-item h2 a {
    color: var(--color-text);
    text-decoration: none;
}

.main .post-item h2 a:hover { color: var(--color-accent); }

.main .post-item .post-date {
    font-size: 13px;
    color: #aaa;
    margin-top: 4px;
}

.main .post-item .post-excerpt {
    font-size: 15px;
    color: var(--color-muted);
    margin-top: 6px;
    line-height: 1.6;
}

.post-list {
    margin-top: 24px;
    max-width: 100%;
}

.main .pagination,
.main .nav-links {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
}

.main .pagination a,
.main .nav-links a {
    color: var(--color-accent);
    text-decoration: none;
}

.main .pagination a:hover,
.main .nav-links a:hover {
    text-decoration: underline;
}

/* ===== 页脚 ===== */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
    z-index: var(--z-footer);
}

.site-footer-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 14px 32px;
    font-size: 13px;
    color: #aaa;
}

.site-footer-inner p {
    margin: 0;
    line-height: 1.6;
}

.site-footer a {
    color: #aaa;
    text-decoration: none;
}

.site-footer a:hover { color: var(--color-accent); }

/* ===== 移动端适配 ===== */
@media (max-width: 700px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 8px;
    }

    .topbar-info {
        text-align: left;
        max-width: 100%;
    }

    .topbar-brand a { font-size: 20px; }

    .sidebar {
        width: min(var(--sidebar-width), calc(100vw - var(--nav-offset) * 2));
    }

    .sidebar-window-bar {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
    }

    .sidebar-window-title {
        grid-column: 1 / -1;
        text-align: left;
        order: -1;
        padding-bottom: 4px;
    }

    .sidebar-search-form {
        width: 100%;
        grid-column: 1 / -1;
    }

    .sidebar-search-form:focus-within {
        width: 100%;
    }

    .main {
        padding: 30px 20px 100px;
        min-height: auto;
    }

    .main h1 { font-size: 28px; }
    .main p { font-size: 16px; }

    .site-footer-inner {
        flex-direction: column;
        padding: 12px 16px;
    }
}
