/* SPDX-License-Identifier: GPL-3.0-only
   PerAnt 官网样式 · 纯静态，无外部字体或依赖 */

/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry.
   Put this @layer first; product CSS outside the layer wins ordinary layout rules.
   Native hidden and closed-dialog states take precedence over component display rules. */
@layer od-layout {
  [hidden]:not([hidden="until-found" i]) { display: none !important; }
  dialog:not([open]) { display: none !important; }
  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }
  .od-nowrap { white-space: nowrap; }
  .od-keep { word-break: keep-all; overflow-wrap: anywhere; }
}
:root [hidden]:where(:not([hidden="until-found" i])) { display: none; }
/* /OD-LAYOUT-PRIMITIVES v1 */

/* ---------- 设计变量 ---------- */
:root {
  --c-bg: #F8F8F3;
  --c-white: #FFFFFF;
  --c-text: #252A24;
  --c-muted: #686F60;
  --c-sage: #455C3E;
  --c-deep: #31452C;
  --c-sage-soft: #EDF1E5;
  --c-line: #E7EAE0;
  --c-on-deep-muted: #D9E2CF;

  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans CJK SC", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-h2: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --fs-hero: clamp(2.5rem, 1.2rem + 5.2vw, 5rem);

  --s-4: 4px;
  --s-8: 8px;
  --s-12: 12px;
  --s-16: 16px;
  --s-24: 24px;
  --s-32: 32px;
  --s-48: 48px;
  --s-64: 64px;
  --s-96: 96px;
  --section-pad: clamp(64px, 8vw, 120px);
  --gutter: clamp(20px, 5vw, 48px);
  --container: 1200px;
  --header-h: 64px;

  --r-8: 8px;
  --r-12: 12px;
  --r-20: 20px;
  --r-phone: clamp(24px, 3vw, 36px);
  --r-pill: 999px;

  --shadow-phone: 0 1px 2px rgba(37, 42, 36, 0.06), 0 24px 48px -24px rgba(49, 69, 44, 0.28);

  --t-fast: 160ms;
  --t-base: 240ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --focus: 0 0 0 3px var(--c-bg), 0 0 0 5px var(--c-sage);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--s-16)); }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-8); }

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: absolute; top: var(--s-8); left: var(--s-8); z-index: 100;
  padding: var(--s-8) var(--s-16); border-radius: var(--r-8);
  background: var(--c-deep); color: var(--c-white); text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

.text-link { color: var(--c-sage); text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) { .text-link:hover { color: var(--c-deep); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-8);
  min-height: 48px; padding: var(--s-12) var(--s-24);
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-size: var(--fs-16); font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.btn-primary { background: var(--c-sage); color: var(--c-white); }
.btn-secondary { background: var(--c-white); color: var(--c-text); border-color: var(--c-line); }
.btn-light { background: var(--c-white); color: var(--c-deep); }
.btn-outline-light { background: transparent; color: var(--c-white); border-color: rgba(255, 255, 255, 0.6); }
.section-dark .btn:focus-visible, .section-dark .copy-btn:focus-visible { box-shadow: 0 0 0 3px var(--c-deep), 0 0 0 5px var(--c-white); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--c-deep); }
  .btn-secondary:hover { border-color: var(--c-sage); color: var(--c-deep); }
  .btn-light:hover { background: var(--c-sage-soft); }
  .btn-outline-light:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--c-white); }
}
.btn:focus-visible { border-radius: var(--r-pill); }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base) var(--ease-out);
}
.site-header.is-scrolled { border-bottom-color: var(--c-line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-16); min-height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: var(--s-12); min-height: 44px; text-decoration: none; color: var(--c-text); }
.brand-icon { display: block; width: 36px; height: 36px; border-radius: var(--r-8); }
.brand-name { font-size: var(--fs-20); font-weight: 700; letter-spacing: -0.01em; }

