/* ==========================================================================
   AO3 中文档案库 · 落地页样式
   页面结构参考 befunapp.cn，配色为简约风（白底 + 灰线 + AO3 红点缀）
   布局单位：1rem = 内容区宽度 / 12，桌面端由下方 html 的 clamp 规则缩放
   ========================================================================== */

:root {
  /* ===== 主题色（想换配色改这里） ===== */
  --brand: #990000;
  --brand-deep: #7a0000;
  --brand-light: #b31414;
  --brand-tint: #fafafa;
  --brand-tint-2: #f4f4f4;
  --brand-border: #e9e9e9;
  --ink: #1c1c1c;
  --ink-2: #3d3d3d;
  --muted: #6b6b6b;
  --muted-2: #9b9b9b;
  --line: #e9e9e9;
  --radius: 0.14rem;
  --radius-lg: 0.24rem;
  --shadow-soft: 0 0.12rem 0.28rem rgba(0, 0, 0, 0.06);
  --shadow-strong: 0 0.22rem 0.5rem rgba(0, 0, 0, 0.12);

  /* ===== 电脑端 位置 / 间距总开关（单位 rem：1920 宽时 1rem = 100px） =====
     手机端的间距开关在 css/mobile.css 文件开头 */
  --gap-hero: 0.5rem;       /* 首屏：左边文字 ↔ 右边截图 的横向距离 */
  --showcase-offset: 60px;  /* 首屏：三张截图整体下移多少（电脑+手机都生效，改大＝图片往下移） */
  --gap-section: 0.7rem;    /* 电脑端：区块之间的上下间距 */
  --gap-cards: 0.34rem;     /* 区块标题 ↔ 下方卡片 的距离 */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* 全站缩放基准，三行从旧到新依次覆盖，浏览器取它能识别的最后一条：
     72.9px  → 极老浏览器兜底
     5.2083vw → 不支持 clamp() 的浏览器（老安卓 / 老华为自带浏览器）按视口等比缩放
     clamp() → 现代浏览器，1400 宽≈72.9px、1920 宽=100px、2240 宽以上封顶 116.7px */
  font-size: 72.9px;
  font-size: 5.2083vw;
  font-size: clamp(72.9px, 5.2083vw, 116.7px);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  /* 字体依次回退：先苹果/谷歌，再华为鸿蒙、小米、OPPO、vivo 等国产机型自带字体，
     最后落到微软雅黑，保证任何手机都不出现方框字 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "HarmonyOS Sans SC",
    "HarmonyOS Sans", "MiSans", "HYQiHei", "OPPOSans", "vivo Sans",
    "Source Han Sans SC", "Noto Sans CJK SC", "Hiragino Sans GB",
    "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.16rem;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.25s ease,
    border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease,
    opacity 0.25s ease;
}

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

ul,
ol {
  list-style: none;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
  height: auto;
}

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

::selection {
  background: #ececec;
  color: var(--ink);
}

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

/* ---------- 页面骨架 ---------- */

.fluid-container {
  width: 100%;
  min-width: 12rem;
  min-height: 12.21rem;
  overflow: hidden;
  background-color: #ffffff;
  background-image: linear-gradient(180deg, #fafafa 0%, #ffffff 30%);
  /* 全面屏（iPhone 刘海屏 / 安卓手势条）底部留白，不支持的浏览器会自动忽略 */
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.content-container {
  width: 12rem;
  margin: 0 auto;
  padding-bottom: 1px;
}

/* ---------- 顶部导航 ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.24rem 0;
}

.brand {
  display: flex;
  align-items: center;
}

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

.brand-logo {
  width: 0.46rem;
  height: 0.46rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  margin-left: 0.12rem;
  line-height: 1.2;
}

.brand-name {
  font-size: 0.24rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--brand);
}

.brand-sub {
  font-size: 0.11rem;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
}

/* 说明：下面这些间距统一用 margin 而不是 flex 的 gap —— 华为、小米等老机型
   自带浏览器（Chromium 84 以下）不支持 flex gap，用 margin 才能全平台一致 */
.nav-links li + li {
  margin-left: 0.3rem;
}

.nav-links a {
  font-size: 0.16rem;
  color: var(--ink-2);
}

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

.nav-links .nav-download {
  padding: 0.09rem 0.22rem;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
}

.nav-links .nav-download:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.nav-only-mobile,
.nav-toggle {
  display: none;
}

/* ---------- 首屏 ---------- */

.main-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 5.4rem;
  padding: 0.3rem 0 0.5rem;
}

.intro {
  max-width: 5.4rem;
  margin-right: var(--gap-hero);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.06rem;
  padding: 0.05rem 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-tint-2);
  color: var(--muted);
  font-size: 0.13rem;
  letter-spacing: 0.02em;
}

.intro-title {
  margin-top: 0.22rem;
  font-size: 0.46rem;
  line-height: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.intro-title em {
  font-style: normal;
  color: var(--brand);
}

.intro-desc {
  margin-top: 0.2rem;
  max-width: 5.2rem;
  font-size: 0.185rem;
  line-height: 0.31rem;
  color: var(--ink-2);
}

.intro-desc--sub {
  margin-top: 0.12rem;
  font-size: 0.15rem;
  line-height: 0.27rem;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  /* 用「子元素 margin + 父级负 margin」模拟 gap：上 0.3rem、左右 0.12rem */
  margin: 0.24rem -0.06rem -0.06rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  margin: 0.06rem;
  padding: 0.05rem 0.13rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.13rem;
  color: var(--muted);
}

.chip svg {
  width: 0.13rem;
  height: 0.13rem;
  margin-right: 0.05rem;
  color: var(--brand);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* 同上：上间距 0.36rem、按钮之间 0.18rem */
  margin: 0.27rem -0.09rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.09rem;
  height: 0.56rem;
  border-radius: 999px;
  font-size: 0.18rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn svg {
  width: 0.2rem;
  height: 0.2rem;
  margin-right: 0.09rem;
}

.btn-primary {
  padding: 0 0.36rem;
  color: #fff;
  background-image: linear-gradient(135deg, #b31414 0%, #8d0000 100%);
  box-shadow: 0 0.12rem 0.26rem rgba(153, 0, 0, 0.26);
}

.btn-primary:hover {
  color: #fff;
  transform: translateY(-0.02rem);
  box-shadow: 0 0.18rem 0.34rem rgba(153, 0, 0, 0.34);
}

.btn-ghost {
  padding: 0 0.28rem;
  font-size: 0.17rem;
  font-weight: 500;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--brand-border);
}

.btn-ghost:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-tint);
}

/* ---------- 手机展示 ---------- */

.showcase {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 三张截图整体下移，改 :root 里的 --showcase-offset 即可 */
  margin-top: var(--showcase-offset);
}

.phone-glow {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  width: 7rem;
  height: 5.8rem;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
}

/* 三张截图：中间一张在前，两侧略小、下沉并被中间遮挡 */
.showcase-phones {
  position: relative;
  width: 6.1rem;
  aspect-ratio: 6.1 / 5.6;
}

.shot {
  position: absolute;
  margin: 0;
  aspect-ratio: 375 / 667;
  overflow: hidden;
  border-radius: 0.16rem;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 0.14rem 0.3rem rgba(0, 0, 0, 0.08);
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.shot--main {
  top: 0;
  left: 50%;
  width: 47%;
  transform: translateX(-50%);
  z-index: 3;
  border-radius: 0.2rem;
  box-shadow: var(--shadow-strong);
}

.shot--side {
  top: 16%;
  width: 35%;
  z-index: 1;
}

.shot--left {
  left: 0;
}

.shot--right {
  right: 0;
}

/* ---------- 通用区块 ---------- */

.section {
  padding: var(--gap-section) 0 0;
  scroll-margin-top: 0.3rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.3rem;
  padding-bottom: 0.14rem;
  border-bottom: 1px solid var(--line);
}

.section-title {
  font-size: 0.3rem;
  line-height: 0.42rem;
  font-weight: 700;
  color: var(--ink);
}

.section-sub {
  margin-top: 0.06rem;
  font-size: 0.14rem;
  color: var(--muted);
  font-weight: 400;
}

.section-more {
  flex: none;
  font-size: 0.15rem;
  color: var(--brand);
}

.section-more:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

/* ---------- 热门分类 ---------- */

.fandom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.16rem;
  margin-top: var(--gap-cards);
}

.fandom-card {
  display: block;
  height: 100%;
  padding: 0.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--brand-border);
  background: var(--brand-tint);
}

