/* ==========================================================================
   base.css — 设计变量、重置、排版、按钮与通用工具类
   品牌色取自小程序端 app.json / app.wxss，保证官网与产品视觉一致
   ========================================================================== */

:root {
  /* 品牌色 —— 与小程序 tabBar selectedColor 一致 */
  --brand: #3e63dd;
  --brand-hover: #3355c9;
  --brand-active: #2b47ab;
  --brand-ink: #1d3aa8;
  --brand-50: #f2f6ff;
  --brand-100: #e3ebff;
  --brand-200: #c8d7ff;

  /* 功能语义色 —— 与 AI 卡片渲染规范一致（待办蓝 / 随手记绿） */
  --todo: #1d4ed8;
  --memo: #059669;
  --memo-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;

  /* 中性色 */
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #8a96bd;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9ff;
  --surface-mute: #f8fafc;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 48px rgba(30, 58, 138, 0.1);
  --shadow-brand: 0 10px 28px rgba(62, 99, 221, 0.24);

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* 尺寸 */
  --container: 1180px;
  --nav-h: 68px;

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 重置 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

a:hover {
  color: var(--brand-hover);
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

/* ---------- 排版 ---------- */

.h1 {
  font-size: clamp(2rem, 1.35rem + 2.6vw, 3.25rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.h2 {
  font-size: clamp(1.55rem, 1.2rem + 1.5vw, 2.35rem);
  line-height: 1.28;
}

.h3 {
  font-size: clamp(1.15rem, 1.05rem + 0.45vw, 1.4rem);
}

.lead {
  font-size: clamp(1rem, 0.96rem + 0.25vw, 1.15rem);
  color: var(--muted);
  line-height: 1.75;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.eyebrow--memo {
  background: var(--memo-soft);
  color: #047857;
}

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

/* ---------- 布局 ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: clamp(56px, 4vw + 40px, 96px) 0;
}

.section--soft {
  background: var(--surface-soft);
}

.section--tight {
  padding: clamp(40px, 3vw + 28px, 64px) 0;
}

.section-head {
  max-width: 720px;
  margin: 0 auto clamp(36px, 3vw, 56px);
  text-align: center;
}

.section-head .lead {
  margin-top: 14px;
}

.grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--r-pill);
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.btn--primary:hover {
  background: var(--brand-hover);
  color: #fff;
}

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.btn--ghost:hover {
  border-color: var(--brand-200);
  color: var(--brand-ink);
}

.btn--soft {
  background: var(--brand-50);
  color: var(--brand-ink);
}

.btn--soft:hover {
  background: var(--brand-100);
  color: var(--brand-ink);
}

.btn--lg {
  padding: 15px 34px;
  font-size: 1.05rem;
}

.btn--sm {
  padding: 9px 20px;
  font-size: 0.9rem;
}

.btn--block {
  width: 100%;
}

.btn__icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------- 卡片与标签 ---------- */

.card {
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
    border-color 0.22s var(--ease);
}

.card--hover:hover {
  transform: translateY(-4px);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
}

.tag--memo {
  background: var(--memo-soft);
  color: #047857;
}

.tag--warn {
  background: var(--warn-soft);
  color: #b45309;
}

.tag--danger {
  background: var(--danger-soft);
  color: #b91c1c;
}

.tag--muted {
  background: var(--surface-mute);
  color: var(--muted);
}

/* ---------- 图标底座 ---------- */

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 13px;
  background: var(--brand-50);
  color: var(--brand);
}

.icon-badge svg {
  width: 24px;
  height: 24px;
}

.icon-badge--memo {
  background: var(--memo-soft);
  color: var(--memo);
}

.icon-badge--warn {
  background: var(--warn-soft);
  color: #d97706;
}

/* ---------- 滚动进场动画 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 无障碍 ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}
