/*
Theme Name: H5 SEO Theme
Theme URI: https://example.com/h5-seo-theme
Author: Codex
Description: 移动端优先、轻量且支持每页独立 TDK 的 WordPress SEO 主题。
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: h5seo
*/

:root {
  --brand: #1769e0;
  --brand-dark: #0e4ea9;
  --ink: #162033;
  --muted: #657085;
  --line: #e6eaf0;
  --surface: #f6f8fb;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(22, 32, 51, .08);
  --wrap: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button, input, textarea { font: inherit; }
.container { width: min(calc(100% - 32px), var(--wrap)); margin-inline: auto; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { top: 8px; left: 8px; z-index: 9999; width: auto; height: auto; padding: 10px 14px; clip: auto; background: #fff; }

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-branding { display: flex; align-items: center; min-width: 0; }
.custom-logo { max-height: 42px; width: auto; }
.site-title { color: var(--ink); font-size: 20px; font-weight: 800; line-height: 1.2; }
.site-description { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.menu-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 20px; height: 2px; background: currentColor; content: ""; transition: .2s; }
.menu-bars { position: relative; }
.menu-bars::before { position: absolute; top: -6px; }
.menu-bars::after { position: absolute; top: 6px; }
.primary-nav { display: none; position: absolute; top: 68px; left: 0; width: 100%; padding: 8px 16px 16px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.primary-nav.is-open { display: block; }
.primary-nav ul { margin: 0; padding: 0; list-style: none; }
.primary-nav a { display: block; padding: 11px 6px; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--line); }
.primary-nav .current-menu-item > a, .primary-nav a:hover { color: var(--brand); }

.site-main { min-height: 55vh; }
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 78px 0 94px; color: #fff; background: linear-gradient(135deg, #0b3f96 0%, #1769e0 52%, #35a1ee 100%); }
.hero::before, .hero::after { position: absolute; z-index: -1; border-radius: 50%; content: ""; }
.hero::before { top: -180px; right: -100px; width: 420px; height: 420px; border: 80px solid rgba(255,255,255,.08); }
.hero::after { bottom: -210px; left: 45%; width: 330px; height: 330px; background: rgba(255,255,255,.06); }
.hero-inner { position: relative; max-width: 820px; }
.eyebrow { margin: 0 0 10px; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .88; }
.hero h1 { margin: 0 0 18px; max-width: 760px; font-size: clamp(32px, 8vw, 58px); line-height: 1.14; letter-spacing: -.025em; }
.hero-text { max-width: 680px; margin: 0 0 28px; font-size: clamp(17px, 2vw, 20px); opacity: .9; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; color: var(--brand); background: #fff; border-radius: 10px; font-weight: 700; box-shadow: 0 5px 20px rgba(0,0,0,.12); }
.button:hover { color: var(--brand-dark); transform: translateY(-1px); }

.feature-strip { position: relative; z-index: 2; margin-top: -38px; }
.feature-strip-inner { display: grid; background: #fff; border: 1px solid rgba(23,105,224,.1); border-radius: var(--radius); box-shadow: 0 16px 45px rgba(15,60,130,.14); }
.feature-item { display: flex; gap: 13px; align-items: center; padding: 20px 22px; }
.feature-item + .feature-item { border-top: 1px solid var(--line); }
.feature-icon { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), #49a9eb); border-radius: 10px; font-weight: 800; }
.feature-copy strong { display: block; line-height: 1.3; }
.feature-copy span { color: var(--muted); font-size: 13px; }
.content-section { padding: 64px 0; }
.section-alt { background: linear-gradient(180deg, #f7f9fc 0%, #fff 100%); }
.section-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.section-kicker { margin: 0 0 6px; color: var(--brand); font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.section-heading { margin: 0; font-size: clamp(26px, 4vw, 36px); line-height: 1.25; }
.section-link { font-size: 14px; font-weight: 700; }
.category-chips { display: flex; gap: 10px; margin: 0; padding: 0 0 4px; overflow-x: auto; list-style: none; scrollbar-width: thin; }
.category-chips a { display: block; padding: 8px 15px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.category-chips a:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.category-spacer { height: 22px; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.post-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 6px 20px rgba(22,32,51,.055); transition: transform .2s ease, box-shadow .2s ease; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card-thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(145deg, #dceaff, #eef4fb); }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.post-card:hover .post-card-thumb img { transform: scale(1.03); }
.post-card-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: rgba(23,105,224,.72); font-size: 34px; font-weight: 800; }
.post-card-body { padding: 13px 14px 15px; }
.post-card-title { display: -webkit-box; min-height: 2.8em; margin: 0; overflow: hidden; font-size: 16px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.post-card-title a { color: var(--ink); }
.post-card-title a:hover { color: var(--brand); }
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }

.archive-hero { position: relative; isolation: isolate; overflow: hidden; padding: 48px 0 42px; color: #fff; background: linear-gradient(120deg, #102f65, #1769e0); }
.archive-hero::after { position: absolute; z-index: -1; top: -80px; right: 8%; width: 210px; height: 210px; border: 42px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.archive-hero .section-heading { font-size: clamp(30px, 5vw, 44px); }
.archive-description { max-width: 680px; margin-top: 12px; opacity: .82; }
.archive-description p { margin: 0; }
.archive-tools { padding: 20px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.archive-content { padding-top: 44px; }

.breadcrumb { padding: 14px 0; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.breadcrumb li:not(:last-child)::after { margin-left: 6px; color: #a3aaba; content: "/"; }
.single-layout { display: grid; gap: 42px; width: min(calc(100% - 32px), var(--wrap)); margin: 0 auto; padding: 42px 0 64px; }
.article-wrap { min-width: 0; max-width: 820px; margin: 0 auto; }
.entry-header { margin-bottom: 28px; }
.entry-title { margin: 0 0 14px; font-size: clamp(30px, 6vw, 46px); line-height: 1.2; letter-spacing: -.02em; }
.entry-thumbnail { margin: 0 0 30px; overflow: hidden; border-radius: var(--radius); }
.entry-content { overflow-wrap: anywhere; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { margin-top: 1.8em; font-size: 28px; line-height: 1.35; }
.entry-content h3 { margin-top: 1.6em; font-size: 22px; line-height: 1.4; }
.entry-content blockquote { margin: 28px 0; padding: 18px 22px; background: var(--surface); border-left: 4px solid var(--brand); }
.entry-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.entry-content th, .entry-content td { padding: 10px; border: 1px solid var(--line); }
.entry-tags { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.latest-panel { align-self: start; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.latest-panel-title { display: flex; gap: 10px; align-items: center; margin: 0 0 16px; font-size: 20px; }
.latest-panel-title::before { width: 4px; height: 21px; background: var(--brand); border-radius: 5px; content: ""; }
.latest-list { margin: 0; padding: 0; list-style: none; counter-reset: latest; }
.latest-list li { position: relative; min-height: 45px; padding: 12px 0 12px 36px; border-top: 1px solid var(--line); counter-increment: latest; }
.latest-list li::before { position: absolute; top: 13px; left: 0; display: grid; width: 24px; height: 24px; place-items: center; color: var(--brand); background: #e5efff; border-radius: 7px; font-size: 12px; font-weight: 800; content: counter(latest); }
.latest-list a { display: block; color: var(--ink); font-size: 14px; font-weight: 650; line-height: 1.45; }
.latest-list a:hover { color: var(--brand); }
.latest-list time { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.pagination, .post-navigation { margin-top: 36px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.page-numbers { padding: 8px 13px; color: var(--ink); background: var(--surface); border-radius: 8px; }
.page-numbers.current { color: #fff; background: var(--brand); }
.comments-area { margin-top: 48px; padding-top: 30px; border-top: 1px solid var(--line); }
.comment-list { padding-left: 22px; }
textarea, input[type="text"], input[type="email"], input[type="url"], input[type="search"] { width: 100%; padding: 11px 12px; border: 1px solid #ccd3de; border-radius: 8px; }
input[type="submit"] { padding: 11px 20px; color: #fff; background: var(--brand); border: 0; border-radius: 8px; cursor: pointer; }

.empty-state { padding: 80px 0; text-align: center; }
.search-form { display: flex; gap: 8px; max-width: 560px; margin: 24px auto 0; }
.search-form label { flex: 1; }
.site-footer { padding: 40px 0 22px; color: #c9d1df; background: #111a2b; }
.footer-grid { display: grid; gap: 28px; }
.footer-title { margin: 0 0 10px; color: #fff; font-size: 18px; }
.footer-menu { margin: 0; padding: 0; list-style: none; }
.footer-menu a { color: #c9d1df; }
.footer-bottom { margin-top: 28px; padding-top: 20px; font-size: 13px; border-top: 1px solid rgba(255,255,255,.12); }

@media (min-width: 720px) {
  .feature-strip-inner { grid-template-columns: repeat(3, 1fr); }
  .feature-item + .feature-item { border-top: 0; border-left: 1px solid var(--line); }
  .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .footer-grid { grid-template-columns: 2fr 1fr; }
}

@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .primary-nav { display: block; position: static; width: auto; padding: 0; border: 0; box-shadow: none; }
  .primary-nav ul { display: flex; align-items: center; gap: 28px; }
  .primary-nav a { padding: 23px 0; border: 0; }
  .post-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .single-layout.has-sidebar { grid-template-columns: minmax(0, 820px) 280px; align-items: start; }
  .single-layout.has-sidebar .article-wrap { margin: 0; }
  .latest-panel { position: sticky; top: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
