/*
Theme Name: Kimi Code 介绍
Theme URI: https://www.kimi.com/resources/kimi-code-introduction
Author: Moonshot AI
Author URI: https://www.kimi.com/
Description: 仿 Kimi Code 官方介绍页的 WordPress 主题。首页为 Kimi Code 产品长文介绍（核心功能、使用指南、应用场景、常见问题），文章系统用作"最新新闻"（目录页 + 详情页），导航锚点直达各区块。
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
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: kimi-code
Tags: blog, news, custom-menu, featured-images, one-column
*/

/* ===== 基础 ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #fff;
  color: #171717;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 1024px) { .container { padding: 0 40px; } }

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ===== 顶部导航 ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #f5f5f5;
}
.header-inner {
  max-width: 1440px; margin: 0 auto; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
@media (min-width: 1024px) { .header-inner { padding: 0 40px; } }
.site-logo {
  font-size: 22px; font-weight: 900; letter-spacing: .08em; color: #171717;
}
.main-nav { display: none; align-items: center; gap: 28px; }
.main-nav a {
  padding: 8px 0; font-size: 14px; color: #262626; transition: color .15s;
}
.main-nav a:hover, .main-nav a.current { color: #000; }
.main-nav a.current { font-weight: 500; }
.header-actions { display: none; align-items: center; gap: 12px; }
.btn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 8px 16px;
  font-size: 14px; font-weight: 500; border: 0; transition: background .15s;
}
.btn-light { background: #f5f5f5; color: #171717; }
.btn-light:hover { background: #e5e5e5; }
.btn-dark { background: #171717; color: #fff; }
.btn-dark:hover { background: #404040; }
.menu-toggle {
  display: block; background: none; border: 0; color: #262626; padding: 4px;
}
@media (min-width: 1024px) {
  .main-nav { display: flex; }
  .header-actions { display: flex; }
  .menu-toggle { display: none; }
}
.mobile-nav { border-top: 1px solid #f5f5f5; background: #fff; padding: 16px 20px; }
.mobile-nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mobile-nav-grid a {
  border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #262626;
}
.mobile-nav-grid a:hover { background: #fafafa; }
.mobile-nav-actions {
  display: flex; gap: 12px; margin-top: 12px;
  border-top: 1px solid #f5f5f5; padding-top: 16px;
}
.mobile-nav-actions a { flex: 1; text-align: center; justify-content: center; }
[hidden] { display: none !important; }

/* ===== Hero ===== */
.hero { padding: 56px 0 64px; }
@media (min-width: 1024px) { .hero { padding: 80px 0 64px; } }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: 1fr 1fr; } }
.hero h1 {
  margin: 0; font-size: 34px; font-weight: 700; line-height: 1.25;
  letter-spacing: -.01em; color: #171717;
}
@media (min-width: 1024px) { .hero h1 { font-size: 44px; } }
.hero p {
  margin: 24px 0 0; max-width: 560px; font-size: 15px; line-height: 2; color: #525252;
}
.hero-cta { margin-top: 32px; display: flex; align-items: center; gap: 12px; }
.hero-img {
  display: block; width: 100%; height: auto;
  border-radius: 12px; border: 1px solid #e5e5e5;
}

