@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --bg: #0b0f14;
    --bg-alt: #0f1621;
    --surface: #111927;
    --surface-strong: #142033;
    --border: #1e2a3a;
    --text-primary: #e6edf3;
    --text-secondary: #a1acb9;
    --text-muted: #7d8896;
    --accent: #5cc8ff;
    --accent-strong: #7dd3fc;
    --accent-soft: rgba(92, 200, 255, 0.16);
    --shadow: 0 18px 36px rgba(7, 12, 18, 0.45);

    --article-max-width: 880px;
    --code-bg: #0f1724;
    --code-border: #1c293a;
    --blockquote-border: rgba(92, 200, 255, 0.7);
    --table-border: #223146;

    --font-sans: 'IBM Plex Sans', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    --font-display: 'Space Grotesk', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f7f9fc;
        --bg-alt: #eef2f7;
        --surface: #ffffff;
        --surface-strong: #f5f7fb;
        --border: #d9e1ee;
        --text-primary: #0b1220;
        --text-secondary: #324055;
        --text-muted: #5d6b7b;
        --accent: #2f7de1;
        --accent-strong: #2b6bd6;
        --accent-soft: rgba(47, 125, 225, 0.16);
        --shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
        --code-bg: #f1f5fb;
        --code-border: #d9e1ee;
        --blockquote-border: rgba(47, 125, 225, 0.7);
        --table-border: #d9e1ee;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: radial-gradient(1200px circle at top, rgba(92, 200, 255, 0.08), transparent 50%),
        linear-gradient(180deg, var(--bg) 0%, #0c111a 60%, var(--bg) 100%);
    color: var(--text-primary);
    line-height: 1.85;
    padding: clamp(2rem, 5vw, 4rem) 0;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 52px 52px;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

.article-container {
    max-width: var(--article-max-width);
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.article-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at top left, rgba(92, 200, 255, 0.12), transparent 55%);
    opacity: 0.6;
    pointer-events: none;
}

.article-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.article-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.article-category {
    background: rgba(92, 200, 255, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(92, 200, 255, 0.2);
}

.article-reading-time {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    padding: 0.55rem 1.25rem;
    border-radius: 999px;
    transition: background 0.2s ease, transform 0.2s ease, border 0.2s ease;
    border: 1px solid rgba(92, 200, 255, 0.35);
    background: rgba(92, 200, 255, 0.12);
}

.back-button:hover {
    background: rgba(92, 200, 255, 0.2);
    transform: translateX(-4px);
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.9;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: var(--text-primary);
    margin: 2.2rem 0 1rem 0;
    font-weight: 600;
    font-family: var(--font-display);
}

.article-content h1 { font-size: 2.2rem; }
.article-content h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid rgba(92, 200, 255, 0.35);
    padding-bottom: 0.5rem;
}
.article-content h3 { font-size: 1.5rem; }
.article-content h4 { font-size: 1.3rem; }
.article-content h5 { font-size: 1.1rem; }
.article-content h6 { font-size: 1rem; }

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.article-content pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.6rem 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.article-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.article-content p code,
.article-content li code {
    background: var(--code-bg);
    color: var(--accent);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--code-border);
}

.article-content blockquote {
    border-left: 4px solid var(--blockquote-border);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: rgba(92, 200, 255, 0.08);
    border-radius: 0 12px 12px 0;
}

.article-content blockquote p {
    color: var(--text-primary);
    margin-bottom: 0;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1.5rem 2rem;
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content ul li::marker,
.article-content ol li::marker {
    color: var(--accent);
    font-weight: 600;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--table-border);
}

.article-content th,
.article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--table-border);
    text-align: left;
}

.article-content th {
    background: var(--surface-strong);
    color: var(--text-primary);
    font-weight: 600;
}

.article-content td {
    color: var(--text-secondary);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 8px 24px rgba(7, 12, 18, 0.35);
}

.article-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.article-content a:hover {
    border-bottom-color: var(--accent);
    color: var(--accent-strong);
}

.article-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(92, 200, 255, 0.4), transparent);
    margin: 2rem 0;
}

.article-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-content em {
    color: var(--accent);
    font-style: italic;
}

@media (max-width: 768px) {
    body {
        padding: 1.5rem 0;
    }

    .article-container {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 14px;
    }

    .article-title {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
    }

    .article-content {
        font-size: 1rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.3rem;
    }

    .article-content pre {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .article-content ul,
    .article-content ol {
        margin-left: 1.5rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .article-container {
        margin: 0.5rem;
        padding: 1rem;
    }

    .article-content pre {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .article-content th,
    .article-content td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.article-container {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
