/* GitBook-style docs layout — overlays hprit.css */

:root {
  --docs-sidebar-width: 260px;
  --docs-toc-width: 220px;
  --docs-top-h: 64px;
  --docs-gap: 32px;
}

body.docs { background: var(--bg); }

/* TOP BAR */
.docs-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--docs-top-h);
}
.docs-top__inner {
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.docs-brand { flex-shrink: 0; }
.docs-brand img { height: 30px; width: auto; display: block; }
.docs-search {
  flex: 1;
  max-width: 520px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--section-bg);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 120ms, background 120ms;
}
.docs-search::placeholder { color: var(--muted-2); }
.docs-search:focus { border-color: var(--accent); background: #fff; }
.docs-top__cta { margin-left: auto; }

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

/* SIDEBAR (left) */
.docs-sidebar {
  position: sticky;
  top: var(--docs-top-h);
  max-height: calc(100vh - var(--docs-top-h));
  overflow-y: auto;
  padding: 28px 0 40px;
  font-size: 14px;
}
.docs-sidebar__section { margin-bottom: 22px; }
.docs-sidebar__title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin: 0 0 8px;
  padding: 0 10px;
}
.docs-sidebar__list { list-style: none; padding: 0; margin: 0; }
.docs-sidebar__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  transition: background 120ms, color 120ms;
}
.docs-sidebar__link:hover {
  background: var(--section-bg);
  color: var(--text);
  text-decoration: none;
}
.docs-sidebar__link--active {
  background: var(--accent-bg);
  color: var(--accent-2);
  font-weight: 600;
}
.docs-sidebar__link--active:hover {
  background: var(--accent-bg);
  color: var(--accent-2);
}
.docs-sidebar__icon { flex-shrink: 0; font-size: 15px; }

/* MAIN CONTENT */
.docs-main {
  min-width: 0;
  padding: 28px 0 80px;
}
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted-2);
  margin-bottom: 18px;
}
.docs-breadcrumb a { color: var(--muted-2); }
.docs-breadcrumb a:hover { color: var(--accent); }
.docs-breadcrumb__sep { color: #cbd5e1; }
.docs-breadcrumb__current { color: var(--text); font-weight: 500; }

.docs-article { max-width: 760px; }
.docs-article h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 24px;
  color: var(--text);
}
.docs-article h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 14px;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--docs-top-h) + 16px);
}
.docs-article h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 10px;
  scroll-margin-top: calc(var(--docs-top-h) + 16px);
}
.docs-article h4 {
  font-size: 16px;
  font-weight: 700;
  margin: 22px 0 8px;
}
.docs-article p { margin: 0 0 14px; line-height: 1.65; color: var(--text); }
.docs-article ul,
.docs-article ol { margin: 0 0 16px; padding-left: 22px; line-height: 1.65; }
.docs-article ul li,
.docs-article ol li { margin-bottom: 6px; }
.docs-article a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(124, 58, 237, 0.3); text-underline-offset: 3px; }
.docs-article a:hover { text-decoration-color: var(--accent); }
.docs-article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.docs-article blockquote,
.docs-article .docs-callout {
  margin: 16px 0;
  padding: 14px 18px;
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
}
.docs-article blockquote p:last-child,
.docs-article .docs-callout p:last-child { margin-bottom: 0; }

.docs-callout--warn {
  background: var(--trouble-bg);
  border-left-color: var(--pink-2);
}
.docs-callout--info {
  background: #EFF6FF;
  border-left-color: #2563EB;
}
.docs-callout--success {
  background: #ECFDF5;
  border-left-color: #059669;
}

.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.docs-article th,
.docs-article td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-article th {
  background: var(--section-bg);
  font-weight: 700;
}

.docs-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--section-bg);
  border-radius: 4px;
}

.docs-article figure { margin: 18px 0; }
.docs-article figure img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}
.docs-article figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--muted-2);
  margin-top: 8px;
}

/* PAGINATION */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.docs-pagination__item {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms, transform 120ms;
}
.docs-pagination__item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.docs-pagination__label {
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 500;
  margin-bottom: 4px;
}
.docs-pagination__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.docs-pagination__item--next { text-align: right; }
.docs-pagination__item--empty {
  visibility: hidden;
}

/* TOC (right) */
.docs-toc {
  position: sticky;
  top: var(--docs-top-h);
  max-height: calc(100vh - var(--docs-top-h));
  overflow-y: auto;
  padding: 28px 0;
  font-size: 13px;
}
.docs-toc__title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin: 0 0 10px;
}
.docs-toc__list { list-style: none; padding: 0; margin: 0; }
.docs-toc__item { margin: 0; }
.docs-toc__link {
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.45;
  font-size: 13px;
  transition: color 120ms, border-color 120ms;
}
.docs-toc__link:hover {
  color: var(--accent);
  text-decoration: none;
}
.docs-toc__link--active {
  color: var(--accent-2);
  border-left-color: var(--accent);
  font-weight: 600;
}
.docs-toc__link--h3 { padding-left: 20px; font-size: 12.5px; }

/* HOME PAGE HERO + SECTIONS */
.docs-home-hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.docs-home-hero h1 {
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 12px;
}
.docs-home-hero p {
  font-size: 17px;
  color: var(--muted);
  margin: 0;
  max-width: 640px;
  line-height: 1.55;
}

.docs-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 32px 0 48px;
}
.docs-section-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  transition: transform 120ms, box-shadow 120ms, border-color 120ms;
}
.docs-section-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.docs-section-card__title {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.docs-section-card__list { list-style: none; padding: 0; margin: 0; }
.docs-section-card__list li { margin-bottom: 8px; }
.docs-section-card__list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  transition: color 120ms;
}
.docs-section-card__list a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* MOBILE HAMBURGER */
.docs-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .docs-layout {
    grid-template-columns: var(--docs-sidebar-width) 1fr;
  }
  .docs-toc { display: none; }
}

@media (max-width: 900px) {
  :root { --docs-sidebar-width: 220px; --docs-gap: 24px; }
  .docs-sidebar__link { font-size: 13.5px; padding: 6px 8px; }
}

@media (max-width: 720px) {
  .docs-layout {
    grid-template-columns: 1fr;
    padding: 0 18px;
  }
  .docs-menu-btn { display: inline-flex; }
  .docs-sidebar {
    position: fixed;
    top: var(--docs-top-h);
    left: 0;
    bottom: 0;
    width: 280px;
    background: #fff;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 40;
    padding: 20px 16px 40px;
    max-height: none;
  }
  .docs-sidebar.is-open { transform: translateX(0); }
  .docs-sidebar-backdrop {
    position: fixed;
    inset: var(--docs-top-h) 0 0 0;
    background: rgba(0,0,0,0.4);
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .docs-sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .docs-search { max-width: none; height: 36px; font-size: 13px; }
  .docs-top__cta { display: none; }
  .docs-section-grid { grid-template-columns: 1fr; }
  .docs-article h1 { font-size: 28px; }
  .docs-home-hero h1 { font-size: 32px; }
  .docs-pagination { grid-template-columns: 1fr; }
}

/* FOOTER */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  font-size: 13px;
  color: var(--muted-2);
  background: var(--section-bg);
  margin-top: auto;
}
.docs-footer__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
}
.docs-footer a { color: var(--muted); }
.docs-footer a:hover { color: var(--accent); }
