/* ===========================================================
   RyeBlog 前台样式 —— 绿色主题，响应式（PC 左右栏，移动端仅左栏）
   仅引用 themes.css 中的 --green-* 变量
   =========================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink); background: var(--green-025); line-height: 1.7; font-size: 15px;
}
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-500); }
img { max-width: 100%; display: block; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* ---------- 头部 ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; color: var(--green-700); flex-shrink: 0; }
.brand-logo { width: 30px; height: 30px; border-radius: 7px; }
.brand-name { white-space: nowrap; }
.brand-slogan { font-size: 12px; font-weight: 400; color: var(--g-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; border-left: 1px solid var(--line); padding-left: 10px; }
@media (max-width: 768px) { .brand-slogan { display: none; } }
.site-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; align-items: center; }
.site-nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.site-nav a:hover { background: var(--green-050); color: var(--green-700); }
.site-nav .nav-login { margin-left: auto; background: var(--green-050); color: var(--green-700); font-weight: 600; }
.site-nav .nav-login:hover { background: var(--green-600); color: #fff; }
/* 分类下拉树（顶部导航「分类」菜单） */
.nav-drop { position: relative; }
.nav-drop-btn { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; cursor: default; user-select: none; }
.nav-drop-btn:hover { background: var(--green-050); color: var(--green-700); }
.nav-drop-arrow { font-size: 10px; opacity: .6; transition: transform .15s; }
.nav-drop:hover .nav-drop-arrow { transform: rotate(180deg); }
.nav-drop-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 200px; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--line, #e2e8f0); border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.10); padding: 6px; z-index: 50; }
.nav-drop:hover .nav-drop-menu, .nav-drop:focus-within .nav-drop-menu { display: block; }
.nav-drop-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--ink); font-size: 13.5px; white-space: nowrap; }
.nav-drop-menu a:hover { background: var(--green-050); color: var(--green-700); }
.nav-drop-menu a.nav-drop-sub { padding-left: 26px; color: #52606f; font-size: 13px; }
.nav-drop-menu a.nav-drop-sub:hover { color: var(--green-700); }
.nav-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--green-700); cursor: pointer; }

