/* zeditor documentation site. Built by scripts/build-site.mjs; no framework, no build step. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-mute: #eef0f3;
  --fg: #16181d;
  --fg-soft: #4a5160;
  --fg-mute: #6b7280;
  --border: #e3e6eb;
  --accent: #5b4fe0;
  --accent-soft: #eeecfd;
  --accent-fg: #ffffff;
  --code-bg: #f4f5f8;
  --code-fg: #1f2328;
  --inline-code-bg: #eff1f4;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 8px 24px rgb(16 24 40 / 6%);
  --header-h: 60px;
  --sidebar-w: 268px;
  --toc-w: 220px;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --tok-keyword: #cf222e;
  --tok-string: #0a3069;
  --tok-comment: #6e7781;
  --tok-number: #0550ae;
  --tok-function: #8250df;
  --tok-tag: #116329;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0f1115;
  --bg-soft: #151820;
  --bg-mute: #1c2029;
  --fg: #e7e9ee;
  --fg-soft: #b4bac6;
  --fg-mute: #8b93a3;
  --border: #262b36;
  --accent: #8b80ff;
  --accent-soft: #24213f;
  --accent-fg: #0f1115;
  --code-bg: #151820;
  --code-fg: #e6edf3;
  --inline-code-bg: #1f2430;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 30%);
  --tok-keyword: #ff7b72;
  --tok-string: #a5d6ff;
  --tok-comment: #8b949e;
  --tok-number: #79c0ff;
  --tok-function: #d2a8ff;
  --tok-tag: #7ee787;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--fg); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 1000; background: var(--accent); color: var(--accent-fg); padding: 6px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--fg); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #6d5cff, #22b8cf); color: #fff; font-size: 16px; font-weight: 800; }
.version { font-size: 12px; font-weight: 600; color: var(--fg-soft); background: var(--bg-mute); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.top-nav { display: flex; gap: 4px; margin-left: 8px; }
.top-nav a { color: var(--fg-soft); font-size: 14.5px; font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.top-nav a:hover, .top-nav a[aria-current='page'] { color: var(--fg); background: var(--bg-mute); text-decoration: none; }
.header-spacer { flex: 1; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 220px; height: 36px; padding: 0 10px; font: inherit; font-size: 14px; color: var(--fg-mute); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.search-btn:hover { border-color: var(--fg-mute); }
.search-btn svg { width: 16px; height: 16px; flex: none; }
.search-btn span { white-space: nowrap; }
.search-btn kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--fg-soft); cursor: pointer; }
.icon-btn:hover { background: var(--bg-mute); color: var(--fg); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
.theme-light-icon { display: none; }
:root[data-theme='dark'] .theme-light-icon { display: block; }
:root[data-theme='dark'] .theme-dark-icon { display: none; }

/* ---------- docs layout ---------- */
.docs { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); max-width: 1480px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 16px 40px 20px; border-right: 1px solid var(--border); scrollbar-width: thin; }
.sidebar h2 { margin: 18px 0 6px; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mute); }
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 5px 10px; border-radius: 7px; color: var(--fg-soft); font-size: 14.5px; line-height: 1.45; }
.sidebar a:hover { color: var(--fg); background: var(--bg-mute); text-decoration: none; }
.sidebar a[aria-current='page'] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sidebar .side-links { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }

main.content { min-width: 0; padding: 36px 48px 80px; }
.toc { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 36px 20px 40px 8px; font-size: 13.5px; scrollbar-width: thin; }
.toc h2 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mute); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 3px 0 3px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--fg-mute); line-height: 1.4; }
.toc a.lvl3 { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

.breadcrumb { font-size: 13px; color: var(--fg-mute); margin-bottom: 8px; }
.page-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); }
.page-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--fg-mute); margin-bottom: 20px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--fg-mute); font-size: 12.5px; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- prose ---------- */
.prose { max-width: 840px; }
.prose h1 { font-size: 2.2rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 18px; }
.prose h2 { font-size: 1.55rem; line-height: 1.3; letter-spacing: -0.01em; margin: 48px 0 14px; padding-top: 8px; border-top: 1px solid var(--border); }
.prose h1 + h2, .prose h2:first-child { border-top: 0; margin-top: 24px; }
.prose h3 { font-size: 1.2rem; margin: 32px 0 10px; }
.prose h4 { font-size: 1.02rem; margin: 24px 0 8px; }
.prose :is(h2, h3, h4) .anchor { margin-left: 8px; color: var(--fg-mute); opacity: 0; font-weight: 400; }
.prose :is(h2, h3, h4):hover .anchor { opacity: 1; text-decoration: none; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.prose blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--fg-soft); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: 0.86em; padding: 0.15em 0.38em; border-radius: 5px; background: var(--inline-code-bg); overflow-wrap: anywhere; }
.prose a code { color: inherit; }
.prose .table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { overflow-wrap: normal; white-space: nowrap; }
.prose td:not(:first-child) code { white-space: normal; overflow-wrap: anywhere; }

