/* KernelCode Blog — Front-end Modern Clean Theme
   Design System: Rounded, Card-based, Teal-primary
   Primary:  #009688   |  Surface: #ffffff  |  BG: #f0f4f8
   ============================================================
   ✅ [OPTIMIZATION-006] CSS变量化: 使用CSS变量集中管理设计系统
   原因: 减少代码重复，便于主题切换，提升可维护性
   性能提升: 减少编译后CSS体积，便于动态主题切换
   ============================================================ */
:root {
    --primary:       #009688;
    --primary-h:     #00796b;
    --primary-light: #e0f2f0;
    --accent:        #e53935;
    --accent-light:  #ffebee;
    --bg:            #f0f4f8;
    --surface:       #ffffff;
    --border:        #e2e8f0;
    --border-light:  #f1f5f9;
    --text:          #1a2332;
    --text-muted:    #64748b;
    --text-light:    #94a3b8;
    --radius-sm:     8px;
    --radius:        12px;
    --radius-lg:     16px;
    --radius-full:   9999px;
    --shadow-xs:     0 1px 2px rgba(0,0,0,.04);
    --shadow-sm:     0 2px 8px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
    --shadow:        0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
    --shadow-md:     0 8px 28px rgba(0,0,0,.10);
    --transition:    .2s ease;
}

/* ============================================================
   Base Reset
   ============================================================ */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table, caption,
tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    border: 0; font-family: inherit; font-size: 100%;
    font-style: inherit; margin: 0; outline: 0;
    padding: 0; vertical-align: baseline;
}

html {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    font-size: 62.5%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    height: 100%;
}

*, *:before, *:after {
    -webkit-box-sizing: inherit;
    box-sizing: inherit;
}

body, button, input, select, textarea {
    font: 14px -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.8;
    background: var(--bg);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-footer {
    margin-top: auto;
}

article, aside, details, figcaption, figure,
footer, header, main, nav, section { display: block; }

pre {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    line-height: 1.7;
    margin: 0 0 1.6em;
    max-width: 100%;
    overflow: auto;
    padding: 16px 20px;
    white-space: pre;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #f8fafc;
    font-size: 13px;
    position: relative;
}

ol, ul { list-style: none; }
dl  { margin-bottom: 1.6em; }
dt  { font-weight: bold; }
dd  { margin-bottom: 1.6em; }

table, th, td { border: 1px solid var(--border); }
table {
    border-collapse: separate;
    border-spacing: 0;
    border-width: 1px 0 0 1px;
    margin: 0 0 10px;
}
caption, th, td { font-weight: normal; text-align: left; }
th { border-width: 0 1px 1px 0; font-weight: 700; }
td { border-width: 0 1px 1px 0; }
th, td { padding: 8px 10px; }

blockquote:before, blockquote:after, q:before, q:after { content: ""; }
blockquote, q { -webkit-hyphens: none; -moz-hyphens: none; hyphens: none; quotes: none; }

a:hover, a:active { outline: 0; }
a img { border: 0; }
a { color: var(--text); text-decoration: none; transition: color var(--transition); }
a:visited { color: #475569; }
a:hover { color: var(--primary); }

.clear { clear: both; display: block; }
:focus { outline: 0; }
button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: none; }
a, button, input { -webkit-tap-highlight-color: rgba(255,0,0,0); }

@keyframes fade-in {
    0%   { opacity: 0; }
    40%  { opacity: 0; }
    100% { opacity: 1; }
}
@-webkit-keyframes fade-in {
    0%   { opacity: 0; }
    40%  { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Layout
   ============================================================ */
#content { 
    max-width: 1080px; 
    width: 100%; 
    margin: 0 auto 10px; 
    padding: 0 15px;
    box-sizing: border-box;
}
.header-sub { 
    max-width: 1080px; 
    width: 100%; 
    margin: 0 auto; 
    padding: 0 15px;
    box-sizing: border-box;
}

/* ============================================================
   Top Info Bar
   ============================================================ */
#top-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.top-nav {
    height: 34px; 
    max-width: 1080px; 
    width: 100%; 
    line-height: 34px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
}

.top-menu {
    display: flex;
    margin: 0;
    gap: 2px;
}

.top-menu li {
    list-style: none;
    display: inline-flex;
    align-items: center;
}

.top-menu a {
    color: var(--text-muted);
    font-size: 12.5px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 4px;
    transition: color 0.2s ease;
    text-decoration: none;
}

.top-menu a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.top-sep {
    color: var(--border);
    margin: 0 2px;
}

.user-login {
    float: left;
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
}

.user-login a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 4px 8px;
    border-radius: 3px;
}

