/* base.css — Pico 风格基座（骨架版，W1 替换为 pico.min.css CDN + 本地回退，见 D-043）
   目标：现在能预览；届时仅改模板 head 引用，类名策略不变。 */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --content: 960px;
  --spacing: 1rem;
  --radius: 10px;
  --border: 1px solid var(--line);
}

/* 明暗双主题：默认浅色；[data-theme=dark] 与媒体查询双通道 */
:root, [data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --text: #1c2126;
  --text-soft: #56616c;
  --line: #dfe3e8;
  --primary: #4f6df5;
  --primary-hover: #3d59e8;
  --primary-focus: rgba(79, 109, 245, .35);
  --card: #ffffff;
  --code-bg: #f0f2f5;
  --mark: #fff3c4;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #13171d;
  --bg-soft: #1a2028;
  --text: #dde4ec;
  --text-soft: #94a1b0;
  --line: #2b3540;
  --primary: #7d94ff;
  --primary-hover: #97aaff;
  --primary-focus: rgba(125, 148, 255, .4);
  --card: #182029;
  --code-bg: #1e2733;
  --mark: #4d431f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #13171d; --bg-soft: #1a2028; --text: #dde4ec; --text-soft: #94a1b0;
    --line: #2b3540; --primary: #7d94ff; --primary-hover: #97aaff; --primary-focus: rgba(125,148,255,.4);
    --card: #182029; --code-bg: #1e2733; --mark: #4d431f; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; font-weight: 700; }
h1 { font-size: 1.9rem; margin-top: .4em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: .7em 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:where(a, button, input, select, textarea, details summary):focus-visible {
  outline: 3px solid var(--primary-focus); outline-offset: 1px; border-radius: 4px;
}
code, kbd, pre { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--code-bg); padding: .12em .4em; border-radius: 5px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .15em; }

.container { width: min(100% - 2rem, var(--content)); margin-inline: auto; }

/* ---- 表单控件（Pico 式）---- */
input, textarea, select {
  font: inherit; color: inherit; background: var(--bg);
  border: var(--border); border-radius: calc(var(--radius) / 2);
  padding: .55rem .7rem; width: 100%;
}
input[type="search"] { appearance: textfield; }
textarea { resize: vertical; min-height: 8rem; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
label { display: inline-block; font-size: .92rem; margin: .8em 0 .3em; font-weight: 600; }
label.mini { font-weight: 500; font-size: .85rem; margin: 0; }
label.mini select { width: auto; padding: .3rem .5rem; margin-left: .3rem; }
button, [role="button"] {
  font: inherit; cursor: pointer; border-radius: calc(var(--radius) / 2);
  padding: .55rem 1rem; border: var(--border); background: var(--bg-soft); color: var(--text);
}
button:hover { border-color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] button.primary, :root:not([data-theme]) button.primary {}
button.primary:hover { background: var(--primary-hover); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row output { color: var(--text-soft); font-size: .9rem; }
output.err { color: #c0392b; font-weight: 600; }
[data-theme="dark"] output.err { color: #ff8f80; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: var(--border); vertical-align: top; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-soft); }
tr[hidden] { display: none; }
.scroll { overflow-x: auto; }
table.kv { max-width: 560px; }
table.kv td:first-child { color: var(--text-soft); width: 40%; }
table.kv td { font-size: 1rem; }

/* ---- 其他 Pico 式细节 ---- */
details { border: var(--border); border-radius: calc(var(--radius) / 2); padding: .6rem .9rem; margin: .5rem 0; background: var(--bg-soft); }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: .6em 0 .2em; }
hr { border: 0; border-top: var(--border); margin: 2rem 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { position: static; margin: .5rem; padding: .4rem .8rem; background: var(--primary); color: #fff; border-radius: 6px; display: inline-block; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
