:root {
  --bg: #09090b;
  --surface: #0f0f12;
  --surface-raised: #151519;
  --surface-hover: #1b1b20;
  --line: #29292f;
  --line-strong: #3a3a42;
  --text: #f4f4f5;
  --text-soft: #d4d4d8;
  --muted: #9b9ba5;
  --faint: #6d6d78;
  --coral: #ed765f;
  --plum: #9b557b;
  --success: #46b878;
  --radius: 7px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); color: var(--text); scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--bg); font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button { appearance: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: #6f384f; color: #fff; }

.site-brand { display: inline-grid; grid-template-columns: 42px minmax(0, 1fr); gap: 11px; align-items: center; min-width: 0; }
.site-brand img { width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 50%; object-fit: cover; }
.site-brand strong, .site-brand small { display: block; }
.site-brand strong { font-size: 0.94rem; line-height: 1.25; }
.site-brand small { margin-top: 2px; color: var(--muted); font-size: 0.74rem; line-height: 1.2; }

.button, .icon-control { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text-soft); cursor: pointer; transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease; }
.button { min-height: 42px; gap: 9px; padding: 0 15px; font-size: 0.88rem; font-weight: 700; }
.button:hover, .icon-control:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--text); }
.button-primary { border-color: var(--text); background: var(--text); color: var(--bg); }
.button-primary:hover { border-color: #fff; background: #fff; color: var(--bg); }
.icon-control { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; }
.text-link { color: var(--muted); font-size: 0.87rem; }
.text-link:hover { color: var(--text); }
.overline { margin: 0 0 11px; color: var(--coral); font-size: 0.71rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }

/* Home */
.site-header { display: flex; align-items: center; justify-content: space-between; width: min(1160px, calc(100% - 48px)); min-height: 80px; margin: 0 auto; border-bottom: 1px solid var(--line); }
.header-actions { display: flex; align-items: center; gap: 22px; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 390px); gap: 72px; align-items: center; width: min(1160px, calc(100% - 48px)); min-height: min(680px, calc(100vh - 80px)); margin: 0 auto; padding: 72px 0 88px; }
.home-hero-content { max-width: 690px; }
.home-hero h1 { max-width: 680px; margin: 0; font-size: clamp(2.7rem, 5vw, 4.6rem); line-height: 1.02; }
.home-lede { max-width: 620px; margin: 25px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.75; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.home-mark { width: 100%; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 50%; object-fit: cover; }
.product-directory { border-top: 1px solid var(--line); background: #0b0b0e; padding: 78px max(24px, calc((100% - 1160px) / 2)) 104px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading h2 { margin: 0; font-size: 1.8rem; }
.section-meta { color: var(--muted); font-size: 0.84rem; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { display: grid; grid-template-rows: auto 1fr auto; min-height: 250px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 24px; }
.product-card:hover { border-color: var(--line-strong); background: var(--surface-raised); }
.product-card-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 28px; border: 1px solid #553344; border-radius: var(--radius); background: #1a1015; color: var(--coral); }
.product-card h3 { margin: 0; font-size: 1.05rem; }
.product-card p { margin: 9px 0 24px; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.product-card footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 17px; color: var(--faint); font-size: 0.78rem; }
.product-card:hover footer i { color: var(--coral); }
.library-empty { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius); padding: 56px; color: var(--muted); text-align: center; }
.library-empty i { color: var(--faint); font-size: 1.6rem; }
.library-empty h3 { margin: 16px 0 6px; color: var(--text); }
.library-empty p { margin: 0; }
.site-footer { display: flex; align-items: center; justify-content: space-between; width: min(1160px, calc(100% - 48px)); min-height: 104px; margin: 0 auto; color: var(--faint); font-size: 0.82rem; }
.site-footer div { display: flex; gap: 24px; }
.site-footer a:hover { color: var(--text); }

/* Search */
.search-dialog { width: min(670px, calc(100% - 30px)); max-height: min(650px, calc(100vh - 70px)); margin-top: 10vh; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; }
.search-dialog::backdrop { background: rgb(0 0 0 / 0.78); }
.search-dialog-frame { display: grid; grid-template-rows: auto minmax(120px, 1fr); max-height: inherit; }
.search-dialog-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 13px 14px 13px 19px; color: var(--muted); }
.search-dialog-head input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1rem; }
.search-results { overflow: auto; padding: 8px; }
.search-result { display: block; border-radius: 5px; padding: 13px 14px; }
.search-result:hover { background: var(--surface-hover); }
.search-result > span { display: block; margin-bottom: 4px; color: var(--coral); font-size: 0.69rem; font-weight: 800; text-transform: uppercase; }
.search-result strong { font-size: 0.94rem; }
.search-result p { overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.search-hint { margin: 0; padding: 30px 18px; color: var(--muted); text-align: center; font-size: 0.87rem; }
.error-text { color: #ff9f9f !important; }

/* Documentation */
.docs-shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.docs-sidebar { position: sticky; top: 0; display: grid; grid-template-rows: auto auto 1fr auto; height: 100vh; overflow: hidden; border-right: 1px solid var(--line); background: #0c0c0f; padding: 22px 16px 15px; }
.docs-sidebar-head { display: flex; align-items: center; justify-content: space-between; margin: 0 5px 22px; }
.docs-search-trigger { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); padding: 0 10px; text-align: left; cursor: pointer; }
.docs-search-trigger:hover { border-color: var(--line-strong); color: var(--text-soft); }
kbd { border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--faint); padding: 2px 6px; font: 0.7rem ui-monospace, monospace; }
.docs-navigation { overflow-y: auto; margin: 17px -4px 0; padding: 0 4px 30px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.nav-section { margin: 0 0 26px; }
.nav-section-title { display: flex; align-items: center; justify-content: space-between; padding: 7px 9px; color: var(--muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.nav-section-title small { color: var(--faint); font-size: 0.68rem; }
.nav-page { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 36px; margin: 2px 0; border-radius: 5px; color: var(--muted); padding: 7px 9px; font-size: 0.85rem; }
.nav-page i { color: var(--faint); font-size: 0.81rem; }
.nav-page:hover { background: var(--surface-raised); color: var(--text); }
.nav-page.active { background: #21151b; color: #ffd6c9; }
.nav-page.active i { color: var(--coral); }
.nav-page.nested { padding-left: 30px; }
.nav-folder { margin-top: 9px; }
.nav-folder-title { display: grid; grid-template-columns: 15px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 9px; color: var(--faint); font-size: 0.71rem; font-weight: 700; }
.nav-folder-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 14px 7px 0; color: var(--faint); font-size: 0.75rem; }
.sidebar-footer span:last-child { display: inline-flex; gap: 7px; align-items: center; color: var(--success); }
.sidebar-footer span:last-child i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sidebar-footer span.offline { color: var(--faint); }
.docs-main { min-width: 0; }
.docs-topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 64px; border-bottom: 1px solid var(--line); background: var(--bg); padding: 0 28px; }
.breadcrumbs { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--faint); font-size: 0.8rem; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs strong { overflow: hidden; color: var(--muted); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.docs-top-actions { display: flex; align-items: center; gap: 8px; }
.docs-content-grid { display: grid; grid-template-columns: minmax(0, 780px) 210px; gap: 54px; width: min(1096px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 104px; }
.doc-article { min-width: 0; color: var(--text-soft); }
.article-header { margin-bottom: 44px; border-bottom: 1px solid var(--line); padding-bottom: 36px; }
.article-header p { margin: 0 0 13px; color: var(--coral); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.article-header h1, .doc-article > h1 { margin: 0; color: var(--text); font-size: clamp(2.2rem, 4vw, 3.15rem); line-height: 1.09; }
.article-header span { display: block; max-width: 650px; margin-top: 17px; color: var(--muted); font-size: 0.98rem; line-height: 1.65; }
.article-body > :first-child { margin-top: 0; }
.article-body > h1:first-child { display: none; }
.doc-article h2, .doc-article h3, .doc-article h4 { color: var(--text); scroll-margin-top: 86px; }
.doc-article h2 { margin: 45px 0 15px; border-top: 1px solid var(--line); padding-top: 36px; font-size: 1.52rem; }
.doc-article h3 { margin: 30px 0 12px; font-size: 1.18rem; }
.doc-article h4 { margin: 24px 0 10px; font-size: 1rem; }
.doc-article p, .doc-article li { color: var(--text-soft); font-size: 0.96rem; line-height: 1.78; }
.doc-article ul, .doc-article ol { padding-left: 24px; }
.doc-article li { margin: 5px 0; padding-left: 3px; }
.doc-article a { color: #ffad96; text-decoration: underline; text-underline-offset: 3px; }
.doc-article code { border: 1px solid var(--line); border-radius: 4px; background: var(--surface-raised); color: #f0d8cf; padding: 0.12em 0.35em; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 0.87em; }
.doc-article pre { position: relative; overflow: auto; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--radius); background: #0c0c0f; padding: 20px; }
.doc-article pre code { border: 0; background: transparent; color: #e2e2e7; padding: 0; font-size: 0.86rem; line-height: 1.7; }
.copy-code { position: absolute; top: 9px; right: 9px; display: inline-flex; gap: 6px; align-items: center; min-height: 29px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); padding: 0 9px; cursor: pointer; font-size: 0.72rem; }
.copy-code:hover { color: var(--text); }
.doc-article blockquote { margin: 24px 0; border-left: 3px solid var(--plum); background: #141014; padding: 14px 20px; }
.doc-article blockquote p { margin: 0; }
.doc-article table { display: block; width: 100%; overflow-x: auto; margin: 24px 0; border-collapse: collapse; }
.doc-article th, .doc-article td { border: 1px solid var(--line); padding: 11px 13px; text-align: left; }
.doc-article th { background: var(--surface-raised); color: var(--text); }
.doc-article img { border: 1px solid var(--line); border-radius: var(--radius); }
.page-toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; border-left: 1px solid var(--line); padding-left: 17px; }
.page-toc:empty { display: none; }
.page-toc strong { display: block; margin-bottom: 12px; color: var(--text-soft); font-size: 0.76rem; }
.page-toc a { display: block; margin: 9px 0; color: var(--faint); font-size: 0.78rem; line-height: 1.4; }
.page-toc a:hover { color: var(--text-soft); }
.page-toc a.nested { padding-left: 12px; }
.article-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; border-top: 1px solid var(--line); padding-top: 24px; }
.article-pager a { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; text-decoration: none; }
.article-pager a:hover { border-color: var(--line-strong); background: var(--surface); }
.article-pager small { display: block; margin-bottom: 7px; color: var(--faint); font-size: 0.7rem; text-transform: uppercase; }
.article-pager span { display: flex; gap: 8px; align-items: center; color: var(--text-soft); font-size: 0.86rem; }
.article-pager .next { text-align: right; }
.article-pager .next span { justify-content: flex-end; }
.doc-empty { display: grid; justify-items: start; align-content: center; min-height: 480px; }
.doc-empty > i { color: var(--faint); font-size: 1.8rem; }
.doc-empty h1 { margin: 18px 0 8px; color: var(--text); font-size: 2rem; }
.doc-empty p { margin: 0 0 24px; color: var(--muted); }
.error-code { color: var(--coral); font-size: 0.8rem; font-weight: 800; }
.loading-block { padding-top: 20px; }
.loading-block span { display: block; height: 16px; margin: 14px 0; border-radius: 4px; background: var(--surface-raised); }
.loading-block span:first-child { width: min(72%, 560px); height: 50px; margin-bottom: 34px; }
.loading-block span:last-child { width: 55%; }
.mobile-control, .sidebar-backdrop { display: none; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; max-width: min(370px, calc(100% - 40px)); transform: translateY(12px); opacity: 0; pointer-events: none; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-raised); color: var(--text); padding: 12px 15px; transition: opacity 150ms ease, transform 150ms ease; font-size: 0.82rem; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1120px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-content-grid { grid-template-columns: minmax(0, 760px); width: min(820px, calc(100% - 48px)); }
  .page-toc { display: none; }
}

@media (max-width: 820px) {
  .site-header, .home-hero { width: min(100% - 32px, 680px); }
  .home-hero { grid-template-columns: 1fr; gap: 44px; min-height: auto; padding: 58px 0 70px; }
  .home-mark { width: min(340px, 88vw); }
  .product-directory { padding: 58px 16px 76px; }
  .product-grid { grid-template-columns: 1fr; }
  .site-footer { width: calc(100% - 32px); }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-sidebar { position: fixed; z-index: 50; width: min(310px, 88vw); transform: translateX(-105%); transition: transform 170ms ease; }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / 0.7); }
  .mobile-control { display: inline-flex; }
  .docs-topbar { padding: 0 16px; }
  .docs-content-grid { width: min(100% - 34px, 760px); padding-top: 42px; }
}

@media (max-width: 560px) {
  .site-header { min-height: 70px; }
  .home-hero h1 { font-size: 2.55rem; }
  .home-lede { font-size: 0.98rem; }
  .home-actions { display: grid; }
  .home-actions .button { width: 100%; }
  .home-mark { width: 260px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .product-card { min-height: 220px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 13px; }
  .breadcrumbs i, .breadcrumbs span { display: none; }
  .docs-content-grid { width: calc(100% - 28px); padding: 34px 0 76px; }
  .article-header h1, .doc-article > h1 { font-size: 2.1rem; }
  .article-pager { grid-template-columns: 1fr; }
}
