/* =========================================================
   PeekMD 静态官网样式
   设计基线：PeekMD 设计系统（安静 / 原生 / 系统色 / 留白）
   风格参考：NuPhy 设置页（配置器卡片 + 侧栏分组 + 圆角）
   主题：通过 [data-theme] 切换明/暗，颜色集中在 :root 变量
   ========================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  /* 浅色主题 */
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --border: #e6e6ea;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --accent: #0a84ff;        /* 品牌强调 / Markdown 蓝 */
  --accent-2: #34c759;      /* HTML 绿 */
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.06);
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 深色主题：沿用系统语义色思路 */
[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --border: #38383a;
  --text: #f5f5f7;
  --text-2: #aeb2b8;
  --accent: #0a84ff;
  --accent-2: #30d158;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--accent);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 13px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { opacity: 0.9; }
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand__mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 9px; font-weight: 800;
}
.nav__links { display: flex; gap: 28px; margin-left: 24px; flex: 1; }
.nav__links a { color: var(--text-2); font-size: 15px; font-weight: 500; transition: color 0.2s; }
.nav__links a:hover { color: var(--text); }
.nav__actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.2s;
}
.theme-toggle:hover { background: var(--surface-2); }
/* 根据主题显示对应图标 */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 11px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav__burger span {
  width: 18px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 72px 24px 56px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero__title { font-size: clamp(34px, 5vw, 56px); }
.hero__subtitle {
  margin-top: 20px;
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-2);
  max-width: 520px;
}
.hero__actions { margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero__note { margin-top: 18px; font-size: 14px; color: var(--text-2); }

/* ---------- 手机预览 mockup ---------- */
.hero__visual { display: flex; justify-content: center; }
.phone {
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.phone--sm { width: 230px; }
.phone__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--blue { background: var(--accent); }
.dot--green { background: var(--accent-2); }
.phone__filename { font-weight: 600; flex: 1; }
.phone__badge {
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 2px 8px; border-radius: 6px;
}
.phone__badge--green { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 16%, transparent); }
.phone__screen { padding: 18px; font-size: 13px; }
.phone__screen h3 { font-size: 17px; margin-bottom: 8px; }
.phone__screen h4 { font-size: 14px; margin-bottom: 6px; }
.phone__screen p { color: var(--text-2); margin-bottom: 8px; }
.phone__screen pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px; margin: 8px 0;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px; overflow: hidden;
}
.phone__screen ul { padding-left: 18px; margin: 8px 0; color: var(--text-2); }
.phone__screen blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px; margin: 8px 0;
  color: var(--text-2); font-style: italic;
}
.phone__screen--html { display: grid; place-items: center; min-height: 180px; }
.mock-card {
  width: 100%; text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 18px;
}
.mock-btn {
  margin-top: 10px;
  background: var(--accent-2); color: #fff;
  border: none; border-radius: 10px;
  padding: 8px 16px; font-weight: 600; font-size: 12px; cursor: pointer;
}
.mock-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11px; }
.mock-table td { border: 1px solid var(--border); padding: 5px; text-align: center; color: var(--text-2); }

/* ---------- 通用区块 ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: 80px 24px; }
.section--alt { background: var(--surface-2); max-width: none; }
.section--alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section__head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section__head h2 { font-size: clamp(26px, 3.5vw, 38px); margin-top: 8px; }
.section__head p { margin-top: 14px; color: var(--text-2); font-size: 17px; }

/* ---------- 功能网格 ---------- */
.grid { display: grid; gap: 20px; }
.grid--features { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature h3 { font-size: 19px; margin: 14px 0 8px; }
.feature p { color: var(--text-2); font-size: 15px; }
.feature__icon {
  width: 48px; height: 48px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 22px;
}
.feature__icon--blue { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.feature__icon--green { background: color-mix(in srgb, var(--accent-2) 16%, transparent); }

/* ---------- 配置器（仿 NuPhy 设置页） ---------- */
.configurator {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.configurator__side {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.cfg-step {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cfg-step:hover { background: var(--surface); }
.cfg-step.is-active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.cfg-step__no { font-size: 13px; color: var(--accent); font-weight: 700; }
.configurator__panel { padding: 40px; min-height: 280px; }
.cfg-panel { display: none; }
.cfg-panel.is-active { display: block; animation: fade 0.25s ease; }
.cfg-panel h3 { font-size: 24px; margin-bottom: 12px; }
.cfg-panel p { color: var(--text-2); font-size: 16px; max-width: 520px; }
.cfg-list { margin-top: 18px; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.cfg-list li { color: var(--text-2); font-size: 15px; padding-left: 22px; position: relative; }
.cfg-list li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--accent-2); font-weight: 700;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 界面展示 ---------- */
.showcase { display: flex; gap: 32px; justify-content: center; flex-wrap: wrap; }

/* ---------- 下载 CTA ---------- */
.cta { text-align: center; }
.cta__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 64px 32px;
}
.cta__card h2 { font-size: clamp(26px, 3.5vw, 40px); }
.cta__card p { margin-top: 14px; color: var(--text-2); font-size: 18px; }
.cta__actions { margin-top: 30px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.cta__meta { margin-top: 22px; font-size: 14px; color: var(--text-2); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 36px 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.footer__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.footer__links { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.footer__links a { color: var(--text-2); font-size: 15px; }
.footer__links a:hover { color: var(--text); }
.footer__copy { color: var(--text-2); font-size: 13px; width: 100%; }

/* ---------- 滚动渐显 ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 响应式断点 ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; text-align: center; }
  .hero__subtitle, .hero__actions, .hero__note { margin-left: auto; margin-right: auto; }
  .hero__visual { order: -1; }
  .grid--features { grid-template-columns: repeat(2, 1fr); }
  .configurator { grid-template-columns: 1fr; }
  .configurator__side { flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .cfg-step { white-space: nowrap; }
}

@media (max-width: 640px) {
  /* 移动端折叠导航 */
  .nav__links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav__cta { display: none; }
  .nav__burger { display: flex; }
  .grid--features { grid-template-columns: 1fr; }
  .section { padding: 56px 20px; }
  .configurator__panel { padding: 28px 22px; }
  .cta__card { padding: 44px 22px; }
}

/* 尊重「减少动态效果」系统设置 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