.site-nav { display: flex; align-items: center; gap: var(--s-24); }
.nav-list { display: flex; align-items: center; gap: var(--s-4); }
.nav-list a, .nav-github {
  display: inline-flex; align-items: center; gap: var(--s-8);
  min-height: 44px; padding-inline: var(--s-12);
  border-radius: var(--r-pill);
  color: var(--c-text); font-size: var(--fs-16); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.nav-github { border: 1px solid var(--c-line); background: var(--c-white); padding-inline: var(--s-16); font-weight: 600; }
.github-mark { display: block; flex: none; }
.nav-list a:focus-visible, .nav-github:focus-visible { border-radius: var(--r-pill); }
@media (hover: hover) {
  .nav-list a:hover { background: var(--c-sage-soft); color: var(--c-deep); }
  .nav-github:hover { border-color: var(--c-sage); color: var(--c-deep); }
}

.menu-toggle {
  display: none; align-items: center; gap: var(--s-8);
  min-height: 44px; padding-inline: var(--s-16);
  border: 1px solid var(--c-line); border-radius: var(--r-pill);
  background: var(--c-white); cursor: pointer;
  --od-icon-size: 20px;
}
.menu-toggle:focus-visible { border-radius: var(--r-pill); }

/* ---------- 首屏 ---------- */
.hero { padding-block: clamp(40px, 6vw, 88px) var(--section-pad); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center; gap: var(--s-64); }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-24); }
.hero-tags { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.tag {
  display: inline-block; padding: var(--s-4) var(--s-12);
  border-radius: var(--r-pill);
  background: var(--c-sage-soft); color: var(--c-deep);
  font-size: var(--fs-14); font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.tag-quiet { background: var(--c-white); border: 1px solid var(--c-line); color: var(--c-text); }
.hero-title {
  font-size: var(--fs-hero); font-weight: 700; line-height: 1.18; letter-spacing: -0.02em;
  color: var(--c-text); word-break: keep-all;
}
.hero-lede { font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); line-height: 1.6; color: var(--c-text); max-width: 30em; }
.hero-note { color: var(--c-muted); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-12); padding-top: var(--s-8); }

.hero-media { position: relative; justify-self: center; width: min(100%, 360px); }
.hero-ant {
  position: absolute; left: -22%; bottom: 6%;
  width: 34%; height: auto; pointer-events: none;
}

/* 截图：保持 1170×2532 原比例，完整显示，保留状态栏 */
.phone-shot {
  overflow: hidden;
  border-radius: var(--r-phone);
  border: 1px solid var(--c-line);
  background: var(--c-white);
  box-shadow: var(--shadow-phone);
}
.phone-shot img { --od-ratio: 1170 / 2532; }
.phone-shot-hero { position: relative; z-index: 1; }

/* ---------- 通用分区 ---------- */
.section { padding-block: var(--section-pad); }
.section-tint { background: var(--c-white); border-block: 1px solid var(--c-line); }
.section-head { display: flex; flex-direction: column; gap: var(--s-12); max-width: 40em; margin-bottom: var(--s-48); }
.eyebrow { color: var(--c-sage); font-size: var(--fs-14); font-weight: 700; letter-spacing: 0.08em; }
.section-title { font-size: var(--fs-h2); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.section-lede { color: var(--c-muted); }

/* ---------- 三个入口 ---------- */
.tab-list {
  display: inline-flex; gap: var(--s-4); padding: var(--s-4);
  margin-bottom: var(--s-48);
  border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-white);
}
.tab {
  min-height: 44px; min-width: 88px; padding: var(--s-8) var(--s-24);
  border: 0; border-radius: var(--r-pill); background: transparent;
  color: var(--c-muted); font-size: var(--fs-16); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.tab[aria-selected="true"] { background: var(--c-sage); color: var(--c-white); }
.tab:focus-visible { border-radius: var(--r-pill); }
@media (hover: hover) { .tab[aria-selected="false"]:hover { background: var(--c-sage-soft); color: var(--c-deep); } }

.tab-panel {
  display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  align-items: center; gap: clamp(32px, 7vw, 112px);
  border-radius: var(--r-20);
}
.tab-panel.is-entering { animation: panel-in var(--t-base) var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tab-panel .phone-shot { width: 100%; max-width: 320px; justify-self: center; }
.panel-copy { display: flex; flex-direction: column; gap: var(--s-16); max-width: 34em; }
.panel-index { color: var(--c-sage); font-size: var(--fs-14); font-weight: 700; letter-spacing: 0.06em; }
.panel-title { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); font-weight: 700; line-height: 1.35; }
.panel-copy > p:not(.panel-index) { color: var(--c-muted); font-size: var(--fs-18); }
.panel-points { display: flex; flex-direction: column; gap: var(--s-8); padding-top: var(--s-8); border-top: 1px solid var(--c-line); }
.panel-points li { position: relative; padding: var(--s-8) 0 var(--s-8) var(--s-24); }
.panel-points li::before {
  content: ""; position: absolute; left: 0; top: calc(var(--s-8) + 0.85em - 4px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--c-sage);
}

/* ---------- 工作方式 ---------- */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-32); counter-reset: none; }
.step { position: relative; display: flex; flex-direction: column; gap: var(--s-8); padding-top: var(--s-64); }
.step::before {
  content: ""; position: absolute; top: 20px; left: 56px; right: calc(var(--s-32) * -1);
  height: 1px; background: var(--c-line);
}
.step:last-child::before { display: none; }
.step-num {
  position: absolute; top: 0; left: 0;
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--c-sage-soft); color: var(--c-deep);
  font-weight: 700;
}
.step-title { font-size: var(--fs-20); font-weight: 700; line-height: 1.4; }
.step p { color: var(--c-muted); }

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-24);
  margin-top: var(--s-64); padding-top: var(--s-32); border-top: 1px solid var(--c-line);
}
.fact { display: flex; flex-direction: column; gap: var(--s-4); }
.fact dt { font-weight: 700; color: var(--c-deep); }
.fact dd { color: var(--c-muted); }

