/*
Theme Name: RailKnow
Theme URI: https://www.railknow.org
Author: RailKnow
Author URI: https://www.railknow.org
Description: RailKnow 全球铁路信息展示站首页模板，支持后台自定义轮播大图、数据统计、最近收录车型/线路、友情链接与 SEO 设置。
Version: 1.0.0
Requires at least: 5.6
Requires PHP: 7.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: railknow
*/

:root {
  --navy: #12305e;
  --navy-deep: #0b1d3a;
  --gold: #c9a24b;
  --ink: #1f2733;
  --muted: #5b6675;
  --line: #e4e8ee;
  --bg: #f4f5f7;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-main { min-height: 420px; }

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.header-bar { display: flex; align-items: center; gap: 32px; height: 72px; }
.site-brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.site-logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: .5px;
  white-space: nowrap;
}
.site-logo:hover { color: var(--navy); }
.site-tag { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block;
  padding: 8px 0;
  font-size: 15px;
  color: var(--ink);
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--navy); border-color: var(--gold); }
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a { color: var(--navy); border-color: var(--gold); }
.nav-search { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; color: var(--navy); }
.nav-search svg { width: 18px; height: 18px; fill: currentColor; }
.nav-toggle { display: none; }

/* ---------- 首页轮播 ---------- */
.hero { position: relative; height: 520px; overflow: hidden; background: var(--navy-deep); }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; visibility: hidden; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,29,58,.10) 0%, rgba(11,29,58,.45) 55%, rgba(11,29,58,.75) 100%);
}
.hero-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 66px;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 0 24px;
}
.hero-caption h2 {
  margin: 0 0 10px;
  font-size: 40px;
  line-height: 1.25;
  text-shadow: 0 2px 14px rgba(0,0,0,.4);
}
.hero-caption p { margin: 0 0 24px; font-size: 17px; opacity: .92; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.hero-btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--gold);
  color: #fff;
  font-size: 15px;
  border-radius: 4px;
}
.hero-btn:hover { background: #b88f38; color: #fff; }
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}
.hero-arrow:hover { background: rgba(255,255,255,.28); }
.hero-prev { left: 28px; }
.hero-next { right: 28px; }
.hero-dots { position: absolute; bottom: 28px; left: 0; right: 0; z-index: 3; display: flex; justify-content: center; gap: 10px; }
.hero-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  cursor: pointer;
}
.hero-dot.is-active { background: var(--gold); }