/* ===== 安装按钮下拉 ===== */
.install-wrap { position: relative; display: inline-block; }
.install-toggle .chev { transition: transform .2s; }
.install-wrap.open .install-toggle .chev { transform: rotate(180deg); }
.install-menu {
  position: absolute; left: 0; top: 100%; z-index: 50;
  margin-top: 8px; width: 300px;
  background: #fff; border: 1px solid #f5f5f5; border-radius: 16px;
  padding: 8px; box-shadow: 0 20px 40px -10px rgba(23,23,23,.08);
}
.install-cmd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-radius: 12px; padding: 10px 12px;
}
.install-cmd .label { font-size: 14px; font-weight: 500; color: #171717; }
.install-cmd code {
  display: block; margin-top: 2px; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: #a3a3a3;
}
.icon-btn {
  flex-shrink: 0; background: none; border: 0; color: #a3a3a3;
  padding: 4px; transition: color .15s;
}
.icon-btn:hover { color: #171717; }
.install-menu a {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-weight: 500; color: #171717; transition: background .15s;
}
.install-menu a:hover { background: #fafafa; }
.install-menu a svg { color: #a3a3a3; }

/* ===== 正文布局 + 目录 ===== */
.article-layout { display: flex; gap: 64px; }
.article { min-width: 0; max-width: 720px; flex: 1; }
.toc {
  position: sticky; top: 96px; align-self: flex-start; flex-shrink: 0;
  display: none; width: 260px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  border-left: 1px solid #e5e5e5; padding-left: 20px;
}
@media (min-width: 1024px) { .toc { display: block; } }
.toc-group { margin-bottom: 16px; }
.toc a {
  position: relative; display: block; padding: 6px 0;
  font-size: 14px; color: #737373; transition: color .15s;
}
.toc a:hover { color: #171717; }
.toc .toc-child a { padding-left: 16px; font-size: 13px; }
.toc a.active {
  color: #171717; font-weight: 500;
}
.toc a.active::before {
  content: ""; position: absolute; left: -20px; top: 4px;
  width: 2px; height: calc(100% - 8px); background: #171717;
}

/* ===== 文章排版 ===== */
.article section { scroll-margin-top: 96px; }
.article h2 {
  margin: 64px 0 24px; font-size: 26px; font-weight: 700;
  line-height: 1.4; letter-spacing: -.01em; color: #171717;
}
.article h3 {
  margin: 40px 0 16px; font-size: 18px; font-weight: 700;
  line-height: 1.4; color: #171717;
}
.article p { margin: 0 0 20px; font-size: 15px; line-height: 2; color: #404040; }
.article ul {
  margin: 0 0 20px; padding-left: 24px; list-style: disc;
  font-size: 15px; line-height: 1.9; color: #404040;
}
.article li { margin-bottom: 12px; }
.article li::marker { color: #a3a3a3; }
.article strong { font-weight: 600; color: #171717; }
.ic {
  white-space: nowrap; border-radius: 4px; background: #f5f5f5;
  padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; color: #262626;
}
.code-block {
  position: relative; margin: 0 0 24px;
  border-radius: 8px; background: #f5f5f5;
}
.code-block pre {
  margin: 0; overflow-x: auto; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; color: #262626;
}
.copy-btn {
  position: absolute; right: 8px; top: 8px;
  display: flex; align-items: center; gap: 4px;
  border: 1px solid #e5e5e5; border-radius: 6px;
  background: rgba(255,255,255,.85); padding: 4px 8px;
  font-size: 12px; color: #737373; opacity: 0;
  transition: opacity .15s, color .15s; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.code-block:hover .copy-btn, .prompt-block:hover .copy-btn-inline { opacity: 1; }
.copy-btn:hover { color: #171717; }
.prompt-block {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin: 0 0 24px; border-radius: 8px; background: #f5f5f5; padding: 12px 16px;
}
.prompt-block p {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; color: #404040;
}
.copy-btn-inline {
  flex-shrink: 0; margin-top: 2px; background: none; border: 0;
  color: #a3a3a3; padding: 4px; opacity: 0;
  transition: opacity .15s, color .15s;
}
.copy-btn-inline:hover { color: #171717; }
.figure {
  display: block; width: 100%; height: auto; margin: 8px 0 24px;
  border-radius: 12px; border: 1px solid #e5e5e5;
}
.cta-buttons { display: flex; align-items: center; gap: 12px; margin: 32px 0 40px; }

/* ===== 常见问题 ===== */
.faq-section { scroll-margin-top: 96px; border-top: 1px solid #f5f5f5; }
.faq-inner { padding: 80px 20px; }
@media (min-width: 1024px) {
  .faq-inner {
    display: grid; grid-template-columns: 280px 1fr; gap: 40px;
    max-width: 1280px; margin: 0 auto; padding: 80px 40px;
  }
}
.faq-inner > h2 {
  margin: 0 0 32px; font-size: 26px; font-weight: 700;
  letter-spacing: -.01em; color: #171717;
}
@media (min-width: 1024px) { .faq-inner > h2 { margin-bottom: 0; } }
.faq-item { border-bottom: 1px solid #e5e5e5; }
.faq-q {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  gap: 16px; border: 0; background: none; padding: 20px 0;
  text-align: left; font-size: 15px; font-weight: 500; color: #171717;
}
.faq-q svg { flex-shrink: 0; color: #a3a3a3; transition: transform .2s; }
.faq-item.open .faq-q svg { transform: rotate(180deg); }
.faq-a { padding: 0 0 24px; font-size: 15px; line-height: 2; color: #525252; }

/* ===== 新闻卡片 / 相关推荐 ===== */
.related-section { border-top: 1px solid #f5f5f5; }
.related-inner { padding: 80px 20px; }
@media (min-width: 1024px) { .related-inner { padding: 80px 40px; } }
.related-head {
  display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 40px;
}
.related-head h2 {
  margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; color: #171717;
}
.related-head a {
  display: flex; align-items: center; gap: 4px;
  font-size: 14px; color: #737373; transition: color .15s;
}
.related-head a:hover { color: #171717; }
.news-grid { display: grid; gap: 24px; }
@media (min-width: 640px) { .news-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .news-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .news-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.news-card {
  display: block; overflow: hidden; border: 1px solid #f5f5f5;
  border-radius: 16px; background: #fff; transition: box-shadow .2s;
}
.news-card:hover { box-shadow: 0 16px 32px -12px rgba(23,23,23,.08); }
.news-card .thumb { aspect-ratio: 16 / 10; overflow: hidden; }
.news-card.cols-4 .thumb { aspect-ratio: 4 / 3; }
.news-card .thumb img {
  width: 100%; height: 100%; object-fit: cover; transition: transform .3s;
}
.news-card:hover .thumb img { transform: scale(1.05); }
.news-card .body { padding: 20px; }
.news-card h3, .news-card h2 {
  margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #171717;
}
.news-card.cols-3 h2 { font-size: 17px; }
.news-card .summary {
  margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: #737373;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-card .meta {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: #a3a3a3;
}
.news-card .more {
  display: flex; align-items: center; gap: 4px; transition: color .15s;
}
.news-card:hover .more { color: #171717; }

/* ===== 新闻目录页 / 详情页 ===== */
.news-list-head h1 {
  margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.01em; color: #171717;
}
@media (min-width: 1024px) { .news-list-head h1 { font-size: 40px; } }
.news-list-head p { margin: 16px 0 0; max-width: 560px; font-size: 15px; line-height: 2; color: #525252; }
.news-list-grid { margin-top: 48px; }
.news-detail { max-width: 760px; margin: 0 auto; padding: 56px 20px; }
@media (min-width: 1024px) { .news-detail { padding: 80px 20px; } }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; color: #737373; transition: color .15s;
}
.back-link:hover { color: #171717; }
.news-detail h1 {
  margin: 32px 0 0; font-size: 30px; font-weight: 700; line-height: 1.3;
  letter-spacing: -.01em; color: #171717;
}
@media (min-width: 1024px) { .news-detail h1 { font-size: 38px; } }
.news-detail .date { margin: 20px 0 0; font-size: 14px; color: #a3a3a3; }
.news-detail .cover {
  display: block; width: 100%; height: auto; margin-top: 40px;
  border-radius: 12px; border: 1px solid #e5e5e5;
}
.news-detail .entry-content { margin-top: 40px; font-size: 15px; line-height: 2; color: #404040; }
.news-detail .entry-content p { margin: 0 0 20px; }
.post-nav {
  margin-top: 56px; padding-top: 40px; border-top: 1px solid #f5f5f5;
  display: grid; gap: 16px;
}
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav a {
  display: block; border: 1px solid #f5f5f5; border-radius: 16px; padding: 20px;
  transition: box-shadow .2s;
}
.post-nav a:hover { box-shadow: 0 16px 32px -12px rgba(23,23,23,.08); }
.post-nav a.next { text-align: right; }
.post-nav .nav-label {
  display: flex; align-items: center; gap: 4px; font-size: 12px; color: #a3a3a3;
}
.post-nav a.next .nav-label { justify-content: flex-end; }
.post-nav .nav-title {
  display: block; margin-top: 8px; font-size: 14px; font-weight: 500;
  line-height: 1.5; color: #171717;
}

/* ===== 页脚 ===== */
.site-footer { background: #0a0a0a; color: #737373; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 40px 20px; }
@media (min-width: 1024px) { .footer-inner { padding: 40px; } }
.footer-inner p { margin: 0; text-align: center; font-size: 12px; color: #737373; }