/* 侧栏内的搜索框（沿用原顶部样式） */
.widget-search .site-search { display: flex; align-items: center; gap: 6px; }
.widget-search input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--green-025); }
.widget-search input:focus { outline: none; border-color: var(--green-500); background: #fff; }
.widget-search button { background: var(--green-600); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.widget-search button:hover { background: var(--green-700); }

/* ---------- 布局 ---------- */
.layout { display: flex; gap: 22px; padding: 22px 16px; align-items: flex-start; }
.content-col { flex: 1; min-width: 0; }
.sidebar { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
/* 侧边栏固定（后台「侧边栏固定」开关开启时生效） */
.sidebar-sticky { position: sticky; top: 78px; }

/* ---------- 博主信息卡（仅首页 PC） ---------- */
.author-card {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow);
    position: relative; transition: box-shadow .2s;
}
.author-card:hover { box-shadow: 0 14px 36px rgba(46,107,53,.18); }
.author-card .ac-banner {
    height: 180px; background-size: cover; background-position: center;
    background-color: var(--g-200); position: relative; overflow: hidden;
}
.author-card .ac-banner::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,.22) 100%);
    pointer-events: none;
}
.author-card .ac-banner:hover .ac-banner-img { transform: scale(1.04); }
.author-card .ac-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.author-card .ac-body {
    padding: 0 18px 22px; text-align: center; margin-top: -52px; position: relative;
}
.author-card .ac-avatar {
    width: 104px; height: 104px; border-radius: 50%;
    border: 5px solid var(--white); margin: 0 auto 12px;
    background: var(--g-100); display: block; object-fit: cover;
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
}
.author-card .ac-title {
    font-size: 13px; color: var(--g-700); margin: 0 0 4px;
    text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.author-card .ac-name {
    font-size: 20px; color: var(--ink); font-weight: 700; margin: 0 0 8px;
}
.author-card .ac-bio {
    font-size: 13px; color: var(--muted); line-height: 1.65;
    margin: 6px 0 0; word-break: break-word;
}

/* ---------- 图文列表卡片（参考截图：底部单行 meta + 右侧阅读全文） ---------- */
.post-card { display: flex; gap: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.post-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(46,107,53,.14); }
.post-card .post-thumb { width: 200px; height: 132px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--green-050); }
.post-card .post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .post-thumb.empty { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2e7d46, #1b5e2e); }
.post-card .post-thumb.empty .thumb-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.post-card .post-thumb.empty .thumb-logo { width: 76px; height: 76px; object-fit: contain; }
.post-card .post-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-card .post-title { font-size: 18px; line-height: 1.4; margin-bottom: 8px; }
.post-card .post-title a { color: var(--ink); }
.post-card .post-title a:hover { color: var(--green-700); }
.post-card .post-excerpt { color: var(--muted); font-size: 14px; line-height: 1.65; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.post-card .post-tags a { font-size: 12px; color: var(--green-600); background: var(--green-050); padding: 2px 8px; border-radius: 6px; }
.post-card .post-footer-row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.post-card .post-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.post-card .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.post-card .meta-item a { color: var(--green-700); }
.post-card .meta-item .i-, .post-card .meta-item [class^="i-"] { display: inline-block; width: 14px; height: 14px; background-color: var(--green-600); -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; opacity: .85; }
.post-card .i-calendar { -webkit-mask-image: url('../img/i-calendar.svg'); mask-image: url('../img/i-calendar.svg'); }
.post-card .i-user      { -webkit-mask-image: url('../img/i-user.svg');      mask-image: url('../img/i-user.svg'); }
.post-card .i-eye       { -webkit-mask-image: url('../img/i-eye.svg');       mask-image: url('../img/i-eye.svg'); }
.post-card .i-comment   { -webkit-mask-image: url('../img/i-comment.svg');   mask-image: url('../img/i-comment.svg'); }
.post-card .i-folder    { -webkit-mask-image: url('../img/i-folder.svg');    mask-image: url('../img/i-folder.svg'); }
.post-card .read-more { color: var(--green-700); font-size: 13px; font-weight: 600; flex-shrink: 0; }
.post-card .read-more:hover { color: var(--green-500); }

/* ---------- 文章详情 ---------- */
.article { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); margin-bottom: 18px; }
.article h1 { font-size: 26px; line-height: 1.35; margin-bottom: 12px; color: var(--ink); }
.article .post-meta { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.article-content { font-size: 16px; line-height: 1.85; }
.article-content h2, .article-content h3 { margin: 1.4em 0 .6em; color: var(--green-800, var(--green-700)); scroll-margin-top: 80px; }
.article-content h2 { font-size: 1.4em; padding-left: 10px; border-left: 4px solid var(--green-500); }
.article-content h3 { font-size: 1.15em; color: var(--green-700); }
.article-content p { margin-bottom: 1em; }
.article-content img { border-radius: 8px; margin: 1em 0; }
.article-content pre { background: var(--green-025); padding: 14px; border-radius: 8px; overflow-x: auto; border: 1px solid var(--line); }
.article-content code { background: var(--green-050); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.article-content blockquote { border-left: 4px solid var(--green-400); padding: 8px 16px; margin: 1em 0; color: var(--muted); background: var(--green-025); border-radius: 0 8px 8px 0; }
.article-content ul, .article-content ol { margin: 0 0 1em 1.5em; }
.attachments { background: var(--green-025); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-top: 18px; }
.attachments h4 { font-size: 14px; color: var(--green-700); margin-bottom: 8px; }
.attachments a { display: block; padding: 4px 0; font-size: 14px; }

/* ---------- 评论 ---------- */
.comments { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.comments h3 { font-size: 18px; margin-bottom: 14px; color: var(--green-700); }
.comment-list { list-style: none; margin-bottom: 18px; }
.comment-item { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.c-meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.comment-form { font-size: 14px; }
.comment-form label { display: block; font-weight: 600; margin: 10px 0 5px; color: var(--green-900); font-size: .92rem; }
.comment-form input, .comment-form textarea, .comment-form select { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--white); outline: none; transition: border-color .15s, box-shadow .15s; }
.comment-form input:focus, .comment-form textarea:focus, .comment-form select:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(67,160,71,.12); }

/* Markdown 目录小部件 */
.widget-toc .toc-list { list-style: none; padding: 0; margin: 0; }
.widget-toc .toc-list ul { list-style: none; padding-left: 12px; margin: 4px 0; }
.widget-toc .toc-list li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.widget-toc .toc-list li:last-child { border-bottom: none; }
.widget-toc .toc-list a { color: var(--ink); font-size: 13px; line-height: 1.5; display: block; padding: 2px 4px; border-radius: 6px; transition: background .15s; }
.widget-toc .toc-list a:hover { background: var(--green-050); color: var(--green-700); }
.widget-toc .toc-list .toc-sub a { font-size: 12px; color: var(--muted); }
.widget-toc .toc-list .toc-active > a { color: var(--green-700); font-weight: 600; background: var(--green-050); }
@media (max-width: 900px) {
    .widget-toc { display: none; } /* 移动端隐藏目录 */
}
.btn { display: inline-block; background: var(--green-600); color: #fff; padding: 9px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--green-700); color: #fff; }
.btn-ghost { background: transparent; color: var(--green-700); border: 1px solid var(--line); }

/* ---------- 侧栏组件 ---------- */
.widget { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.widget h3 { font-size: 15px; color: var(--green-700); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--green-100); }
.widget ul { list-style: none; }
.widget li { padding: 5px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.widget li:last-child { border-bottom: none; }
.widget small { color: var(--muted); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a { font-size: 13px; padding: 3px 10px; background: var(--green-050); border-radius: 14px; color: var(--green-700); }
.tag-cloud a:hover { background: var(--green-500); color: #fff; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-size: 14px; }
.pagination .current { background: var(--green-600); color: #fff; border-color: var(--green-600); }

/* ---------- 页面/空态 ---------- */
.empty-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.notice-ok { background: var(--green-050); color: var(--green-700); border: 1px solid var(--green-200); }
.notice-err { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }

/* ---------- 页头标题条 ---------- */
.page-head { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.page-head h1 { font-size: 20px; color: var(--green-700); }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- 用户中心 ---------- */
.user-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 16px; display: flex; gap: 16px; align-items: center; }
.user-card img { width: 64px; height: 64px; border-radius: 50%; }
.user-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.user-tabs a { padding: 7px 16px; border-radius: 8px; background: var(--white); border: 1px solid var(--line); font-size: 14px; }
.user-tabs a.active { background: var(--green-600); color: #fff; border-color: var(--green-600); }
.mini-form { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); max-width: 460px; margin: 30px auto; }
.mini-form h1 { font-size: 22px; color: var(--green-700); margin-bottom: 16px; text-align: center; }
.mini-form label { display: block; font-size: 13px; margin: 12px 0 4px; }
.mini-form input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.mini-form .btn { width: 100%; margin-top: 18px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer {
    position: relative;
    background: var(--green-900);
    background: linear-gradient(180deg, var(--green-900) 0%, color-mix(in srgb, var(--green-900) 86%, #000) 100%);
    color: var(--green-100);
    margin-top: 56px;
    padding: 0;
}
/* 顶部主题色装饰线 */
.site-footer::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--green-500), var(--green-400), var(--green-500));
}
.footer-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 64px;
    align-items: start;
    padding: 64px 0 48px;
}
.footer-brand { max-width: 46ch; }
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    line-height: 1.2;
    text-decoration: none;
}
.footer-logo-mark {
    width: 40px;
    height: 40px;
    padding: 7px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.footer-slogan {
    margin: 18px 0 0;
    color: var(--green-200);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 36ch;
}
.footer-nav {
    display: flex;
    gap: 72px;
}
.footer-col-title {
    margin: 0 0 20px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: #fff;
    opacity: .9;
}
.footer-links { display: flex; flex-direction: column; gap: 2px; }
.footer-links a {
    display: inline-block;
    color: var(--green-200);
    font-size: .95rem;
    padding: 8px 0;
    width: fit-content;
    transition: color .18s, transform .18s;
}
.footer-links a:hover { color: #fff; transform: translateX(4px); text-decoration: none; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding: 22px 0;
}
.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 13px;
    color: color-mix(in srgb, var(--green-200) 85%, transparent);
}
.footer-copy, .footer-support, .footer-icp { margin: 0; font-size: 13px; }
.footer-support a, .footer-icp a { color: var(--green-200); }
.footer-support a:hover, .footer-icp a:hover { color: #fff; }
.footer-icp { font-size: 12px; }

@media (max-width: 768px) {
    .footer-top { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 32px; }
    .footer-nav { flex-direction: column; gap: 32px; }
    .footer-bottom-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .layout { padding: 14px 12px; }
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
}
@media (max-width: 640px) {
    .nav-toggle { display: block; order: 2; margin-left: auto; }
    .site-nav { display: none; width: 100%; flex-direction: column; order: 4; }
    body.nav-open .site-nav { display: flex; }
    .site-nav .nav-login { margin-left: 0; }
    .post-card { flex-direction: column; }
    .post-card .post-thumb { width: 100%; height: 180px; }
    .article { padding: 18px; }
    .article h1 { font-size: 21px; }
    .author-card { display: none; } /* 博主卡仅 PC 首页 */
}

/* 语言切换器（前台，导航最右）——简洁分段控件 */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
    font-size: 13px;
    background: var(--green-025);
    flex: none;
}
.lang-switch a {
    padding: 3px 13px;
    border-radius: 999px;
    color: var(--g-600);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: .5px;
    line-height: 1.4;
    transition: color .2s, background .2s, box-shadow .2s;
}
.lang-switch a:hover { color: var(--green-700); background: var(--green-050); }
.lang-switch a.active {
    background: var(--accent, var(--green-600));
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
}

/* 文章页 上一篇/下一篇 导航 */
.post-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.post-nav a { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--green-025); transition: border-color .2s, background .2s; }
.post-nav a:hover { border-color: var(--green-500); background: var(--green-050); }
.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; }
.post-nav-empty { flex: 1; }
.post-nav-label { display: block; font-size: 12px; color: var(--g-600); margin-bottom: 4px; }
.post-nav-title { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
    .post-nav { flex-direction: column; }
}

/* ---------- 首页宣传区（官方站 Hero） ---------- */
.hero { margin-bottom: 26px; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, #2e7d46 0%, #1b5e2e 55%, #14532d 100%); color: #fff; position: relative; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 85% 20%, rgba(255,255,255,.12), transparent 55%); pointer-events: none; }
.hero-inner { position: relative; padding: 46px 34px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero-logo { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 6px 22px rgba(0,0,0,.28); margin-bottom: 4px; }
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: 1px; margin: 0; display: flex; align-items: baseline; gap: 10px; }
.hero-sub { font-size: 17px; font-weight: 600; color: #dcedc8; letter-spacing: 4px; }
.hero-slogan { font-size: 15px; color: #e8f5e9; margin: 0; }
.hero-desc { font-size: 13px; color: rgba(255,255,255,.72); margin: 0; }
.hero-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.hero-actions .btn { padding: 10px 22px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.hero-actions .btn:hover { transform: translateY(-1px); }
.btn-hero-primary { background: #fff; color: #1b5e2e; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.btn-hero-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-hero-ghost:hover { background: rgba(255,255,255,.2); }
@media (max-width: 640px) {
    .hero-inner { padding: 30px 18px 26px; }
    .hero-title { font-size: 26px; flex-direction: column; gap: 2px; }
}
