/* ============================================================
   Index 站样式
   - 颜色变量由 main.js 根据 _config.yml 的 theme.{light|dark} 注入
   - 设计参考 anzhiyu：温暖、卡片化、不冷硬
   ============================================================ */

/* ---------- 基础设计常量（不随主题变）---------- */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN",
                 "Noto Sans CJK SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas,
                 "Cascadia Code", "Source Code Pro", monospace;

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    --t-fast: 0.18s cubic-bezier(.4,0,.2,1);
    --t-base: 0.28s cubic-bezier(.4,0,.2,1);
}

/* main.js 注入的主题变量都挂在 [data-theme="..."] 上 */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    /* sticky footer：列布局 + main flex:1，让 footer 永远贴底 */
    display: flex;
    flex-direction: column;
    transition: background var(--t-base), color var(--t-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }
ul { list-style: none; }
button {
    font: inherit; color: inherit; background: none; border: none; cursor: pointer;
}
img { max-width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(150%) blur(12px);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: inline-flex; align-items: center; gap: 0.55rem;
    color: var(--text); font-weight: 600;
    transition: color var(--t-fast);
}
.brand:hover { color: var(--accent); }
.brand-icon {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-strong);
    transition: border-color var(--t-fast);
}
.brand:hover .brand-icon { border-color: var(--accent); }
.brand-text { letter-spacing: 0.02em; }

