/*
Theme Name: 狸花 · Trae 风
Theme URI: https://wp.limaowork.top
Author: 狸花网络
Description: 白色为主、深色可切的科技风主题（参考 Trae 视觉语言）——亮色为默认，半动态胶囊导航、全幅图片横幅（可后台配置图片/裁剪焦点/文案/参数）、玻璃卡片与栅格底纹。
Version: 2.1.0
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
License: GPL-2.0-or-later
Tags: light, white, dark, tech, gradient, blog
Text Domain: lihua-trae
*/

/* ===================== 令牌：亮色（默认，白主题） ===================== */
:root {
  --bg-base: #ffffff;
  --bg-secondary: #f6f8fb;
  --bg-tertiary: #eaeef4;
  --fg-1: #0b0d12;
  --fg-2: #46506a;
  --fg-3: #7a8499;

  --brand: #4d6bfe;
  --brand-2: #3f85ff;
  --brand-3: #64b4ff;
  --brand-4: #a8cdff;
  --grad-brand: linear-gradient(90deg, #3f85ff 0%, #4d6bfe 42%, #64b4ff 74%, #a8cdff 100%);
  --grad-brand-soft: linear-gradient(90deg, rgba(63, 133, 255, .14), rgba(77, 107, 254, .10));
  --glow-brand: 0 0 24px rgba(77, 107, 254, .30);

  --border: rgba(11, 13, 18, .09);
  --border-strong: rgba(11, 13, 18, .16);
  --card: #ffffff;
  --card-solid: #ffffff;
  --card-hover: #fbfcff;
  --top-highlight: inset 0 .5px 0 0 rgba(255, 255, 255, .9);
  --nav-bg: rgba(255, 255, 255, .72);
  --nav-hover: rgba(11, 13, 18, .05);
  --grid-line: rgba(11, 13, 18, .035);
  --code-bg: #f4f6fa;
  --code-fg: #253046;

  /* Hero 横幅 */
  --hero-fg: #ffffff;                                        /* 亮色下横幅仍用深色遮罩 + 白字，观感更稳 */
  --hero-scrim: rgba(10, 11, 13, var(--hero-overlay, .55));
  --hero-scrim-grad: linear-gradient(90deg, rgba(10, 11, 13, .92) 0%, rgba(10, 11, 13, .5) 46%, transparent 78%);

  --r-2: 2px; --r-4: 4px; --r-6: 6px; --r-8: 8px; --r-10: 10px; --r-full: 9999px;
  --font: Inter, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --shadow-sm: 0 2px 8px rgba(11, 13, 18, .06);
  --shadow-lg: 0 18px 40px rgba(11, 13, 18, .12);
}

/* ===================== 令牌：深色 ===================== */
html[data-theme="dark"] {
  --bg-base: #0a0b0d;
  --bg-secondary: #121314;
  --bg-tertiary: #2a2d31;
  --fg-1: #f5f7fa;
  --fg-2: #afb9cf;
  --fg-3: #747e94;

  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --card: rgba(255, 255, 255, .03);
  --card-solid: #121417;
  --card-hover: rgba(255, 255, 255, .055);
  --top-highlight: inset 0 .5px 0 0 hsla(0, 0%, 100%, .06);
  --nav-bg: rgba(10, 11, 13, .66);
  --nav-hover: rgba(255, 255, 255, .07);
  --grid-line: rgba(255, 255, 255, .022);
  --code-bg: #0d0f11;
  --code-fg: #d8e0ea;
  --shadow-sm: 0 4px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--fg-1);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
/* 栅格底纹 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}
/* 顶部品牌辉光 */
body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 900px; height: 900px; top: -420px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(77, 107, 254, .18) 0%, rgba(100, 180, 255, .10) 40%, transparent 70%);
  filter: blur(40px); animation: drift 18s ease-in-out infinite;
}
html[data-theme="dark"] body::after {
  background: radial-gradient(circle, rgba(77, 107, 254, .22) 0%, rgba(100, 180, 255, .12) 40%, transparent 70%);
}
@keyframes drift {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50%      { transform: translateX(-52%) translateY(30px) scale(1.08); }
}

