/* Tsukiguma／BopoTaco — 全站樣式。

   設計就是 26.10.16 的商店頁（Screenshots/shots.json，由 Tools/ShotComposer 繪製）：
   平塗的色帶用上架圖的底色、機身是「截圖＋一圈實色邊」、浮出卡片是從截圖裁下的
   區塊、字型照 ShotComposer 的 Typesetter。顏色只從 colors.css 取（那是
   Scripts/site-colors.py 從 BopoColors.xcassets 產生的），這裡沒有任何 hex，
   也沒有任何漸層。 */

:root {
  color-scheme: light dark;

  /* 字型照 Typesetter：ja 用 Hiragino、zh-Hant 用 PingFang TC、en 用 SF Pro Rounded
     （呼應 App 的圓角鍵帽）。不載 Web Font——網站和 App 一樣不對第三方發任何請求。 */
  --font-en-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-en-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-ja: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --font-tc: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;

  --font-display: var(--font-en-display);
  --font-text: var(--font-en-text);
  --display-weight: 800;

  --gutter: 1rem;
  --radius: 1.25rem;
}

/* HiraginoSans-W8 與 PingFangTC-Semibold，和上架圖的標題同一套字重。 */
:root:lang(ja) { --font-display: var(--font-ja); --font-text: var(--font-ja); }
:root:lang(zh-Hant) { --font-display: var(--font-tc); --font-text: var(--font-tc); --display-weight: 600; }

/* 別的語言頁裡標了 lang 的片段（注音符號、404 的三語說明）用該語言的字形。 */
:not(:root)[lang="zh-Hant"] { font-family: var(--font-tc); }
:not(:root)[lang="ja"] { font-family: var(--font-ja); }

@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; }
}

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

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 1.0625rem/1.8 var(--font-text);
}
:root:lang(en) body { line-height: 1.65; }
:root:lang(ja) body { line-break: strict; word-break: auto-phrase; }

img, video, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--link, var(--accent)); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: .3rem; }

.wrap { width: min(68rem, 100% - 2 * var(--gutter)); margin-inline: auto; }
.wrap.narrow { width: min(46rem, 100% - 2 * var(--gutter)); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 色帶：shots.json 的 background／text ---------- */

.band { padding-block: clamp(4rem, 9vw, 6.5rem); }

/* indigo＋ink@dark（01、03、06） */
.band--indigo {
  background: var(--indigo-light); color: var(--ink-dark);
  --muted: color-mix(in srgb, var(--ink-dark) 86%, transparent);
  --link: var(--sunshineFill-light);
}
/* sunshineFill＋sunshineContrast（02、05） */
.band--sunshine {
  background: var(--sunshineFill-light); color: var(--sunshineContrast-light);
  --muted: color-mix(in srgb, var(--sunshineContrast-light) 80%, transparent);
  --link: var(--sunshineContrast-light);
}
/* surface@dark＋ink@dark（04） */
.band--night {
  background: var(--surface-dark); color: var(--ink-dark);
  --muted: var(--inkSecondary-dark);
  --link: var(--sunshineFill-dark);
}
/* 中性段落跟著訪客的外觀切換。 */
.band--paper { background: var(--surface); --muted: var(--inkSecondary); }
.band--screen { background: var(--surfaceElevated); --muted: var(--inkSecondary); }

/* ---------- 導覽列 ---------- */

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 1.5rem; padding-block: 1.25rem;
}
/* 字跟 App 的 BopoLogo 一樣：.system(.rounded) 的 bold，也就是 SF Pro Rounded Bold。
   它不是能放上網頁的字型，但 Safari 的 ui-rounded 用的就是這一套；其他瀏覽器退回系統字。
   光暈也照 BopoLogo：accent 25%，56 pt 時半徑 12、下移 4，跟著字級等比縮。 */
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--accent); text-decoration: none;
  font: 700 1.35rem/1 var(--font-en-display); letter-spacing: -.01em;
  text-shadow: 0 .07em .21em color-mix(in srgb, var(--accent) 25%, transparent);
}
/* accent 疊在 indigo 上看不見，色帶上的字改用 ink@dark。 */
.band--indigo .brand { color: var(--ink-dark); text-shadow: none; }
/* 商店頁上的 App Icon，圓角是 iOS 圖示的比例。 */
.brand-icon {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 22.5%;
  box-shadow: 0 .1rem .35rem var(--shadowCard-light);
}