.nav { display: flex; align-items: center; gap: 1.2rem; margin-left: auto; margin-right: 1rem; }
.nav a {
    color: var(--text-muted); font-size: 0.94rem;
    padding: 0.3rem 0.1rem; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* @bc/auth-ui topbar 元素 */
.bc-auth-user {
    color: var(--text-muted); font-size: 0.94rem;
    text-decoration: none;
}
.bc-auth-user:hover { color: var(--text); }
.bc-auth-user .role {
    font-size: 0.7rem;
    padding: 1px 6px;
    margin-left: 0.4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.bc-auth-login, .bc-auth-logout, .bc-auth-register { cursor: pointer; }

.theme-btn {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--t-fast);
}
.theme-btn:hover { background: var(--surface-alt); }
[data-theme="dark"]  .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark  { display: none; }

/* ---------- 主容器 ---------- */
main {
    flex: 1;                           /* sticky footer：占满 body 剩余高度 */
    width: 100%;
    max-width: 1100px; margin: 0 auto;
    padding: 0 1.5rem 4rem;
    /* 列布局，让带 flex:1 的子项能正确撑满高度居中 */
    display: flex;
    flex-direction: column;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    margin: 3rem 0 2.5rem;
    padding: 4.5rem 2.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-grad {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at top left,
                  color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 55%),
                radial-gradient(ellipse at bottom right,
                  color-mix(in srgb, var(--warm) 18%, transparent) 0%, transparent 60%);
}
.hero-blob {
    position: absolute; border-radius: 50%;
    filter: blur(60px); opacity: .35;
}
.hero-blob-1 {
    width: 320px; height: 320px;
    background: var(--accent);
    top: -80px; right: -40px;
    animation: float 14s ease-in-out infinite;
}
.hero-blob-2 {
    width: 260px; height: 260px;
    background: var(--warm);
    bottom: -100px; left: 10%;
    animation: float 18s ease-in-out infinite reverse;
}
@keyframes float {
    0%,100% { transform: translate(0,0); }
    50%     { transform: translate(20px,30px); }
}
.hero-content { position: relative; }
.hero-title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 0.7rem;
}
.typewriter { color: var(--text); }
.caret {
    display: inline-block;
    color: var(--accent);
    margin-left: 2px;
    font-weight: 300;
    /* | 字符天然偏顶，向下挪一点视觉对齐文字基线 */
    transform: translateY(1px);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.hero-tagline  { font-size: 0.95rem; color: var(--text-dim);   margin-bottom: 1.8rem; }
.hero-actions  { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 500;
    transition: transform var(--t-fast), background var(--t-fast),
                box-shadow var(--t-fast), color var(--t-fast),
                border-color var(--t-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: var(--accent); color: #fff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost {
    background: var(--surface-alt); color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-color: var(--accent);
}

/* ---------- 公告 ---------- */
.news {
    display: flex; gap: 1rem; align-items: center;
    padding: 1.1rem 1.4rem;
    margin-bottom: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}
.news-icon { font-size: 1.4rem; flex: 0 0 auto; }
.news-body { min-width: 0; }
.news-time { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); margin-bottom: 2px; }
.news-text { font-size: 0.95rem; color: var(--text); }

/* ---------- 区块通用 ---------- */
.section-head { margin-bottom: 1.5rem; }
.section-head h2 {
    font-size: 1.5rem; font-weight: 600;
    margin-bottom: 0.3rem;
    display: inline-flex; align-items: center;
}
.section-head h2::before {
    content: ''; display: inline-block;
    width: 4px; height: 1.2em;
    background: var(--accent); border-radius: 2px;
    margin-right: 0.6rem; vertical-align: middle;
}
.section-sub { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- 子站矩阵 ---------- */
.sites { margin-bottom: 3rem; }
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}
.site-card {
    position: relative;
    padding: 1.4rem 1.3rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform var(--t-base), box-shadow var(--t-base),
                border-color var(--t-base);
    overflow: hidden;
}
.site-card::before {
    content: ''; position: absolute; inset: 0;
    border-radius: inherit; pointer-events: none;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 60%);
    opacity: 0; transition: opacity var(--t-base);
}
.site-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px color-mix(in srgb, var(--text) 18%, transparent);
    border-color: var(--border-strong);
}
.site-card:hover::before { opacity: 1; }
.site-emoji { font-size: 2rem; margin-bottom: 0.6rem; }
.site-name {
    font-size: 1.15rem; font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.site-desc {
    font-size: 0.88rem; color: var(--text-muted);
    line-height: 1.55; margin-bottom: 1rem;
    min-height: 2.7em;
}
.site-meta {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.7rem;
}
.status-dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-dim);
}
.site-card[data-status="online"]   .status-dot { background: var(--good); animation: pulse 2.4s ease-in-out infinite; }
.site-card[data-status="offline"]  .status-dot { background: var(--bad); }
.site-card[data-status="checking"] .status-dot { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.site-card[data-status="soon"]     .status-dot { background: transparent; border: 1px dashed var(--text-dim); }
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
    70%  { box-shadow: 0 0 0 6px transparent; opacity: .6; }
    100% { box-shadow: 0 0 0 0 transparent;   opacity: 1; }
}
.status-text { color: var(--text-muted); }
.site-card[data-status="online"]   .status-text { color: var(--good); }
.site-card[data-status="offline"]  .status-text { color: var(--bad); }
.site-card[data-status="checking"] .status-text { color: var(--warn); }
.site-link { margin-left: auto; color: var(--accent); font-weight: 500; }
.site-link-soon {
    color: var(--text-dim);
    font-weight: 400;
    border-bottom: 1px dashed currentColor;
    transition: color var(--t-fast);
}
.site-link-soon:hover { color: var(--warm); border-bottom-color: var(--warm); }
.site-card[data-status="soon"] { opacity: 0.7; }
.site-card[data-status="soon"]:hover { opacity: 0.9; }

/* ---------- Footer ---------- */
.footer {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.2rem 1.5rem;
}
.footer-inner {
    max-width: 1100px; margin: 0 auto;
    display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap;
    gap: 0.6rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.footer-mono { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 6px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--text); }

/* ---------- 移动端 ---------- */
@media (max-width: 540px) {
    .topbar { padding: 0.7rem 1rem; }
    .nav { gap: 0.7rem; }
    .nav a { font-size: 0.88rem; }
    .hero { padding: 3rem 1.5rem; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .btn { justify-content: center; }
}
