/* PhoneJail 官网样式。
 *
 * 排版语法取自应用界面而非通行的网站模板：不设导航条、不用卡片与边框，
 * 每个区块占满一屏并各自成为一张海报，以大留白、超大字与有机色块分区。
 * 改动结构前请先看 design/home-concepts/home-b-editorial-cream.png 与
 * test/goldens/home-editorial.png，那两张图是本站视觉的依据。
 *
 * 配色取自 lib/theme/palette.dart，与应用界面共用同一套常量；修改此处的
 * 色值前，须确认应用内的对应常量是否一并调整。
 * 品牌字样 PhoneJail 使用 Space Grotesk，与应用一致，且仅用于品牌字样与
 * 拉丁文标签——该字体不含西里尔字母，不得用于正文。 */

:root {
  /* 取自 palette.dart 的品牌常量 */
  --ink: #18231e;
  --cream: #f4f1e8;
  --yellow: #f6c541;
  --coral: #ff765f;
  --moss: #3f6652;
  --olive: #a7b66f;

  /* 由品牌色派生的界面色，浅色主题 */
  --bg: var(--cream);
  --fg: var(--ink);
  --fg-muted: #5c6b62;
  --fg-faint: #8a978e;
  --hairline: #d9d3c2;
  --mark: var(--coral);
  /* 标题首行的浅色，与应用首页浅深两行的对比排版一致。 */
  --title-soft: #97a390;
  /* 超大序号的底色，须淡到不与正文争夺注意力。 */
  --numeral: #e2ddcc;
  /* 纸面颗粒。应用的插画与底色均带纸质感，纯色平涂会显得不同。 */
  --grain-opacity: 0.075;
  --grain-blend: multiply;

  --font-brand: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;

  --measure: 32rem;
  --page: 72rem;
  --gutter: clamp(1.5rem, 6vw, 5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a16;
    --fg: var(--cream);
    --fg-muted: #a8b5ac;
    --fg-faint: #74827a;
    --hairline: #2c3a33;
    --mark: #ff8b77;
    --title-soft: #728473;
    --numeral: #202e27;
    --grain-opacity: 0.05;
    --grain-blend: soft-light;
  }
}

:root[data-theme="dark"] {
  --bg: #121a16;
  --fg: var(--cream);
  --fg-muted: #a8b5ac;
  --fg-faint: #74827a;
  --hairline: #2c3a33;
  --mark: #ff8b77;
  --title-soft: #728473;
  --numeral: #202e27;
  --grain-opacity: 0.05;
  --grain-blend: soft-light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.1vw, 1.06rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 纸面颗粒覆盖层。不拦截指针事件，仅改变观感。 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration-color: var(--fg-faint);
  text-underline-offset: 0.25em;
}

a:hover {
  text-decoration-color: var(--mark);
}

/* 语言分区：两种语言的内容同页并存，切换只改变显示状态。
   英文块在标记中预设 hidden，因而脚本未执行时页面退回中文版而非整页空白。 */
[data-lang-block][hidden] {
  display: none;
}

/* ---------- 顶部：只有品牌字样与一枚圆钮，没有导航条 ---------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 700;
  /* 字距按驼峰式字样设定；0.16em 是为全大写字样所配，用在此处会把字母拆散。 */
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--fg);
}

.brand::after {
  content: "";
  width: 0.36em;
  height: 0.36em;
  border-radius: 50%;
  background: var(--mark);
}

/* 圆钮呼应应用界面右上角的圆形按钮。 */
.lang-toggle {
  appearance: none;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.lang-toggle:hover {
  color: var(--fg);
  border-color: var(--fg-faint);
}

/* ---------- 海报：每屏一张 ---------- */

.poster {
  min-height: 100svh;
  padding: clamp(6rem, 12vh, 9rem) var(--gutter) clamp(4rem, 9vh, 6rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.poster > .inner {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
}

/* 末屏与页脚同处一屏，不再单独占满视口。 */
.poster--tail {
  min-height: 0;
  padding-bottom: clamp(2rem, 5vh, 3rem);
}

.eyebrow {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 1.5rem;
}

.display {
  font-family: var(--font-brand);
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 1.75rem;
  text-wrap: balance;
}

.display .soft {
  color: var(--title-soft);
}

/* 中文字身远宽于拉丁字母，同一字号下标题会多折出两行。中文标题因而单独
   收窄字号并放宽行高，使其保持在两行之内。 */
[data-lang-block="zh"] .display {
  font-size: clamp(1.8rem, 4.2vw, 2.8rem);
  line-height: 1.26;
  letter-spacing: 0;
}

.lede {
  margin: 0;
  max-width: var(--measure);
  font-size: clamp(1.02rem, 1.5vw, 1.16rem);
  color: var(--fg-muted);
}

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

.hero-grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  }
}

.hero-art {
  justify-self: center;
  width: min(100%, 30rem);
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(2rem, 5vh, 3rem);
  font-family: var(--font-brand);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.soon::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: var(--mark);
}

/* ---------- 步骤：序号本身就是版面，不用卡片 ---------- */

.steps {
  list-style: none;
  margin: clamp(2.5rem, 6vh, 4rem) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(2.5rem, 5vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
  counter-reset: step;
}

@media (min-width: 52rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-top: clamp(2.5rem, 5vw, 3.5rem);
}

/* 超大序号作为版面骨架，而非装饰性的小标签。 */
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: -0.06em;
  font-family: var(--font-brand);
  font-size: clamp(3.4rem, 6vw, 4.6rem);
  font-weight: 700;
  line-height: 0.8;
  color: var(--numeral);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.steps h3,
.list h3 {
  font-family: var(--font-brand);
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  font-weight: 700;
  margin: 0 0 0.65rem;
}

.steps p,
.list p {
  margin: 0;
  color: var(--fg-muted);
  max-width: 26rem;
}

/* ---------- 功能：两列文字，靠细线与留白分隔 ---------- */

.list {
  list-style: none;
  margin: clamp(2.5rem, 6vh, 4rem) 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 46rem) {
  .list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2.5rem, 6vw, 5rem);
  }
}