.fandom-card:hover {
  color: inherit;
  background: #fff;
  border-color: var(--brand);
  transform: translateY(-0.03rem);
  box-shadow: var(--shadow-soft);
}

.fandom-name {
  display: block;
  font-size: 0.17rem;
  font-weight: 600;
  color: var(--ink);
}

.fandom-en {
  display: block;
  margin-top: 0.04rem;
  font-size: 0.115rem;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}

.fandom-count {
  display: block;
  margin-top: 0.14rem;
  font-size: 0.13rem;
  color: var(--brand);
}

/* ---------- 核心功能 ---------- */

.feature-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.16rem;
  margin-top: var(--gap-cards);
}

.feature-item {
  height: 100%;
  padding: 0.22rem;
  border-radius: var(--radius);
  border: 1px solid var(--brand-border);
  background: #fff;
}

.feature-item:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-soft);
}

.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0.44rem;
  height: 0.44rem;
  margin-bottom: 0.14rem;
  border-radius: 0.12rem;
  background: var(--brand-tint-2);
  color: var(--brand);
}

.feature-icon svg {
  width: 0.24rem;
  height: 0.24rem;
}

.feature-title {
  font-size: 0.17rem;
  font-weight: 600;
  color: var(--ink);
}

.feature-desc {
  margin-top: 0.08rem;
  font-size: 0.135rem;
  line-height: 0.23rem;
  color: var(--muted);
}

