/* 拾鸟 WhatsBird 下载页 —— 视觉沿用 App 的 Paper Almanac 体系（见 docs/design/DESIGN.md §2.2）。
   token：纸底 #F7F4EC / 苔绿 #3A5540 / 琥珀 #DDA45A / 墨绿 #1F2A22 */

:root {
  --paper: #F7F4EC;
  --card: #FFFDF8;
  --ink: #1F2A22;
  --ink-soft: #55635A;
  --moss: #3A5540;
  --moss-bright: #5A7A5F;
  --sage: #E9F0E6;
  --olive: #5B6B4F;
  --amber: #DDA45A;
  --red: #E2483D;
  --line: #E4DFCF;
  --sil-a: #EFEBDF;
  --sil-b: #E4DFCF;
  --shadow: 0 10px 24px rgba(31, 42, 34, .10), 0 2px 4px rgba(31, 42, 34, .06);
  --serif: "Georgia", "Songti SC", "Source Han Serif SC", "Noto Serif SC", serif;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1B211C;
    --card: #232A24;
    --ink: #E8E6DE;
    --ink-soft: #A6B0A6;
    --moss: #8FB294;
    --moss-bright: #A7C6AB;
    --sage: #2C352C;
    --olive: #B9C9AF;
    --line: #343D35;
    --sil-a: #2A312A;
    --sil-b: #333C33;
    --shadow: 0 10px 24px rgba(0, 0, 0, .45), 0 2px 4px rgba(0, 0, 0, .30);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  /* 手机端禁掉捏合缩放与横向回弹，避免缩到页面边界外露白边 */
  touch-action: manipulation;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.sci { font-family: var(--serif); font-style: italic; font-weight: 400; }

a { color: var(--moss); }
a:hover { color: var(--moss-bright); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px clamp(14px, 5vw, 48px);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .02em;
}
.appicon {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  box-shadow: 0 2px 6px rgba(31, 42, 34, .18);
}
.topbar nav { display: flex; gap: clamp(10px, 2vw, 22px); font-size: 14px; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; }
.topbar nav a:hover { color: var(--moss); }
.topbar nav .ghost {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  color: var(--moss); border: 1px solid var(--moss); border-radius: 999px;
  padding: 4px 13px; opacity: .9;
}
.topbar nav .ghost:hover { background: var(--sage); opacity: 1; }
.topbar nav .ghost .gh { width: 15px; height: 15px; flex: none; }
.topbar nav .afdian { border-color: var(--line); color: var(--ink-soft); }
.topbar nav .afdian:hover { color: var(--moss); }
/* 爱发电官方图标（取自 static.afdiancdn.com 的 favicon），保持原色不跟随主题 */
.topbar nav .afdian .afdian-icon {
  width: 16px; height: 16px; border-radius: 3px; flex: none; display: block;
}

/* ---------- 版心 ---------- */
main { max-width: 960px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 32px) 72px; }
section { padding: 52px 0 8px; }
h2 { font-size: clamp(20px, 3.4vw, 26px); margin: 0 0 20px; display: flex; align-items: center; gap: 14px; }
h2 .rule { display: inline-block; width: 28px; height: 3px; background: var(--amber); border-radius: 2px; flex: none; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(24px, 5vw, 56px); position: relative; }
/* 纸面压印：品牌字样淡淡印在纸底上 */
.hero::before {
  content: "拾鸟 WhatsBird";
  position: absolute; top: clamp(4px, 2vw, 32px); right: -2%;
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(52px, 10vw, 124px); line-height: 1;
  color: var(--ink); opacity: .055; white-space: nowrap;
  pointer-events: none; user-select: none; z-index: 0;
}
.hero-text { position: relative; z-index: 1; }

