/* CZG 星际博客 - 基础样式（变量 / 星空背景 / 导航 / 通用组件）
   前后台共用；前台页面见 home.css，后台见 czgblog.css */

:root {
    /* 配色 */
    --bg-deep: #050816;
    --bg-panel: rgba(var(--bg-panel-rgb), .72);
    --bg-panel-solid: #0d1226;
    --bg-input: rgba(var(--bg-input-rgb), .85);
    --neon: #00e5ff;
    --neon-dim: rgba(var(--neon-rgb), .18);
    --nebula: #7c4dff;
    --nebula-dim: rgba(var(--nebula-rgb), .16);
    --text-main: #e2e8f0;
    --text-sub: #7a86a8;
    --text-faint: #4a5578;
    --border-dim: rgba(var(--neon-rgb), .18);
    --danger: #ff5c7a;
    --success: #38e8a0;

    /* 主题化辅助变量：前台 / 后台主题包通过覆盖这些变量实现换肤 */
    --neon-rgb: 0, 229, 255;                 /* 主色 RGB（用于透明叠加） */
    --neon-bright: #6ff1ff;                  /* 主色亮阶（链接 hover 等） */
    --nebula-rgb: 124, 77, 255;              /* 辅色 RGB */
    --bg-deep-rgb: 5, 8, 22;                 /* 页面底色 RGB */
    --bg-panel-rgb: 13, 18, 38;              /* 面板实底 RGB */
    --bg-shell-rgb: 7, 11, 26;               /* 侧栏 / 外壳 RGB */
    --bg-input-rgb: 7, 12, 28;               /* 输入框 / 代码块 RGB */
    --muted-rgb: 122, 134, 168;              /* 次要描边 / 分隔线 RGB */
    --hud-hi-rgb: 200, 247, 255;             /* HUD 高亮 RGB */
    --accent-ink: #050816;                   /* 渐变按钮上的文字色 */

    /* HUD 全息辅助色（后台科幻风，见 czgblog.css HUD 层） */
    --hud-hi: #c8f7ff;                       /* 高亮蓝白：标题 / 数值 */
    --hud-grid: rgba(var(--neon-rgb), .045);     /* 全息网格线 */
    --hud-line: rgba(var(--neon-rgb), .35);      /* 角标 / 虚线描边 */

    /* 字体 */
    --font-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;

    /* 尺寸 */
    --radius: 10px;
    --radius-lg: 16px;
    --header-h: 64px;
    --container-w: 1200px;
}

/* ---------- 重置 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-deep);
    /* 多层星云：青 / 紫低透明度大团 */
    background-image:
        radial-gradient(ellipse 80% 55% at 12% -8%, rgba(var(--neon-rgb), .10), transparent 60%),
        radial-gradient(ellipse 70% 50% at 92% 12%, rgba(var(--nebula-rgb), .12), transparent 62%),
        radial-gradient(ellipse 90% 60% at 50% 118%, rgba(var(--neon-rgb), .07), transparent 65%),
        radial-gradient(ellipse 40% 35% at 68% 42%, rgba(var(--nebula-rgb), .05), transparent 60%);
    background-attachment: fixed;
    background-size: 160% 160%;
    animation: nebula-drift 120s ease-in-out infinite alternate;
    min-height: 100vh;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--neon);
    text-decoration: none;
    transition: color .2s, text-shadow .2s;
}

a:hover {
    color: var(--neon-bright);
    text-shadow: 0 0 12px rgba(var(--neon-rgb), .45);
}

ul,
ol {
    list-style: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

::selection {
    background: rgba(var(--neon-rgb), .30);
    color: #fff;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: #070b1c;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(var(--neon-rgb), .45), rgba(var(--nebula-rgb), .45));
    border-radius: 6px;
}

/* ---------- 星点层 ---------- */
.stars-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-repeat: repeat;
}