a { color: var(--brand); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand-2); }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
::selection { background: rgba(77, 107, 254, .22); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: var(--r-full); }

/* ===================== 半动态胶囊导航 ===================== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 14px 24px;
  transition: transform .45s cubic-bezier(.4, 0, .2, 1), padding .35s ease;
  will-change: transform;
}
.admin-bar .site-header { top: 32px; }
.site-header.is-hidden { transform: translateY(-130%); }

.nav-shell {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  height: 58px; padding: 0 16px;
  border-radius: var(--r-full);
  border: 1px solid transparent; background: transparent;
  transition: max-width .45s cubic-bezier(.4, 0, .2, 1), background .35s ease,
              border-color .35s ease, box-shadow .35s ease, padding .35s ease;
}
.site-header.is-scrolled .nav-shell {
  max-width: 1020px; padding: 0 10px 0 18px;
  background: var(--nav-bg);
  border-color: var(--border-strong);
  backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: var(--shadow-lg), var(--top-highlight);
}

.site-logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; font-weight: 700; font-size: 16px; color: var(--fg-1); letter-spacing: -.2px; }
.site-logo:hover { color: var(--fg-1); }
.site-logo .dot {
  width: 22px; height: 22px; border-radius: var(--r-6); flex-shrink: 0;
  background: var(--grad-brand); box-shadow: var(--glow-brand); transition: all .3s;
}
.site-logo:hover .dot { transform: rotate(-8deg) scale(1.06); }

.main-nav { margin-left: auto; position: relative; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; position: relative; z-index: 1; }
.main-nav a {
  position: relative; display: block; padding: 9px 15px; border-radius: var(--r-full);
  font-size: 14px; color: var(--fg-2); transition: color .22s ease; white-space: nowrap;
}
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--fg-1); }
.nav-pill {
  position: absolute; top: 50%; left: 0; height: 34px; width: 0;
  transform: translateY(-50%); border-radius: var(--r-full);
  background: var(--nav-hover); border: 1px solid var(--border);
  opacity: 0; pointer-events: none;
  transition: transform .32s cubic-bezier(.4, 0, .2, 1), width .32s cubic-bezier(.4, 0, .2, 1), opacity .25s;
}
.nav-pill.on { opacity: 1; }
.nav-pill.brand { background: var(--grad-brand-soft); border-color: rgba(77, 107, 254, .38); }

.nav-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 8px; }
.theme-btn {
  width: 38px; height: 38px; border-radius: var(--r-full); cursor: pointer; font-size: 15px;
  background: var(--nav-hover); border: 1px solid var(--border-strong); color: var(--fg-2);
  transition: all .22s;
}
.theme-btn:hover { color: var(--fg-1); transform: rotate(18deg); }
.btn-cta {
  padding: 9px 18px; border-radius: var(--r-full); font-size: 14px; font-weight: 600;
  background: var(--grad-brand); color: #fff !important; box-shadow: var(--glow-brand); transition: all .22s;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 0 34px rgba(77, 107, 254, .5); }
.nav-toggle {
  display: none; margin-left: auto; width: 40px; height: 40px;
  background: var(--nav-hover); border: 1px solid var(--border-strong);
  color: var(--fg-1); border-radius: var(--r-10); font-size: 17px; cursor: pointer;
}

/* ===================== 全幅 Hero 横幅 ===================== */
.hero-banner {
  position: relative; min-height: var(--hero-h, 520px);
  display: flex; align-items: center; overflow: hidden; margin-bottom: 56px;
  background: radial-gradient(120% 140% at 15% 20%, var(--grad-brand-soft), transparent 60%),
              linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-base) 60%);
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image: var(--hero-img, none);
  background-size: cover;
  background-position: var(--hero-focus, center);
  filter: blur(var(--hero-blur, 0px));
  transform: scale(1.05);
}
.hero-scrim { position: absolute; inset: 0; z-index: 1; background: var(--hero-scrim); }
.hero-scrim::after { content: ""; position: absolute; inset: 0; background: var(--hero-scrim-grad); }
.hero-inner { position: relative; z-index: 2; width: 100%; }
.hero-banner h1 {
  font-size: 62px; line-height: 1.1; font-weight: 800; letter-spacing: -1.8px;
  margin: 0 0 18px; color: var(--hero-fg); max-width: 16em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .45);
}
.hero-banner .lede {
  font-size: 17px; color: var(--hero-fg); opacity: .86; max-width: 40em;
  margin: 0 0 32px; text-shadow: 0 1px 18px rgba(0, 0, 0, .4);
}
.hero-inner.align-center { text-align: center; }
.hero-inner.align-center h1, .hero-inner.align-center .lede { margin-left: auto; margin-right: auto; }
.hero-inner.align-center .hero-actions { justify-content: center; }
.hero-inner.align-left .hero-actions { justify-content: flex-start; }

