/* S2Fitting handbook stylesheet (S2F-H001, 2026-10-19).  Plain CSS, no build step.
   Contains the skill's bilingual switch block pasted unchanged (skill 0.5.0). */

/* ---- bilingual switch (pasted from assets_ref/lang.css, unchanged) ---- */
html[data-lang="en"] .l-zh,
html:not([data-lang="en"]) .l-en { display: none !important; }

.lang-toggle {
  font: inherit; font-size: 0.9rem; padding: 0.3rem 0.8rem; min-height: 44px; min-width: 44px;
  border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; cursor: pointer;
}
.lang-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---- theme tokens ---- */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --warn-bg: #fffbeb;
  --warn-line: #f59e0b;
  --ok: #166534;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
}
html[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #131c2e;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: #334155;
  --accent: #7dd3fc;
  --accent-soft: #1e293b;
  --warn-bg: #26200a;
  --warn-line: #b45309;
  --ok: #86efac;
  --code-bg: #020617;
  --code-ink: #e2e8f0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  line-height: 1.65;
  font-size: 17px;
}
img, svg, video, canvas { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* ---- layout ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
header.site {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
header.site .bar {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  max-width: 1080px; margin: 0 auto; padding: 8px 16px;
}
header.site .brand { font-weight: 700; margin-right: auto; }
header.site nav { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 0.92rem; }
header.site nav a { padding: 4px 6px; border-radius: 6px; }
header.site nav a:hover { background: var(--accent-soft); }
header.site nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }

main { padding: 20px 0 64px; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.4em 0 0.3em; }
h2 { font-size: 1.28rem; margin: 1.6em 0 0.5em; border-bottom: 1px solid var(--line); padding-bottom: 0.2em; }
h3 { font-size: 1.08rem; margin: 1.3em 0 0.4em; }
h4 { font-size: 1rem; margin: 1.1em 0 0.3em; color: var(--muted); }
p { margin: 0.55em 0; }
ul, ol { margin: 0.5em 0; padding-left: 1.4em; }
li { margin: 0.25em 0; }

/* ---- cards & panels ---- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin: 14px 0;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

/* ---- table of contents ---- */
.toc { font-size: 0.92rem; }
.toc summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.toc ol { margin: 6px 0; }
.toc li { margin: 2px 0; }

/* ---- source notes ---- */
.src {
  font-size: 0.8rem; color: var(--muted); margin: 6px 0 0;
  border-left: 3px solid var(--line); padding-left: 8px;
}
.src code { color: inherit; }

/* ---- figures ---- */
figure { margin: 16px 0; }
figure img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
figcaption { font-size: 0.92rem; color: var(--muted); margin-top: 6px; }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 10px 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- status pills ---- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; border: 1px solid var(--line); white-space: nowrap; }
.pill-trusted { background: #dcfce7; color: #14532d; border-color: #86efac; }
.pill-provisional { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.pill-questioned { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.pill-open { background: #e0e7ff; color: #312e81; border-color: #a5b4fc; }
.pill-pending { background: #e2e8f0; color: #334155; }
.pill-closed { background: #dcfce7; color: #14532d; border-color: #86efac; }
html[data-theme="dark"] .pill-trusted, html[data-theme="dark"] .pill-closed { background: #052e16; color: #86efac; }
html[data-theme="dark"] .pill-provisional { background: #271a05; color: #fcd34d; }
html[data-theme="dark"] .pill-questioned { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .pill-open { background: #1e1b4b; color: #a5b4fc; }
html[data-theme="dark"] .pill-pending { background: #1e293b; color: #cbd5e1; }

/* trend arrows are language-neutral glyphs */
.trend { font-family: inherit; }
.trend-up { color: var(--ok); }
.trend-down { color: #b91c1c; }
html[data-theme="dark"] .trend-down { color: #fca5a5; }

/* ---- callouts ---- */
.note { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.suggest { border-left: 4px solid var(--warn-line); }

/* ---- code ---- */
code, pre, kbd, samp { font-family: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; }
code { background: var(--accent-soft); padding: 1px 4px; border-radius: 4px; font-size: 0.9em; }
pre {
  background: var(--code-bg); color: var(--code-ink); padding: 12px 14px;
  border-radius: 10px; overflow-x: auto; font-size: 0.86rem; line-height: 1.5;
}
pre code { background: none; color: inherit; padding: 0; }
pre .c { color: #94a3b8; }  /* comment */
pre .p { color: #7dd3fc; }  /* prompt / placeholder */

/* ---- math ---- */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex { font-size: 1.05em; }

/* ---- footer ---- */
footer.site { border-top: 1px solid var(--line); padding: 20px 0 40px; font-size: 0.88rem; color: var(--muted); }

/* ---- workbench home ---- */
.hero { display: grid; grid-template-columns: 1fr; gap: 14px; }
.hero .lede { font-size: 1.02rem; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi .cell { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kpi .cell .v { font-size: 1.15rem; font-weight: 700; }
.kpi .cell .k { font-size: 0.8rem; color: var(--muted); }

/* ---- animations ---- */
.anim { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 8px; }
.anim .stage { display: block; width: 100%; }
.anim .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 0.85rem; }
.anim button { font: inherit; font-size: 0.85rem; padding: 4px 10px; min-height: 34px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--accent-soft); color: inherit; cursor: pointer; }
.anim button:hover { border-color: var(--accent); }
.anim output { color: var(--muted); }
.anim-title { font-weight: 700; margin: 4px 2px; }
.anim-hint { font-size: 0.88rem; color: var(--muted); margin: 4px 2px 8px; }
.anim-label { font-size: 11px; fill: var(--muted); }
.anim text { font-family: inherit; }

/* ---- slides (seminar.html) ---- */
.deck { --slide-w: 1280px; }
.slide {
  position: relative; width: 100%; aspect-ratio: 16/9; min-height: 320px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  padding: 3.2% 4%; margin: 0 0 18px; overflow: hidden;
}
.slide h2 { border: none; margin: 0 0 2%; font-size: clamp(1.05rem, 2.6vw, 1.9rem); line-height: 1.2; }
.slide .body { font-size: clamp(0.85rem, 1.35vw, 1.15rem); }
.slide .num { position: absolute; right: 3%; bottom: 2%; font-size: 0.8rem; color: var(--muted); }
.slide .ev { display: grid; grid-template-columns: 1fr; gap: 10px; height: 86%; align-content: start; }
.slide .ev img { max-height: 100%; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.slide .ev table { font-size: clamp(0.7rem, 1.05vw, 0.95rem); }
.script { font-size: 0.95rem; border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.script .t { font-weight: 700; color: var(--accent); }
.deck-nav { position: sticky; bottom: 0; background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-top: 1px solid var(--line); padding: 8px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- presenter view (seminar.html) ---- */
body.presenter .slide.on {
  position: fixed; inset: 0; z-index: 200; max-width: none; border: none; border-radius: 0;
  aspect-ratio: auto; min-height: 0; margin: 0; padding: 4vh 4vw;
}
body.presenter .script.on { position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
  max-width: none; margin: 0; border: none; border-top: 2px solid var(--line); border-radius: 0;
  background: var(--panel); padding: 10px 16px; font-size: 1rem; max-height: 26vh; overflow: auto; }
#presenter-bar { display: none; }
body.presenter #presenter-bar { display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 220;
  gap: 14px; align-items: center; padding: 6px 14px; font-size: 0.9rem;
  background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted); }
body.presenter .slide.on { padding-top: 8vh; }

/* ---- print view (seminar.html): ?print shows every slide plus its script ---- */
@media print {
  header.site, .deck-nav, .decknav, .anim .controls, .lang-toggle, [data-theme-toggle],
  #presenter-bar, .deck .banner, .qa { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .slide { break-after: page; border: none; box-shadow: none; }
  .script { break-after: page; }
  .l-zh, .l-en { display: block !important; }
  html[data-lang="en"] .l-zh, html:not([data-lang="en"]) .l-en { display: none !important; }
}
/* ?print (on screen and in print): every slide visible, script under its slide */
body.print-all .slide { display: block !important; }
body.print-all .script { display: block !important; }

/* ---- small screens ---- */
@media (max-width: 420px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  h1 { font-size: 1.4rem; }
  header.site .bar { padding: 8px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
