/*
Theme Name: breaddog Apple Style
Theme URI: https://breaddog.top
Author: breaddog
Description: 苹果官网风格主题 —— 毛玻璃导航、大标题排版、卡片文章流、深浅色模式、滚动渐入、代码高亮。
Version: 1.0
License: MIT
Text Domain: breaddog
*/

/* ================= 主题变量 ================= */
:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.10);
  --nav-bg: rgba(251, 251, 253, 0.8);
  --code-bg: #1d1d1f;
  --code-text: #f5f5f7;
  --hero-gradient: linear-gradient(180deg, #fbfbfd 0%, #ffffff 100%);
}
[data-theme='dark'] {
  --bg: #000000;
  --bg-secondary: #1d1d1f;
  --bg-elevated: rgba(29, 29, 31, 0.72);
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #86868b;
  --accent: #2997ff;
  --accent-hover: #47a9ff;
  --border: rgba(255, 255, 255, 0.12);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(22, 22, 23, 0.8);
  --code-bg: #161617;
  --code-text: #f5f5f7;
  --hero-gradient: linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
}

/* ================= 基础 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  transition: background-color 0.35s ease, color 0.35s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(0, 113, 227, 0.25); }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; color: var(--text); }
.hero-title { font-size: clamp(40px, 6vw, 68px); font-weight: 700; letter-spacing: -0.02em; }
.section-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: 980px;
  font-size: 16px; font-weight: 500; cursor: pointer; border: none;
  transition: all 0.2s ease; background: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost:hover { background: rgba(0, 113, 227, 0.06); text-decoration: none; }

/* ================= 导航（毛玻璃） ================= */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 16px; }
.nav-brand { font-size: 18px; font-weight: 600; color: var(--text); white-space: nowrap; }
.nav-brand:hover { text-decoration: none; opacity: 0.8; }
.nav-links { display: flex; align-items: center; gap: 26px; list-style: none; flex-wrap: wrap; }
.nav-links a { font-size: 14px; color: var(--text); opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  opacity: 0.8; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s;
  font-size: 18px; text-decoration: none;
}
.icon-btn:hover { opacity: 1; background: var(--bg-secondary); text-decoration: none; }
.nav-search { display: flex; align-items: center; gap: 6px; }
.nav-search input {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 980px; padding: 6px 14px; font-size: 13px; width: 150px; outline: none;
}
.nav-search button { border: none; background: none; cursor: pointer; color: var(--text); opacity: 0.7; font-size: 15px; }

/* ================= Hero ================= */
.hero { background: var(--hero-gradient); padding: 72px 0 56px; text-align: center; }
.hero .hero-title { margin: 12px 0 20px; }
.hero-subtitle { font-size: clamp(19px, 2.5vw, 24px); color: var(--text-secondary); max-width: 640px; margin: 0 auto; font-weight: 400; }

/* ================= 文章卡片 ================= */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; padding: 48px 0 72px; }
.post-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 18px;
  padding: 28px; cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex; flex-direction: column; gap: 12px; color: inherit;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); border-color: transparent; text-decoration: none; }
.post-card .meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-tertiary); }
.category-badge {
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: rgba(0, 113, 227, 0.08); padding: 3px 10px; border-radius: 980px;
}
[data-theme='dark'] .category-badge { background: rgba(41, 151, 255, 0.16); }
.post-card h3 { font-size: 22px; font-weight: 600; }
.post-card p.excerpt { color: var(--text-secondary); font-size: 15px; line-height: 1.55; flex: 1; }
.post-card .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.post-card .tag { font-size: 12px; color: var(--text-tertiary); }

/* ================= 文章/页面详情 ================= */
.post-article { max-width: 760px; margin: 0 auto; padding: 56px 24px 96px; }
.post-header { text-align: center; margin-bottom: 48px; }
.post-header h1 { font-size: clamp(32px, 5vw, 48px); font-weight: 700; margin: 16px 0; }
.post-header .meta { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--text-tertiary); font-size: 14px; flex-wrap: wrap; }

