/* ==========================================================================
   YizheWenji Modern Design System & CSS Variables
   ========================================================================== */

:root, [data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --brand-primary: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-light: #eff6ff;
    --brand-accent: #d97706;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 12px 28px -6px rgba(37, 99, 235, 0.12);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Noto Serif SC', 'Songti SC', 'Source Han Serif SC', Georgia, serif;
}

[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-surface: #111827;
    --bg-card: #1e293b;
    --bg-muted: #1e293b;
    --bg-glass: rgba(17, 24, 39, 0.85);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --brand-primary: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-light: rgba(59, 130, 246, 0.15);
    --brand-accent: #f59e0b;

    --border-color: #334155;
    --border-subtle: #1e293b;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --shadow-hover: 0 12px 28px rgba(59, 130, 246, 0.2);
}

/* Global Reset & Body */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Reading Progress Bar */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #d97706);
    width: 0%;
    z-index: 1050;
    transition: width 0.1s ease-out;
}

/* Glassmorphism Header */
.glass-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary), #1d4ed8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

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

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Search Form */
.max-w-500 {
    max-width: 500px;
}

.search-form .search-input {
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 30px;
    padding-left: 2.5rem;
    padding-right: 5.5rem;
    height: 44px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-form .search-input:focus {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.search-form .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.05rem;
}

.search-form .btn-search-submit {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    border-radius: 20px;
    background: var(--brand-primary);
    color: white;
    border: none;
    padding: 0 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.search-form .btn-search-submit:hover {
    background: var(--brand-hover);
}

/* Theme Toggle Button */
.btn-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
    color: var(--brand-primary);
    transform: scale(1.05);
}

[data-theme="light"] .dark-icon { display: block; }
[data-theme="light"] .light-icon { display: none; }
[data-theme="dark"] .dark-icon { display: none; }
[data-theme="dark"] .light-icon { display: block; color: var(--brand-accent); }

/* Offcanvas Drawer */
.drawer-custom {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-right: 1px solid var(--border-color);
}

.drawer-section-divider {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1rem 1.5rem 0.5rem;
    background-color: var(--bg-muted);
}

.volume-list .list-group-item {
    background: transparent;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle) !important;
    transition: background 0.15s ease, padding-left 0.15s ease;
    font-size: 0.92rem;
}

.volume-list .list-group-item:hover {
    background: var(--bg-muted);
    color: var(--brand-primary);
    padding-left: 1.75rem !important;
}

.volume-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    background-color: var(--brand-light);
    color: var(--brand-primary);
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 4rem 1.5rem;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Category Card */
.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--brand-primary);
    color: var(--text-primary);
}

.category-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--brand-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
}

.category-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.category-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

/* Article ListItem */
.article-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.article-item-card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.article-item-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.article-item-title:hover {
    color: var(--brand-primary);
}

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

/* Article Detail Reading Layout */
.article-reading-container {
    max-width: 820px;
    margin: 0 auto;
}

.article-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
    margin-bottom: 2.5rem;
}

.article-title-main {
    font-family: var(--font-serif);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* Reading Body Typography (Noto Serif SC) */
.article-body-content {
    font-family: var(--font-serif);
    font-size: 1.125rem; /* 18px */
    line-height: 1.9;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.article-body-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    text-justify: inter-ideograph;
}

.article-body-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

/* Reading Control Bar (Floating / Toolbar) */
.reading-toolbar {
    position: sticky;
    top: 80px;
    z-index: 1020;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.4rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.btn-control-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-control-icon:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Footer */
.footer {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-color) !important;
}

/* Utility Helpers */
.leading-relaxed { line-height: 1.7; }
.max-w-400 { max-width: 400px; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.fs-xs { font-size: 0.75rem; }