/* 颜色取自 App 的 AppTheme：米白纸色、暖墨色和陶土橙。
   --brand 是 App 里的陶土橙，只用在圆点这类装饰上；浅色模式下它压在纸色上的对比度只有 3.8:1，
   所以文字和链接用加深一档的 --accent（4.9:1）。 */
:root {
  color-scheme: light dark;
  --paper: #f7f4ef;
  --card: #ffffff;
  --ink: #1c1a17;
  --secondary: #5c564d;
  --muted: #8a8276;
  --rule: rgba(28, 26, 23, 0.12);
  --brand: #c2603f;
  --accent: #a9502f;
  --on-accent: #ffffff;
  --hover: rgba(28, 26, 23, 0.05);
  --menu: rgba(255, 255, 255, 0.86);
  --menu-shadow: 0 12px 32px rgba(60, 40, 24, 0.16), 0 2px 6px rgba(60, 40, 24, 0.06);
  --phone-shadow: 0 32px 64px -32px rgba(76, 48, 28, 0.5), 0 0 0 1px rgba(28, 26, 23, 0.08);
  --serif: ui-serif, "New York", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  /* 先快后慢，最后轻轻落定。 */
  --settle: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #201d1a;
    --card: #2b2723;
    --ink: #ece7df;
    --secondary: #c2baae;
    --muted: #9e968b;
    --rule: rgba(236, 231, 223, 0.14);
    --brand: #d0714f;
    --accent: #d0714f;
    --on-accent: #1c1a17;
    --hover: rgba(236, 231, 223, 0.08);
    --menu: rgba(43, 39, 35, 0.86);
    --menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    --phone-shadow: 0 32px 64px -32px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(236, 231, 223, 0.1);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
}

p,
ul {
  margin: 0 0 12px;
}

/* 标题分行时两行尽量一样长，正文不让最后一行只剩一个词。 */
h1,
h2 {
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

.hero {
  padding: 88px 0 8px;
  text-align: center;
}

.hero .icon {
  display: block;
  width: 120px;
  height: 120px;
  margin: 0 auto;
  filter: drop-shadow(0 12px 24px rgba(76, 48, 28, 0.18));
}

/* 名字用衬线体，和图标里的"译"字呼应。 */
.hero h1 {
  margin: 22px 0 6px;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 8vw, 3.4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.tagline {
  color: var(--secondary);
  font-size: 1.25rem;
}

/* App 上架前，这枚标签代替下载按钮。圆点学的是 App 译文卡里语言名前的那个点。 */
.soon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 7px 16px;
  border: 1px solid var(--rule);
  border-radius: 980px;
  color: var(--secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.soon::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.feature {
  display: grid;
  gap: 32px;
  align-items: center;
  margin-top: 80px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.feature h2 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4.4vw, 2.1rem);
  line-height: 1.25;
}

.feature .copy p:not(.eyebrow) {
  color: var(--secondary);
}

.phone img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0 auto;
  border-radius: 38px;
  background: var(--card);
  box-shadow: var(--phone-shadow);
}

/* 宽屏时文字和截图左右排开，中间一段截图换到左边。 */
@media (min-width: 760px) {
  .feature {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    margin-top: 112px;
  }

  .feature:nth-of-type(even) .copy {
    order: 2;
  }
}

/* 三条要点：宽屏排成一行，窄屏上下排列。卡片的圆角和底色沿用 App 里的卡片。 */
.facts {
  display: grid;
  gap: 12px;
  margin: 112px 0 0;
}

.facts div {
  padding: 22px 24px;
  border-radius: 22px;
  background: var(--card);
}

.facts dt {
  margin-bottom: 4px;
  font-weight: 600;
}

/* 要点只有一两行；两行时让两行一样长，不让第二行只剩“翻译。”这样一两个字。 */
.facts dd {
  margin: 0;
  color: var(--secondary);
  font-size: 0.95rem;
  text-wrap: balance;
}

/* 中文和韩文的要点只在标点和空格处换行，不把“储存”这样的词拆成两半；日文按词组换行（Chrome 支持
   auto-phrase，其他浏览器照常换行）。overflow-wrap 兜底：一行里找不到换行点时仍在字间断开，不撑破卡片。 */
:lang(zh) .facts dd,
:lang(ko) .facts dd {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

:lang(ja) .facts dd {
  word-break: auto-phrase;
}

@media (min-width: 760px) {
  .facts {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.requirement {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

footer p {
  margin: 0;
}

footer p a {
  color: inherit;
}

/* 语言菜单：按钮像 macOS 的弹出按钮，菜单在按钮上方展开。 */
.languages {
  position: relative;
}

.languages button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s var(--settle);
}

.languages button:hover,
.languages.open button {
  background: var(--hover);
}

.languages button:active {
  transform: scale(0.97);
}

.languages button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.languages .globe,
.languages .chevrons {
  flex: none;
  color: var(--muted);
}

.languages ul {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 10;
  min-width: 170px;
  margin: 0;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--menu);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--menu-shadow);
  transform-origin: 20px 100%;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  visibility: hidden;
  /* 收起时干脆利落；visibility 等淡出做完再切。 */
  transition: opacity 0.16s ease-in, transform 0.2s ease-in, visibility 0s linear 0.2s;
}

.languages.open ul {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity 0.2s ease-out, transform 0.42s var(--settle), visibility 0s;
}

.languages li {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease-in, transform 0.12s ease-in;
}

/* 展开时各项从按钮往上依次出现。--i 由 language.js 设置。 */
.languages.open li {
  opacity: 1;
  transform: none;
  transition: opacity 0.24s ease-out, transform 0.38s var(--settle);
  transition-delay: calc(var(--i, 0) * 18ms + 40ms);
}

.languages a {
  position: relative;
  display: block;
  padding: 6px 14px 6px 30px;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}

.languages a:hover,
.languages a:focus-visible {
  outline: none;
  background: var(--accent);
  color: var(--on-accent);
}

/* 当前语言前面打勾，和 macOS 菜单一样。 */
.languages a[aria-current]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 11px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5 4.8 9.2 10 3' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5 4.8 9.2 10 3' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 读者切换语言时，新语言淡入。 */
main > section.entering {
  animation: enter 0.4s var(--settle);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .languages button:active,
  .languages ul,
  .languages li {
    transform: none !important;
  }

  main > section.entering {
    animation: fade 0.2s ease-out;
  }

  @keyframes fade {
    from {
      opacity: 0;
    }
  }
}