.code { position: relative; margin: 0 0 20px; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--code-fg); background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); tab-size: 2; }
.code pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.code .lang { position: absolute; top: 8px; right: 52px; font-size: 11px; font-family: var(--mono); color: var(--fg-mute); text-transform: lowercase; pointer-events: none; }
.copy { position: absolute; top: 6px; right: 6px; font: inherit; font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg-soft); cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy.done { color: #16a34a; border-color: #16a34a; }
.tok-keyword { color: var(--tok-keyword); }
.tok-string { color: var(--tok-string); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-number { color: var(--tok-number); }
.tok-function { color: var(--tok-function); }
.tok-tag { color: var(--tok-tag); }

/* ---------- search dialog ---------- */
.search-dialog { width: min(640px, calc(100vw - 24px)); max-height: min(70vh, 640px); padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 64px rgb(0 0 0 / 28%); margin-top: 10vh; overflow: hidden; }
.search-dialog::backdrop { background: rgb(10 12 16 / 45%); backdrop-filter: blur(2px); }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-input-row svg { width: 18px; height: 18px; color: var(--fg-mute); flex: none; }
.search-input-row input { flex: 1; font: inherit; font-size: 17px; border: 0; outline: 0; background: none; color: var(--fg); }
.search-input-row kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--fg-mute); }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--fg); }
.search-results li a:hover, .search-results li a.sel { background: var(--accent-soft); text-decoration: none; }
.search-results .r-page { font-size: 12px; color: var(--fg-mute); }
.search-results .r-head { font-weight: 600; }
.search-results .r-text { font-size: 13.5px; color: var(--fg-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-results mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; }
.search-empty { padding: 28px 16px; text-align: center; color: var(--fg-mute); font-size: 14px; }

/* ---------- landing ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 24px 40px; text-align: center; }
.hero::before { content: ''; position: absolute; inset: -40% -10% auto; height: 560px; background: radial-gradient(closest-side, color-mix(in srgb, #6d5cff 22%, transparent), transparent), radial-gradient(closest-side at 70% 40%, color-mix(in srgb, #22b8cf 18%, transparent), transparent); z-index: -1; pointer-events: none; }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.06; letter-spacing: -0.035em; margin: 0 auto 18px; max-width: 900px; }
.hero h1 .grad { background: linear-gradient(90deg, #6d5cff, #22b8cf); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.2rem; color: var(--fg-soft); max-width: 680px; margin: 0 auto 30px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 10px; font-weight: 600; font-size: 15px; border: 1px solid var(--border); color: var(--fg); background: var(--bg); }
.btn:hover { text-decoration: none; border-color: var(--fg-mute); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.install { display: inline-flex; align-items: center; gap: 12px; margin-top: 26px; padding: 8px 8px 8px 16px; font-family: var(--mono); font-size: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); }
.install .copy { position: static; opacity: 1; }
.install .prompt { color: var(--fg-mute); user-select: none; }

.section { max-width: 1160px; margin: 0 auto; padding: 48px 24px; }
.section > h2 { font-size: 1.9rem; letter-spacing: -0.02em; text-align: center; margin: 0 0 8px; }
.section > p.sub { text-align: center; color: var(--fg-soft); margin: 0 auto 32px; max-width: 640px; }

.demo { max-width: 1000px; margin: 8px auto 0; padding: 0 24px; }
.demo-frame { border: 1px solid var(--border); border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.demo-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-soft); font-size: 13px; color: var(--fg-mute); }
.demo-bar .dots { display: inline-flex; gap: 6px; margin-right: 6px; }
.demo-bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border); display: block; }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button { font: inherit; font-size: 13px; padding: 5px 14px; border: 0; background: none; color: var(--fg-soft); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--accent); color: var(--accent-fg); }
#demo { min-height: 360px; }
#demo .zeditor { border: 0; border-radius: 0; }
.demo-note { text-align: center; font-size: 13.5px; color: var(--fg-mute); margin-top: 12px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid.examples { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid, .grid.examples { grid-template-columns: 1fr; } }
.card { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); transition: border-color 0.15s, transform 0.15s; }
a.card { color: var(--fg); display: block; }
a.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 19px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--fg-soft); font-size: 14.5px; line-height: 1.55; }
.card .go { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--accent); }

.tabs { max-width: 860px; margin: 0 auto; }
.tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tablist button { font: inherit; font-size: 14.5px; font-weight: 600; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--fg-mute); cursor: pointer; margin-bottom: -1px; }
.tablist button[aria-selected='true'] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .code pre { font-size: 13.5px; }

.band { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; text-align: center; }
.stats b { display: block; font-size: 1.8rem; letter-spacing: -0.02em; }
.stats span { color: var(--fg-mute); font-size: 14px; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 24px; color: var(--fg-mute); font-size: 14px; }
.site-footer .inner { max-width: 1160px; margin: 0 auto; display: flex; gap: 16px 28px; flex-wrap: wrap; justify-content: space-between; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--fg-soft); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .docs { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar { position: fixed; z-index: 60; top: var(--header-h); left: 0; width: min(320px, 86vw); background: var(--bg); transform: translateX(-102%); transition: transform 0.2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: var(--header-h) 0 0; background: rgb(0 0 0 / 35%); z-index: 55; }
  main.content { padding: 24px 18px 64px; }
  .top-nav { display: none; }
  .search-btn { min-width: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .prose h1 { font-size: 1.8rem; }
}
@media (max-width: 560px) {
  .site-header { gap: 8px; padding: 0 12px; }
  .version { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 600px) { .demo-bar .hint, .demo-bar .dots { display: none; } .demo { padding: 0 12px; } }