.stars-1 {
    background-image:
        radial-gradient(1.2px 1.2px at 17px 31px, rgba(255, 255, 255, .9), transparent),
        radial-gradient(1px 1px at 113px 67px, rgba(190, 235, 255, .8), transparent),
        radial-gradient(1.4px 1.4px at 211px 141px, rgba(255, 255, 255, .75), transparent),
        radial-gradient(1px 1px at 67px 199px, rgba(190, 235, 255, .65), transparent),
        radial-gradient(1.2px 1.2px at 283px 23px, rgba(255, 255, 255, .8), transparent),
        radial-gradient(1px 1px at 43px 281px, rgba(190, 235, 255, .7), transparent);
    background-size: 320px 320px;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.stars-2 {
    background-image:
        radial-gradient(1px 1px at 41px 97px, rgba(255, 255, 255, .55), transparent),
        radial-gradient(1.4px 1.4px at 199px 33px, rgba(200, 190, 255, .6), transparent),
        radial-gradient(1px 1px at 151px 217px, rgba(255, 255, 255, .5), transparent),
        radial-gradient(1.2px 1.2px at 257px 173px, rgba(200, 190, 255, .55), transparent),
        radial-gradient(1px 1px at 83px 261px, rgba(255, 255, 255, .45), transparent);
    background-size: 300px 300px;
    animation: twinkle 7s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
    from { opacity: .35; }
    to   { opacity: .95; }
}

@keyframes nebula-drift {
    from { background-position: 0% 0%, 100% 0%, 50% 100%, 70% 40%; }
    to   { background-position: 8% 4%, 92% 6%, 48% 96%, 74% 46%; }
}

/* 减少动效偏好：关闭动画 */
@media (prefers-reduced-motion: reduce) {
    body,
    .stars-1,
    .stars-2 {
        animation: none;
    }
    html {
        scroll-behavior: auto;
    }
}

/* ---------- 布局容器 ---------- */
.container {
    width: min(var(--container-w), 100% - 2.5rem);
    margin-inline: auto;
}

/* ---------- 顶栏 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(var(--bg-deep-rgb), .78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-dim);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .02em;
    flex-shrink: 0;
}

.logo:hover {
    color: var(--text-main);
    text-shadow: none;
}

.logo-mark {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    background:
        conic-gradient(from 45deg, var(--neon), var(--nebula), var(--neon));
    clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
    filter: drop-shadow(0 0 6px rgba(var(--neon-rgb), .55));
    animation: logo-spin 14s linear infinite;
}

@keyframes logo-spin {
    to { transform: rotate(360deg); }
}

.logo-text {
    background: linear-gradient(90deg, var(--neon) 10%, var(--nebula) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.35rem;
    flex-wrap: wrap;
}

.site-nav > a {
    color: var(--text-sub);
    font-size: .95rem;
    position: relative;
    padding-block: .3rem;
}

.site-nav > a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon), var(--nebula));
    transition: width .25s;
}

.site-nav > a:hover {
    color: var(--text-main);
    text-shadow: none;
}

.site-nav > a:hover::after {
    width: 100%;
}

.nav-search {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.nav-search input {
    width: 150px;
    padding: .38rem .8rem;
    font-size: .85rem;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    border-radius: 999px;
    outline: none;
    transition: width .3s, border-color .3s, box-shadow .3s;
}

.nav-search input:focus {
    width: 200px;
    border-color: rgba(var(--neon-rgb), .55);
    box-shadow: 0 0 0 3px rgba(var(--neon-rgb), .12);
}

.nav-search button {
    padding: .32rem .85rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--neon);
    background: transparent;
    border: 1px solid var(--border-dim);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s, color .2s, box-shadow .2s;
}

.nav-search button:hover {
    background: rgba(var(--neon-rgb), .12);
    box-shadow: 0 0 14px rgba(var(--neon-rgb), .3);
}

/* 汉堡按钮（移动端） */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, var(--neon), var(--nebula));
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 主体 ---------- */
.site-main {
    padding: 2rem 0 3rem;
    min-height: calc(100vh - var(--header-h) - 160px);
}