/* ---------- 当前能力 ---------- */
.cap-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-48) var(--s-64); align-items: start; }
.cap-head { margin-bottom: 0; }
.cap-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--c-line); }
.cap-list li {
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-16) var(--s-16) var(--s-16) 0;
  border-bottom: 1px solid var(--c-line);
}
.cap-list strong { display: block; font-weight: 700; }
.cap-list span { display: block; color: var(--c-muted); font-size: var(--fs-16); }
.cap-note {
  grid-column: 2;
  display: flex; flex-direction: column; gap: var(--s-8);
  padding: var(--s-24); border-radius: var(--r-20);
  background: var(--c-sage-soft);
}
.cap-note-title { font-size: var(--fs-18); font-weight: 700; color: var(--c-deep); }
.cap-note p { color: var(--c-text); }
.cap-note p + .cap-note-title { margin-top: var(--s-16); }

/* ---------- 安装 ---------- */
.section-dark { background: var(--c-deep); color: var(--c-white); }
.section-dark .section-title { color: var(--c-white); }
.eyebrow-inverse { color: var(--c-on-deep-muted); }
.download-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-64); align-items: start; }
.download-copy { display: flex; flex-direction: column; gap: var(--s-16); }
.download-copy p:not(.eyebrow) { color: var(--c-on-deep-muted); max-width: 34em; }
.download-actions { display: flex; flex-wrap: wrap; gap: var(--s-12); padding-top: var(--s-16); }

.spec { display: flex; flex-direction: column; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.spec-row {
  display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: var(--s-16); align-items: baseline;
  padding-block: var(--s-16); border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.spec-row dt { color: var(--c-on-deep-muted); font-size: var(--fs-14); }
.spec-row dd { font-weight: 600; }
.spec-row-hash dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-12); }
.hash {
  display: block; width: 100%;
  font-family: var(--font-mono); font-size: var(--fs-14); font-weight: 400; line-height: 1.6;
  overflow-wrap: anywhere; word-break: break-all;
  padding: var(--s-12); border-radius: var(--r-12); background: rgba(0, 0, 0, 0.2);
}
.copy-btn {
  min-height: 44px; padding-inline: var(--s-16);
  border: 1px solid rgba(255, 255, 255, 0.6); border-radius: var(--r-pill);
  background: transparent; color: var(--c-white); font-size: var(--fs-14); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out);
}
@media (hover: hover) { .copy-btn:hover { background: rgba(255, 255, 255, 0.12); } }
.copy-btn:focus-visible { border-radius: var(--r-pill); }
.copy-status { color: var(--c-on-deep-muted); font-size: var(--fs-14); font-weight: 400; }

