/* -------------------------------------------------------------------
   Gamentic Docs - stylesheet

   Follows gamentic-assets/09-brand-system — same tokens as the marketing
   pages and the editor — in a document-first layout: sidebar / content
   column / on-this-page rail.
   Dark is the default (2026-08-20); light stays available on the toggle.
   ------------------------------------------------------------------- */

:root {
  /* ── 品牌系統(09-brand-system)—— 同宣傳頁、app 用同一套 ──────────
     一條藍 ramp carry 全部;中性色偏冷向住藍,所以面板坐喺 accent 之下。
     ⚠ 冇紫色。舊版 .brand-mark 用緊 #7b5cf0,而系統由頭到尾得一條 ramp ——
       一隻多出嚟嘅顏色就係「唔係同一個品牌」嘅最快講法。
     ⚠ 預設深色。文件同宣傳頁、editor 係同一個站嘅三個表面,淺白嗰版
       撳過去就好似去咗第二個網站。想睇淺色仲有個 toggle。 */
  --g950: #0a0b0d; --g900: #101114; --g800: #16181c;
  --g700: #202124; --g600: #2a2c31; --g400: #5a5e66;
  --g300: #96999f; --g100: #dfe0e4;
  --b900: #0b2447; --b700: #12539e; --b500: #1877f2;
  --b400: #3f96f0; --b300: #6fb4ff; --b200: #a8cfff; --b100: #dceeff;

  --bg:            var(--g950);
  --bg-soft:       var(--g900);
  --surface:       var(--g900);
  --surface-2:     var(--g800);
  --border:        #23252b;
  --border-lt:     #1a1c20;
  --text:          var(--g100);
  --text-strong:   #ffffff;
  --muted:         var(--g300);
  --accent:        var(--b400);
  --accent-soft:   rgba(63, 150, 240, 0.13);
  --accent-line:   rgba(63, 150, 240, 0.36);
  --ok:            #62c98d;
  --ok-soft:       rgba(85, 193, 135, 0.13);
  --warn:          #e0b054;
  --warn-soft:     rgba(216, 166, 87, 0.13);
  --danger:        #e88189;
  --danger-soft:   rgba(224, 108, 117, 0.13);
  --gold:          #d8a657;
  /* ⚠ 唔可以同 --bg 一樣(#0a0b0d)—— 撞晒色,啲 code block 完全睇唔出邊界 */
  --code-bg:       var(--g800);
  --code-text:     var(--b200);
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:     0 6px 24px rgba(0, 0, 0, 0.45);

  /* ⚠ CJK 係一等公民 token 唔係後備 —— Orbitron / Montserrat 零個漢字,
       唔噉寫中文文件就係成版豆腐。 */
  --cjk:  'PingFang TC', 'PingFang HK', 'Hiragino Sans CNS', 'Noto Sans CJK TC',
          'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --display: 'Orbitron', ui-sans-serif, system-ui, sans-serif;
  --font: 'Montserrat', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --mech: cubic-bezier(.22, .94, .30, 1);

  --sidebar-w: 268px;
  --toc-w:     212px;
  --topbar-h:  58px;
  --radius:    10px;
  --radius-sm: 7px;
}

