/* miaoalpha.com 全站共用样式（杂志风格）
 * 标题宋体为自托管子集字体（只含页面用到的字，由构建脚本生成），正文用系统字体。
 * 不依赖 Google Fonts：国内访问不到，会拖慢甚至卡住首屏。 */
@font-face { font-family: "MiaoSerif"; src: url("fonts/serif-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "MiaoSerif"; src: url("fonts/serif-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #ffffff; --ink: #16150f; --muted: #5c5a52; --rule: #e6e4dc; --soft: #f3f4f1;
  --yellow: #edc317; --on-yellow: #16150f;
  --c-strat: #9a6a00; --c-bench: #3f72c4; --c-up: #a81c16; --c-down: #34a866;
  --c-grid: #ecece6; --c-axis: #cfcfc6; --c-ink: #16150f; --c-muted: #5c5a52; --c-surface: #ffffff;
  --serif: "MiaoSerif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --chart-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121210; --ink: #f1efe8; --muted: #aaa79c; --rule: #2c2b26; --soft: #1a1a17;
    --c-strat: #b58c08; --c-bench: #5b8ee0; --c-up: #c4302a; --c-down: #2caa66;
    --c-grid: #24241f; --c-axis: #3a3a33; --c-ink: #f1efe8; --c-muted: #aaa79c; --c-surface: #121210;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121210; --ink: #f1efe8; --muted: #aaa79c; --rule: #2c2b26; --soft: #1a1a17;
  --c-strat: #b58c08; --c-bench: #5b8ee0; --c-up: #c4302a; --c-down: #2caa66;
  --c-grid: #24241f; --c-axis: #3a3a33; --c-ink: #f1efe8; --c-muted: #aaa79c; --c-surface: #121210;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.8;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 48px; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
p { margin: 0; }
img { max-width: 100%; }
.kicker { font-size: 13px; letter-spacing: .18em; color: var(--muted); font-weight: 700; margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 900; line-height: 1.2; margin: 6px 0 14px; text-wrap: balance; }
h2 { font-size: clamp(28px, 4.4vw, 52px); }
h3 { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.45; margin: 0 0 6px; text-wrap: balance; }

/* 二维码卡片：两种主题下都保持白底，保证能扫 */
.qr-card { background: #fff; color: #191919; padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qr-card strong { font-size: 18px; display: block; }
.qr-card span { color: #8f8f8f; font-size: 13.5px; display: block; margin: 2px 0 10px; }
.qr-card em { font-style: normal; font-weight: 700; font-size: 14.5px; }
.qr-card .wx { color: #07c160; } .qr-card .zx { color: #16b998; }
.qr-card img { width: 124px; height: 124px; flex: none; display: block; }

/* 子页面 */
.page { max-width: 760px; margin: 0 auto; display: grid; gap: 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 3px solid var(--ink); padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 900; font-size: 24px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 2px solid var(--yellow); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 6px 0; }
.topbar nav a[aria-current="page"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px var(--yellow); }
.prose { display: grid; gap: 14px; }
.prose h2 { font-size: clamp(26px, 5vw, 36px); margin-bottom: 4px; }
.prose h3 { margin-top: 10px; }
.prose ul { margin: 0; padding-left: 22px; }
.prose li { margin: 6px 0; }
.box { border-left: 6px solid var(--yellow); background: var(--soft); padding: 16px 18px; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; padding: 0; list-style: none; }
.boards li { border-top: 1px solid var(--rule); padding-top: 10px; margin: 0; }
.boards b { display: block; font-family: var(--serif); font-weight: 600; font-size: 17px; }
.boards span { color: var(--muted); font-size: 14.5px; }
.en p, .en li { font-size: 15.5px; }

/* 专栏试读页（tools/build_previews.py 生成） */
.article h1 { font-size: clamp(26px, 5.4vw, 38px); line-height: 1.32; }
.byline { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.article figure { margin: 22px 0; }
.article figure img { width: 100%; height: auto; display: block; background: #fff; border: 1px solid var(--rule); }
.article figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.read { position: relative; margin-top: 22px; }
.read p { font-size: 17px; line-height: 1.9; margin: 0 0 1.1em; }
.read strong { background: linear-gradient(transparent 62%, rgba(237, 195, 23, .45) 0); }
.read hr { border: 0; margin: 30px 0; text-align: center; color: var(--muted); }
.read hr::before { content: "· · ·"; letter-spacing: .6em; }
.read::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 110px; background: linear-gradient(rgba(0, 0, 0, 0), var(--bg)); pointer-events: none; }
.paywall { background: var(--yellow); color: var(--on-yellow); padding: 28px 26px; display: grid; gap: 14px; margin-top: 8px; }
.paywall .kicker { color: rgba(22, 21, 15, .7); }
.paywall h2 { margin: 0; font-size: clamp(24px, 4.4vw, 32px); }
.paywall ul { margin: 0; padding-left: 20px; }
.paywall li { margin: 4px 0; text-wrap: pretty; }
.paywall .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.paywall .acts a { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; font-weight: 700; font-size: 15px; text-decoration: none; border: 2px solid var(--on-yellow); color: var(--on-yellow); }
.paywall .acts a.primary { background: var(--on-yellow); color: var(--yellow); }
.paywall .qr-card { max-width: 360px; }
.more-reads { margin-top: 30px; }
.more-reads ul { margin: 6px 0 12px; padding-left: 20px; }
.more-reads li { margin: 6px 0; }
.more-reads a { font-weight: 700; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 4px; }

.note { font-size: 13px; color: var(--muted); line-height: 1.75; border-top: 1px solid var(--rule); padding-top: 16px; }
.site-footer { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); padding-block: 6px; }

/* 手机底部固定按钮栏 */
.dock { display: none; }
@media (max-width: 600px) {
  body.has-dock { padding-block-end: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .dock { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px max(14px, env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); }
  .dock a { display: flex; align-items: center; justify-content: center; min-height: 46px; text-decoration: none; font-weight: 700; font-size: 15px; }
  .dock .a1 { border: 2px solid var(--ink); }
  .dock .a2 { background: var(--yellow); color: var(--on-yellow); }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar nav { gap: 2px 18px; }
  .boards { grid-template-columns: minmax(0, 1fr); }
  .qr-card img { width: 112px; height: 112px; }
  .read p { font-size: 16.5px; }
  .paywall { margin-inline: -16px; padding: 24px 18px; }
  .paywall .acts a { flex: 1 1 100%; }
}
