/* Bagua site: base, nav, buttons, hero type, phones and the overview. Colours come from themes.css;
   sections and sub-pages are in sections.css; motion, glass and the hero stage in motion.css.
   Type: the app's serif (Georgia / Noto Serif, system fonts) for names and headlines, Inter for text,
   JetBrains Mono for labels and specs (both OFL, self-hosted). */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Noto Serif", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 40px);
  --r: 4px;          /* the app's card radius */
  --r-lg: 10px;
  --pill: 999px;     /* the app's buttons are pills */
  --nav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-size: 17px; line-height: 1.65; color: var(--sub); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden;
  transition: background-color .4s, color .4s;
}
img { display: block; max-width: 100%; height: auto; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--accent-text); text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb), .45); text-underline-offset: 3px; transition: color .2s; }
a:hover { color: var(--head); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(var(--accent-rgb), .35); color: var(--head); }
h1, h2, h3 { color: var(--head); font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; line-height: 1.12; text-wrap: balance; }
strong { color: var(--text); font-weight: 600; }
code { font-family: var(--mono); }
.zh { font-family: "Noto Serif CJK TC", "Songti TC", "PMingLiU", var(--serif); }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: 8px;
  background: var(--head); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--bg); }

/* ── Nav ─────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(140%) blur(16px); backdrop-filter: saturate(140%) blur(16px);
}
.nav-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; color: var(--head); text-decoration: none;
  font-family: var(--serif); font-size: 1.22rem; letter-spacing: .08em;
}
.wordmark:hover { color: var(--head); }
.wordmark svg { width: 28px; height: 28px; flex: none; }
.nav-links { display: flex; gap: 24px; margin-left: auto; font-size: .9rem; }
.nav-links a { position: relative; padding: 6px 0; color: var(--sub); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--head); }
.nav-links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent);
}
.theme-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--text); transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--head); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
html:not(.js) .theme-toggle { display: none; }

/* ── Buttons: the app's pills ────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding: 0 26px;
  border-radius: var(--pill); font: inherit; font-size: .97rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  cursor: pointer; border: 0; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s, border-color .25s, color .25s;
}
.btn-primary {
  color: var(--cta-ink); background: var(--accent);
  box-shadow: 0 12px 30px -12px rgba(var(--accent-rgb), .95), 0 0 40px -14px rgba(var(--accent-rgb), .9);
}
.btn-primary:hover { color: var(--cta-ink); transform: translateY(-1px); box-shadow: 0 16px 38px -12px rgba(var(--accent-rgb), 1), 0 0 56px -12px rgba(var(--accent-rgb), 1); }
.btn-ghost { color: var(--head); background: transparent; box-shadow: inset 0 0 0 1px var(--line-3); }
.btn-ghost:hover { color: var(--head); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-sm { height: 38px; padding: 0 16px; font-size: .86rem; }
.btn .sep { opacity: .6; }
.btn svg { width: 16px; height: 16px; }

/* ── Hero type (the stage and the turning ring are in motion.css) ───── */
.hero-copy { text-align: center; max-width: 920px; margin: 0 auto; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: var(--pill);
  border: 1px solid var(--line-2); background: var(--glass);
  font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--sub);
}
.kicker .dot, .pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .18), 0 0 12px rgba(var(--accent-rgb), .9);
  animation: pulse 2.5s ease-in-out infinite; /* the app's changing-line pulse */
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), .06), 0 0 18px rgba(var(--accent-rgb), .55); } }
.hero h1 {
  display: flex; justify-content: center; align-items: flex-start; gap: .1em; margin-top: 20px;
  font-size: clamp(4.2rem, 12vw, 8.2rem); letter-spacing: .02em; line-height: .95;
}
.hero h1 .zh {
  writing-mode: vertical-rl; margin-top: .14em; font-size: .3em; letter-spacing: .12em; line-height: 1;
  color: var(--accent-text); padding: .3em .14em; border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 3px;
}
.hero-sub { margin: 18px auto 0; max-width: 900px; font-size: clamp(1.25rem, 2.5vw, 1.8rem); letter-spacing: -.015em; line-height: 1.28; color: var(--head); text-wrap: balance; }
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.hero-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 26px; list-style: none;
  font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; color: var(--sub);
}
.hero-meta li { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ── Phones: real screenshots in a device frame ─────── */
.phone {
  position: relative; width: 100%; max-width: 320px; margin: 0 auto; padding: 9px; border-radius: 46px;
  background: linear-gradient(160deg, var(--phone-edge), color-mix(in srgb, var(--phone-edge) 70%, var(--bg)));
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow), 0 40px 90px -60px rgba(var(--accent-rgb), .8);
}
.phone img { width: 100%; border-radius: 38px; background: var(--bg); }
.phone::after { /* speaker slot */
  content: ""; position: absolute; top: 17px; left: 50%; width: 22%; height: 6px; margin-left: -11%; border-radius: 6px;
  background: color-mix(in srgb, var(--phone-edge) 60%, #000); opacity: .5;
}
.frame {
  position: relative; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--bg);
  box-shadow: var(--shadow);
}
.frame img { width: 100%; }

/* overview: three real screens, a lead and the key numbers */
.overview { position: relative; z-index: 3; margin-top: clamp(-80px, -7vh, -40px); }
.trio { display: grid; grid-template-columns: 1fr 1.18fr 1fr; align-items: end; gap: clamp(14px, 3vw, 44px); max-width: 980px; margin: 0 auto; }
.trio .phone { max-width: 300px; }
.trio .main .phone { max-width: 340px; }
.trio figure:not(.main) { padding-bottom: 6%; }
.trio figcaption { margin-top: 16px; text-align: center; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; color: var(--muted); }
.overview-lead { max-width: 760px; margin: clamp(40px, 6vw, 72px) auto 0; text-align: center; font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.55; color: var(--text); }
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); margin-top: clamp(36px, 5vw, 56px); list-style: none;
  border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--glass);
}
.stats li { padding: 22px 22px 20px; border-left: 1px solid var(--line); }
.stats li:first-child { border-left: 0; }
.stats .v { font-family: var(--mono); font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 500; letter-spacing: -.03em; color: var(--head); line-height: 1.15; }
.stats .k { margin-top: 6px; font-size: .88rem; line-height: 1.4; }