.user-login a:hover {
    color: var(--primary);
}

/* ============================================================
   Main Nav Bar
   ============================================================ */

#masthead {
    height: auto;
    transition: height var(--transition);
}

#menu-box {
    background: var(--surface);
    width: 100%;
    z-index: 999;
    right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#menu-box.shadow {
    top: 0;
    position: fixed;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

#top-menu {
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition-duration: 0.5s;
    padding: 0 15px;
    box-sizing: border-box;
    height: 64px;
}

.shadow #top-menu {
    margin: 0 auto;
}

/* Logo */
.logo-site, .logo-sites {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 20px 0 0;
    transition: none;
    order: 2;
}

.logo-site img, .logo-sites img {
    width: 220px;
    max-height: 46px;
    object-fit: contain;
}

@media screen and (max-width: 480px) {
    .logo-site, .logo-sites {
        margin: 0 12px 0 0;
    }
    
    .logo-site img, .logo-sites img {
        width: 140px;
    }
}

/* 站名现代文字效果 */
@keyframes title-glow {
    0%, 100% {
        text-shadow: 0 0 18px rgba(0, 150, 136, 0.22), 0 2px 8px rgba(0, 150, 136, 0.10);
    }
    50% {
        text-shadow: 0 0 32px rgba(0, 150, 136, 0.38), 0 4px 16px rgba(0, 150, 136, 0.18);
    }
}

@keyframes cursor-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.site-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin: 0;
}

.site-title a {
    background: linear-gradient(135deg, #00796b 0%, var(--primary) 45%, #26c6da 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: filter var(--transition);
    animation: title-glow 3s ease-in-out infinite;
    position: relative;
    text-decoration: none;
}

.site-title a::after {
    content: '|';
    -webkit-text-fill-color: var(--primary);
    opacity: 1;
    margin-left: 2px;
    font-weight: 300;
    animation: cursor-blink 1.1s step-end infinite;
}

.site-title a:hover {
    filter: brightness(1.12) saturate(1.15);
}

/* 副标题装饰 */
.site-description {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.2;
}

.site-description::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    opacity: 0.7;
}

.site-name {
    display: none;
}

/* Main nav menu */
.main-nav {
    display: flex;
    align-items: center;
    margin: 0;
    gap: 0;
}

.nav-menu, .nav-menu * {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-menu li {
    position: relative;
    white-space: nowrap;
}

.nav-menu ul {
    position: absolute;
    display: none;
    top: 100%;
    left: 0;
    z-index: 10001;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: dropdown-in 0.2s ease;
}

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

.nav-menu > li {
    float: left;
}

.nav-menu li:hover > ul, .nav-menu li.sfHover > ul {
    display: block;
}

.nav-menu a {
    display: block;
    position: relative;
    zoom: 1;
    text-decoration: none;
}

.nav-menu ul ul {
    top: 0;
    left: 100%;
}

.nav-menu li:hover, .nav-menu li.sfHover {
    transition: none;
}

#site-nav-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    order: 3;
    margin-left: auto;
}

#site-nav {
    display: flex;
    align-items: center;
    width: auto;
}

.menu-pcmenu-container {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#site-nav .down-menu {
    display: flex !important;
    align-items: center;
    gap: 2px !important;
}

#site-nav .down-menu li {
    display: flex;
    align-items: center;
    height: auto;
    float: none;
}

#site-nav .down-menu a {
    padding: 8px 12px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

#site-nav .down-menu a i {
    font-size: 14px;
}

/* ✅ [OPTIMIZATION-024] 菜单按钮悬停效果优化: 与登录按钮保持一致
   原因: 文章归档等按钮悬停效果应与登录、注册按钮一致
   性能提升: 统一用户体验，减少视觉混乱 */
#site-nav .down-menu > li > a:hover,
#site-nav .down-menu > li.sfHover > a {
    color: #fff !important;
    background: var(--primary) !important;
    border-radius: 6px;
}

#site-nav .down-menu > .current-menu-item > a,
#site-nav .down-menu > .current-menu-item > a:hover {
    color: var(--primary);
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
    transition: none;
}

#site-nav .down-menu ul {
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

#site-nav .down-menu ul li {
    background: var(--surface);
    line-height: 1.4em;
    height: auto;
    float: none;
    display: block;
    border-top: 1px solid var(--border-light);
    border-left: none;
    border-right: none;
    white-space: nowrap;
}