/* ---------- 常见问题 ---------- */

.faq-list {
  margin-top: 0.3rem;
  border-top: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.24rem;
  padding: 0.2rem 0.04rem;
  font-size: 0.18rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex: none;
  width: 0.09rem;
  height: 0.09rem;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(45deg);
  transition: transform 0.25s ease;
}

.faq-item[open] summary {
  color: var(--brand);
}

.faq-item[open] summary::after {
  transform: rotate(-135deg);
}

.faq-answer {
  max-width: 9.4rem;
  padding: 0 0.04rem 0.22rem;
  font-size: 0.15rem;
  line-height: 0.28rem;
  color: var(--muted);
}

.faq-answer a {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- 关于本站：默认收起，点按钮才展开 ---------- */

.about-more {
  margin-top: var(--gap-cards);
}

.about-more-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-tint-2);
  color: var(--brand);
  font-size: 0.15rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.about-more-btn::-webkit-details-marker {
  display: none;
}

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

.about-more-btn svg {
  width: 0.15rem;
  height: 0.15rem;
  margin-left: 0.08rem;
  transition: transform 0.25s ease;
}

.about-more[open] .about-more-btn svg {
  transform: rotate(180deg);
}

.about-more-text-less,
.about-more[open] .about-more-text-more {
  display: none;
}

.about-more[open] .about-more-text-less {
  display: inline;
}

.about-more-body {
  max-width: 9.8rem;
  margin-top: 0.22rem;
}

/* ---------- 正文（给搜索引擎读的原创文字） ---------- */

.seo-text p {
  font-size: 0.15rem;
  line-height: 0.29rem;
  color: var(--muted);
}

.seo-text p + p {
  margin-top: 0.12rem;
}

.seo-text strong {
  font-weight: 600;
  color: var(--ink-2);
}