/* 想睇淺色仲有得㨂(長文閱讀有人鍾意)—— 但唔再係預設。 */
:root[data-theme="light"] {
  --bg:          #ffffff;
  --bg-soft:     #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #f2f4f7;
  --border:      #e4e7ec;
  --border-lt:   #eef0f4;
  --text:        #1e2128;
  --text-strong: #0d0f14;
  --muted:       #676d7a;
  --accent:      #12539e;
  --accent-soft: rgba(24, 119, 242, 0.09);
  --accent-line: rgba(24, 119, 242, 0.28);
  --ok:          #17864b;
  --ok-soft:     rgba(23, 134, 75, 0.09);
  --warn:        #a5680a;
  --warn-soft:   rgba(180, 118, 20, 0.11);
  --danger:      #c0392f;
  --danger-soft: rgba(192, 57, 47, 0.09);
  --gold:        #9a7420;
  --code-bg:     #f6f8fa;
  --code-text:   #24292f;
  --shadow-sm:   0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md:   0 4px 16px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 20px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* ⚠ 一句就夠。之前呢度有兩句 font-family,第二句(冇 --cjk)蓋咗第一句,
     即係個 CJK token 由頭到尾冇生效過 —— 而測試查「有冇呢句」係查得到嘅。 */
  font-family: var(--font), var(--cjk);
  font-size: 15.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* --- top bar ------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand:hover { text-decoration: none; }
/**
 * ⚠ 字標一律用圖,唔准打字。個字標係品牌原檔嘅 chrome 質感字,唔係任何
 *   裝得到嘅字體 —— 打 "Gamentic" 出嚟只會係「隨便一隻 sans 打嘅公司名」,
 *   同宣傳頁、片頭、og:image 嗰個完全兩回事。
 * ⚠ 淺色主題之下要壓深啲:個字標本身係白色 chrome,白底會消失。
 */
.brand-lockup { height: 24px; width: auto; display: block; }
:root[data-theme="light"] .brand-lockup { filter: brightness(.42) saturate(1.2); }
.brand-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-left: 1px solid var(--border); padding-left: 10px; margin-left: 2px;
}
.topbar-spacer { flex: 1; }
.topbar-links { display: flex; align-items: center; gap: 4px; }
.topbar-links a {
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap;
}
.topbar-links a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.icon-btn {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; line-height: 1;
}
.icon-btn:hover { color: var(--text-strong); border-color: var(--accent-line); }
.menu-btn { display: none; }