/* ===================== 按钮与卡片 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--r-10); font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .22s; font-family: inherit;
}
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: 0 8px 22px rgba(77, 107, 254, .28); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(77, 107, 254, .38); color: #fff; }
.btn-ghost {
  background: rgba(255, 255, 255, .10); color: var(--hero-fg); border-color: rgba(255, 255, 255, .35);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .2); transform: translateY(-2px); color: var(--hero-fg); }

.card {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  transition: all .28s cubic-bezier(.4, 0, .2, 1);
}
.card:hover {
  background: var(--card-hover); border-color: rgba(77, 107, 254, .35);
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.card-icon { font-size: 26px; margin-bottom: 14px; }
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; color: var(--fg-1); }
.card-desc { font-size: 14px; color: var(--fg-3); margin: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.section { padding: 72px 0; }
.section-head { text-align: center; margin-bottom: 46px; }
.section-head h2 { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin: 0 0 12px; }
.section-head p { color: var(--fg-3); margin: 0; font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; text-align: center; }
.stat-num { font-size: 38px; font-weight: 800; letter-spacing: -1px;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 13px; color: var(--fg-3); margin-top: 4px; }

/* ===================== 文章列表 ===================== */
.list-head { padding: 64px 0 34px; text-align: center; }
.list-head h1 { font-size: 42px; font-weight: 800; letter-spacing: -1.2px; margin: 0 0 10px; }
.list-head p { color: var(--fg-3); margin: 0; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; padding: 20px 0 64px; }
.post-card .post-title { font-size: 19px; font-weight: 700; margin: 0 0 10px; line-height: 1.45; }
.post-card .post-title a { color: var(--fg-1); }
.post-card .post-title a:hover { color: var(--brand); }
.post-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-3); margin-bottom: 12px; font-family: var(--mono); }
.post-excerpt { font-size: 14px; color: var(--fg-2); }
.post-excerpt p { margin: 0; }
.read-more { display: inline-flex; gap: 6px; margin-top: 16px; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.read-more:hover { gap: 10px; }

/* ===================== 单篇 ===================== */
.article { max-width: 800px; margin: 48px auto 72px; }
.article h1.entry-title { font-size: 40px; line-height: 1.25; font-weight: 800; letter-spacing: -1px; margin: 0 0 16px; }
.entry-content { font-size: 16px; color: var(--fg-2); }
.entry-content h2, .entry-content h3 { color: var(--fg-1); margin: 1.7em 0 .6em; letter-spacing: -.4px; }
.entry-content h2 { font-size: 25px; }
.entry-content h3 { font-size: 20px; }
.entry-content a { border-bottom: 1px solid rgba(77, 107, 254, .35); }
.entry-content blockquote {
  margin: 1.4em 0; padding: 14px 20px; border-left: 3px solid var(--brand);
  background: rgba(77, 107, 254, .06); border-radius: 0 var(--r-8) var(--r-8) 0; color: var(--fg-2);
}
.entry-content code {
  font-family: var(--mono); font-size: .89em; padding: 2px 7px; border-radius: var(--r-4);
  background: rgba(77, 107, 254, .08); color: var(--brand);
}
.entry-content pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-10);
  padding: 18px 20px; overflow-x: auto;
}
.entry-content pre code { background: none; padding: 0; color: var(--code-fg); }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14.5px; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 9px 13px; }
.entry-content th { background: var(--bg-secondary); color: var(--fg-1); }
.entry-content img { border-radius: 12px; border: 1px solid var(--border); }

