/**
 * 妙趣AI 共享样式 - 暗色主题
 * 基于 index.html 提取的设计规范
 */

/* ========== CSS Variables ========== */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0c0c0c;
    --bg-secondary: #141414;
    --bg-tertiary: #1c1c1c;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #e8c547;
    --accent-hover: #d4b33d;
    --border: #27272a;
    --border-light: #3f3f46;

    /* Legacy aliases for compatibility */
    --primary: #e8c547;
    --lobster: #e8c547;
    --bg: #0c0c0c;
    --text: #fafafa;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Noto Serif SC', serif;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 12px;
}

h3 {
    font-size: 1.25rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

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

/* ========== Layout ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== Header ========== */
header {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    background: rgba(12, 12, 12, 0.9);
    backdrop-filter: blur(12px);
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
    font-family: 'Noto Serif SC', serif;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

nav {
    display: flex;
    gap: 32px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--accent);
}

/* ========== Hero Section ========== */
.hero {
    padding: 100px 0 80px;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 40px;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-light);
    background: var(--bg-secondary);
}

/* ========== Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 48px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Noto Serif SC', serif;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ========== Sections ========== */
section {
    padding: 64px 0;
}

section h2 {
    font-family: 'Noto Serif SC', serif;
}

section .section-desc {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* ========== Cards ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Serif SC', serif;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.card .card-meta {
    margin-top: 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Article Card variant */
.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s;
}

.article-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.article-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.article-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.article-card h3 a:hover {
    color: var(--accent);
}

.article-card .meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.article-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

/* ========== Tags Cloud ========== */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tags-cloud a {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.tags-cloud a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ========== Footer ========== */
footer {
    border-top: 1px solid var(--border);
    padding: 48px 0;
    margin-top: 64px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 16px;
}

.footer-links h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 8px;
    transition: color 0.2s;
}

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

.footer-bottom {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ========== Article Content ========== */
.article-content {
    background: var(--bg-secondary);
    padding: 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 900px;
    margin: 0 auto;
}

.article-content h1 {
    font-size: 2.25rem;
    margin-bottom: 16px;
}

.article-content .meta {
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.article-content .tags {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.article-content .tags a {
    display: inline-block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 100px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

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

.article-content .article-body {
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.article-content .article-body h1,
.article-content .article-body h2,
.article-content .article-body h3 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 700;
}

.article-content .article-body h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.article-content .article-body p {
    margin-bottom: 20px;
}

.article-content .article-body code {
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.9em;
    color: var(--accent);
}

.article-content .article-body pre {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.article-content .article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-content .article-body ul,
.article-content .article-body ol {
    margin: 20px 0;
    padding-left: 28px;
}

.article-content .article-body li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

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

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

.article-content .article-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 16px 24px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-tertiary);
    border-radius: 0 8px 8px 0;
}

.article-content .article-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 24px 0;
}

/* ========== Main Content ========== */
main {
    padding: 40px 0 60px;
}

/* ========== Intro Section ========== */
.intro {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}

.intro p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

.intro p:last-child {
    margin-bottom: 0;
}

/* ========== Related Links ========== */
aside.related-links {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 28px;
    margin-top: 40px;
    border: 1px solid var(--border);
}

aside.related-links h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

aside.related-links ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

aside.related-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.2s;
    font-size: 0.95rem;
}

aside.related-links li a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateX(4px);
}

/* ========== Topic Grid ========== */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.topic-card {
    background: var(--bg-secondary);
    padding: 28px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.topic-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.topic-card h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.topic-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.topic-card h3 a:hover {
    color: var(--accent);
}

.topic-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ========== Article List ========== */
#latest-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.article-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}

.article-item:last-child a {
    border-bottom: none;
}

.article-item a:hover {
    background: var(--bg-tertiary);
    padding-left: 28px;
}

.article-item .title {
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s;
}

.article-item a:hover .title {
    color: var(--accent);
}

.article-item .date {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* ========== Topics Index Page ========== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero,
section {
    animation: fadeIn 0.6s ease-out;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero p {
        font-size: 1rem;
    }

    nav {
        display: none;
    }

    .hero-cta {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

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

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

    .article-content {
        padding: 24px;
    }

    .article-content h1 {
        font-size: 1.75rem;
    }

    aside.related-links ul {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 16px;
    }
}