.hero-brand {
  display: inline-flex; align-items: center; gap: 11px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 20px 6px 6px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.hero-brand img {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  box-shadow: 0 2px 8px rgba(31, 42, 34, .18);
}
.hero-brand span { font-size: 19px; font-weight: 800; letter-spacing: .02em; }
.hero-brand span .sci { color: var(--moss); font-size: 18px; }

.eyebrow { margin: 0 0 14px; font-size: 13px; letter-spacing: .16em; color: var(--olive); }
h1 { font-size: clamp(29px, 5.4vw, 46px); line-height: 1.22; margin: 0 0 18px; letter-spacing: -.01em; }
h1 .sci { color: var(--moss); }
.lede { max-width: 40em; color: var(--ink-soft); font-size: clamp(15px, 2.2vw, 18px); margin: 0 0 28px; }
.lede-sm { color: var(--ink-soft); max-width: 44em; }

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn-primary {
  display: inline-flex; align-items: baseline; gap: 8px;
  background: var(--moss); color: #FFFDF8; text-decoration: none;
  padding: 15px 28px; border-radius: 14px; font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow); transition: transform .15s ease, filter .15s ease;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); color: #FFFDF8; }
.btn-mirror {
  display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none;
  border: 1px solid var(--moss); color: var(--moss); border-radius: 14px;
  padding: 14px 22px; font-size: 16px; font-weight: 700;
}
.btn-mirror span { font-size: 12.5px; font-weight: 400; color: var(--ink-soft); }
/* 提取码加粗：用户要照着敲，太小太淡容易敲错 */
.btn-mirror span b { font-weight: 800; color: var(--ink); letter-spacing: .6px; }
.btn-mirror:hover { background: var(--sage); }
.btn-mirror[aria-disabled="true"] {
  opacity: .5; pointer-events: none; border-style: dashed;
}
.btn-ghost { color: var(--moss); text-decoration: none; font-weight: 600; padding: 14px 8px; border-bottom: 2px solid var(--amber); }
.cta-hint { color: var(--ink-soft); font-size: 13.5px; margin: 14px 0 0; line-height: 1.85; }
/* 蓝奏云「电脑模式」提示：这是最容易被当成收费墙误伤用户的一处，单独标色 */
.cta-hint .hint-warn { color: var(--moss); font-weight: 700; }

/* ---------- 版本信息六宫格 ---------- */
.meta {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.meta { margin: 26px 0 0; }
.meta > div { background: var(--card); padding: 14px 10px; text-align: center; }
.meta b { display: block; font-size: 18px; font-weight: 800; color: var(--moss); line-height: 1.35; }
.meta span { font-size: 12.5px; color: var(--ink-soft); }
@media (max-width: 760px) {
  .meta { grid-template-columns: repeat(3, 1fr); }
  .meta > div { padding: 12px 6px; }
  .meta b { font-size: 16px; }
  .meta span { font-size: 11.5px; }
}

/* ---------- 通用卡 / 两栏 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); }
.card-h { margin: 0 0 12px; font-size: 16px; color: var(--moss); }
.two-col { display: grid; gap: 18px; }
@media (min-width: 760px) { .two-col { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 安装步骤 ---------- */
.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 50px; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--sage); color: var(--olive);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
}
.steps strong { color: var(--moss); }

.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-soft); flex: none; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- FAQ ---------- */
.qa {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.qa summary {
  cursor: pointer; font-weight: 700; color: var(--moss); list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  touch-action: manipulation;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "＋"; color: var(--amber); font-size: 18px; flex: none; }
.qa[open] summary::after { content: "－"; }
.qa p { margin: 10px 0 0; color: var(--ink-soft); font-size: 14.5px; }

/* ---------- 版本记录 ---------- */
.releases { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); }
.rel-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.rel-row:last-child { border-bottom: 0; }
.rel-row strong { display: block; font-size: 15px; }
.rel-meta { font-size: 13px; color: var(--ink-soft); }
.rel-dl { text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; }
.rel-dl::after { content: " ↗"; }
.releases .aside { border: 0; padding: 14px 18px; margin: 0; }

code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--sage); color: var(--ink); padding: 2px 7px; border-radius: 6px; word-break: break-all;
}
code.fp { display: inline-block; margin-top: 4px; font-size: 11.5px; }