/* ================= 正文排版（WP 内容） ================= */
.markdown-body { font-size: 17px; line-height: 1.75; color: var(--text); overflow-wrap: break-word; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1.8em 0 0.7em; }
.markdown-body h2 { font-size: 28px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.markdown-body h3 { font-size: 22px; }
.markdown-body p { margin: 1em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin: 1em 0; }
.markdown-body li { margin: 0.4em 0; }
.markdown-body blockquote {
  margin: 1.5em 0; padding: 12px 20px; border-left: 4px solid var(--accent);
  background: var(--bg-secondary); border-radius: 0 12px 12px 0; color: var(--text-secondary);
}
.markdown-body code:not(pre code) {
  background: var(--bg-secondary); padding: 2px 7px; border-radius: 6px; font-size: 0.88em;
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, 'Courier New', monospace; color: var(--accent);
}
.markdown-body pre, .markdown-body .wp-block-code {
  background: var(--code-bg); color: var(--code-text); border-radius: 14px;
  padding: 20px; overflow-x: auto; margin: 1.5em 0; line-height: 1.6; font-size: 14px;
}
.markdown-body pre code {
  font-family: 'SF Mono', 'JetBrains Mono', Consolas, 'Courier New', monospace;
  background: transparent; padding: 0; color: inherit;
}
.markdown-body pre code.hljs { background: transparent; padding: 0; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: 15px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.markdown-body th { background: var(--bg-secondary); font-weight: 600; }
.markdown-body img { border-radius: 12px; margin: 1.5em auto; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }
.markdown-body a { color: var(--accent); }
.aligncenter { margin-left: auto; margin-right: auto; }

/* ================= 分页 ================= */
.pagination { display: flex; justify-content: center; gap: 10px; padding: 8px 0 64px; flex-wrap: wrap; }
.pagination .page-numbers {
  padding: 8px 16px; border-radius: 980px; font-size: 14px;
  color: var(--text-secondary); border: 1px solid var(--border);
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .page-numbers:hover { text-decoration: none; opacity: 0.85; }

/* ================= 页脚 ================= */
.footer { border-top: 1px solid var(--border); padding: 40px 0; background: var(--bg-secondary); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-tertiary); }

/* ================= 空状态 / 404 ================= */
.empty-state, .notfound { text-align: center; padding: 120px 24px; }
.empty-state h2, .notfound h2 { font-size: 32px; margin-bottom: 12px; }
.empty-state p, .notfound p { color: var(--text-secondary); margin-bottom: 24px; }

/* ================= 滚动渐入 ================= */
.fade-up { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.fade-up.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .fade-up { opacity: 1; transform: none; transition: none; } }

/* ================= 搜索结果 ================= */
.search-count { color: var(--text-secondary); margin: 8px 0 0; }

/* ================= 响应式 ================= */
/* 桌面：隐藏手机专用搜索图标 */
.mobile-search { display: none; }

@media (max-width: 640px) {
  /* 导航：单行紧凑（隐藏长搜索框，换图标入口） */
  .navbar-inner { flex-wrap: nowrap; gap: 8px; }
  .nav-brand { font-size: 16px; }
  .nav-links { gap: 14px; flex-wrap: nowrap; }
  .nav-links a { font-size: 13px; white-space: nowrap; }
  .nav-search { display: none; }
  .mobile-search { display: inline-flex; }

  /* 内容区 */
  .post-grid { grid-template-columns: 1fr; padding: 32px 0 56px; }
  .post-card { padding: 22px; }
  .post-card h3 { font-size: 19px; }
  .post-article { padding: 36px 20px 72px; }
  .post-header h1 { font-size: clamp(26px, 7vw, 32px); }
  .hero { padding: 48px 0 40px; }

  /* 正文表格/代码横向滚动，避免撑破布局 */
  .markdown-body table { display: block; overflow-x: auto; }
  .entry-content { overflow-wrap: break-word; }
}