.langs {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem;
  margin: 0; padding: 0; list-style: none; font-size: .95rem;
}
.langs a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.langs [aria-current] { font-weight: 700; text-decoration: none; }

/* ---------- 標題與文案 ---------- */

.title, .hero-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display); font-weight: var(--display-weight);
  letter-spacing: -.01em; text-wrap: balance;
}
.hero-title { font-size: clamp(2.6rem, 7vw, 4.5rem); line-height: 1.12; }
.title { font-size: clamp(2.1rem, 5vw, 3.25rem); line-height: 1.2; }
/* 概要的 ■ 小標比上架圖的標題長，字級小一號才不會切在詞中間。 */
.title--long { font-size: clamp(1.75rem, 3.6vw, 2.5rem); }
:root:lang(en) :is(.title, .hero-title) { letter-spacing: -.025em; line-height: 1.06; }
:root:lang(ja) :is(.title, .hero-title, .sub, .badges, .tiles, .plan h3, .stat) {
  font-feature-settings: "palt"; letter-spacing: .02em;
}

/* shots.json 的一行就是一行：標題只在上架圖斷行的地方換行。 */
.ln { display: block; text-wrap: balance; }

.sub {
  margin: -.25rem 0 1.5rem;
  font: 600 clamp(1.1rem, 2.2vw, 1.3rem)/1.5 var(--font-display);
}

/* pretty 讓段落最後一行不會只剩一個字（「練。」）。 */
.copy > p, .lead p, .doc p { text-wrap: pretty; }
.copy > p { margin: 0 0 1rem; max-width: 36rem; }
.copy > p:last-child { margin-bottom: 0; }
.copy .note { color: var(--muted); }

/* ---------- 版面 ---------- */

.split { display: grid; gap: clamp(2.75rem, 6vw, 5rem); align-items: center; }
@media (min-width: 54rem) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split--flip > .copy { order: 2; }
}

/* ---------- 英雄區（01 與 App Preview） ---------- */

.hero { padding-top: 0; }
.hero .split { padding-top: clamp(1.5rem, 5vw, 3.5rem); }
.lead p { margin: 0 0 .6rem; font-size: 1.125rem; color: var(--muted); max-width: 32rem; }

.badges {
  display: flex; flex-wrap: wrap; gap: .6rem;
  margin: 1.75rem 0 2.25rem; padding: 0; list-style: none;
}
.badges li {
  padding: .45rem 1.15rem; border-radius: 999px;
  background: var(--sunshineFill-light); color: var(--sunshineContrast-light);
  font: 700 1rem/1.35 var(--font-display);
}

/* App Preview 的手機螢幕，套和截圖一樣的機身。 */
.preview { width: min(16rem, 100%); margin: 0 auto; }
@media (min-width: 54rem) {
  .preview { width: 19rem; }
}

/* ---------- App Store 徽章 ---------- */

/* Apple 行銷工具的官方檔（assets/badges/），不改色、不變形；淺色外觀用黑款、
   深色外觀用白款（白款自帶黑邊，在 indigo 與 sunshine 色帶上都清楚）。
   高度不低於 Apple 規定的 40 px，四周至少留徽章高度的四分之一。 */
.store-badge {
  display: inline-block; line-height: 0; border-radius: .6rem;
  transition: transform .12s ease;
}
.store-badge picture { display: block; }
.store-badge img { width: auto; height: 3rem; }
.closing .store-badge img { height: 3.25rem; }
.store-badge:hover { transform: translateY(-.1rem); }

/* ---------- 機身（Device.swift：邊寬 2.4%、內圓角為內寬的 13%） ---------- */

.device { container-type: inline-size; }
.device .rim {
  padding: 2.4cqi; border-radius: 14.78cqi;
  background: var(--rim, var(--sunshineContrast-light));
  box-shadow: 0 1.5rem 3rem -1rem var(--overlayScrimSoft-light);
}
/* 底色讓還沒載入的畫面是一塊淺色螢幕，而不是一整片深色機身。 */
.device :is(img, video) { width: 100%; border-radius: 12.38cqi; background: var(--surfaceElevated-light); }
/* 影片是從 Preview 的機身裡往內收幾像素裁的，圓角稍大才蓋得住原本的邊。 */
.device video { border-radius: 12.85cqi; }
.device--night { --rim: var(--surfaceElevated-dark); }
.device--day { --rim: var(--surfaceElevated-light); }

/* ---------- 浮出卡片（Card.swift：surfaceElevated 的邊、overlayScrimSoft 的影） ---------- */