#site-nav .down-menu ul li a {
    white-space: nowrap;
}

#site-nav .down-menu ul a {
    display: flex;
    align-items: center;
    gap: 6px;
    height: auto;
    line-height: 1.6;
    padding: 10px 20px;
    margin: 0;
    border: 0;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

#site-nav .down-menu ul li > a:hover {
    color: #fff;
    background: var(--primary);
    border-radius: 4px;
}

.sidr, #sidr-close, #mobile-search {
    display: none;
}

#navigation-toggle {
    display: none;
}

#navigation-toggle .fa-bars {
    display: none;
}

/* Dropdown arrows */
.sf-arrows .sf-with-ul {
    padding-right: 2.5em;
}

.sf-arrows .sf-with-ul::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.6;
    transition: none;
}

#sidr-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 999998;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    animation: fade-in .2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

#sidr-overlay.active {
    display: block;
    pointer-events: auto;
}

#sidr-main {
    position: fixed; top: 0; left: -320px; height: 100%;
    z-index: 999999;
    width: 280px;
    overflow-x: hidden; overflow-y: auto;
    background: #0f1117;
    display: none;
    box-shadow: 8px 0 40px rgba(0,0,0,.5);
    box-sizing: border-box;
}
.sidr.right { left: auto; right: -320px; }
.sidr.left  { left: -320px; right: auto; }

.sidr-class-toggle-sidr-close {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    height: 64px;
    background: #0f1117;
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky; top: 0; z-index: 1;
    cursor: pointer;
    font-size: 0; color: transparent;
}
.sidr-class-toggle-sidr-close::before {
    content: '\f0c9\00a0\00a0 导航菜单';
    font-family: FontAwesome, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; font-weight: 600; color: rgba(255,255,255,.9);
    letter-spacing: .5px;
}
.sidr-class-toggle-sidr-close::after {
    content: '×';
    font-size: 22px; font-weight: 300; color: rgba(255,255,255,.4);
    line-height: 1; transition: color .2s;
}
.sidr-class-toggle-sidr-close:hover::after { color: rgba(255,255,255,.9); }

#sidr-main a {
    color: rgba(255,255,255,.85);
    transition: background .2s, color .2s;
    text-decoration: none;
}

#sidr-main .sidr-class-bars { display: none !important; }

#sidr-main .sidr-class-nav-menu { margin: 8px 0 40px; padding: 0 8px; }
#sidr-main .sidr-class-nav-menu > li {
    display: block; float: none;
    height: auto; line-height: 1;
    border-radius: 8px;
    margin-bottom: 2px;
}
#sidr-main .sidr-class-nav-menu > li > a {
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    height: 48px;
    font-size: 14px; font-weight: 500;
    color: rgba(255,255,255,.8);
    border-radius: 8px;
    transition: color 0.2s;
}
#sidr-main .sidr-class-nav-menu > li > a:hover,
#sidr-main .sidr-class-nav-menu > li > a:active {
    color: #fff;
}
#sidr-main .sidr-class-nav-menu > li > a .fa {
    width: 18px; text-align: center;
    color: rgba(255,255,255,.4); font-size: 14px;
    transition: color .2s; flex-shrink: 0;
}
#sidr-main .sidr-class-nav-menu > li > a:hover .fa { color: rgba(255,255,255,.8); }

/* ============================================================
   Search Button & Modal
   ============================================================ */
.nav-search {
    background: transparent; color: var(--text-muted);
    line-height: 30px; margin: 17px 12px 0; padding: 0 12px 2px;
    cursor: pointer; border-radius: var(--radius-full);
      border: 1.5px solid var(--border);
      transition: color var(--transition), border-color var(--transition);
      font-size: 13px;
      display: flex; align-items: center; gap: 6px;
      order: 1;
  }

.searchbar { width: 100%; }
.searchbar span { display: flex; }
.searchbar span input {
    flex: 1; height: 42px; line-height: 42px;
    font: 14px "PingFang SC", "Microsoft YaHei", Helvetica;
    padding: 0 14px; background: #f1f5f9;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); -webkit-appearance: none;
    transition: border-color var(--transition), box-shadow var(--transition); outline: none;
}
.searchbar span input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,150,136,.12);
}
.searchbar button {
    height: 42px; padding: 0 20px;
    color: #fff; background: var(--primary);
    border: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    transition: background var(--transition);
}
.searchbar button:hover { background: var(--primary-h); }

/* ============================================================
