/* SmartChair Manual — shared stylesheet
   Palette extends static/css/sc_design.css tokens; serif display face
   for headings, system sans for running text (CJK-safe stacks). */

:root {
  --paper: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3fa;
  --rail: #f0f4fa;
  --ink: #16233d;
  --ink-soft: #55698a;
  --ink-faint: #8496b8;
  --rule: #dde6f2;
  --primary: #1d63d8;
  --primary-deep: #174784;
  --accent: #17b4b1;
  --shadow: 0 22px 48px rgba(19, 41, 84, 0.10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1322;
    --surface: #121b2e;
    --surface-soft: #18243b;
    --rail: #0f1728;
    --ink: #e9edf8;
    --ink-soft: #9aabc9;
    --ink-faint: #63749a;
    --rule: #263355;
    --primary: #5b9bff;
    --primary-deep: #8fbcff;
    --accent: #3fd0cb;
    --shadow: 0 22px 48px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Hiragino Sans", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.serif, h1, h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Hiragino Mincho ProN", "Songti SC", Georgia, serif;
}

.shell { display: flex; flex-direction: column; min-height: 100%; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; }
.brand-mark {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 700; font-size: 19px; color: var(--ink); letter-spacing: -0.01em;
}
.brand-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 5px; padding: 2px 7px;
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.langswitch {
  display: flex; background: var(--surface-soft);
  border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px;
}
.langswitch a {
  color: var(--ink-soft); font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 999px; text-decoration: none;
}
.langswitch a.on { background: var(--primary); color: #fff; }
.back-link {
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; border-bottom: 1px solid transparent;
}
.back-link:hover { color: var(--primary); border-color: var(--primary); }

/* ── Body: rail + content ── */
.body { flex: 1; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
@media (max-width: 860px) {
  .body { grid-template-columns: 1fr; }
  .rail { display: none; }
}
.rail {
  background: var(--rail);
  border-right: 1px solid var(--rule);
  padding: 28px 20px;
}
.rail-group { margin-bottom: 24px; }
.rail-group-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 8px 10px;
}
.rail a {
  display: block; font-size: 13.5px; color: var(--ink-soft); text-decoration: none;
  padding: 6px 10px; border-radius: 7px; margin-bottom: 1px;
}
.rail a:hover { background: var(--surface-soft); color: var(--ink); }
.rail a.active {
  background: var(--surface); color: var(--primary-deep); font-weight: 650;
  box-shadow: inset 2px 0 0 var(--primary);
}
.rail a.special::after { content: " ★"; font-size: 9px; color: var(--accent); }

main { padding: 52px 44px 100px; max-width: 780px; }
.eyebrow {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.18; margin: 0 0 18px; text-wrap: balance; }
.intro { font-size: 16.5px; color: var(--ink-soft); max-width: 62ch; margin: 0 0 30px; }
h2 { font-size: 21px; margin: 42px 0 8px; }
h3 { font-size: 15.5px; font-weight: 700; margin: 26px 0 8px; }
p, li { font-size: 14.5px; max-width: 68ch; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin-bottom: 6px; }
a { color: var(--primary); }
strong { font-weight: 650; }
code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em; background: var(--surface-soft);
  border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px;
}

/* callout card */
.callout {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  padding: 16px 20px; margin: 22px 0;
  box-shadow: var(--shadow);
}
.callout .co-title { font-weight: 700; font-size: 14.5px; margin: 0 0 5px; }
.callout p { font-size: 13.5px; color: var(--ink-soft); margin: 0; max-width: 60ch; }

/* definition tables */
table { border-collapse: collapse; width: 100%; margin: 16px 0 22px; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint); font-weight: 700;
}
td:first-child, th:first-child { padding-left: 0; }
td:first-child { font-weight: 650; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* flow diagram (horizontal steps) */
.flow {
  display: flex; align-items: stretch; overflow-x: auto;
  gap: 0; padding: 10px 2px 16px; margin: 10px 0 8px;
}
.flow-node {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 108px; flex-shrink: 0; text-align: center; padding: 0 6px;
}
.flow-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
  color: var(--primary-deep);
  font-family: "SFMono-Regular", Menlo, monospace; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.flow-node.alt .flow-dot { border-color: var(--accent); color: var(--accent); }
.flow-label { font-size: 11.5px; font-weight: 650; line-height: 1.3; }
.flow-sub { font-size: 10.5px; color: var(--ink-faint); line-height: 1.35; max-width: 120px; }
.flow-arrow {
  color: var(--ink-faint); font-size: 15px; flex-shrink: 0;
  display: flex; align-items: center; padding: 0 2px 34px;
}

/* role / actor cards */
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0 8px; }
@media (max-width: 640px) { .cards2 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 12px; padding: 18px 20px 16px;
}
.card.t-primary { border-top: 3px solid var(--primary); }
.card.t-accent { border-top: 3px solid var(--accent); }
.card.t-muted { border-top: 3px solid var(--ink-faint); }
.card .c-kind {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 6px;
}
.card h3 { margin: 0 0 4px; font-size: 15.5px; }
.card p { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-soft); color: var(--ink); border: 1px solid var(--rule);
}

/* prev / next footer */
.page-foot {
  margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-size: 13px;
}
.page-foot a { color: var(--primary); font-weight: 600; text-decoration: none; }
.page-foot a:hover { text-decoration: underline; }
.page-foot .pf-note { color: var(--ink-faint); font-size: 12px; width: 100%; margin-top: 10px; }