/* --- shell -------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 44px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

/* --- sidebar ------------------------------------------------------ */
.sidebar {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 0 60px;
  font-size: 14px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-group + .nav-group { margin-top: 26px; }
.nav-group > h4 {
  margin: 0 0 8px; padding: 0 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted);
}
.nav-group a {
  display: block; padding: 6px 10px; margin-left: 1px;
  color: var(--text); border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.nav-group a:hover { background: var(--surface-2); text-decoration: none; }
.nav-group a[aria-current="page"] {
  color: var(--accent); font-weight: 600;
  border-left-color: var(--accent); background: var(--accent-soft);
}

/* --- content ------------------------------------------------------ */
.content { padding: 34px 0 80px; min-width: 0; max-width: 790px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.content h1 {
  margin: 0 0 12px;
  /**
   * ⚠ 得**版面 H1** 用 display face,h2 / h3 一律留 body。
   *   品牌系統寫明 Orbitron 係「headlines、字標、30px 以上嘅數字」——
   *   一份長文檔嘅 h2/h3 用落去會好難讀,而且細過 30px 佢個斜槓零會變
   *   實心方塊。
   * ⚠ 中文標題要跌返 CJK token:Orbitron 零個漢字。
   */
  font-family: var(--display), var(--cjk);
  font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: .005em;
  color: var(--text-strong);
}
.lead { font-size: 17.5px; line-height: 1.62; color: var(--muted); margin: 0 0 34px; }

.content h2 {
  margin: 52px 0 14px; padding-top: 22px;
  border-top: 1px solid var(--border-lt);
  font-size: 22px; font-weight: 650; letter-spacing: -0.013em; color: var(--text-strong);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.content h3 {
  margin: 32px 0 10px; font-size: 16.5px; font-weight: 650; color: var(--text-strong);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.content h4 { margin: 24px 0 8px; font-size: 14.5px; font-weight: 650; color: var(--text-strong); }
.content p { margin: 0 0 16px; }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; }
.content li { margin-bottom: 7px; }
.content li > ul, .content li > ol { margin-top: 7px; }
.content strong { color: var(--text-strong); font-weight: 640; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

.anchor {
  float: left; margin-left: -0.85em; padding-right: 0.25em;
  color: var(--muted); opacity: 0; font-weight: 400; text-decoration: none;
}
h2:hover .anchor, h3:hover .anchor { opacity: 0.55; }
.anchor:hover { opacity: 1 !important; text-decoration: none; }

/* --- inline code + code blocks ------------------------------------ */
code {
  font-family: var(--mono); font-size: 0.875em;
  background: var(--surface-2); color: var(--text-strong);
  padding: 0.14em 0.4em; border-radius: 5px;
  border: 1px solid var(--border-lt);
}
pre {
  margin: 0 0 18px; padding: 15px 17px;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; font-size: 13.3px; line-height: 1.62;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }

.codeblock { position: relative; margin-bottom: 18px; }
.codeblock pre { margin: 0; }
.codeblock > .cb-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0;
  padding: 7px 13px; border-radius: var(--radius) var(--radius) 0 0;
}
.codeblock > .cb-title + pre { border-radius: 0 0 var(--radius) var(--radius); }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: 500 11.5px/1 var(--font); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 9px; border-radius: 6px; cursor: pointer; opacity: 0;
  transition: opacity 0.13s;
}
.codeblock:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.copy-btn.done { color: var(--ok); border-color: var(--ok); }

/* --- callouts ----------------------------------------------------- */
.callout {
  display: flex; gap: 12px;
  margin: 0 0 20px; padding: 13px 16px;
  border: 1px solid var(--border); border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm); background: var(--bg-soft);
  font-size: 14.6px;
}
.callout > .co-ic { flex: none; font-size: 15px; line-height: 1.5; }
.callout > div:last-child > :last-child { margin-bottom: 0; }
.callout p { margin-bottom: 9px; }
.callout.note   { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.tip    { border-left-color: var(--ok);     background: var(--ok-soft); }
.callout.warn   { border-left-color: var(--warn);   background: var(--warn-soft); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout b { color: var(--text-strong); }

/* --- card grid ---------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 14px; margin: 0 0 26px; }
.card {
  display: block; padding: 17px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.card-t { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text-strong); margin-bottom: 5px; }
.card-t .ic { font-size: 15px; }
.card-t .arw { margin-left: auto; color: var(--muted); font-size: 13px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.58; }

/* --- steps -------------------------------------------------------- */
.steps { list-style: none; margin: 0 0 26px; padding: 0; counter-reset: st; }
.steps > li {
  position: relative; counter-increment: st;
  padding: 0 0 26px 44px; margin: 0;
  border-left: 1px solid var(--border); margin-left: 13px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.steps > li::before {
  content: counter(st);
  position: absolute; left: -13.5px; top: -2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-lt); color: var(--accent);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 4px var(--bg);
}
.steps > li > .st-h { font-weight: 650; color: var(--text-strong); margin-bottom: 6px; display: block; padding-top: 1px; }
.steps > li > :last-child { margin-bottom: 0; }

/* --- tables ------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14.2px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-lt); vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; color: var(--text-strong); white-space: nowrap; font-size: 13.4px; }
tbody tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- misc bits ---------------------------------------------------- */
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.015em;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  vertical-align: middle;
}
.pill.free { color: var(--ok);     border-color: var(--ok);     background: var(--ok-soft); }
.pill.pro  { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pill.cr   { color: var(--gold);   border-color: var(--gold);   background: var(--warn-soft); }

kbd {
  font: 600 11.5px/1.6 var(--mono);
  background: var(--surface-2); color: var(--text-strong);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}

figure { margin: 0 0 24px; }
figure svg { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
figcaption { font-size: 13px; color: var(--muted); margin-top: 9px; text-align: center; }

/* --- on this page ------------------------------------------------- */
.toc {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 38px 0 60px; font-size: 13.2px;
}
.toc h5 {
  margin: 0 0 10px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.toc a {
  display: block; padding: 4px 0 4px 12px; color: var(--muted);
  border-left: 2px solid var(--border); line-height: 1.45;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }
.toc a.lvl3 { padding-left: 24px; font-size: 12.6px; }

/* --- prev / next -------------------------------------------------- */
.pagenav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--border); }
.pagenav a {
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-strong); font-weight: 600; background: var(--surface);
}
.pagenav a:hover { border-color: var(--accent-line); text-decoration: none; }
.pagenav a span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.pagenav .nx { text-align: right; grid-column: 2; }

.foot { margin-top: 30px; font-size: 13px; color: var(--muted); }

/* --- responsive --------------------------------------------------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 36px; }
  .toc { display: none; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 18px; }
  .menu-btn { display: grid; }
  .sidebar {
    position: fixed; inset: var(--topbar-h) auto 0 0; z-index: 39;
    width: 282px; background: var(--bg); border-right: 1px solid var(--border);
    padding: 22px 14px 60px; transform: translateX(-102%);
    transition: transform 0.2s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: none; }
  .content h1 { font-size: 28px; }
  .lead { font-size: 16.5px; }
  .pagenav { grid-template-columns: 1fr; }
  .pagenav .nx { grid-column: 1; }
  .topbar-links a.hide-sm { display: none; }
}