/* ===================== 评论 / 表单 / 分页 ===================== */
.comments-area { max-width: 800px; margin: 0 auto 72px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.comment-meta { font-size: 12.5px; color: var(--fg-3); margin-bottom: 8px; font-family: var(--mono); }
.comment-respond .comment-form textarea,
.comment-respond .comment-form input:not([type=submit]),
.wp-block-search__input {
  width: 100%; padding: 11px 14px; border-radius: var(--r-8); color: var(--fg-1); font-size: 14px;
  background: var(--bg-secondary); border: 1px solid var(--border-strong);
  outline: none; font-family: inherit; transition: all .2s;
}
.comment-respond .comment-form textarea:focus,
.wp-block-search__input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(77, 107, 254, .14); }
.comment-respond .submit, .wp-block-search__button, .button {
  background: var(--grad-brand); color: #fff; border: none; padding: 11px 22px;
  border-radius: var(--r-8); font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 18px rgba(77, 107, 254, .26); transition: all .2s;
}
.comment-respond .submit:hover, .wp-block-search__button:hover { transform: translateY(-2px); }

.pagination { text-align: center; padding: 8px 0 64px; }
.pagination .page-numbers {
  display: inline-flex; padding: 8px 15px; margin: 0 3px; border-radius: var(--r-8);
  border: 1px solid var(--border); color: var(--fg-2); font-size: 14px; background: var(--bg-secondary);
}
.pagination .page-numbers:hover { border-color: rgba(77, 107, 254, .4); color: var(--fg-1); }
.pagination .page-numbers.current { background: var(--grad-brand); color: #fff; border-color: transparent; font-weight: 700; }

/* ===================== 页脚 ===================== */
.site-footer {
  border-top: 1px solid var(--border); padding: 40px 0 32px; margin-top: 40px;
  background: var(--bg-secondary);
}
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--fg-3); }
.footer-brand { display: flex; align-items: center; gap: 9px; color: var(--fg-2); }
.footer-brand .dot { width: 18px; height: 18px; border-radius: var(--r-4); background: var(--grad-brand); box-shadow: var(--glow-brand); }

/* ===================== 固定导航的内容避让 ===================== */
body { padding-top: 86px; }

/* ===================== 响应式 ===================== */
@media (max-width: 900px) {
  .hero-banner { min-height: calc(var(--hero-h, 520px) * .72); margin-bottom: 40px; }
  .hero-banner h1 { font-size: 36px; letter-spacing: -1px; }
  .hero-banner .lede { font-size: 15px; }
  .hero-scrim::after { background: linear-gradient(180deg, rgba(10, 11, 13, .45), rgba(10, 11, 13, .85)); }
  .grid-3, .grid-4, .stats { grid-template-columns: repeat(2, 1fr); }
  .article h1.entry-title { font-size: 28px; }
  .list-head h1 { font-size: 30px; }
  .site-header .wrap { gap: 12px; }
  /* 移动端菜单 */
  .nav-toggle { display: block; }
  .btn-cta { display: none; }
  .main-nav {
    position: absolute; top: 68px; left: 0; right: 0; display: none; padding: 0;
    background: var(--nav-bg);
    border: 1px solid var(--border-strong); border-radius: 16px;
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    box-shadow: var(--shadow-lg); overflow: hidden;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 8px; }
  .main-nav a { padding: 12px 14px; border-radius: var(--r-10); }
  .nav-pill { display: none; }
  .site-header.is-scrolled .nav-shell { max-width: 100%; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4, .grid-2, .stats { grid-template-columns: 1fr; }
  .hero-banner h1 { font-size: 31px; letter-spacing: -.6px; }
}
