
:root {
    --primary: #E63946;
    --primary-hover: #C1121F;
    --accent: #1D3557;
    --bg-header: #1D3557;
    --bg-main: #F1FAEE;
    --bg-card: #FFFFFF;
    --text-primary: #1D3557;
    --text-secondary: #457B9D;
    --text-muted: #A8DADC;
    --text-inverted: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.14);
    --radius: 12px;
    --font: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    --xs: 4px;
    --sm: 8px;
    --md: 16px;
    --lg: 24px;
    --xl: 32px;
    --xxl: 48px;
    --sidebar-width: 320px;
    --max-width: 1280px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
img { display: block; max-width: 100%; }
a { color: inherit; }

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* HEADER */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--lg);
    height: 56px;
    display: flex;
    align-items: center;
    gap: var(--lg);
}

.site-logo {
    color: var(--text-inverted);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-logo .logo-china { color: var(--primary); }
.site-logo .logo-news { color: var(--text-inverted); }
.site-logo .logo-dot { color: var(--primary); }
.site-logo .logo-ai { color: var(--text-muted); font-weight: 600; }

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--xs);
    flex: 1;
}

.site-nav a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px var(--sm);
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text-inverted);
    background: rgba(255,255,255,0.09);
}

.nav-spacer { flex: 1; }

.nav-search {
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.nav-search:hover { color: var(--text-inverted); }

/* SEARCH OVERLAY */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    padding: var(--xxl) var(--lg);
}
.search-overlay.active { display: flex; justify-content: center; align-items: flex-start; }
.search-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-md);
    margin-top: 80px;
}
.search-box input {
    width: 100%;
    padding: var(--sm) var(--md);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font);
    outline: none;
}
.search-box input:focus { border-color: var(--primary); }
.search-results { margin-top: var(--md); max-height: 400px; overflow-y: auto; }
.search-result-item {
    display: block;
    padding: var(--sm) var(--md);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s;
}
.search-result-item:hover { background: var(--bg-main); }
.search-result-item .sr-title { font-weight: 600; font-size: 0.9rem; }
.search-result-item .sr-source { font-size: 0.75rem; color: var(--text-secondary); }

/* PAGE LAYOUT */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--xl) var(--lg);
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--xl);
    align-items: start;
}

.content-area { min-width: 0; }

/* HERO CARD */
.hero-card {
    position: relative;
    height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--xl);
    background: var(--bg-header);
    display: block;
    text-decoration: none;
    color: var(--text-inverted);
    transition: box-shadow 0.2s;
}
.hero-card:hover { box-shadow: var(--shadow-md); }
.hero-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.48) 50%, rgba(0,0,0,0.1) 100%);
}
.hero-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 62%;
    padding: var(--xl);
}
.hero-card-meta {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: var(--sm);
    display: flex;
    align-items: center;
    gap: var(--sm);
}
.hero-source-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.hero-card h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--md);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-card-excerpt {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.78);
    line-height: 1.6;
    margin-bottom: var(--lg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    background: var(--primary);
    color: var(--text-inverted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: var(--sm) var(--md);
    border-radius: 8px;
    transition: background 0.15s;
    border: none;
    cursor: pointer;
}
.hero-cta:hover { background: var(--primary-hover); }
.hero-card.no-image {
    background: linear-gradient(135deg, #1D3557 0%, #2B4570 100%);
}
.hero-card.no-image .hero-card-content { width: 80%; }

/* STORY CARDS */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--lg);
}
.story-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}
.story-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.story-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #e5e7eb;
}
.story-card-body {
    padding: var(--md);
    flex: 1;
    display: flex;
    flex-direction: column;
}
.story-card-meta {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--xs);
    display: flex;
    align-items: center;
    gap: var(--sm);
}
.story-card h3 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: var(--sm);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.story-card h3 a {
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.15s;
}
.story-card h3 a:hover { color: var(--primary); }
.story-card-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.story-card-tags {
    margin-top: var(--sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--xs);
}
.tag-pill {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(230,57,70,0.1);
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}
.tag-pill:hover {
    background: rgba(230,57,70,0.2);
}
.tag-pill.active {
    background: var(--primary);
    color: var(--text-inverted);
}

/* SOURCE BADGES */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--text-inverted);
}

/* SIDEBAR */
.sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--lg);
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: var(--md);
    padding-bottom: var(--sm);
    border-bottom: 2px solid var(--primary);
}

.top-story-item {
    display: flex;
    gap: var(--sm);
    padding: var(--sm) 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}
.top-story-item:last-child { border-bottom: none; }

.top-story-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    opacity: 0.3;
    line-height: 1;
    min-width: 28px;
}

.top-story-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--xs);
}

/* TAG FILTER BAR */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--xs);
    margin-bottom: var(--lg);
}

/* ARTICLE PAGE */
.article-page {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--xl) var(--lg);
}
.article-hero-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: var(--lg);
}
.article-meta {
    display: flex;
    align-items: center;
    gap: var(--md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--lg);
}
.article-back {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: var(--lg);
}
.article-back:hover { text-decoration: underline; }
.article-content h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--md);
    color: var(--text-primary);
}
.article-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: var(--xl);
    margin-bottom: var(--md);
    color: var(--text-primary);
}
.article-content p {
    margin-bottom: var(--md);
    font-size: 1.05rem;
    line-height: 1.75;
}
.article-content ul, .article-content ol {
    margin-bottom: var(--md);
    padding-left: var(--lg);
}
.article-content li {
    margin-bottom: var(--sm);
    line-height: 1.6;
}
.article-content a {
    color: var(--primary);
    text-decoration: underline;
}
.article-content code {
    background: rgba(230,57,70,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.article-tags {
    margin-top: var(--xl);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm);
}
.article-source-link {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    margin-top: var(--lg);
    padding: var(--sm) var(--md);
    background: var(--bg-main);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}
.article-source-link:hover { background: var(--border); }

/* FOOTER */
.site-footer {
    background: var(--bg-header);
    color: rgba(255,255,255,0.5);
    padding: var(--xl) var(--lg);
    margin-top: var(--xxl);
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}
.footer-links { display: flex; gap: var(--md); }
.footer-links a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-inverted); }

/* RESPONSIVE */
@media (max-width: 1023px) {
    .page-grid {
        grid-template-columns: 1fr;
    }
    .sidebar { position: static; }
    .hero-card { height: 360px; }
    .hero-card-content { width: 75%; }
}
@media (max-width: 767px) {
    .stories-grid { grid-template-columns: 1fr; }
    .hero-card { height: 300px; }
    .hero-card-content { width: 90%; padding: var(--md); }
    .hero-card h1 { font-size: 1.3rem; }
    .site-nav { display: none; }
    .header-inner { padding: 0 var(--md); }
    .page-container { padding: var(--md); }
    .article-hero-img { height: 250px; }
}

/* IMAGE ATTRIBUTION */
.img-credit {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: var(--xs);
}
.img-credit a { color: var(--text-secondary); }