/* ---------- 数据统计条 ---------- */
.stat-bar { background: var(--navy); color: #fff; padding: 36px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; }
.stat-item strong { display: block; font-size: 38px; font-weight: 700; color: var(--gold); line-height: 1.2; }
.stat-item span { display: block; margin-top: 6px; font-size: 14px; letter-spacing: 2px; opacity: .85; }
.stat-note { text-align: center; margin-top: 14px; font-size: 13px; opacity: .65; letter-spacing: 1px; }

/* ---------- 通用板块 ---------- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.section-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  padding-left: 14px;
  border-left: 4px solid var(--gold);
}
.section-more { font-size: 14px; color: var(--muted); white-space: nowrap; }
.section-more:hover { color: var(--navy); }

/* ---------- 简介区 ---------- */
.intro-section { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.intro-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.intro-copy h2 { margin: 0 0 20px; font-size: 28px; color: var(--navy); line-height: 1.4; }
.intro-copy p { margin: 0 0 16px; line-height: 2; color: var(--muted); }
.intro-list { list-style: none; margin: 0; padding: 0; }
.intro-list li {
  position: relative;
  padding: 13px 0 13px 34px;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
  color: var(--ink);
}
.intro-list li:last-child { border-bottom: 0; }
.intro-list li::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 22px;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  background: var(--gold);
}

/* ---------- 分类入口 ---------- */
.entry-section { padding-bottom: 72px; }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.entry-card {
  position: relative;
  padding: 40px;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  overflow: hidden;
}
.entry-card::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(201,162,75,.35);
  border-radius: 50%;
}
.entry-card h3 { margin: 0 0 10px; font-size: 24px; color: #fff; }
.entry-card p { margin: 0 0 22px; font-size: 15px; opacity: .85; line-height: 1.8; }
.entry-btn {
  display: inline-block;
  padding: 10px 26px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 14px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.entry-btn:hover { background: var(--gold); color: #fff; }

/* ---------- 文章列表 ---------- */
.page-wrap { padding: 48px 0 72px; }
.archive-head h1 { margin: 0 0 30px; font-size: 28px; color: var(--navy); padding-left: 14px; border-left: 4px solid var(--gold); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: 22px;
  transition: box-shadow .2s;
}
.post-card:hover { box-shadow: 0 6px 20px rgba(18,48,94,.08); }
.post-card img { border-radius: 6px; }
.post-card h2 { margin: 14px 0 8px; font-size: 18px; line-height: 1.5; }
.post-card h2 a { color: var(--ink); }
.post-card h2 a:hover { color: var(--navy); }
.post-meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.post-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.8; }
.pagination { margin-top: 40px; text-align: center; }
.pagination .nav-links { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.pagination a, .pagination .current {
  display: inline-block;
  min-width: 38px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
}
.pagination .current { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- 页面/文章 ---------- */
.entry-wrap { padding: 48px 0 72px; }
.entry-head { margin-bottom: 28px; }
.entry-head h1 { margin: 0 0 10px; font-size: 32px; color: var(--navy); line-height: 1.35; }
.entry-meta { font-size: 14px; color: var(--muted); }
.entry-content {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 40px 44px;
  font-size: 16px;
  line-height: 2;
  color: var(--ink);
}
.entry-content h2, .entry-content h3, .entry-content h4 { color: var(--navy); margin: 1.6em 0 .6em; }
.entry-content h2 { font-size: 24px; }
.entry-content h3 { font-size: 20px; }
.entry-content img { border-radius: 6px; }
.entry-content a { text-decoration: underline; }
.entry-content blockquote { margin: 24px 0; padding: 16px 24px; border-left: 4px solid var(--gold); background: #f8f9fb; color: var(--muted); }
.entry-content table { border-collapse: collapse; width: 100%; margin: 24px 0; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.entry-content th { background: #f8f9fb; }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--navy-deep); color: #c7d0dd; margin-top: 0; }
.footer-recent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 48px 0 42px;
}
.footer-recent .fr-col {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 28px 30px;
}
.footer-recent h3 {
  margin: 0 0 18px;
  padding-left: 12px;
  border-left: 3px solid var(--gold);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}
.footer-recent ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.footer-recent a { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #c7d0dd; }
.footer-recent a::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.footer-recent a:hover { color: #fff; }
.footer-cols {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 44px;
  padding: 40px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.footer-cols h4 { margin: 0 0 16px; color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.footer-cols p { margin: 0 0 14px; font-size: 14px; line-height: 1.9; color: #9aa7b8; }
.footer-cols a { display: block; padding: 5px 0; font-size: 14px; color: #c7d0dd; }
.footer-cols a:hover { color: var(--gold); }
.footer-cols .fc-brand { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.footer-links {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 22px 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.footer-links .fl-label { color: var(--gold); font-size: 13px; letter-spacing: 2px; flex-shrink: 0; }
.footer-links a { font-size: 13px; color: #c7d0dd; margin-right: 18px; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 20px 0 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: #8b97a8;
}
.footer-bottom strong { color: #fff; font-weight: 600; }
.footer-legal a { color: #8b97a8; margin-left: 20px; }
.footer-legal a:hover { color: #fff; }

/* ---------- 404 ---------- */
.error-wrap { text-align: center; padding: 90px 0 110px; }
.error-wrap .err-code { font-size: 90px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 14px; }
.error-wrap p { color: var(--muted); margin: 0 0 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 900px) {
  .header-bar { height: 60px; }
  .site-tag { display: none; }
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
  }
  .nav-toggle span { display: block; width: 18px; height: 2px; background: var(--navy); transition: transform .2s; }
  .nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-active span:nth-child(2) { transform: rotate(-45deg); }
  .main-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
  }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 6px 24px; }
  .main-nav li { border-bottom: 1px solid var(--line); }
  .main-nav li:last-child { border-bottom: 0; }
  .main-nav a { padding: 15px 0; font-size: 16px; border-bottom: 0; }
  .main-nav a:hover { border-bottom: 0; }
  .nav-search { display: none; }
  .hero { height: 420px; }
  .hero-caption h2 { font-size: 30px; }
  .hero-caption p { font-size: 15px; }
  .hero-arrow { width: 38px; height: 38px; font-size: 20px; }
  .hero-prev { left: 14px; }
  .hero-next { right: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 26px; }
  .intro-grid { grid-template-columns: 1fr; gap: 32px; }
  .entry-grid { grid-template-columns: 1fr; }
  .footer-recent { grid-template-columns: 1fr; }
  .footer-recent ul { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .hero { height: 300px; }
  .hero-caption h2 { font-size: 22px; }
  .hero-caption p { font-size: 13px; margin-bottom: 16px; }
  .hero-btn { padding: 9px 22px; font-size: 13px; }
  .hero-dots { bottom: 14px; }
  .section { padding: 44px 0; }
  .section-head h2 { font-size: 21px; }
  .post-grid { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; }
  .footer-recent ul { grid-template-columns: 1fr; }
  .entry-content { padding: 26px 20px; }
  .entry-head h1 { font-size: 26px; }
}
