@import url("rtd-tokens.css?v=3");

/* 小M基地 · 全站组件样式（依据 Apple HIG，规范见 design/小M基地-AppleHIG改版设计文档.md）
   颜色只用语义令牌；深色跟随系统；不要在页面里写死颜色值。 */

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 1rem/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
       stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--r-ctl);
        background: var(--accent-fill); color: var(--on-accent); }
.skip:focus { top: 12px; }

/* ---------- 内容区（侧栏、导航栏、标签栏由 archive-nav.js 注入，样式在 archive-nav.css） ---------- */
.wrap { width: 100%; max-width: 1024px; margin: 0 auto; padding: 40px 32px 56px; display: flex; flex-direction: column; gap: 32px; }
.wrap.read { max-width: 784px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--accent); background: none; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--fill-hover); }

/* ---------- 文字层级 ---------- */
.large-title { display: flex; flex-direction: column; gap: 8px; }
.large-title h1 { font-size: 2.125rem; line-height: 1.2; font-weight: 700; letter-spacing: .01em; }
.lede { font-size: 1.0625rem; line-height: 1.6; color: var(--label-2); }
.eyebrow { font-size: .9375rem; font-weight: 600; color: var(--accent); }
.t1 { font-size: 1.75rem; line-height: 1.3; font-weight: 700; }
.t2 { font-size: 1.375rem; line-height: 1.3; font-weight: 700; }
.t3 { font-size: 1.25rem; line-height: 1.3; font-weight: 600; }
.foot { font-size: .8125rem; line-height: 1.5; color: var(--label-2); }
.sub { color: var(--label-2); }

/* ---------- 区块 ---------- */
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.sec-h h2 { font-size: 1.375rem; line-height: 1.3; font-weight: 700; }
.sec-h .aside { font-size: .8125rem; color: var(--label-2); }
.sec-h a.aside { font-size: .9375rem; color: var(--accent); }

.card { background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; }

/* 数据块 */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile-k { font-size: .8125rem; color: var(--label-2); }
.tile-v { font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
.tile-v small { font-size: 1.0625rem; font-weight: 600; color: var(--label-2); }
.tile-s { font-size: .8125rem; color: var(--label-2); }

/* 列表组（inset grouped） */
.group { background: var(--surface); border-radius: var(--r-card); overflow: hidden; margin: 0; padding: 0; list-style: none; }
.group > * + * { border-top: .5px solid var(--separator); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 52px; color: var(--label); }
a.row:hover { background: var(--fill-hover); text-decoration: none; }
.row-icon { width: 36px; height: 36px; flex: none; border-radius: 9px; display: grid; place-items: center;
            background: var(--accent-tint); color: var(--accent); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 1.0625rem; line-height: 1.3; font-weight: 600; }
.row-sub { font-size: .9375rem; line-height: 1.45; color: var(--label-2); }
.chev { width: 16px; height: 16px; flex: none; color: var(--label-3); stroke-width: 2.25; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
        background: var(--fill); color: var(--label-2); font-size: .8125rem; line-height: 1.4; white-space: nowrap; }
.pill .ico { width: 12px; height: 12px; stroke-width: 2.25; }

/* 横条 */
.bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--label-3); }
.bar > i.hi { background: var(--accent-fill); }

/* 分段控件 */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(88px, 1fr); padding: 2px; border-radius: var(--r-ctl);
       background: var(--fill); max-width: 100%; }
.seg button { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--label); font: inherit; font-size: .9375rem; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* 按钮与表单 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
       border: 0; border-radius: 12px; font: inherit; font-size: 1.0625rem; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-secondary { background: var(--fill); color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8125rem; font-weight: 600; color: var(--label-2); }
.input { height: 44px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--separator);
         background: var(--surface-2); color: var(--label); font: inherit; font-size: 1.0625rem; width: 100%; }
.input[aria-invalid="true"] { border: 1.5px solid var(--critical); }
.msg-err { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--critical); }
.msg-ok { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--accent); }

/* 提示块 */
.note { display: flex; gap: 10px; padding: 14px 16px; border-radius: var(--r-card); background: var(--accent-tint); font-size: .9375rem; line-height: 1.6; }
.note .ico { color: var(--accent); margin-top: 2px; }
.note.warn { background: rgba(255, 149, 0, .12); }
.note.warn .ico { color: var(--warning); }

details.card > summary { font-size: 1.0625rem; font-weight: 600; cursor: pointer; list-style-position: inside; }
details.card[open] > summary { margin-bottom: 8px; }

@media (max-width: 767px) {
  .wrap { padding: 24px 16px 32px; gap: 24px; }
  .large-title h1 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
