/* ===== CSS Custom Properties ===== */
:root {
    --color-bg: #0c0c0c;
    --color-surface: #161616;
    --color-surface-hover: #1e1e1e;
    --color-border: #222222;
    --color-text: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #707070;
    --color-accent: #8b5cf6;
    --color-accent-light: #a78bfa;
    --color-accent-glow: rgba(139, 92, 246, 0.15);
    --color-gradient-start: #8b5cf6;
    --color-gradient-end: #6366f1;
    --color-code-bg: #1e1e1e;
    --color-tag-bg: rgba(139, 92, 246, 0.1);
    --max-width: 1100px;
    --max-width-content: 720px;
    --nav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    padding-top: var(--nav-height);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-accent-light);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-accent);
}

/* ===== Navigation ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(12, 12, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.nav-brand span {
    color: var(--color-accent);
}

.nav-brand:hover {
    color: var(--color-text);
}

.nav-links {
    display: flex;
    gap: 32px;
    margin-left: auto;
}

.nav-link {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-link.active {
    color: var(--color-accent-light);
}

/* Hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.3s, opacity 0.3s;
    border-radius: 1px;
}

.hamburger {
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger::before { top: -6px; }
.hamburger::after  { top: 6px; }

/* ===== Container ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Hero Section ===== */
.hero {
    padding: 80px 0 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
    min-height: calc(60vh - var(--nav-height));
}

.hero-content {
    flex: 1;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--color-tag-bg);
    color: var(--color-accent-light);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.hero-title .highlight {
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin-bottom: 28px;
}

.hero-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-tag {
    padding: 6px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
}

.hero-visual {
    flex: 0 0 auto;
    position: relative;
}

.hero-avatar {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    position: relative;
    z-index: 1;
}

.hero-avatar::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    opacity: 0.4;
    filter: blur(30px);
    z-index: -1;
}

.hero-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--color-accent-glow);
    filter: blur(80px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

/* ===== Section Heading ===== */
.section-heading {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 36px;
    position: relative;
    display: inline-block;
}

.section-heading::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    border-radius: 2px;
}

/* ===== Post Grid (Home) ===== */
.posts-section {
    padding: 40px 0 80px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 28px;
    transition: border-color 0.25s, transform 0.25s, background 0.25s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: var(--color-surface-hover);
    transform: translateY(-2px);
}

.post-card .post-date {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
    font-weight: 500;
}

.post-card .post-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.post-card .post-title a {
    color: var(--color-text);
}

.post-card .post-title a:hover {
    color: var(--color-accent-light);
}

.post-card .post-summary {
    font-size: 0.92rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
}

.post-card .read-more {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-light);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s;
}

.post-card .read-more:hover {
    gap: 8px;
    color: var(--color-accent);
}

.no-posts {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    text-align: center;
    padding: 80px 0;
    grid-column: 1 / -1;
}

/* ===== Single Post ===== */
.post-full {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 60px 0 80px;
}

.post-header {
    margin-bottom: 40px;
    text-align: center;
}

.post-header .post-title {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.post-header .post-date {
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
}

.post-body {
    font-size: 1.08rem;
    line-height: 1.85;
    color: #d4d4d4;
}

.post-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 44px 0 14px;
    letter-spacing: -0.01em;
}

.post-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 32px 0 10px;
}

.post-body p {
    margin-bottom: 18px;
}

.post-body ul,
.post-body ol {
    margin-bottom: 18px;
    padding-left: 24px;
}

.post-body li {
    margin-bottom: 8px;
}

.post-body strong {
    font-weight: 600;
    color: var(--color-text);
}

.post-body a {
    color: var(--color-accent-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-body code {
    background: var(--color-code-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
    font-size: 0.88em;
    color: #e0e0e0;
}

.post-body pre {
    background: var(--color-code-bg);
    padding: 20px 24px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 22px;
    border: 1px solid var(--color-border);
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
    line-height: 1.7;
}

.post-body blockquote {
    border-left: 3px solid var(--color-accent);
    padding-left: 18px;
    margin: 20px 0;
    color: var(--color-text-secondary);
    font-style: italic;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 48px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: color 0.2s, gap 0.2s;
}

.back-link:hover {
    color: var(--color-accent-light);
    gap: 10px;
}

/* ===== About Page ===== */
.about-page {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 60px 0 80px;
}

.about-page .page-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 36px;
    text-align: center;
}

.about-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #d4d4d4;
}

.about-content p {
    margin-bottom: 16px;
}

.about-links {
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid var(--color-border);
}

.about-links h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.about-links ul {
    list-style: none;
    padding: 0;
}

.about-links li {
    margin-bottom: 8px;
}

.about-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    transition: all 0.2s;
}

.about-links a:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-light);
}

/* ===== 404 Page ===== */
.error-page {
    text-align: center;
    padding: 100px 0;
}

.error-code {
    font-size: 7rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}

.error-message {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
}

.error-page .back-link {
    justify-content: center;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 28px 24px;
    color: var(--color-text-tertiary);
    font-size: 0.82rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 48px 0;
        gap: 32px;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-tags {
        justify-content: center;
    }

    .hero-avatar {
        width: 140px;
        height: 140px;
        font-size: 2.5rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .post-header .post-title {
        font-size: 1.8rem;
    }

    .section-heading {
        font-size: 1.4rem;
    }
}

@media (max-width: 600px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(12, 12, 12, 0.95);
        backdrop-filter: blur(12px);
        flex-direction: column;
        gap: 0;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        padding: 15px 24px;
        border-top: 1px solid var(--color-border);
    }

    .hero {
        padding: 32px 0;
        min-height: auto;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .post-body {
        font-size: 1rem;
    }

    .error-code {
        font-size: 4.5rem;
    }

    .about-page .page-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 400px) {
    .hero-title {
        font-size: 1.55rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }
}
