/*
Theme Name: 期货门户 (Futures Portal)
Theme URI: https://example.com
Author: Futures Portal Team
Author URI: https://example.com
Description: 期货开户介绍方专用主题 - 资讯门户风格，4 个主栏目，多引擎 SEO 友好，AI 自动发布适配
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: futures-portal
Tags: news, portal, two-columns, custom-menu, featured-images, translation-ready
*/

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #1f2937;
  background: #f5f7fa;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: #1976d2; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

:root {
  --c-primary: #0a2540;
  --c-primary-light: #1976d2;
  --c-accent: #d4a017;
  --c-up: #d32f2f;
  --c-down: #2e7d32;
  --c-bg: #ffffff;
  --c-bg-gray: #f5f7fa;
  --c-border: #e5e7eb;
  --c-text: #1f2937;
  --c-text-2: #6b7280;
  --c-text-3: #9ca3af;
  --container: 1280px;
}

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

/* ===== Header ===== */
.header { background: #ffffff; border-bottom: 1px solid var(--c-border); }
.header-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; gap: 1.5rem; }
.logo { display: flex; align-items: center; gap: 0.625rem; font-size: 22px; font-weight: 700; color: var(--c-primary); }
.logo-mark { width: 36px; height: 36px; background: var(--c-primary); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #ffffff; font-size: 18px; font-weight: 700; }
.logo-sub { font-size: 12px; color: var(--c-text-2); font-weight: 400; margin-left: 0.5rem; }
.header-search { flex: 1; max-width: 360px; display: flex; border: 2px solid var(--c-primary); border-radius: 4px; overflow: hidden; }
.header-search input { flex: 1; border: none; outline: none; padding: 8px 12px; font-size: 13px; font-family: inherit; }
.header-search button { padding: 0 16px; background: var(--c-primary); color: #ffffff; }
.header-cta { display: flex; gap: 0.5rem; align-items: center; }
.btn-wechat { display: inline-flex; align-items: center; gap: 0.4rem; padding: 8px 16px; background: #07c160; color: #ffffff; border-radius: 4px; font-size: 13px; font-weight: 600; }
.btn-wechat:hover { background: #06b057; color: #ffffff; }
.btn-wechat svg { width: 16px; height: 16px; }
@media (max-width: 768px) { .header-search { display: none; } .logo-sub { display: none; } }

/* ===== Main Nav ===== */
.mainnav { background: #ffffff; border-top: 1px solid var(--c-border); border-bottom: 2px solid var(--c-primary); }
.mainnav-inner { display: flex; align-items: center; height: 44px; gap: 0; }
.mainnav a, .mainnav .nav-item { padding: 0 18px; height: 100%; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--c-text); border-right: 1px solid var(--c-border); transition: all 0.15s; }
.mainnav a:first-child, .mainnav .nav-item:first-child { border-left: 1px solid var(--c-border); }
.mainnav a:hover, .mainnav a.current-menu-item, .mainnav a.active { background: var(--c-primary); color: #ffffff; }
.mainnav-spacer { flex: 1; }
.mainnav-aux { display: flex; gap: 0.75rem; padding-right: 0; }
.mainnav-aux a { padding: 0 12px; font-size: 13px; font-weight: 400; color: var(--c-text-2); border: none; }
.mainnav-aux a:hover { background: transparent; color: var(--c-primary-light); }
@media (max-width: 1024px) { .mainnav { display: none; } }

/* ===== News Ticker ===== */
.newsticker { background: #fffbeb; border-bottom: 1px solid #fde68a; padding: 8px 0; font-size: 13px; }
.newsticker-inner { display: flex; align-items: center; gap: 0.75rem; }
.newsticker-label { background: var(--c-up); color: #ffffff; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.newsticker-content { flex: 1; overflow: hidden; white-space: nowrap; }
.newsticker-list { display: flex; gap: 2rem; animation: ticker 30s linear infinite; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.newsticker-item { display: inline-flex; gap: 0.5rem; align-items: center; color: var(--c-text); }
.newsticker-time { color: var(--c-text-3); font-size: 12px; }
.newsticker-empty { color: var(--c-text-3); font-size: 12px; padding: 4px 0; }

/* ===== 主内容区 ===== */
.main { padding: 16px 0 24px; }
.grid-main { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1024px) { .grid-main { grid-template-columns: 1fr 280px; } }

/* ===== 头条区 ===== */
.headline { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; padding: 16px; }
.headline-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .headline-grid { grid-template-columns: 2fr 1fr; } }
.headline-main { border-right: 0; padding-right: 0; }
@media (min-width: 768px) { .headline-main { border-right: 1px solid var(--c-border); padding-right: 16px; } }
.headline-thumb { width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, #e0e7ff, #dbeafe); border-radius: 4px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; color: var(--c-primary-light); font-size: 12px; overflow: hidden; }
.headline-thumb img { width: 100%; height: 100%; object-fit: cover; }
.headline-title { font-size: 24px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; color: var(--c-text); }
.headline-title:hover { color: var(--c-primary-light); }
.headline-summary { color: var(--c-text-2); font-size: 14px; line-height: 1.7; margin-bottom: 8px; }
.headline-meta { display: flex; gap: 1rem; font-size: 12px; color: var(--c-text-3); }
.headline-meta-source { color: var(--c-primary-light); font-weight: 600; }
.headline-side { display: flex; flex-direction: column; gap: 12px; }
.headline-item { padding-bottom: 12px; border-bottom: 1px dashed var(--c-border); }
.headline-item:last-child { border-bottom: none; padding-bottom: 0; }
.headline-item-title { font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--c-text); }
.headline-item-title:hover { color: var(--c-primary-light); }
.headline-item-meta { font-size: 12px; color: var(--c-text-3); margin-top: 4px; }

/* ===== 栏目内容块 ===== */
.section-block { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; margin-top: 16px; overflow: hidden; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 2px solid var(--c-primary); background: #fafbfc; }
.section-title { font-size: 18px; font-weight: 700; color: var(--c-primary); display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 18px; background: var(--c-accent); }
.section-nav { display: flex; gap: 12px; font-size: 13px; }
.section-nav a { color: var(--c-text-2); }
.section-nav a:hover { color: var(--c-primary-light); }
.section-more { color: var(--c-text-3); font-size: 13px; }
.section-body { padding: 16px; }

/* ===== 文章网格 ===== */
.article-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .article-grid { grid-template-columns: repeat(3, 1fr); } }
.article-item { display: flex; gap: 12px; padding: 0; }
.article-thumb-sm { width: 100px; height: 70px; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); border-radius: 3px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--c-text-3); font-size: 11px; overflow: hidden; }
.article-thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.article-info { flex: 1; min-width: 0; }
.article-item-title { font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--c-text); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-item-title:hover { color: var(--c-primary-light); }
.article-item-meta { font-size: 12px; color: var(--c-text-3); margin-top: 6px; }

/* ===== 合并 section ===== */
.merged-section { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .merged-section { grid-template-columns: 1fr 1fr; gap: 28px; } }
.merged-col {}
.merged-col .article-grid { grid-template-columns: 1fr !important; }

/* ===== 文章列表（备用） ===== */
.article-list { padding: 0; }
.article-list-item { display: flex; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--c-border); font-size: 14px; align-items: center; }
.article-list-item:last-child { border-bottom: none; }
.article-list-tag { color: var(--c-primary-light); font-weight: 600; font-size: 12px; padding: 1px 6px; background: #e0e7ff; border-radius: 2px; flex-shrink: 0; }
.article-list-title { flex: 1; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-list-title:hover { color: var(--c-primary-light); }
.article-list-time { color: var(--c-text-3); font-size: 12px; flex-shrink: 0; }

/* ===== Sidebar ===== */
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.side-block { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; overflow: hidden; }
.side-head { padding: 10px 14px; background: var(--c-primary); color: #ffffff; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.side-head-link { color: #cbd5e1; font-size: 12px; font-weight: 400; }
.side-head-link:hover { color: #ffffff; }
.side-body { padding: 12px 14px; }

/* 加微信卡片 */
.wechat-card { background: linear-gradient(135deg, #07c160, #06ad56); color: #ffffff; padding: 16px; text-align: center; }
.wechat-card-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.wechat-card-desc { font-size: 12px; opacity: 0.9; margin-bottom: 12px; line-height: 1.5; }
.wechat-card-qr { width: 120px; height: 120px; background: #ffffff; border-radius: 4px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; color: var(--c-text-3); font-size: 11px; overflow: hidden; }
.wechat-card-qr img { width: 100%; height: 100%; object-fit: contain; }
.wechat-card-btn { display: inline-block; padding: 8px 16px; background: #ffffff; color: #07c160; border-radius: 4px; font-size: 13px; font-weight: 600; }
.wechat-card-btn:hover { background: #f0fdf4; color: #06b057; }

/* 热门排行 */
.rank-list { font-size: 13px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--c-border); }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 18px; height: 18px; background: var(--c-text-3); color: #ffffff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border-radius: 2px; flex-shrink: 0; }
.rank-num.top1 { background: var(--c-up); }
.rank-num.top2 { background: #f59e0b; }
.rank-num.top3 { background: #d97706; }
.rank-title { flex: 1; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-title:hover { color: var(--c-primary-light); }
.rank-views { color: var(--c-text-3); font-size: 11px; }

/* 工具入口 */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tool-item { padding: 12px 8px; background: #f8fafc; border: 1px solid var(--c-border); border-radius: 4px; text-align: center; font-size: 12px; color: var(--c-text); transition: all 0.2s; }
.tool-item:hover { background: #e0e7ff; border-color: var(--c-primary-light); color: var(--c-primary-light); }
.tool-icon { font-size: 22px; margin-bottom: 4px; display: block; }

/* ===== 文章详情页 ===== */
.single-content { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; padding: 32px; margin-top: 16px; }
.single-title { font-size: 28px; font-weight: 700; line-height: 1.3; margin-bottom: 16px; color: var(--c-text); }
.single-meta { color: var(--c-text-3); font-size: 13px; padding-bottom: 16px; border-bottom: 1px solid var(--c-border); margin-bottom: 24px; display: flex; gap: 1rem; flex-wrap: wrap; }
.single-meta-cat { color: var(--c-primary-light); font-weight: 600; }
.entry-content { font-size: 15px; line-height: 1.8; color: var(--c-text); }
.entry-content h2 { font-size: 22px; font-weight: 700; margin: 32px 0 16px; }
.entry-content h3 { font-size: 18px; font-weight: 700; margin: 24px 0 12px; }
.entry-content p { margin-bottom: 16px; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin-bottom: 16px; list-style: disc; }
.entry-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 16px 0; }
.entry-content a { color: var(--c-primary-light); }
.entry-content blockquote { border-left: 4px solid var(--c-primary-light); background: var(--c-bg-gray); padding: 12px 16px; margin: 16px 0; color: var(--c-text-2); }
.single-tags { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--c-border); display: flex; flex-wrap: wrap; gap: 8px; }
.tag-badge { display: inline-block; padding: 4px 10px; background: var(--c-bg-gray); border: 1px solid var(--c-border); border-radius: 3px; font-size: 12px; color: var(--c-text-2); }
.tag-badge:hover { background: var(--c-primary-light); color: #ffffff; border-color: var(--c-primary-light); }

/* ===== 归档页 ===== */
.archive-header { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; padding: 20px 24px; margin-top: 16px; }
.archive-title { font-size: 22px; font-weight: 700; color: var(--c-primary); }
.archive-desc { color: var(--c-text-2); font-size: 14px; margin-top: 4px; }
.archive-list { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; margin-top: 16px; padding: 8px 0; }
.archive-list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--c-border); }
.archive-list-item:last-child { border-bottom: none; }
.archive-list-thumb { width: 80px; height: 60px; background: var(--c-bg-gray); border-radius: 3px; flex-shrink: 0; overflow: hidden; }
.archive-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.archive-list-info { flex: 1; min-width: 0; }
.archive-list-title { font-size: 15px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; }
.archive-list-title:hover { color: var(--c-primary-light); }
.archive-list-meta { font-size: 12px; color: var(--c-text-3); }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 24px 0; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--c-border); border-radius: 3px; font-size: 13px; color: var(--c-text); background: #ffffff; }
.pagination a:hover { background: var(--c-primary-light); color: #ffffff; border-color: var(--c-primary-light); }
.pagination .current { background: var(--c-primary); color: #ffffff; border-color: var(--c-primary); }

/* ===== 404 ===== */
.not-found { background: #ffffff; border: 1px solid var(--c-border); border-radius: 4px; padding: 60px 20px; text-align: center; margin-top: 16px; }
.not-found-code { font-size: 72px; font-weight: 700; color: var(--c-primary); }
.not-found-text { font-size: 18px; color: var(--c-text-2); margin: 16px 0; }

/* ===== Footer ===== */
.footer { background: var(--c-primary); color: #94a3b8; padding: 32px 0 16px; font-size: 13px; margin-top: 32px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid #1a3a6e; }
@media (max-width: 1024px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
.footer-brand { max-width: 360px; }
.footer-brand .logo { color: #ffffff; margin-bottom: 12px; }
.footer-brand .logo-mark { background: #ffffff; color: var(--c-primary); }
.footer-brand p { line-height: 1.7; color: #cbd5e1; font-size: 12px; }
.footer-title { color: #ffffff; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: #cbd5e1; font-size: 12px; }
.footer-links a:hover { color: #ffffff; }
.footer-disclosure { padding: 12px 16px; background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--c-accent); font-size: 12px; line-height: 1.7; margin: 16px 0; color: #cbd5e1; }
.footer-bottom { padding-top: 16px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #64748b; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-meta a { color: #94a3b8; }
.footer-meta a:hover { color: #ffffff; }

/* ===== 移动端 ===== */
.mobile-toggle { display: none; }
@media (max-width: 1024px) {
  .mobile-toggle { display: flex; padding: 8px; background: var(--c-primary); color: #ffffff; border-radius: 4px; }
}
.mobile-menu { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #ffffff; z-index: 1000; padding: 16px; overflow-y: auto; }
.mobile-menu.open { display: block; }
.mobile-menu-close { position: absolute; top: 12px; right: 12px; padding: 8px; font-size: 24px; }
.mobile-menu a { display: block; padding: 14px 0; font-size: 16px; font-weight: 600; color: var(--c-text); border-bottom: 1px solid var(--c-border); }

/* ===== 移动端响应 ===== */
@media (max-width: 768px) {
  .headline-title { font-size: 20px; }
  .section-title { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .single-content { padding: 20px; }
  .single-title { font-size: 22px; }
}

/* ===== WordPress 必要样式 ===== */
.alignleft { float: left; margin-right: 1.5em; }
.alignright { float: right; margin-left: 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 12px; color: var(--c-text-2); text-align: center; padding: 4px 0; }
.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); -webkit-clip-path: inset(50%); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; }
.sticky { background: #fffbeb; }