.float { container-type: inline-size; }
.float .rim {
  padding: 1.6cqi; border-radius: 5.5cqi;
  background: var(--surfaceElevated-light);
  box-shadow: 0 1.25rem 2.5rem -.75rem var(--overlayScrimSoft-light);
}
.float img { width: 100%; border-radius: 4cqi; }

/* ---------- 構圖：每段一種，對應上架圖的版型 ---------- */

.stage { position: relative; width: min(100%, var(--stage, 30rem)); margin-inline: auto; }

/* 02 tilt-duo：課程表在後、單字練習在前，TBCL 卡釘在角落。 */
.stage--duo { aspect-ratio: 1 / 1.42; }
.stage--duo > * { position: absolute; }
.stage--duo .back { left: 0; top: 4%; width: 54%; }
.stage--duo .front { right: 0; top: 12%; width: 58%; }
.stage--duo .stat { right: -1%; top: 0; z-index: 1; }

.stat {
  padding: .85rem 1.35rem; border-radius: 1.25rem; text-align: center;
  background: var(--indigo-light); color: var(--ink-dark);
  box-shadow: 0 1rem 2rem -.75rem var(--overlayScrimSoft-light);
}
.stat b { display: block; font: 800 clamp(1.7rem, 5vw, 2.5rem)/1.05 var(--font-en-display); letter-spacing: -.02em; }
.stat span { display: block; margin-top: .2rem; font: 600 1rem/1.3 var(--font-display); }

/* 03 tilt-callout：統計畫面，易混淆符號與趨勢浮在上面。 */
.stage--callout { --stage: 32rem; aspect-ratio: 1 / 1.34; }
.stage--callout > * { position: absolute; }
.stage--callout .device { left: 0; top: 0; width: 62%; }
.stage--callout .float:nth-of-type(2) { right: 0; top: 12%; width: 74%; }
.stage--callout .float:nth-of-type(3) { right: 2%; top: 58%; width: 58%; }

/* 04 screen-hero：深色畫面為主，淺色小圖與月亮圓。 */
.stage--night { aspect-ratio: 1 / 1.4; }
.stage--night > * { position: absolute; }
.stage--night .device--night { right: 0; top: 0; width: 64%; }
.stage--night .device--day { left: 0; bottom: 7%; width: 36%; z-index: 1; }
.stage--night .disc { left: 28%; bottom: 0; width: 17%; z-index: 2; }

.disc {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%;
  background: var(--sunshineFill-dark); color: var(--sunshineContrast-light);
}
.disc svg { width: 54%; }

/* 05 caption-bottom：畫面在上、聲波在下。 */
.stage--listen { --stage: 21rem; display: grid; justify-items: center; gap: 2.25rem; }
.stage--listen .device { width: 88%; }
.wave { width: 100%; color: var(--sunshineContrast-light); }

/* 打字速度：結果畫面的成績浮卡。 */
.stage--card { --stage: 27rem; }

/* 06 feature-grid：首頁從色帶底部出血。 */
.band--bleed { padding-bottom: 0; }
.bleed {
  display: flex; justify-content: center;
  height: clamp(15rem, 36vw, 22rem); margin-top: clamp(3rem, 7vw, 4.5rem); overflow: hidden;
}
.bleed .device { width: min(20rem, 80%); flex: none; }

/* ---------- 注音鍵盤（照 App 的實際鍵位與比例） ---------- */

/* 數字都是 1320 寬的 App 截圖量出來的像素（word-practice.png）：
   鍵距 118、鍵寬 105、列距 144；第 2、3 列右移 35、71；空白鍵從第 4 鍵起
   跨 5 鍵、刪除鍵從第 10 鍵起跨 2 鍵。全部用 cqi 換算，任何寬度都是 11 鍵一列。 */
