/* ============================================
   EU STOR — European Energy Storage Intelligence
   Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --color-primary: #0a1628;
    --color-primary-light: #1e293b;
    --color-accent: #2563eb;
    --color-accent-hover: #1d4ed8;
    --color-accent-light: #dbeafe;
    --color-text: #0f172a;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-dark: #0f172a;
    --color-success: #059669;
    --color-warning: #d97706;
    --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-article: Georgia, 'Times New Roman', 'Noto Serif', 'Source Han Serif SC', serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    --shadow-header: 0 1px 3px rgba(0,0,0,0.08);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --max-width: 1280px;
    --header-height: 64px;
    --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 800; line-height: 1.2; color: var(--color-text); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* --- Reading Progress Bar --- */
.reading-progress {
    position: fixed; top: 0; left: 0; width: 0; height: 3px;
    background: var(--color-accent); z-index: 1001; transition: width 50ms linear;
}

/* --- Header --- */
.site-header {
    position: sticky; top: 0; z-index: 1000;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition), box-shadow var(--transition);
}
.site-header.scrolled { background: rgba(255,255,255,0.97); backdrop-filter: blur(12px); box-shadow: var(--shadow-header); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-weight: 800; font-size: 1.35rem; color: var(--color-primary); letter-spacing: -0.5px; }
.logo:hover { color: var(--color-primary); }
.logo-icon { width: 36px; height: 36px; background: var(--color-primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.logo-icon svg { width: 20px; height: 20px; }
.nav-main { display: flex; align-items: center; gap: 4px; }
.nav-main a {
    padding: 8px 16px; font-size: 0.9rem; font-weight: 500;
    color: var(--color-text-secondary); border-radius: var(--radius-md);
    transition: color var(--transition), background var(--transition);
}
.nav-main a:hover, .nav-main a.active { color: var(--color-accent); background: var(--color-accent-light); }
.mobile-toggle { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: var(--radius-md); }
.mobile-toggle:hover { background: var(--color-bg-alt); }
.hamburger { width: 20px; height: 14px; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.hamburger span { display: block; width: 100%; height: 2px; background: var(--color-text); border-radius: 1px; transition: transform var(--transition), opacity var(--transition); }
.mobile-toggle.active .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-toggle.active .hamburger span:nth-child(2) { opacity: 0; }
.mobile-toggle.active .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- Hero Section --- */
.hero-section { padding: 48px 0 32px; border-bottom: 1px solid var(--color-border); }
.hero-grid { display: grid; grid-template-columns: 1fr 380px; gap: 40px; align-items: start; }
.hero-main { display: flex; flex-direction: column; gap: 24px; }
.hero-featured {
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 0;
    background: var(--color-bg); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-md); transition: box-shadow var(--transition), transform var(--transition);
}
.hero-featured:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.hero-featured-image { overflow: hidden; min-height: 320px; }
.hero-featured-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.hero-featured:hover .hero-featured-image img { transform: scale(1.05); }
.hero-featured-content { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.hero-featured-content .category-badge { margin-bottom: 16px; }
.hero-featured-content h2 { font-size: 1.6rem; margin-bottom: 12px; line-height: 1.25; }
.hero-featured-content h2 a { color: var(--color-text); }
.hero-featured-content h2 a:hover { color: var(--color-accent); }
.hero-featured-content .summary { color: var(--color-text-secondary); font-size: 0.95rem; line-height: 1.6; margin-bottom: 16px; }
.hero-featured-content .meta { font-size: 0.8rem; color: var(--color-text-muted); }

.hero-secondary { display: flex; flex-direction: column; gap: 0; }
.hero-secondary-item {
    display: grid; grid-template-columns: 120px 1fr; gap: 16px;
    padding: 16px 0; border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}
.hero-secondary-item:first-child { padding-top: 0; }
.hero-secondary-item:last-child { border-bottom: none; }
.hero-secondary-item .thumb { width: 120px; height: 80px; border-radius: var(--radius-md); overflow: hidden; }
.hero-secondary-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-secondary-item .info h3 { font-size: 0.9rem; font-weight: 700; line-height: 1.4; margin-bottom: 6px; }
.hero-secondary-item .info h3 a { color: var(--color-text); }
.hero-secondary-item .info h3 a:hover { color: var(--color-accent); }
.hero-secondary-item .info .meta { font-size: 0.75rem; color: var(--color-text-muted); }

/* --- Sidebar --- */
.sidebar-trending { background: var(--color-bg-alt); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--color-border); }
.sidebar-trending h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--color-accent); }
.trending-list { display: flex; flex-direction: column; }
.trending-item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--color-border); align-items: flex-start; }
.trending-item:last-child { border-bottom: none; }
.trending-number { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800; color: var(--color-accent); min-width: 28px; line-height: 1; }
.trending-content h4 { font-size: 0.85rem; font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
.trending-content h4 a { color: var(--color-text); }
.trending-content h4 a:hover { color: var(--color-accent); }
.trending-content .meta { font-size: 0.75rem; color: var(--color-text-muted); }

/* --- Category Filter --- */
.category-filter { display: flex; gap: 8px; padding: 24px 0; flex-wrap: wrap; }
.filter-btn {
    padding: 8px 20px; font-size: 0.85rem; font-weight: 500;
    color: var(--color-text-secondary); background: var(--color-bg);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.filter-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }


/* --- Section Heading --- */
.section-heading { margin-bottom: 24px; }
.section-heading h1 { font-size: 1.8rem; margin-bottom: 6px; }
.section-heading p { color: var(--color-text-secondary); font-size: 0.95rem; }


/* --- Text-only Card (no cover image) --- */
.article-card-text { border-left: 4px solid var(--color-accent); }
.article-card-text:hover { border-left-color: var(--color-accent-hover); }
.article-card-text .article-card-body { padding: 24px; }
.article-card-text h3 { font-size: 1.15rem; margin: 10px 0 8px; line-height: 1.4; }
.article-card-text h3 a { color: var(--color-text); }
.article-card-text h3 a:hover { color: var(--color-accent); }
.article-card-text .summary { font-size: 0.9rem; color: var(--color-text-secondary); line-height: 1.6; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Article Cover (deprecated) --- */
.article-cover { display: none; }


.content-section { padding: 32px 0 64px; }
.content-grid { display: grid; grid-template-columns: 1fr 340px; gap: 48px; }
.article-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }

/* --- Article Card --- */
.article-card {
    background: var(--color-bg); border-radius: var(--radius-lg); overflow: hidden;
    border: 1px solid var(--color-border);
    transition: transform var(--transition), box-shadow var(--transition);
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.article-card-image { overflow: hidden; aspect-ratio: 16/10; }
.article-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.article-card:hover .article-card-image img { transform: scale(1.05); }
.article-card-body { padding: 20px; }
.category-badge {
    display: inline-block; padding: 4px 12px; font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; border-radius: var(--radius-sm);
    background: var(--color-accent-light); color: var(--color-accent);
}
.article-card-body h3 { font-size: 1.05rem; margin: 10px 0 8px; line-height: 1.35; }
.article-card-body h3 a { color: var(--color-text); }
.article-card-body h3 a:hover { color: var(--color-accent); }
.article-card-body .summary { font-size: 0.875rem; color: var(--color-text-secondary); line-height: 1.55; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; color: var(--color-text-muted); }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--color-text-muted); }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
    display: flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    font-size: 0.9rem; font-weight: 500; border-radius: var(--radius-md);
    border: 1px solid var(--color-border); color: var(--color-text-secondary);
    transition: all var(--transition);
}
.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); }
.pagination .current { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* --- Article Detail --- */
.article-header { padding: 48px 0 32px; border-bottom: 1px solid var(--color-border); }
.article-header .category-badge { margin-bottom: 16px; }
.article-header h1 { font-size: 2.2rem; line-height: 1.2; margin-bottom: 16px; max-width: 800px; }
.article-meta-detail { display: flex; align-items: center; gap: 16px; font-size: 0.9rem; color: var(--color-text-secondary); flex-wrap: wrap; }
.article-cover { margin: 32px 0; border-radius: var(--radius-lg); overflow: hidden; max-height: 480px; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-body { max-width: 720px; font-family: var(--font-article); font-size: 1.05rem; line-height: 1.8; color: var(--color-text); }
.article-body h2 { font-family: var(--font-heading); font-size: 1.5rem; margin: 40px 0 16px; }
.article-body h3 { font-family: var(--font-heading); font-size: 1.2rem; margin: 32px 0 12px; }
.article-body p { margin-bottom: 20px; }
.article-body blockquote { border-left: 3px solid var(--color-accent); padding: 16px 24px; margin: 24px 0; background: var(--color-bg-alt); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-style: italic; color: var(--color-text-secondary); }
.article-body ul, .article-body ol { margin: 16px 0; padding-left: 24px; }
.article-body li { margin-bottom: 8px; list-style: disc; }
.article-body ol li { list-style: decimal; }
.article-source { margin-top: 48px; padding: 20px 24px; background: var(--color-bg-alt); border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.article-source p { font-size: 0.9rem; color: var(--color-text-secondary); margin-bottom: 4px; }
.article-source a { font-weight: 600; word-break: break-all; }
.related-articles { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--color-border); }
.related-articles h2 { font-size: 1.5rem; margin-bottom: 24px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* --- Category Page --- */
.category-header { padding: 48px 0 32px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-alt); }
.category-header h1 { font-size: 2rem; margin-bottom: 8px; }
.category-header p { color: var(--color-text-secondary); font-size: 1.05rem; max-width: 640px; }
.category-stats { display: flex; gap: 24px; margin-top: 16px; font-size: 0.9rem; color: var(--color-text-muted); }

/* --- Page Header --- */
.page-header { padding: 64px 0 48px; background: var(--color-bg-alt); border-bottom: 1px solid var(--color-border); }
.page-header h1 { font-size: 2.2rem; margin-bottom: 12px; }
.page-header p { color: var(--color-text-secondary); font-size: 1.1rem; max-width: 640px; }

/* --- Content Layout --- */
.page-content { padding: 48px 0 64px; }
.content-prose { max-width: 720px; font-size: 1.05rem; line-height: 1.8; color: var(--color-text-secondary); }
.content-prose h2 { font-size: 1.5rem; color: var(--color-text); margin: 40px 0 16px; }
.content-prose h3 { font-size: 1.2rem; color: var(--color-text); margin: 32px 0 12px; }
.content-prose p { margin-bottom: 20px; }
.content-prose ul { margin: 16px 0; padding-left: 0; }
.content-prose li { margin-bottom: 10px; padding-left: 20px; position: relative; color: var(--color-text-secondary); }
.content-prose li::before { content: ''; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); }
.content-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }

/* --- Contact --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--color-text); }
.form-group input, .form-group textarea {
    padding: 12px 16px; font-size: 0.95rem; font-family: var(--font-body);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--color-bg);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group textarea { resize: vertical; min-height: 140px; }
.contact-info { display: flex; flex-direction: column; gap: 24px; }
.contact-card { padding: 24px; background: var(--color-bg-alt); border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.contact-card h3 { font-size: 1rem; margin-bottom: 8px; }
.contact-card p { font-size: 0.9rem; color: var(--color-text-secondary); line-height: 1.6; }
.contact-card a { font-weight: 500; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; font-size: 0.9rem; font-weight: 600;
    border-radius: var(--radius-md); transition: all var(--transition); cursor: pointer;
    border: 1px solid transparent; font-family: var(--font-body);
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }
.btn-secondary { background: var(--color-bg); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* --- Footer --- */
.site-footer { background: var(--color-bg-dark); color: #94a3b8; padding: 64px 0 0; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 48px; padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-brand .logo { color: #fff; margin-bottom: 16px; }
.footer-brand .logo-icon { background: var(--color-accent); }
.footer-brand p { font-size: 0.9rem; line-height: 1.6; color: #94a3b8; max-width: 320px; }
.footer-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; margin-bottom: 20px; font-weight: 600; }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 0.9rem; color: #94a3b8; transition: color var(--transition); }
.footer-col a:hover { color: #fff; }
.footer-bottom { padding: 24px 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-bottom p { font-size: 0.8rem; color: #64748b; }
.footer-disclaimer { font-size: 0.75rem; color: #475569; max-width: 600px; line-height: 1.5; }

/* --- Admin --- */
.admin-header { padding: 32px 0; border-bottom: 1px solid var(--color-border); margin-bottom: 32px; }
.admin-header h1 { font-size: 1.8rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th { text-align: left; padding: 12px 16px; background: var(--color-bg-alt); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); border-bottom: 2px solid var(--color-border); }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.admin-table tr:hover { background: var(--color-bg-alt); }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.status-published { background: #d1fae5; color: #065f46; }
.status-draft { background: #fef3c7; color: #92400e; }
.admin-actions { display: flex; gap: 8px; }
.admin-actions form { display: inline; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; }

/* --- Utilities --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }
.mt-4 { margin-top: 32px; }
.mb-4 { margin-bottom: 32px; }

/* --- Animations --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeInUp 0.5s ease forwards; }
.fade-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-featured { grid-template-columns: 1fr; }
    .hero-featured-image { min-height: 240px; }
    .hero-secondary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .hero-secondary-item { border-bottom: none; padding: 0; }
    .content-grid { grid-template-columns: 1fr; }
    .sidebar-trending { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .contact-grid { grid-template-columns: 1fr; }
    .content-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-main {
        display: none; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
        background: var(--color-bg); flex-direction: column; padding: 24px;
        gap: 4px; z-index: 999; overflow-y: auto;
    }
    .nav-main.active { display: flex; }
    .nav-main a { padding: 14px 16px; font-size: 1rem; border-radius: var(--radius-md); }
    .mobile-toggle { display: flex; }
    .article-grid { grid-template-columns: 1fr; }
    .article-header h1 { font-size: 1.6rem; }
    .article-body { font-size: 1rem; }
    .related-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
    .footer-bottom { flex-direction: column; text-align: center; }
    .hero-secondary { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 1.8rem; }
    .category-filter { gap: 6px; }
    .filter-btn { padding: 6px 14px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero-featured-content { padding: 20px; }
    .hero-featured-content h2 { font-size: 1.3rem; }
    .article-card-body { padding: 16px; }
    .article-header h1 { font-size: 1.4rem; }
}