/* ---------- 开发计划 ---------- */
.roadmap-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-24) var(--s-64); align-items: start; }
.roadmap-grid .section-head { margin-bottom: 0; grid-row: span 2; }
.roadmap { display: flex; flex-direction: column; border-top: 1px solid var(--c-line); }
.rm-item {
  display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: var(--s-16); align-items: center;
  padding-block: var(--s-16); border-bottom: 1px solid var(--c-line);
}
.rm-status {
  justify-self: start; padding: 2px var(--s-12); border-radius: var(--r-pill);
  border: 1px solid var(--c-line); background: var(--c-white);
  color: var(--c-muted); font-size: var(--fs-14); font-weight: 600; white-space: nowrap;
}
.rm-text { font-size: var(--fs-18); }
.rm-done .rm-status { background: var(--c-sage); border-color: var(--c-sage); color: var(--c-white); }
.rm-done .rm-text { font-weight: 700; }
.roadmap-note { color: var(--c-muted); }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-24) var(--s-64); align-items: start; }
.faq-grid .section-head { margin-bottom: 0; }
.faq-list { border-top: 1px solid var(--c-line); }
.faq { border-bottom: 1px solid var(--c-line); }
.faq summary {
  position: relative; display: block; cursor: pointer; list-style: none;
  padding: var(--s-24) var(--s-48) var(--s-24) 0;
  font-size: var(--fs-18); font-weight: 700; line-height: 1.5;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: var(--s-8); top: 50%;
  width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--c-sage); border-bottom: 2px solid var(--c-sage);
  transform: rotate(45deg); transition: transform var(--t-base) var(--ease-out);
}
.faq[open] summary::after { transform: translateY(4px) rotate(-135deg); }
.faq summary:focus-visible { border-radius: var(--r-8); }
@media (hover: hover) { .faq summary:hover { color: var(--c-deep); } }
.faq p { padding: 0 var(--s-48) var(--s-24) 0; color: var(--c-muted); }

/* ---------- 页脚 ---------- */
.site-footer { padding-block: var(--s-48); border-top: 1px solid var(--c-line); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-24) var(--s-48); align-items: center; }
.footer-brand { display: flex; align-items: center; gap: var(--s-12); }
.footer-brand-text { display: flex; flex-direction: column; }
.footer-brand .brand-name { line-height: 1.3; }
.footer-muted { color: var(--c-muted); font-size: var(--fs-14); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.footer-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--s-12);
  border-radius: var(--r-pill); text-decoration: none; font-weight: 600;
}
@media (hover: hover) { .footer-links a:hover { background: var(--c-sage-soft); color: var(--c-deep); } }
.footer-links a:focus-visible { border-radius: var(--r-pill); }
.footer-credit { grid-column: 1 / -1; padding-top: var(--s-24); border-top: 1px solid var(--c-line); }

/* ---------- 平板 ≤1024 ---------- */
@media (max-width: 1024px) {
  .hero-grid { gap: var(--s-48); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-48); }
  .step:nth-child(2)::before { display: none; }
  .cap-grid, .roadmap-grid, .faq-grid { grid-template-columns: minmax(0, 1fr); }
  .roadmap-grid .section-head { grid-row: auto; }
  .cap-note { grid-column: auto; }
  .download-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-48); }
}

/* ---------- 窄屏 ≤860：导航折叠 ---------- */
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: var(--s-12);
    padding: var(--s-16) var(--gutter) var(--s-24);
    background: var(--c-bg); border-bottom: 1px solid var(--c-line);
  }
  .js .site-nav:not(.is-open) { display: none; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-list a { padding-inline: var(--s-16); }
  .nav-github { justify-content: center; }
  .site-header { border-bottom-color: var(--c-line); }
}

/* ---------- 平板竖屏 ≤768 ---------- */
@media (max-width: 768px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-media { width: min(100%, 300px); }
  .tab-list { display: flex; width: 100%; }
  .tab { flex: 1 1 0; min-width: 0; padding-inline: var(--s-12); }
  .tab-panel { grid-template-columns: minmax(0, 1fr); gap: var(--s-32); }
  .tab-panel .phone-shot { max-width: 280px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: var(--s-16); margin-top: var(--s-48); }
}

/* ---------- 手机 ≤480 ---------- */
@media (max-width: 480px) {
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 100%; }
  .hero-media { width: min(100%, 260px); margin-left: auto; margin-right: auto; }
  .hero-ant { left: -18%; width: 32%; }
  .steps { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-32); }
  .step { padding-top: 0; padding-left: 56px; }
  .step::before { display: none; }
  .cap-list { grid-template-columns: minmax(0, 1fr); }
  .spec-row { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .download-actions .btn { flex: 1 1 100%; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .faq summary { padding-right: var(--s-32); }
  .faq p { padding-right: 0; }
  .rm-item { grid-template-columns: minmax(0, 1fr); gap: var(--s-8); }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
