
:root {
  --primary: #5e6ff9;
  --primary-soft: rgba(94, 111, 249, 0.12);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #111827;
  --muted: #6b7280;
  --surface: #ffffff;
  --surface-soft: #f7f8fc;
  --surface-strong: #eef2ff;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(94, 111, 249, 0.10), transparent 28rem),
    linear-gradient(180deg, #fbfcff 0%, #f4f7fb 100%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code, pre { font-family: "SFMono-Regular", "SFMono", Consolas, monospace; }

.docs-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  min-height: 72px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 20px;
  align-items: center;
}
.brand-row { display: flex; align-items: center; gap: 14px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand img { width: auto; height: 28px; }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}
.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}

.search-shell { position: relative; width: 100%; }
.search-input {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 16px;
  font-size: 15px;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}
.search-input:focus {
  outline: 0;
  border-color: rgba(94, 111, 249, 0.5);
  box-shadow: 0 0 0 4px rgba(94, 111, 249, 0.12);
}
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-result {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: 0; }
.search-result strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}
.search-result span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.top-links {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  justify-self: end;
  font-size: 14px;
}
.top-links a {
  color: var(--muted);
  font-weight: 600;
}
.top-links .cta-link {
  color: white;
  background: var(--primary);
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 10px 20px rgba(94, 111, 249, 0.24);
}
.top-links .cta-link:hover { text-decoration: none; }

.docs-layout {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 280px;
  gap: 28px;
  padding: 28px 20px 48px;
  align-items: start;
}
.sidebar, .right-rail {
  position: sticky;
  top: 96px;
}
.sidebar-inner, .toc-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.sidebar-inner { padding: 18px; }
.locale-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.locale-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
}
.locale-pill.active {
  background: var(--surface-strong);
  color: var(--primary);
  border-color: rgba(94, 111, 249, 0.2);
}
.sidebar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.sidebar-group { border-bottom: 1px solid rgba(15, 23, 42, 0.05); padding: 6px 0; }
.sidebar-group:last-child { border-bottom: 0; }
.sidebar-group summary {
  list-style: none;
  cursor: pointer;
}
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-children {
  display: grid;
  gap: 6px;
  margin-left: 12px;
  padding: 6px 0 4px;
  border-left: 1px solid rgba(15, 23, 42, 0.06);
  padding-left: 12px;
}
.sidebar-link {
  display: block;
  color: #374151;
  font-size: 14px;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 12px;
}
.sidebar-link.current {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.sidebar-link:hover { text-decoration: none; background: rgba(94, 111, 249, 0.08); }

.content-wrap { min-width: 0; }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  align-items: center;
}
.breadcrumbs .crumb::after {
  content: "/";
  margin-left: 8px;
  color: rgba(107, 114, 128, 0.5);
}
.breadcrumbs .crumb.current::after { content: ""; margin: 0; }
.doc-card {
  padding: 36px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}
.doc-card h1 {
  margin: 0 0 22px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.doc-card h2 {
  margin: 34px 0 14px;
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.doc-card h3 {
  margin: 28px 0 12px;
  font-size: 1.2rem;
  line-height: 1.2;
}
.doc-card p,
.doc-card li,
.doc-card td,
.doc-card th,
.doc-card blockquote {
  font-size: 16px;
  line-height: 1.7;
  color: #374151;
}
.doc-card p { margin: 0 0 16px; }
.doc-card ul, .doc-card ol {
  margin: 0 0 18px 22px;
  padding: 0;
}
.doc-card li + li { margin-top: 8px; }
.doc-card code {
  background: rgba(15, 23, 42, 0.06);
  padding: 0.12rem 0.4rem;
  border-radius: 8px;
  font-size: 0.92em;
}
.doc-card pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 16px;
  border-radius: 18px;
  overflow: auto;
  margin: 18px 0 24px;
}
.doc-card pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.doc-card blockquote {
  margin: 22px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--primary);
  background: rgba(94, 111, 249, 0.08);
  border-radius: 0 16px 16px 0;
}
.doc-card blockquote.is-note {
  border-left-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}
.doc-card hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.doc-card img {
  margin: 18px 0 24px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}
.table-wrap {
  margin: 22px 0 28px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
thead th {
  background: var(--surface-soft);
  font-weight: 700;
}

.hero-card {
  padding: 24px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(94, 111, 249, 0.14), rgba(94, 111, 249, 0.04)),
    white;
  border: 1px solid rgba(94, 111, 249, 0.12);
  margin-bottom: 28px;
}
.eyebrow, .section-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(94, 111, 249, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hero-card h1 { margin-top: 16px; margin-bottom: 14px; }
.hero-card p { font-size: 18px; max-width: 56ch; margin-bottom: 0; }
.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  font-weight: 700;
  color: var(--muted);
}

.child-cards-section { margin: 22px 0 28px; }
.child-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.child-card {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  min-height: 100%;
}
.child-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.1);
}
.child-card-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(94, 111, 249, 0.16), rgba(94, 111, 249, 0.04));
}
.child-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.child-card-media-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}
.child-card-media-fallback span {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: rgba(94, 111, 249, 0.12);
  color: var(--primary);
  font-size: 28px;
  font-weight: 800;
}
.child-card-body { padding: 18px; }
.child-card-title {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.right-rail {
  display: grid;
  gap: 16px;
}
.toc-card { padding: 18px; }
.toc-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.toc-link, .related-link {
  display: block;
  color: var(--muted);
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.35;
}
.toc-link.is-sub { padding-left: 12px; font-size: 13px; }
.related-link.current { color: var(--primary); font-weight: 700; }

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .right-rail { display: none; }
}

@media (max-width: 960px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .top-links { justify-self: start; flex-wrap: wrap; }
  .docs-layout {
    grid-template-columns: 1fr;
    padding-top: 20px;
  }
  .sidebar {
    position: fixed;
    top: 72px;
    left: 16px;
    bottom: 16px;
    width: min(320px, calc(100vw - 32px));
    z-index: 40;
    transform: translateX(-120%);
    transition: transform 180ms ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
}

@media (max-width: 720px) {
  .doc-card { padding: 22px; border-radius: 22px; }
  .topbar-inner, .docs-layout { padding-left: 14px; padding-right: 14px; }
  .child-cards { grid-template-columns: 1fr; }
}
