/* ==========================================
   素华凝月站点 - 公共样式表
   ========================================== */

:root {
    /* 浅色主题 */
    --bg: #f5f5f0;
    --bg-elevated: #ffffff;
    --bg-subtle: #fafafa;
    --text: #2c2c2c;
    --text-light: #555;
    --text-lighter: #888;
    --text-muted: #aaa;
    --accent: #6a6a5a;
    --accent-soft: #8a8a7a;
    --accent-warm: #b4aa8c;
    --border: #e0e0d8;
    --border-light: #f0f0e8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --max-content: 800px;
    --max-home: 720px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --bg-elevated: #242424;
        --bg-subtle: #2a2a2a;
        --text: #e8e8e8;
        --text-light: #c0c0c0;
        --text-lighter: #999;
        --text-muted: #777;
        --accent: #c4b896;
        --accent-soft: #a8a080;
        --accent-warm: #d4c8a8;
        --border: #3a3a3a;
        --border-light: #2a2a2a;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
        --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
        --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    }
}

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

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-stack);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.container-narrow {
    max-width: var(--max-home);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p {
    margin-bottom: 1em;
}

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

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

/* Back button / link */
.back-btn,
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    color: var(--text-lighter);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.back-btn:hover,
.back-link:hover {
    color: var(--text);
}

/* Cards */
.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.article-card {
    display: block;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.article-card .title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.article-card .excerpt {
    color: var(--text-lighter);
    font-size: 0.9rem;
    line-height: 1.6;
}

.article-card .meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.character-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-sm);
}

/* Tags */
.tag {
    display: inline-block;
    font-size: 0.8rem;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin: 0 4px 4px 0;
    background: rgba(180, 170, 140, 0.12);
    color: var(--accent);
    transition: transform var(--transition-fast);
}

.tag.pop {
    animation: tagPop 0.4s ease;
}

@keyframes tagPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.tag.main { background: #e8f4f8; color: #4a90a4; }
.tag.mbti { background: #f8e8f0; color: #a44a7a; }
.tag.element { background: #f0f8e8; color: #7a8a4a; }

@media (prefers-color-scheme: dark) {
    .tag.main { background: rgba(74, 144, 164, 0.2); color: #8ecae0; }
    .tag.mbti { background: rgba(164, 74, 122, 0.2); color: #e0a0c0; }
    .tag.element { background: rgba(122, 138, 74, 0.2); color: #c8d8a0; }
}

/* Section */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 3px solid var(--accent-warm);
}

.section-content {
    padding-left: 15px;
    color: var(--text-light);
    line-height: 2;
}

.section-content p {
    margin-bottom: 1em;
}

/* Quote */
.quote,
.quote-box {
    background: var(--bg-subtle);
    border-left: 4px solid var(--border);
    padding: 16px 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-lighter);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Stats grid */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-item {
    background: var(--bg-subtle);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1rem;
    color: var(--text);
    font-weight: 500;
}

/* Article list */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Page header */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: var(--text);
    margin-bottom: 10px;
}

.page-header .subtitle {
    color: var(--text-lighter);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* Character header */
.character-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 2px solid var(--border-light);
}

.character-header .name {
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
}

.character-header .name-en {
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    font-weight: 300;
}

.character-header .tags {
    margin-top: 16px;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--text-lighter);
    border-bottom: 1px solid var(--border);
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.site-footer a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent-warm);
    outline-offset: 2px;
}

/* Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 24px 16px;
    }
    .page-header h1,
    .character-header .name {
        font-size: 1.5rem;
    }
    .character-card {
        padding: 32px 20px;
    }
    .article-card {
        padding: 20px 24px;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
}

/* World page cards */
.magic-type,
.country-card {
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 16px 0;
}

.magic-type h3,
.country-card h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 8px;
}

.magic-type p,
.country-card p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* Section title accent colors */
.section-title.accent-blue { border-left-color: #4a90a4; }
.section-title.accent-green { border-left-color: #7a8a4a; }
.section-title.accent-amber { border-left-color: #c9a227; }