.seo-text a {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- 底部行动区 ---------- */

.cta-panel {
  margin-top: var(--gap-section);
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background-color: var(--brand-tint);
  text-align: center;
}

.cta-title {
  font-size: 0.3rem;
  line-height: 0.44rem;
  font-weight: 700;
  color: var(--ink);
}

.cta-title em {
  font-style: normal;
  color: var(--brand);
}

.cta-sub {
  margin: 0.12rem auto 0;
  max-width: 6.4rem;
  font-size: 0.15rem;
  line-height: 0.27rem;
  color: var(--muted);
}

.cta-panel .btn-primary {
  margin-top: 0.3rem;
}

/* ---------- 页脚 ---------- */

.footer {
  margin-top: var(--gap-section);
  padding: 0.36rem 0 0.4rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.13rem;
  line-height: 0.24rem;
  color: var(--muted-2);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.12rem;
}

.footer-links a + a {
  margin-left: 0.22rem;
}

.footer-links a {
  font-size: 0.14rem;
  color: var(--muted);
}

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

.footer-copy {
  color: var(--muted);
}

.footer-disclaimer {
  margin: 0.1rem auto 0;
  max-width: 9.6rem;
  font-size: 0.12rem;
  line-height: 0.22rem;
  color: var(--muted-2);
}

/* ---------- 文档页 ---------- */

.doc {
  max-width: 8.6rem;
  margin: 0 auto;
  padding: 0.3rem 0 0;
}

.doc h1 {
  font-size: 0.34rem;
  line-height: 0.48rem;
  color: var(--brand);
}

.doc .doc-meta {
  margin-top: 0.08rem;
  font-size: 0.13rem;
  color: var(--muted-2);
}

.doc .doc-body {
  margin-top: 0.26rem;
  padding-top: 0.26rem;
  border-top: 1px solid var(--line);
}

.doc h2 {
  margin: 0.32rem 0 0.1rem;
  font-size: 0.2rem;
  line-height: 0.32rem;
  color: var(--ink);
}

.doc h2:first-child {
  margin-top: 0;
}

.doc p,
.doc li {
  font-size: 0.15rem;
  line-height: 0.28rem;
  color: var(--muted);
}

.doc p + p {
  margin-top: 0.1rem;
}

.doc ul {
  margin-top: 0.08rem;
}

.doc li {
  position: relative;
  padding-left: 0.16rem;
}

.doc li + li {
  margin-top: 0.04rem;
}

.doc li::before {
  content: "";
  position: absolute;
  left: 0.04rem;
  top: 0.11rem;
  width: 0.05rem;
  height: 0.05rem;
  border-radius: 50%;
  background: var(--brand);
}

.doc a {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- 滚动入场动画 ---------- */

.wow {
  transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 默认状态下内容全部可见：搜索引擎爬虫、关闭 JS 的浏览器都能直接读到正文 */
.js .wow {
  opacity: 0;
  transform: translateY(0.24rem);
  will-change: opacity, transform;
}

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

/* 兜底：main.js 万一没加载成功，强制显示全部内容 */
html.no-wow .wow {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .wow,
  .js .wow.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   老浏览器兼容兜底
   针对华为 / 小米 / OPPO / vivo 等老机型自带浏览器（内核版本偏低）
   不支持 aspect-ratio、CSS Grid、object-fit 的情况做降级，保证布局不塌。
   现代浏览器不会执行下面任何一条。
   ========================================================================== */

/* 1. 不支持 aspect-ratio：用 padding 撑出高度，三张截图不会变成 0 高度而消失 */
@supports not (aspect-ratio: 1 / 1) {
  .showcase-phones {
    height: 0;
    padding-top: 91.8%; /* 6.1 : 5.6 */
  }

  .shot {
    height: 0;
    padding-top: 177.87%; /* 375 : 667 */
  }

  .shot img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

/* 2. 不支持 CSS Grid：分类 / 功能卡片改成单列堆叠，内容照常可读 */
@supports not (display: grid) {
  .fandom-grid,
  .feature-list {
    display: block;
  }

  .fandom-grid > li,
  .feature-list > li {
    display: block;
    width: 100%;
  }

  .fandom-grid > li + li,
  .feature-list > li + li {
    margin-top: 0.16rem;
  }
}

/* 3. 不支持 object-fit：截图改为按原始比例顶部对齐，由 overflow 裁掉多余部分 */
@supports not (object-fit: cover) {
  .shot img {
    width: 100%;
    height: auto;
  }
}