/* ---------- 页脚 ---------- */
.site-footer {
    border-top: 1px solid var(--border-dim);
    background: rgba(var(--bg-deep-rgb), .6);
    padding: 1.6rem 0 2rem;
    text-align: center;
    color: var(--text-faint);
    font-size: .85rem;
}

.footer-sub {
    margin-bottom: .4rem;
    color: var(--text-sub);
}

.site-footer a {
    color: var(--text-sub);
}

/* ---------- 通用面板（玻璃拟态） ---------- */
.glass-panel,
.side-panel,
.comment-form-panel,
.about-panel,
.flash-message,
.article-page,
.article-card {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-lg);
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--text-main);
    margin-bottom: 1rem;
    padding-left: .7rem;
    position: relative;
}

.panel-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12%;
    height: 76%;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--neon), var(--nebula));
    box-shadow: 0 0 8px rgba(var(--neon-rgb), .5);
}

/* ---------- 霓虹按钮 ---------- */
.btn-neon {
    display: inline-block;
    padding: .55rem 1.5rem;
    font-size: .92rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--neon);
    background: rgba(var(--neon-rgb), .06);
    border: 1px solid rgba(var(--neon-rgb), .4);
    border-radius: 999px;
    cursor: pointer;
    transition: all .25s;
}

.btn-neon:hover,
.btn-neon:focus-visible {
    background: rgba(var(--neon-rgb), .15);
    border-color: var(--neon);
    box-shadow: 0 0 18px rgba(var(--neon-rgb), .35);
    text-shadow: 0 0 8px rgba(var(--neon-rgb), .6);
    outline: none;
}

/* ---------- 表单基础 ---------- */
.form-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .9rem;
}

.form-field label {
    font-size: .85rem;
    color: var(--text-sub);
}

.form-field input,
.form-field textarea,
.form-field select {
    padding: .6rem .85rem;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: rgba(var(--neon-rgb), .55);
    box-shadow: 0 0 0 3px rgba(var(--neon-rgb), .12);
}

.form-field textarea {
    resize: vertical;
    min-height: 90px;
}

/* honeypot：视觉隐藏 */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ---------- 提示条 ---------- */
.flash-message {
    padding: .8rem 1.1rem;
    margin-bottom: 1.4rem;
    border-left: 3px solid var(--neon);
    color: var(--text-main);
    font-size: .92rem;
}

/* ---------- 响应式（移动优先断点，前后台共用） ---------- */

/* 平板以下：隐藏横向导航，启用汉堡 */
@media (max-width: 767px) {
    .nav-toggle {
        display: flex;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(var(--bg-deep-rgb), .96);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border-dim);
        padding: .5rem 1.25rem 1.1rem;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav > a {
        padding: .8rem .4rem;
        font-size: 1rem;
        border-bottom: 1px dashed rgba(var(--muted-rgb), .18);
    }

    .site-nav > a::after {
        display: none;
    }

    .nav-search {
        padding: .8rem .4rem .2rem;
    }

    .nav-search input,
    .nav-search input:focus {
        width: 100%;
        flex: 1;
    }
}

/* ---------- 主题切换通用组件（前台 / 后台菜单共用） ---------- */
.theme-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon), var(--nebula));
    box-shadow: 0 0 8px rgba(var(--neon-rgb), .6);
}

.theme-swatch {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background:
        radial-gradient(circle at 30% 30%, var(--sw-main), transparent 58%),
        linear-gradient(135deg, var(--sw-bg) 42%, var(--sw-alt));
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, .22);
}

.theme-option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.theme-option-text strong {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-main);
}

.theme-option-text small {
    font-size: .72rem;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-option-check {
    margin-left: auto;
    color: var(--neon);
    font-size: .85rem;
}

