/* =====================================================================
   小麦管家 落地页样式
   设计 token 直接镜像 App 主题（xiaomai-flutter/lib/theme/app_colors.dart）
   亮/暗双主题通过 CSS 变量切换；内联主题引导脚本在首绘前设定 data-theme。
   ===================================================================== */

/* ---------- 设计 token（亮色） ---------- */
:root {
  --bg: #FFFFFF;
  --bg-alt: #F6F6F7;
  --card: #FFFFFF;

  --text-hero: #1A1A1A;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-tertiary: #999999;

  --divider: #EFEFEF;
  --outline: #D9D9D9;
  --hairline: #EBEBEB;

  --accent: #FF6B5C;
  --accent-pressed: #E85446;
  --accent-tint: rgba(255, 107, 92, .12);

  --success: #5BAE7A;
  --warning: #E8A33D;
  --error: #E53935;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .06);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .14);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  --container: 1140px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* ---------- 设计 token（暗色） ---------- */
[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #0E0E0E;
  --card: #161616;

  --text-hero: #FFFFFF;
  --text-primary: #ECECEE;
  --text-secondary: #A8A8A8;
  --text-tertiary: #767676;

  --divider: #262626;
  --outline: #333333;
  --hairline: #222222;

  --accent: #FF6B5C;
  --accent-pressed: #FF8275;
  --accent-tint: rgba(255, 107, 92, .16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

/* 无 JS 时跟随系统偏好 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #000000;
    --bg-alt: #0E0E0E;
    --card: #161616;
    --text-hero: #FFFFFF;
    --text-primary: #ECECEE;
    --text-secondary: #A8A8A8;
    --text-tertiary: #767676;
    --divider: #262626;
    --outline: #333333;
    --hairline: #222222;
    --accent-tint: rgba(255, 107, 92, .16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  color: var(--text-hero);
  line-height: 1.25;
  margin: 0;
  letter-spacing: -.01em;
}
p { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

[id] { scroll-margin-top: 84px; }

/* ---------- 布局容器 ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 840px; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-md);
  font-weight: 600; font-size: 15px;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn--ghost { background: var(--card); color: var(--text-primary); border-color: var(--outline); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }

/* ---------- 跳转链接（无障碍） ---------- */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
  }
}
.topbar__inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-hero); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand__icon { border-radius: 8px; }
.topbar__links { display: none; align-items: center; gap: 24px; margin-left: auto; }
.topbar__links a { color: var(--text-secondary); font-size: 15px; font-weight: 500; }
.topbar__links a:hover { color: var(--accent); text-decoration: none; }
.theme-toggle {
  margin-left: auto; border: 1px solid var(--outline); background: var(--card);
  color: var(--text-primary); width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle__icon::before { content: "🌙"; font-size: 17px; }
[data-theme="dark"] .theme-toggle__icon::before { content: "☀️"; }
@media (min-width: 760px) {
  .topbar__links { display: flex; }
  .theme-toggle { margin-left: 0; }
}

/* ---------- 区块标题 ---------- */
.section-title { font-size: clamp(26px, 4vw, 40px); font-weight: 700; text-align: center; }
.section-title--start { text-align: start; }
.section-lead { text-align: center; color: var(--text-secondary); max-width: 640px; margin: 14px auto 0; }

/* ---------- 商店徽章 ---------- */
.store {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: var(--r-md);
  background: var(--text-hero); color: var(--bg);
  line-height: 1.2; transition: transform .15s ease, box-shadow .2s ease;
}
.store:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.store span { display: flex; flex-direction: column; }
.store small { font-size: 11px; opacity: .82; }
.store strong { font-size: 16px; font-weight: 600; }
.store--lg { padding: 14px 24px; }
.store--lg strong { font-size: 18px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 7vw, 88px); }
.hero__inner { display: grid; grid-template-columns: 1fr; gap: 44px; align-items: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-tint); color: var(--accent-pressed);
  padding: 6px 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; margin: 0 0 20px;
}
.hero__eyebrow img { border-radius: 6px; }
.hero__title { font-size: clamp(28px, 5.2vw, 52px); font-weight: 700; }
.hero__subtitle { font-size: clamp(16px, 2.2vw, 20px); color: var(--text-secondary); max-width: 540px; margin: 20px 0 30px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero__hint { color: var(--text-tertiary); font-size: 13px; margin: 18px 0 0; }

.hero__media { position: relative; display: flex; justify-content: center; }
.blob {
  position: absolute; inset: 4% 4% auto 4%; height: 86%;
  background: radial-gradient(circle at 50% 42%, var(--accent) 0%, transparent 66%);
  filter: blur(14px); opacity: .38; border-radius: 50%; z-index: 0;
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ---------- 手机外框（CSS 绘制） ---------- */
.device {
  position: relative; z-index: 1;
  width: min(76vw, 300px); aspect-ratio: 390 / 844;
  background: #0a0a0a; border-radius: 42px; padding: 10px;
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .device { background: #1c1c1c; }
.device::before {
  content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: 96px; height: 26px; background: #0a0a0a; border-radius: 0 0 16px 16px; z-index: 2;
}
[data-theme="dark"] .device::before { background: #1c1c1c; }
.device__screen { width: 100%; height: 100%; border-radius: 32px; display: block; object-fit: cover; }
.device--sm { width: min(64vw, 248px); }

@media (min-width: 900px) {
  .hero__inner { grid-template-columns: 1.05fr .95fr; gap: 40px; }
}

/* ---------- 三联价值 ---------- */
.trio { background: var(--bg-alt); padding: clamp(56px, 8vw, 96px) 0; }
.trio__grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 44px; }
.trio__card {
  background: var(--card); border-radius: var(--r-xl); padding: 30px 26px;
  border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
}
.trio__emoji { font-size: 34px; line-height: 1; margin-bottom: 14px; }
.trio__card p { margin: 0; color: var(--text-secondary); }
.trio__card strong { color: var(--text-primary); }
@media (min-width: 720px) { .trio__grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 核心功能 ---------- */
.features { padding: clamp(64px, 9vw, 112px) 0; }
.features__grid {
  list-style: none; margin: 44px 0 0; padding: 0;
  display: grid; gap: 18px; grid-template-columns: 1fr;
}
.feature {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: 24px 22px; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.feature__icon {
  width: 48px; height: 48px; border-radius: var(--r-md); background: var(--accent-tint);
  display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 14px;
}
.feature__title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.feature__desc { font-size: 14px; color: var(--text-secondary); margin: 0; }
@media (min-width: 560px) { .features__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .features__grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- 高亮行 ---------- */
.highlight { padding: clamp(56px, 9vw, 104px) 0; }
.highlight--alt { background: var(--bg-alt); }
.highlight__inner { display: grid; grid-template-columns: 1fr; gap: 36px; align-items: center; }
.highlight__media { display: flex; justify-content: center; }
.highlight__title { font-size: clamp(24px, 3.4vw, 36px); font-weight: 700; margin-bottom: 14px; }
.highlight__text { font-size: 17px; color: var(--text-secondary); margin-bottom: 22px; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.check-list li {
  position: relative; padding-left: 32px; color: var(--text-primary); font-weight: 500;
}
.check-list li::before {
  content: "✓"; position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
@media (min-width: 880px) {
  .highlight__inner { grid-template-columns: repeat(2, 1fr); gap: 56px; }
  .highlight--reverse .highlight__media { order: 2; }
}

/* ---------- 暗夜模式 ---------- */
.theme { background: var(--bg-alt); padding: clamp(56px, 9vw, 104px) 0; }
.theme__inner { display: grid; grid-template-columns: 1fr; gap: 36px; align-items: center; }
.theme__media { display: flex; justify-content: center; }
.theme__text { color: var(--text-secondary); font-size: 17px; margin: 16px 0 26px; }
.swatch { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 14px 22px; }
.swatch li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.swatch__dot {
  width: 22px; height: 22px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px var(--bg-alt), 0 0 0 4px var(--hairline);
}
@media (min-width: 880px) {
  .theme__inner { grid-template-columns: 1fr 1fr; gap: 56px; }
  .theme__media { order: 2; }
}

/* ---------- FAQ ---------- */
.faq { padding: clamp(64px, 9vw, 112px) 0; }
.faq__list { margin-top: 44px; display: grid; gap: 14px; }
.faq__item {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: 0 22px; box-shadow: var(--shadow-sm);
}
.faq__q {
  cursor: pointer; list-style: none; padding: 20px 36px 20px 0;
  font-size: 17px; font-weight: 600; color: var(--text-primary); position: relative;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 26px; font-weight: 400; color: var(--accent); line-height: 1;
}
.faq__item[open] .faq__q::after { content: "–"; }
.faq__item[open] .faq__q { padding-bottom: 6px; }
.faq__a { padding: 0 0 20px; color: var(--text-secondary); }
.faq__a p { margin: 0; }

/* ---------- 终极 CTA ---------- */
.cta-final {
  background: linear-gradient(135deg, var(--accent) 0%, #FF8C7F 100%);
  color: #fff; text-align: center; padding: clamp(64px, 9vw, 104px) 0;
}
.cta-final__title { color: #fff; font-size: clamp(28px, 4.5vw, 44px); }
.cta-final__text { font-size: 18px; opacity: .96; margin: 14px auto 32px; max-width: 520px; }
.cta-final__actions { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: center; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr__img { background: #fff; padding: 10px; border-radius: var(--r-lg); }
.qr__caption { color: #fff; font-size: 13px; margin: 0; }

/* ---------- 页脚 ---------- */
.footer { background: var(--bg-alt); border-top: 1px solid var(--hairline); padding: 56px 0 28px; }
.footer__inner { display: grid; grid-template-columns: 1fr; gap: 36px; }
.footer__brand { display: flex; gap: 14px; align-items: center; }
.footer__brand img { border-radius: 10px; }
.footer__name { font-weight: 700; font-size: 18px; margin: 0; color: var(--text-hero); }
.footer__tag { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }
.footer__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.footer__head { font-size: 14px; color: var(--text-hero); margin: 0 0 12px; }
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer__col a { color: var(--text-secondary); font-size: 14px; }
.footer__col a:hover { color: var(--accent); }
.footer__bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--hairline); color: var(--text-tertiary); font-size: 13px; }
.footer__bottom p { margin: 0; }
.footer__bottom p + p { margin-top: 6px; }
.footer__bottom a { color: inherit; text-decoration: none; transition: color .2s; }
.footer__bottom a:hover { color: var(--accent); }
@media (min-width: 680px) {
  .footer__inner { grid-template-columns: 1.5fr 1fr; }
}

/* ---------- 性能：长区块跳过屏外渲染 ---------- */
.features, .faq { content-visibility: auto; contain-intrinsic-size: auto 760px; }

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
