/* KELIBRON guides — one stylesheet for the guide home, categories and articles (en and zh).
   Dark follows the lab; light is used when the reader's system asks for it. Brand cyan marks
   links and accents; on light paper links use a deeper tone of the same hue for contrast. */
:root {
  --bg: #0d0f12;
  --surface: #14181d;
  --surface-2: #1a1f25;
  --line: #262c33;
  --line-strong: #343c45;
  --text: #dfe5ea;
  --heading: #ffffff;
  --muted: #8b96a3;
  --brand: #00f0ff;
  --link: #00f0ff;
  --link-hover: #7ff7ff;
  --brand-soft: rgba(0, 240, 255, 0.08);
  --brand-line: rgba(0, 240, 255, 0.35);
  --pass: #00e676;
  --alert: #ff3366;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 32px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8f9;
    --surface: #ffffff;
    --surface-2: #eef2f4;
    --line: #dde3e8;
    --line-strong: #c9d1d8;
    --text: #27303a;
    --heading: #0d1217;
    --muted: #5d6874;
    --link: #00808a;
    --link-hover: #005e66;
    --brand-soft: rgba(0, 160, 175, 0.07);
    --brand-line: rgba(0, 128, 138, 0.35);
    --pass: #0a8a4a;
    --alert: #c8174a;
    --shadow: 0 1px 2px rgba(13, 18, 23, 0.04), 0 10px 28px rgba(13, 18, 23, 0.06);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(en) body, body:lang(en) { line-height: 1.7; }
img, video { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
.prose a, .faq a, .crumbs a { text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }
.mono { font-family: var(--mono); }

/* top bar */
.bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--heading); font-weight: 700; letter-spacing: 0.14em; font-size: 15px; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }
.cats { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.cats::-webkit-scrollbar { display: none; }
.cats a { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.cats a:hover, .cats a[aria-current] { color: var(--heading); background: var(--surface-2); }
.bar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lang { color: var(--muted); font-size: 14px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 15px; line-height: 1.2; border: 1px solid var(--brand-line); color: var(--link); background: var(--brand-soft); white-space: nowrap; }
.btn:hover { border-color: var(--link); color: var(--link); }
.btn.solid { background: var(--brand); color: #04161a; border-color: var(--brand); }
.btn.solid:hover { filter: brightness(1.08); color: #04161a; }
@media (max-width: 760px) { .bar-in { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px 14px; } .cats { order: 3; flex-basis: 100%; margin: 0 -6px; } .brand span { display: none; } .bar .btn { padding: 7px 12px; font-size: 14px; } }

/* layout */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 20px 72px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 720px) 240px; gap: 64px; justify-content: center; }
.article-grid > aside { position: relative; }
@media (max-width: 1080px) { .article-grid { grid-template-columns: minmax(0, 720px); } .article-grid > aside { display: none; } }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { opacity: 0.5; }
.kicker { font: 600 12px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--link); margin: 0 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); margin: 14px 0 0; }
h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.18; margin: 0; }
.lede { font-size: 19px; line-height: 1.7; color: var(--text); margin: 16px 0 0; max-width: 680px; }

/* article body */
.answer { margin: 28px 0 8px; padding: 18px 22px; border: 1px solid var(--brand-line); border-left: 3px solid var(--brand); border-radius: 12px; background: var(--brand-soft); }
.answer b.label { display: block; font: 600 12px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--link); margin-bottom: 6px; }
.answer p { margin: 0; color: var(--heading); font-size: 17.5px; }
.clip { margin: 28px 0 8px; }
.clip-frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0b0d10; box-shadow: var(--shadow); aspect-ratio: 16 / 9; }
.clip-frame video, .clip-frame img { width: 100%; height: 100%; object-fit: cover; }
.clip figcaption { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; font-size: 14px; color: var(--muted); margin-top: 10px; }
.clip figcaption .acts { display: flex; flex-wrap: wrap; gap: 6px 14px; }
#reenact figcaption { flex-wrap: wrap; }
#reenact > .acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
#reenact .note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.clip figcaption .tag { font: 600 11px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--link); margin-right: 8px; }
.prose { counter-reset: sec; }
.prose section { margin-top: 48px; }
.prose h2 { font-size: 25px; line-height: 1.35; margin: 0 0 14px; display: flex; gap: 14px; align-items: baseline; }
.prose h2::before { counter-increment: sec; content: counter(sec, decimal-leading-zero); font: 600 14px/1 var(--mono); color: var(--link); letter-spacing: 0.06em; flex: none; transform: translateY(-2px); }
.prose h2.plain::before { content: none; }
.prose p { margin: 0 0 16px; }
.prose b, .prose strong { color: var(--heading); font-weight: 650; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.4em; }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--link); font-family: var(--mono); font-size: 0.92em; }
.prose ol > li::marker { font-weight: 600; }
.table { margin: 8px 0 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
.table th { text-align: left; font: 600 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td:first-child { color: var(--heading); font-weight: 550; }
sub { font-size: 0.75em; }

/* faq */
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 10px 0; }
.faq summary { cursor: pointer; list-style: none; padding: 14px 48px 14px 18px; color: var(--heading); font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font: 400 22px/1 var(--mono); color: var(--link); }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--text); }

/* cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 12px 0 0; padding: 0; list-style: none; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
a.card:hover { border-color: var(--brand-line); transform: translateY(-2px); color: var(--text); }
.card .thumb { aspect-ratio: 16 / 9; background: #0b0d10; border-bottom: 1px solid var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .eyebrow { font: 600 11px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--link); }
.card .title { color: var(--heading); font-weight: 650; line-height: 1.45; font-size: 16.5px; }
.card .sum { font-size: 14.5px; line-height: 1.65; color: var(--muted); }
.card .go { margin-top: auto; padding-top: 6px; font-size: 14px; color: var(--link); }

/* aside toc */
.toc { position: sticky; top: 92px; font-size: 14px; }
.toc b { display: block; font: 600 12px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); line-height: 1.5; }
.toc a:hover { color: var(--heading); border-left-color: var(--link); }
.toc .btn { margin-top: 20px; width: 100%; justify-content: center; }
.toc-inline { display: none; margin: 24px 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.toc-inline summary { padding: 12px 16px; cursor: pointer; color: var(--heading); font-weight: 600; }
.toc-inline ol { margin: 0; padding: 0 16px 14px 36px; font-size: 15px; }
@media (max-width: 1080px) { .toc-inline { display: block; } }

/* try band, prev/next */
.try { margin: 56px 0 0; padding: 26px; border-radius: var(--radius); border: 1px solid var(--brand-line); background: linear-gradient(135deg, var(--brand-soft), transparent 70%), var(--surface); display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.try h2 { margin: 0 0 4px; font-size: 21px; }
.try p { margin: 0; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 40px 0 0; }
.pager a { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); color: var(--heading); font-weight: 600; line-height: 1.45; }
.pager a:hover { border-color: var(--brand-line); }
.pager small { display: block; font: 600 11px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* home and category */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; padding: 28px 0 24px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 28px; } }
.block { margin-top: 64px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.block-head h2 { margin: 0; font-size: 24px; }
.block-head p { margin: 0; color: var(--muted); font-size: 15px; }
.topics { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.topic { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px 22px; }
.topic h3 { margin: 0 0 4px; font-size: 19px; }
.topic h3 a { color: var(--heading); }
.topic h3 a:hover { color: var(--link); }
.topic > p { margin: 0 0 12px; color: var(--muted); font-size: 15px; line-height: 1.65; }
.topic ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.topic li { border-bottom: 1px solid var(--line); }
.topic li:last-child { border-bottom: 0; }
.topic li a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 15.5px; color: var(--text); }
.topic li a::after { content: '→'; color: var(--link); }
.topic li a:hover { color: var(--link); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.steps li a { display: block; height: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; color: var(--heading); font-weight: 600; line-height: 1.45; }
.steps li a::before { counter-increment: step; content: counter(step, decimal-leading-zero); display: block; font: 600 13px/1 var(--mono); color: var(--link); margin-bottom: 10px; }
.steps li a:hover { border-color: var(--brand-line); }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 40px 20px 28px; display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); font-size: 14px; }
.foot h3 { font: 600 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 6px 0; }
.foot li a { color: var(--text); }
.foot li a:hover { color: var(--link); }
.foot-note { max-width: 1200px; margin: 0 auto; padding: 0 20px 32px; color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { a.card:hover { transform: none; } }
@media print { .bar, .foot, aside, .try, .clip, .cards, .pager { display: none !important; } body { background: #fff; color: #000; } }

/* references */
.sources { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.sources h2 { font-size: 19px !important; }
.sources ol { font-size: 14.5px; line-height: 1.65; padding-left: 1.6em; }
.sources li { margin: 8px 0; word-break: break-word; }
.sources .pub, .sources .note { color: var(--muted); }
