/* ============================================
   SummerPower Blog - Butterfly-inspired Theme
   ============================================ */

:root {
    --bg-body: #0d1117;
    --bg-card: #161b22;
    --bg-code: #1c2128;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #79c0ff; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 999;
    backdrop-filter: blur(12px);
    background: rgba(13, 17, 23, 0.85);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
}
.navbar-inner {
    display: flex;
    align-items: center;
    height: 56px;
}
.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary) !important;
    margin-right: auto;
}
.navbar-brand i { color: var(--accent); margin-right: 6px; }
.navbar-links { display: flex; gap: 4px; }
.navbar-links a {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.navbar-links a:hover, .navbar-links a.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}
.navbar-links a i { margin-right: 4px; }

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    margin-left: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

/* ---- Hero Banner ---- */
.hero, .post-hero {
    position: relative;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 56px;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    opacity: 0.85;
}
.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 60%);
}
.hero-content {
    position: relative;
    text-align: center;
    z-index: 2;
}
.hero-title {
    font-size: 2.5em;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    margin-bottom: 12px;
}
.hero-subtitle {
    font-size: 1.1em;
    color: rgba(255,255,255,0.85);
    min-height: 28px;
}
.hero-wave {
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    z-index: 3;
}
.hero-wave svg { display: block; width: 100%; height: 60px; }

.post-meta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    margin-top: 8px;
}
.post-meta i { margin-right: 4px; }

/* ---- Content Layout ---- */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    padding: 32px 0;
}

/* ---- Article Cards ---- */
.articles-list { display: flex; flex-direction: column; gap: 20px; }

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: row;
}
.article-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.article-card-cover {
    width: 240px;
    min-height: 180px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(255,255,255,0.5);
}
.article-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.article-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}
.article-card-title a {
    color: var(--text-primary);
}
.article-card-title a:hover { color: var(--accent); }

.article-card-summary {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.article-card-footer i { margin-right: 3px; }

.article-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 4px;
    font-size: 12px;
}

/* ---- Sidebar ---- */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.sidebar-card h4 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.sidebar-card h4 i { margin-right: 6px; color: var(--accent); }

.author-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
}
.sidebar-card h3 { text-align: center; font-size: 16px; margin-bottom: 4px; }
.author-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}
.author-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.author-stats .stat-item .stat-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}
.author-stats .stat-item .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.tag-item:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ---- Post Content ---- */
.post-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    line-height: 1.8;
    font-size: 15px;
}
.post-content h1 { font-size: 26px; margin: 28px 0 14px; }
.post-content h2 {
    font-size: 22px;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 18px; margin: 20px 0 10px; }
.post-content p { margin: 14px 0; }
.post-content img { max-width: 100%; border-radius: 8px; margin: 14px 0; }
.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 10px 20px;
    margin: 16px 0;
    color: var(--text-secondary);
    background: var(--bg-code);
    border-radius: 0 8px 8px 0;
}
.post-content code {
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.post-content pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}
.post-content pre code {
    background: none;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
}
.post-content ul, .post-content ol {
    padding-left: 24px;
    margin: 12px 0;
}
.post-content li { margin: 4px 0; }
.post-content a { color: var(--accent); border-bottom: 1px dashed var(--accent); }
.post-content a:hover { border-bottom-style: solid; }
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.post-content th, .post-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    font-size: 14px;
}
.post-content th { background: var(--bg-code); }

.post-info { font-size: 13px; color: var(--text-secondary); }
.post-info p { margin: 6px 0; }
.post-info i { width: 18px; color: var(--accent); }

.post-toc a {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all 0.2s;
}
.post-toc a:hover, .post-toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
}
.post-toc a.toc-h3 { padding-left: 24px; font-size: 12px; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-bottom: 20px;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Footer ---- */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.footer p { margin: 4px 0; }
.footer a { color: var(--accent); }

/* ---- Loading ---- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 15px;
}
.loading i { margin-right: 8px; }

/* ---- Card (generic) ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    .sidebar { order: -1; }
    .hero-title { font-size: 1.8em; }
    .article-card { flex-direction: column; }
    .article-card-cover { width: 100%; min-height: 140px; }
    .post-content { padding: 20px; }
}

/* ---- Scroll to Top ---- */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    z-index: 99;
    box-shadow: var(--shadow);
}
.scroll-top.visible { opacity: 1; }
.scroll-top:hover { transform: scale(1.1); }