.list li {
  padding: clamp(1.5rem, 3vw, 2rem) 0;
  border-top: 1px solid var(--hairline);
}

/* ---------- 隐私立场：整屏深墨，与应用的深色块同源 ---------- */

.poster--stance {
  background: var(--ink);
  color: var(--cream);
}

.poster--stance .display {
  color: var(--yellow);
}

.stance-list {
  list-style: none;
  margin: clamp(2rem, 5vh, 3rem) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(1rem, 2vh, 1.4rem);
  max-width: 46rem;
}

.stance-list li {
  padding-left: 2.2rem;
  position: relative;
  color: #cdd6cf;
}

.stance-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 1.2rem;
  height: 1px;
  background: var(--coral);
}

.note {
  margin: clamp(1.5rem, 4vh, 2.25rem) 0 0;
  max-width: var(--measure);
  font-size: 0.92rem;
  color: var(--fg-faint);
}

/* ---------- 末屏：应用图标与上架说明并排 ---------- */

.release {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  flex-wrap: wrap;
}

/* 应用图标的源文件是方形，四角为黑色，圆角由 iOS 在设备上裁切。网页须自行
   裁切成同样的圆角，否则四角的黑色会直接露出来。 */
.app-icon {
  flex: none;
  width: clamp(4.25rem, 7vw, 5.5rem);
  height: auto;
  border-radius: 22.5%;
}

/* ---------- 屏间的细曲线，呼应应用底部的那一道 ---------- */

.thread {
  display: block;
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding-inline: var(--gutter);
  overflow: hidden;
}

.thread svg {
  display: block;
  width: 100%;
  height: auto;
}

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

.footer {
  padding: clamp(3rem, 7vh, 4.5rem) var(--gutter) clamp(2.5rem, 5vh, 3.5rem);
  border-top: 1px solid var(--hairline);
}

.footer-inner {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  display: grid;
  gap: 2.5rem;
  font-size: 0.9rem;
}

@media (min-width: 44rem) {
  .footer-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

.footer p {
  margin: 0 0 0.45rem;
  color: var(--fg-muted);
  max-width: var(--measure);
}

.footer .brand {
  margin-bottom: 1.1rem;
}

.footer nav {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
}

@media (min-width: 44rem) {
  .footer nav {
    justify-items: end;
  }
}

.footer nav a {
  color: var(--fg-muted);
  text-decoration: none;
}

.footer nav a:hover,
.footer nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
}

/* ---------- 法务文档：以可读性为先，同样不用边框与底色 ---------- */

.doc {
  padding: clamp(7rem, 14vh, 10rem) var(--gutter) clamp(4rem, 8vh, 6rem);
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin-inline: auto;
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
}

@media (min-width: 62rem) {
  .doc {
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: start;
  }

  /* 技术支持页没有小节目录，正文独占一栏。 */
  .doc--single {
    grid-template-columns: minmax(0, 1fr);
  }
}

.toc {
  font-size: 0.85rem;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

@media (max-width: 61.999rem) {
  .toc {
    position: static;
    max-height: none;
  }
}

.toc h2 {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 1rem;
  font-weight: 500;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.toc a {
  color: var(--fg-muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.prose {
  max-width: 40rem;
}

.prose h1 {
  font-family: var(--font-brand);
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

.prose h2 {
  font-family: var(--font-brand);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  font-weight: 700;
  margin: 3.25rem 0 0.9rem;
  scroll-margin-top: 2rem;
  text-wrap: balance;
}

.prose h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 2rem 0 0.55rem;
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose strong {
  font-weight: 700;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--yellow);
  color: var(--fg-muted);
  font-size: 0.94rem;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 3rem 0 1.75rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 1.5rem;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem 0.7rem 0;
  border-bottom: 1px solid var(--hairline);
}

.prose th {
  font-weight: 700;
  border-bottom-color: var(--fg-faint);
}

/* 表格在窄屏上自行横向滚动，页面主体不得横向滚动。 */
.scroll-x {
  overflow-x: auto;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  font-size: 0.85rem;
  color: var(--fg-faint);
  margin: 0 0 2rem;
}

/* ---------- 入场动效 ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }

  .reveal--late {
    animation-delay: 0.1s;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.9rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
