/* N2NAI Platform. Một thang chữ (12, 14, 16, 20, 32), một thang khoảng cách (4, 8, 12, 16, 24, 32, 48), một bo góc (8). */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #131820;
  --muted: #465163;
  --border: #d3d9e2;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --ok-bg: #dff3e7;
  --ok-text: #0d5a30;
  --stop-bg: #fde5e2;
  --stop-text: #96231a;
  --code-bg: #101822;
  --code-text: #e7edf4;
  --code-muted: #a9b6c6;
  --focus: #0b5cad;
  --r: 8px;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1217;
    --surface: #161b22;
    --surface-2: #1e252e;
    --text: #e9edf2;
    --muted: #adb8c6;
    --border: #2d3644;
    --accent: #86bcff;
    --accent-text: #08182b;
    --ok-bg: #12311f;
    --ok-text: #86e0ab;
    --stop-bg: #3b1a17;
    --stop-text: #ffa59c;
    --code-bg: #0a0e13;
    --code-text: #e7edf4;
    --code-muted: #a9b6c6;
    --focus: #86bcff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
h1, h2, h3, p, ul, ol, dl, dd, pre, table { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, pre:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
p code, dd code, dt code, li code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: var(--r); z-index: 10; }
.skip:focus { top: 8px; }

/* Đầu trang */
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; white-space: nowrap; }
.mark rect { fill: var(--accent); }
.mark path { fill: none; stroke: var(--accent-text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: var(--r); white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }

/* Phần mở đầu */
.hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 48px 0; }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; align-items: center; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 16px; }
.lead { color: var(--muted); max-width: 62ch; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 24px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); text-decoration: none; }
.stat:hover { border-color: var(--accent); }
.stat-num { font-size: 32px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-more { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 8px; }

/* Các mục */
.section { padding: 48px 0 0; }
.section:last-of-type { padding-bottom: 48px; }
h2 { font-size: 20px; line-height: 1.3; margin-bottom: 8px; }
h3 { font-size: 16px; line-height: 1.4; margin-bottom: 8px; }
.sub { color: var(--muted); max-width: 72ch; margin-bottom: 16px; }
.sub.after { margin: 16px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.pad { padding: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }

/* Bảng tình trạng */
.status { width: 100%; border-collapse: collapse; }
.status th, .status td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.status tbody tr:last-child th, .status tbody tr:last-child td { border-bottom: 0; }
.status thead th { font-size: 14px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 8px 16px; white-space: nowrap; }
.status tbody th { font-weight: 400; }
.cap-name { display: block; font-weight: 600; }
.cap-purpose { display: block; font-size: 14px; color: var(--muted); }
.status td { white-space: nowrap; }
.num { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; line-height: 1.5; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-stop { background: var(--stop-bg); color: var(--stop-text); }

/* Các bước */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.steps p { font-size: 14px; color: var(--muted); }

/* Khối mã */
.code { background: var(--code-bg); border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 16px; color: var(--code-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; border-bottom: 1px solid #263140; }
.copy { min-height: 36px; padding: 4px 12px; border-radius: 6px; border: 1px solid #3a4758; background: transparent; color: var(--code-text); font: 600 14px var(--sans); cursor: pointer; }
.copy:hover { background: #1c2733; }
.copy:focus-visible { outline-color: #86bcff; }
pre { overflow-x: auto; padding: 16px; color: var(--code-text); font-family: var(--mono); font-size: 14px; line-height: 1.6; }
pre code { background: none; padding: 0; overflow-wrap: normal; }
.inline-pre { background: var(--code-bg); border-radius: var(--r); margin: 8px 0; padding: 12px; }

/* Danh sách thuộc tính và ghi chú */
.attrs > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.attrs > div:first-child { border-top: 0; padding-top: 0; }
.attrs > div:last-child { padding-bottom: 0; }
.attrs dt { font-weight: 600; }
.attrs dd { color: var(--muted); }
.notes li { position: relative; padding-left: 16px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.notes li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.pad p { font-size: 14px; color: var(--muted); }

/* Danh sách đường API */
.api { margin-top: 16px; }
.api-item { padding: 12px 16px; border-top: 1px solid var(--border); }
.api-item:first-child { border-top: 0; }
.api-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.method { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; min-width: 48px; text-align: center; }
.method-get { background: var(--ok-bg); color: var(--ok-text); }
.method-post { background: var(--surface-2); color: var(--accent); }
.path { font-weight: 600; }
.api-sum, .api-body { font-size: 14px; color: var(--muted); }

.contact { max-width: 72ch; }
.foot { border-top: 1px solid var(--border); background: var(--surface); padding: 16px 0; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .hero-in { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .steps, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stat { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 16px; }
  .stat-more { margin-top: 0; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top-in { flex-direction: column; align-items: stretch; gap: 0; padding-top: 8px; }
  .nav { overflow-x: auto; margin: 0 -16px; padding: 0 8px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 12px 8px; }
  html { scroll-padding-top: 104px; }
  .hero { padding: 32px 0; }
  h1 { font-size: 28px; }
  .section { padding-top: 32px; }
  .section:last-of-type { padding-bottom: 32px; }
  .status th, .status td { padding: 12px 8px; }
  .status thead th { padding: 8px; }
  .status tbody th { padding-left: 12px; }
  .status thead th:first-child { padding-left: 12px; }
  .attrs > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .copy { min-height: 44px; }
}

/* Điện thoại: mỗi năng lực là một khối, tên và mô tả chiếm trọn chiều ngang, tình trạng và phiên bản nằm dòng dưới */
@media (max-width: 640px) {
  .status, .status tbody, .status tr, .status tbody th { display: block; }
  .status thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .status tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .status tbody tr:last-child { border-bottom: 0; }
  .status tbody th, .status td { padding: 0; border: 0; }
  .status td { display: inline-block; margin: 8px 12px 0 0; vertical-align: middle; }
}
