:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --border: #e5e7eb;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --header-bg: rgba(255, 255, 255, 0.9);
}

body.dark {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f8fafc;
    --muted: #cbd5e1;
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --border: #334155;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    --header-bg: rgba(15, 23, 42, 0.9);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

img {
    max-width: 100%;
    display: block;
    border-radius: 12px;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
}

.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 72px;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    font-size: 1.1rem;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    display: grid;
    place-items: center;
    font-weight: bold;
    box-shadow: var(--shadow);
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text);
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.theme-btn {
    border: none;
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.theme-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
}

main {
    padding-top: 110px;
    padding-bottom: 60px;
}

.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 40px;
}

.hero-card,
.side-card,
.card,
.article-layout,
.about-grid,
.tag-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero-card,
.side-card,
.tag-panel {
    padding: 28px;
}

.hero-title {
    font-size: 2.2rem;
    margin: 0 0 12px;
}

.hero-subtitle {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: bold;
    transition: transform 0.2s ease, background 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    transform: translateY(-2px);
}

.section-title {
    font-size: 1.7rem;
    margin: 0 0 20px;
}

.section-subtitle {
    color: var(--muted);
    margin-bottom: 24px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.card {
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}

.card-content {
    padding: 18px;
}

.card-meta,
.meta-line,
.tag-list,
.contact-list {
    color: var(--muted);
    font-size: 0.95rem;
}

.card h3,
.article-title {
    margin-top: 0;
}

.cover {
    height: 200px;
    object-fit: cover;
    width: 100%;
    border-radius: 0;
}

.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.badge {
    display: inline-block;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: bold;
}

.article-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    padding: 24px;
}

.article-body p {
    line-height: 1.9;
    color: var(--text);
}

.article-body h2 {
    margin-top: 28px;
}

.sidebar-box {
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 18px;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tag-panel h3 {
    margin-top: 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    padding: 28px;
}

.avatar {
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    object-fit: cover;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

.about-text p {
    line-height: 1.8;
    color: var(--text);
}

.contact-list li,
.tag-panel li,
.sidebar-box li {
    margin-bottom: 10px;
}

.list-clean {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer {
    text-align: center;
    color: var(--muted);
    padding: 24px 0 40px;
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.show {
    opacity: 1;
    transform: translateY(0);
}

#topBtn {
    position: fixed;
    right: 22px;
    bottom: 22px;
    border: none;
    background: var(--primary);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    box-shadow: var(--shadow);
    font-size: 1.1rem;
}

@media (max-width: 900px) {
    .hero,
    .article-layout,
    .about-grid {
        grid-template-columns: 1fr;
    }

    .posts-grid,
    .tags-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 640px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 0;
    }

    .nav-links {
        width: 100%;
        gap: 12px;
    }

    .posts-grid,
    .tags-grid {
        grid-template-columns: 1fr;
    }

    main {
        padding-top: 140px;
    }

    .hero-card,
    .side-card,
    .tag-panel,
    .about-grid,
    .article-layout {
        padding: 18px;
    }

    .hero-title {
        font-size: 1.5rem;
    }
}