.kb { container-type: inline-size; width: min(100%, 40rem); margin-inline: auto; --u: calc(100cqi / 1320); }
.kb-panel {
  padding-block: calc(26 * var(--u));
  border-radius: calc(54 * var(--u));
  background: var(--surface);
}
.kb-row { display: flex; gap: calc(13 * var(--u)); padding-left: calc((18 + var(--shift, 0)) * var(--u)); }
.kb-row + .kb-row { margin-top: calc(12 * var(--u)); }
.kb-row:nth-child(2) { --shift: 35; }
.kb-row:nth-child(3) { --shift: 71; }
.key {
  flex: none; display: grid; place-items: center;
  width: calc(105 * var(--u)); height: calc(132 * var(--u));
  border-radius: calc(16 * var(--u));
  background: var(--keyFace); color: var(--ink);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--shadowKey);
  font-size: calc(62 * var(--u)); font-weight: 500; line-height: 1;
}
.key--tone, .key--space {
  background: color-mix(in srgb, var(--accent) 17%, var(--keyFace));
  color: var(--accent);
}
/* 聲調符號本來就畫在字身的上半部，置中排就落在 App 鍵帽上的位置。 */
.key--tone { font-size: calc(72 * var(--u)); font-weight: 700; }
.key--space { width: calc(577 * var(--u)); margin-left: calc(354 * var(--u)); font-size: calc(46 * var(--u)); font-weight: 400; }
.key--delete { width: calc(223 * var(--u)); margin-left: calc(118 * var(--u)); }
.key--delete svg { width: calc(78 * var(--u)); }

/* ---------- 06 的四個 tile 與免費／Pro 清單 ---------- */

.tiles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem;
  margin: 2.5rem 0 0; padding: 0; list-style: none;
}
@media (min-width: 54rem) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tiles li {
  padding: 1.1rem 1rem 1.25rem; border-radius: 1.5rem;
  background: var(--accentContrast-dark); color: var(--ink-dark);
}
.tile-icon {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem;
  border-radius: 50%; background: var(--sunshineFill-light); color: var(--sunshineContrast-light);
}
.tile-icon svg { width: 1.6rem; }
.tiles p { margin: 0; font: 700 clamp(.95rem, 3.6vw, 1.08rem)/1.45 var(--font-display); }

.plans { display: grid; gap: .9rem; margin-top: .9rem; }
@media (min-width: 54rem) {
  .plans { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.plan { padding: 1.6rem 1.75rem 1.75rem; border-radius: 1.5rem; }
.plan--free { background: var(--accentContrast-dark); color: var(--ink-dark); }
.plan--pro { background: var(--sunshineFill-light); color: var(--sunshineContrast-light); }
.plan h3 { margin: 0 0 .85rem; font: var(--display-weight) 1.2rem/1.45 var(--font-display); }
.plan ul { margin: 0; padding-left: 1.25rem; }
.plan li { margin-bottom: .3rem; }
.plan li:last-child { margin-bottom: 0; }

/* ---------- 隱私與收尾 ---------- */

.closing { text-align: center; }
.closing .title { margin-bottom: .75rem; }
.closing p { margin: 0 auto 2rem; max-width: 32rem; font-size: 1.125rem; }

/* ---------- 頁尾 ---------- */

.site-footer { padding-block: 2.5rem 3rem; color: var(--inkSecondary); font-size: .92rem; }
.site-footer a { color: inherit; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 0; padding: 0; list-style: none; }
.sources { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); font-size: .85rem; line-height: 1.7; }
.sources h2 { margin: 0 0 .35rem; font: 600 .9rem/1.5 var(--font-display); color: var(--ink); }
.sources p { margin: 0; }

/* ---------- 文件頁（支援・隱私權・組織首頁） ---------- */

.doc { padding-block: clamp(1.5rem, 5vw, 3rem) 3.5rem; }
.doc h1 {
  margin: 0 0 .6rem;
  font: var(--display-weight) clamp(2rem, 5vw, 2.75rem)/1.25 var(--font-display);
  letter-spacing: -.01em;
}
.doc .stamp { margin: 0 0 2.25rem; color: var(--inkSecondary); font-size: .95rem; }
.doc h2 { margin: 2.6rem 0 .5rem; font: var(--display-weight) 1.2rem/1.5 var(--font-display); }
.doc p { margin: 0 0 1rem; }
.doc strong { font-weight: 700; }
.callout {
  margin: 1.75rem 0; padding: 1.25rem 1.4rem;
  border-left: .3rem solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surfaceElevated);
}
.callout p:last-child { margin-bottom: 0; }
.app-card {
  display: grid; gap: 1.25rem; align-items: center; margin: 1.5rem 0 1rem;
  padding: 1.5rem; border-radius: 1.5rem; background: var(--indigo-light); color: var(--ink-dark);
  --link: var(--sunshineFill-light);
}
@media (min-width: 36rem) {
  .app-card { grid-template-columns: 7rem minmax(0, 1fr); }
}
.app-card .device { width: 7rem; }
.app-card h2 { margin: 0 0 .4rem; }
.app-card p { margin: 0 0 .6rem; }
.app-card p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .store-badge { transition: none; }
}