/* 桌面端：截图加白框描边 + 轻微浮动（手机端不做，避免干扰滑动） */
@media (hover: hover) and (pointer: fine) {
  .carousel .ph-wrap {
    border: 1px solid var(--line);
    box-shadow: 0 20px 44px rgba(31, 42, 34, .16), 0 3px 8px rgba(31, 42, 34, .08);
    transition: transform .35s cubic-bezier(.22, .61, .36, 1), box-shadow .35s ease;
  }
  /* 拍立得白框里的细描边 */
  .carousel .ph-wrap::after {
    content: ""; position: absolute; inset: 7px; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .55); pointer-events: none; z-index: 2;
  }
  @media (prefers-color-scheme: dark) {
    .carousel .ph-wrap::after { border-color: rgba(255, 255, 255, .14); }
  }
  .carousel .ph-wrap > img {
    animation: floaty 7.5s ease-in-out infinite;
    transform-origin: 50% 60%;
  }
  .carousel .slide:nth-child(2) .ph-wrap > img { animation-delay: -1.9s; }
  .carousel .slide:nth-child(3) .ph-wrap > img { animation-delay: -3.8s; }
  .carousel .slide:nth-child(4) .ph-wrap > img { animation-delay: -5.7s; }
  .carousel .slide:hover .ph-wrap {
    transform: translateY(-10px);
    box-shadow: 0 30px 64px rgba(31, 42, 34, .22), 0 4px 10px rgba(31, 42, 34, .10);
  }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-7px) scale(1.015); }
}

/* ---------- 页脚 ---------- */
.brand-lock {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 4px auto 20px; text-align: left; max-width: 560px;
}
.brand-lock img {
  width: 64px; height: 64px; border-radius: 15px; flex: none;
  box-shadow: 0 8px 20px rgba(31, 42, 34, .18);
}
.brand-txt strong { display: block; font-size: 22px; letter-spacing: .01em; }
.brand-txt strong .sci { color: var(--moss); font-size: 20px; }
.brand-txt span { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.6; margin-top: 2px; }

footer {
  border-top: 1px solid var(--line); padding: 40px clamp(16px, 5vw, 48px) 44px;
  text-align: center; color: var(--ink-soft); font-size: 13.5px;
}
footer p { margin: 6px 0; }
footer .fine { font-size: 12.5px; opacity: .8; }

.aside {
  color: var(--ink-soft); font-size: 14px;
  border-left: 3px solid var(--line); padding-left: 14px; margin: 14px 0 0;
}

.note {
  margin-top: 20px; padding: 12px 16px; font-size: 14px; color: var(--ink-soft);
  background: var(--sage); border-left: 3px solid var(--amber); border-radius: 0 12px 12px 0;
}

.aside {
  color: var(--ink-soft); font-size: 14px;
  border-left: 3px solid var(--line); padding-left: 14px; margin: 22px 0 0;
}

/* ---------- 四屏：桌面并排，只有触屏手机才轮播 ---------- */
.carousel { position: relative; margin-top: 18px; outline: none; }
.carousel:focus-visible { box-shadow: 0 0 0 3px var(--amber); border-radius: 20px; }
.carousel .track {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
@media (min-width: 1024px) {
  .carousel .track { grid-template-columns: repeat(4, 1fr); }
}
.carousel .slide { margin: 0; display: flex; flex-direction: column; align-items: center; }

.ph-wrap {
  position: relative; display: block; width: 100%; max-width: 260px;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(160deg, var(--sil-a), var(--sil-b));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
/* 骨架：一条斜向高光扫过，像纸面上的反光 */
.ph-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, transparent 18%, rgba(255, 255, 255, .55) 50%, transparent 82%);
  background-size: 220% 100%;
  animation: shimmer 1.25s linear infinite;
  transition: opacity .4s ease;
}
.ph-wrap.is-loaded::before { opacity: 0; animation: none; }
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -120% 0; } }

