/* ==========================================================================
   SakuraGlass —— 二次元毛玻璃 Typecho 主题
   主题三态：light / dark / auto（html[data-theme]）
   配色三套：purple / cyan / orange（html[data-accent]）
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
        "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    font-size: 15px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    animation: ag-fade .5s ease;
}
@keyframes ag-fade { from { opacity: 0; } to { opacity: 1; } }

a { text-decoration: none; transition: color .2s, opacity .2s; }
img { max-width: 100%; height: auto; }
ul, ol { padding-left: 1.2em; }

/* ---------- 主题变量（明暗） ---------- */
:root {
    --text: #2d2b3a;
    --text-weak: #6b6880;
    --panel: rgba(255, 255, 255, 0.55);
    --panel-solid: rgba(255, 255, 255, 0.86);
    --border: rgba(255, 255, 255, 0.6);
    --hover: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(255, 255, 255, 0.6);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    --blur: 20px;
}
html[data-theme="dark"] {
    --text: #e7e5f0;
    --text-weak: #9d99b5;
    --panel: rgba(24, 20, 42, 0.55);
    --panel-solid: rgba(28, 24, 48, 0.88);
    --border: rgba(255, 255, 255, 0.12);
    --hover: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(16, 13, 30, 0.55);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ---------- 主题色（三套配色） ---------- */
:root {
    --accent-1: #a855f7;
    --accent-2: #ec4899;
    --accent-grad: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --accent-soft: rgba(168, 85, 247, 0.16);
}
html[data-accent="cyan"] {
    --accent-1: #0891b2;
    --accent-2: #3b82f6;
    --accent-grad: linear-gradient(135deg, #0891b2 0%, #3b82f6 100%);
    --accent-soft: rgba(8, 145, 178, 0.16);
}
html[data-accent="orange"] {
    --accent-1: #ea580c;
    --accent-2: #f43f5e;
    --accent-grad: linear-gradient(135deg, #ea580c 0%, #f43f5e 100%);
    --accent-soft: rgba(234, 88, 12, 0.16);
}

/* ---------- 背景 ---------- */
body {
    background-image: var(--bg-light);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: #e8dff5;
    color: var(--text);
    transition: color .4s ease, background-color .4s ease;
}
html[data-theme="dark"] body {
    background-image: var(--bg-dark);
    background-color: #141022;
}
a { color: var(--accent-1); }
a:hover { color: var(--accent-2); }

/* ---------- 背景粒子（樱花 + 光斑） ---------- */
.ag-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.ag-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    animation: ag-float 16s ease-in-out infinite;
}
.ag-blob-1 { width: 420px; height: 420px; left: -120px; top: -100px;
    background: radial-gradient(circle, #f9a8d4, transparent 70%); }
.ag-blob-2 { width: 460px; height: 460px; right: -140px; top: 30%;
    background: radial-gradient(circle, #a78bfa, transparent 70%); animation-delay: -5s; }
.ag-blob-3 { width: 380px; height: 380px; left: 35%; bottom: -160px;
    background: radial-gradient(circle, #7dd3fc, transparent 70%); animation-delay: -10s; }
html[data-theme="dark"] .ag-blob { opacity: .35; }

@keyframes ag-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(30px, -30px) scale(1.08); }
}

.ag-petal {
    position: absolute;
    top: -6%;
    width: 16px; height: 16px;
    background: linear-gradient(135deg, #fbcfe8, #f9a8d4);
    border-radius: 150% 0 150% 0;
    opacity: .65;
    animation: ag-fall linear infinite;
}
.ag-petal:nth-of-type(4)  { left: 8%;  animation-duration: 13s; animation-delay: 0s; }
.ag-petal:nth-of-type(5)  { left: 26%; animation-duration: 16s; animation-delay: -4s; width: 12px; height: 12px; }
.ag-petal:nth-of-type(6)  { left: 48%; animation-duration: 14s; animation-delay: -8s; }
.ag-petal:nth-of-type(7)  { left: 66%; animation-duration: 18s; animation-delay: -2s; width: 10px; height: 10px; }
.ag-petal:nth-of-type(8)  { left: 82%; animation-duration: 15s; animation-delay: -11s; }
.ag-petal:nth-of-type(9)  { left: 92%; animation-duration: 17s; animation-delay: -6s; width: 14px; height: 14px; }

@keyframes ag-fall {
    0%   { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
    10%  { opacity: .65; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: .1; }
}

/* ---------- 阅读进度条 ---------- */
.ag-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    z-index: 300;
    pointer-events: none;
}
.ag-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent-grad);
    transition: width .1s linear;
}

/* ---------- 布局骨架 ---------- */
.site-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}
.site-body {
    flex: 1;
    width: 100%;
    padding-top: 28px;
    padding-bottom: 40px;
}
.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

/* ---------- 毛玻璃卡片 ---------- */
.card {
    background: var(--panel);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
    backdrop-filter: blur(var(--blur)) saturate(160%);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: transform .3s ease, box-shadow .3s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 0 1px var(--accent-1), 0 0 26px var(--accent-soft), 0 16px 40px rgba(0, 0, 0, 0.16);
}

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--panel);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
    backdrop-filter: blur(var(--blur)) saturate(160%);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 62px;
}
.site-logo {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.site-logo:hover { color: var(--accent-1); }
.site-desc { font-size: 12px; font-weight: 400; color: var(--text-weak); }

.site-nav { display: flex; gap: 4px; margin-left: 8px; }
.site-nav a {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
}
.site-nav a:hover { background: var(--hover); color: var(--accent-1); }
.site-nav a.current { background: var(--hover); color: var(--accent-1); font-weight: 600; }

.site-search { margin-left: auto; display: flex; align-items: center; }
.site-search input {
    width: 160px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px 0 0 20px;
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: width .25s, border .2s, box-shadow .2s;
}
.site-search input:focus {
    width: 210px;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.site-search .submit {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 38px;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 20px 20px 0;
    background: var(--accent-grad);
    cursor: pointer;
}
.site-search .submit svg { width: 18px; height: 18px; fill: #fff; }

/* ---------- 配色切换 ---------- */
.accent-switch { display: flex; gap: 7px; align-items: center; flex-shrink: 0; }
.accent-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .2s, border-color .2s;
}
.accent-dot:hover { transform: scale(1.18); }
.accent-dot.active { border-color: var(--text); }
.accent-purple { background: linear-gradient(135deg, #a855f7, #ec4899); }
.accent-cyan   { background: linear-gradient(135deg, #0891b2, #3b82f6); }
.accent-orange { background: linear-gradient(135deg, #ea580c, #f43f5e); }

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--panel-solid);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .25s ease;
    box-shadow: var(--shadow);
}
.theme-toggle:hover { transform: scale(1.1) rotate(12deg); }
.theme-toggle-icon { font-size: 18px; line-height: 1; }

/* ---------- Hero 横幅（首页） ---------- */
.hero { padding: 80px 20px 60px; text-align: center; }
.hero-inner {
    display: inline-block;
    max-width: 720px;
    padding: 34px 54px;
    background: var(--panel);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
    backdrop-filter: blur(var(--blur)) saturate(160%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.hero-title {
    margin: 0 0 10px;
    font-size: 38px;
    font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-desc { margin: 0; color: var(--text-weak); font-size: 15px; }

/* ---------- 文章卡片 ---------- */
.post { padding: 26px 28px; }
.post-title { margin: 0 0 10px; font-size: 21px; line-height: 1.4; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent-1); }

.post-meta {
    list-style: none; margin: 0 0 14px; padding: 0;
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    font-size: 13px; color: var(--text-weak);
}
.post-meta li { display: flex; align-items: center; gap: 5px; }
.post-meta .icon { width: 14px; height: 14px; fill: var(--accent-1); opacity: .8; }
.post-meta a { color: var(--text-weak); }
.post-meta a:hover { color: var(--accent-1); }

.post-content { color: var(--text); word-break: break-word; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 { scroll-margin-top: 80px; }
.post-content p { margin: 0.8em 0; }
.post-content img { border-radius: 12px; box-shadow: var(--shadow); }
.post-content pre {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
}
.post-content code {
    font-family: "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--hover);
    padding: 2px 6px;
    border-radius: 6px;
}
.post-content pre code { background: transparent; padding: 0; }
.post-content blockquote {
    margin: 1em 0; padding: 4px 16px;
    border-left: 3px solid var(--accent-1);
    background: var(--hover);
    border-radius: 0 10px 10px 0;
    color: var(--text-weak);
}
.post-content a { text-decoration: underline; text-underline-offset: 2px; }
.post-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; }
.post-content th { background: var(--hover); }

.post-tags { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-weak); }
.post-tags a {
    display: inline-block; margin: 0 4px; padding: 2px 12px;
    border-radius: 20px; background: var(--hover); color: var(--accent-1);
}
.post-tags a:hover { color: #fff; background: var(--accent-grad); }

/* 代码高亮 token */
.tok-comment { color: #7c7c8a; font-style: italic; }
.tok-string  { color: #2e9e6b; }
.tok-number  { color: #3b82c4; }
.tok-keyword { color: #a855f7; font-weight: 600; }
html[data-theme="dark"] .tok-comment { color: #6a9955; }
html[data-theme="dark"] .tok-string  { color: #ce9178; }
html[data-theme="dark"] .tok-number  { color: #b5cea8; }
html[data-theme="dark"] .tok-keyword { color: #c586c0; }

/* 目录 TOC */
.toc { padding: 18px 20px; }
.toc-title {
    font-weight: 700; margin-bottom: 8px; color: var(--text);
    position: relative; padding-left: 14px;
}
.toc-title::before {
    content: ""; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 16px; border-radius: 4px;
    background: var(--accent-grad);
}
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { padding: 4px 0; }
.toc-list a { color: var(--text-weak); font-size: 14px; }
.toc-list a:hover { color: var(--accent-1); }
.toc-h3 a { padding-left: 14px; }
.toc-h4 a { padding-left: 28px; }

/* 归档横幅 */
.archive-banner { padding: 20px 26px; }
.archive-title { margin: 0; font-size: 17px; }

/* ---------- 侧边栏 ---------- */
.widget { padding: 20px 22px; }
.widget-title {
    margin: 0 0 12px; font-size: 15px; color: var(--text);
    position: relative; padding-left: 14px;
}
.widget-title::before {
    content: ""; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 16px; border-radius: 4px;
    background: var(--accent-grad);
}
.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--text); }
.widget-list a:hover { color: var(--accent-1); }
.widget-list .count {
    float: right; font-size: 12px; color: var(--accent-1);
    background: var(--accent-soft); border-radius: 20px; padding: 0 8px;
}

/* ---------- 评论 ---------- */
.comments { padding: 24px 28px; }
.comments-title { margin: 0 0 14px; font-size: 16px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body { margin: 0 0 16px; padding: 14px 16px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 14px; }
.comment-author { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.comment-author .avatar { width: 34px; height: 34px; border-radius: 50%; }
.comment-author cite { font-style: normal; font-weight: 600; color: var(--text); }
.comment-meta { font-size: 12px; color: var(--text-weak); margin: 4px 0 8px; }
.comment-meta a { color: var(--text-weak); }
.comment-reply { margin-left: 8px; }
.comment-content { color: var(--text); }
.comment-children { list-style: none; margin: 10px 0 0 24px; padding: 0; }

.respond { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.respond label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--text-weak); }
.respond label.required::after { content: " *"; color: var(--accent-2); }
.respond input, .respond textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--input-bg); color: var(--text);
    outline: none; font-size: 14px;
}
.respond input:focus, .respond textarea:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.respond p { margin: 10px 0; }
.respond-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cancel-comment-reply { margin-bottom: 10px; }
.cancel-comment-reply a { font-size: 13px; }

.btn-primary {
    display: inline-block; padding: 10px 26px;
    border: none; border-radius: 12px;
    background: var(--accent-grad); color: #fff !important;
    cursor: pointer; font-size: 14px;
    box-shadow: 0 4px 16px var(--accent-soft);
    transition: filter .2s;
}
.btn-primary:hover { filter: brightness(1.08); color: #fff !important; }

/* ---------- 分页 ---------- */
.page-navigator {
    list-style: none; display: flex; gap: 8px;
    justify-content: center; margin: 8px 0 0; padding: 0;
}
.page-navigator li a, .page-navigator li span {
    display: inline-block; min-width: 36px; height: 36px; line-height: 36px;
    padding: 0 8px; text-align: center; border-radius: 10px;
    background: var(--panel);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border); color: var(--text); font-size: 14px;
}
.page-navigator li a:hover { background: var(--hover); color: var(--accent-1); }
.page-navigator li.current span { background: var(--accent-grad); color: #fff; border-color: transparent; }

/* ---------- 上下篇 ---------- */
.post-near { display: flex; justify-content: space-between; gap: 16px; padding: 18px 24px; font-size: 14px; color: var(--text-weak); }
.post-near a { color: var(--accent-1); }

/* ---------- 404 ---------- */
.not-found { padding: 60px 30px; text-align: center; }
.nf-code { font-size: 72px; font-weight: 800; background: var(--accent-grad);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nf-title { margin: 8px 0; }
.nf-desc { color: var(--text-weak); margin: 0 0 24px; }

/* ---------- 返回顶部 ---------- */
.back-top {
    position: fixed; right: 24px; bottom: 24px; z-index: 150;
    width: 44px; height: 44px;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--panel-solid);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transform: translateY(16px);
    transition: all .3s ease;
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { border-color: var(--accent-1); }
.back-top svg { width: 22px; height: 22px; fill: var(--accent-1); }

/* ---------- 灯箱 ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0, 0, 0, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity .3s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-img { max-width: 90vw; max-height: 85vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-close {
    position: absolute; top: 18px; right: 26px;
    font-size: 40px; line-height: 1; color: #fff;
    background: none; border: none; cursor: pointer;
}

/* ---------- 抽屉导航（移动端） ---------- */
.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px; height: 38px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-solid);
    cursor: pointer;
}
.nav-burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: all .3s; }
.nav-mask { display: none; }

/* ---------- 页脚 ---------- */
.site-footer {
    background: var(--panel);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
    backdrop-filter: blur(var(--blur)) saturate(160%);
    border-top: 1px solid var(--border);
    padding: 22px 0; color: var(--text-weak); font-size: 13px;
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--accent-1); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, .35); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, .6); background-clip: content-box; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .row { grid-template-columns: 1fr; }
    .site-desc { display: none; }
    .site-search input { width: 110px; }
    .site-search input:focus { width: 150px; }

    /* 抽屉导航 */
    .nav-burger { display: flex; }
    .site-nav {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 76px 16px 20px;
        background: var(--panel-solid);
        -webkit-backdrop-filter: blur(var(--blur));
        backdrop-filter: blur(var(--blur));
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: translateX(-100%);
        transition: transform .3s ease;
        z-index: 350;
        overflow-y: auto;
    }
    .site-nav a { padding: 12px 14px; }
    body.nav-open .site-nav { transform: translateX(0); }
    .nav-mask {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 340;
        opacity: 0; visibility: hidden;
        transition: opacity .3s;
    }
    body.nav-open .nav-mask { opacity: 1; visibility: visible; }
}
@media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
    .site-search { margin-left: auto; }
    .hero { padding: 50px 16px 40px; }
    .hero-inner { padding: 26px 30px; }
    .hero-title { font-size: 28px; }
    .respond-fields { grid-template-columns: 1fr; }
    .post { padding: 20px; }
    .back-top { right: 16px; bottom: 16px; }
}