.ph-wrap img {
  display: block; width: 100%; height: auto; aspect-ratio: 560 / 1246;
  object-fit: cover; cursor: zoom-in;
  opacity: 0; transition: opacity .45s ease;
}
.ph-wrap img.is-loaded { opacity: 1; }

.carousel .slide figcaption {
  margin-top: 16px; text-align: center;
  font-size: 13.5px; line-height: 1.8; color: var(--ink-soft);
}
.carousel .slide figcaption b {
  color: var(--moss); font-size: 15px; margin-right: 2px;
}

/* 桌面端不出现任何轮播控件 */
.nav-arrow, .dots { display: none; }

/* ---------- 触屏手机：切成轮播 ---------- */
@media (max-width: 900px) and ((pointer: coarse) or (hover: none)) {
  .carousel .track {
    display: flex; gap: 0;
    transition: transform .55s cubic-bezier(.22, .61, .36, 1);
    will-change: transform;
  }
  .carousel .slide { flex: 0 0 100%; }
  .carousel .slide[aria-hidden="true"] { pointer-events: none; }
  /* 手机上按屏幕高度收窄：一屏里能同时看到图和下面的解释，不用再滑一次 */
  .ph-wrap { max-width: min(340px, calc((100vh - 230px) * 0.45)); }
  .carousel .slide figcaption { font-size: 13.5px; line-height: 1.7; }

  /* 触控反馈：禁掉双击缩放与点击高亮，点控件不再触发页面缩放 */
  .nav-arrow, .dots .dot {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-arrow {
    display: block; position: absolute; top: 34%; z-index: 2;
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); color: var(--moss);
    font-size: 22px; line-height: 1; cursor: pointer;
    box-shadow: var(--shadow); transition: transform .15s ease, background .15s ease;
  }
  .nav-arrow:hover { transform: scale(1.06); background: var(--sage); }
  .nav-arrow.prev { left: 0; }
  .nav-arrow.next { right: 0; }
  .nav-arrow:focus { outline: none; }
  .nav-arrow:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

  .dots { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
  .dots .dot {
    width: 30px; height: 8px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--line); transition: background .2s ease, width .2s ease;
  }
  .dots .dot.on { background: var(--moss); width: 42px; }
  .dots .dot:focus { outline: none; }
  .dots .dot:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
}

/* ---------- 大图 ---------- */
dialog#lightbox { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; }
dialog#lightbox::backdrop { background: rgba(20, 26, 21, .8); }
dialog#lightbox img {
  max-width: 90vw; max-height: 86vh; display: block;
  border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
dialog#lightbox button {
  position: absolute; top: 8px; right: 12px;
  background: transparent; border: 0; color: #FFFDF8;
  font-size: 30px; line-height: 1; cursor: pointer; padding: 6px 10px;
}

@supports (height: 100svh) {
  /* 支持 svh 的浏览器用小屏高度算，地址栏收起时图更准 */
  @media (max-width: 900px) and ((pointer: coarse) or (hover: none)) {
    .ph-wrap { max-width: min(340px, calc((100svh - 230px) * 0.45)); }
  }
}

/* ---------- 窄屏小微调 ---------- */
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  body { font-size: 15.5px; }
  section { padding: 40px 0 4px; }

  .topbar { padding: 8px 14px; }
  .topbar nav a:not(.ghost) { display: none; }

  .btn-primary { width: 100%; justify-content: center; font-size: 17px; padding: 16px 20px; }
  .btn-ghost { width: 100%; text-align: center; border-bottom: 0; padding: 10px 0; }
  /* 宽度由上面「触屏手机」那段按屏幕高度算，这里不再覆盖 */
  .ph-wrap { border-radius: 16px; }
  .carousel .slide figcaption { font-size: 14px; line-height: 1.75; padding: 0 4px; }
  .nav-arrow { width: 38px; height: 38px; font-size: 21px; }
  .dots { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .carousel .track { transition: none; }
  .ph-wrap::before { animation: none; }
  .carousel .ph-wrap > img { animation: none; }
  .btn-primary:hover, .nav-arrow:hover { transform: none; }
}