:root {
  --background: #0b0c0e;
  --surface: #111316;
  --surface-raised: #15181c;
  --surface-soft: #0e1013;
  --border: #25292f;
  --border-strong: #343a43;
  --text: #f3f5f7;
  --text-soft: #b6bdc7;
  --muted: #7e8794;
  --accent: #5c8dff;
  --accent-soft: rgba(92, 141, 255, 0.12);
  --green: #72d6a5;
  --red: #ef6b73;
  --header-height: 68px;
  --sidebar-width: 320px;
  --container: 1440px;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--background);
  background-image:
    radial-gradient(
      circle at 57% 0%,
      rgba(73, 116, 220, 0.1),
      transparent 34rem
    ),
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size:
    100% 700px,
    40px 40px,
    40px 40px;
  background-repeat: no-repeat, repeat, repeat;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.menu-open,
body.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: min(calc(100% - 48px), var(--container));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-height);
  border-bottom: 1px solid rgba(37, 41, 47, 0.8);
  background: rgba(11, 12, 14, 0.92);
  backdrop-filter: blur(14px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.desktop-nav a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  transition: color 160ms ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--text);
}

.header-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: #d9dee5;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(114, 214, 165, 0.08);
}

.menu-button {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.menu-button span {
  display: block;
  width: 16px;
  height: 1px;
  margin: 5px auto;
  background: #dfe3e8;
  transition: transform 160ms ease;
}

.menu-button[aria-expanded="true"] span:first-child {
  transform: translateY(3px) rotate(45deg);
}

.menu-button[aria-expanded="true"] span:last-child {
  transform: translateY(-3px) rotate(-45deg);
}

.mobile-nav {
  display: none;
}

.docs-shell {
  width: min(100%, 1800px);
  min-height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  margin-inline: auto;
}

.docs-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(12, 14, 17, 0.94);
  scrollbar-width: thin;
  scrollbar-color: #343a43 transparent;
}

.sidebar-top {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 24px 18px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 14, 17, 0.97);
  backdrop-filter: blur(12px);
}

.sidebar-label {
  margin: 0 0 12px;
  color: #8da8e5;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-box {
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #0d0f12;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: #4d75c8;
  box-shadow: 0 0 0 3px rgba(92, 141, 255, 0.08);
}

.search-box svg {
  width: 17px;
  fill: none;
  stroke: #737d89;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
}

.search-box input::placeholder {
  color: #5d6671;
}

.search-box kbd {
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid #2f353d;
  border-radius: 4px;
  color: #737d89;
  font:
    0.65rem/1.3 "SFMono-Regular",
    Consolas,
    monospace;
  text-align: center;
}

.sidebar-stats {
  margin-top: 11px;
  color: #626b76;
  font-size: 0.68rem;
}

.node-navigation {
  padding: 10px 10px 30px;
}

.node-group {
  margin-bottom: 4px;
}

.group-toggle {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aab2bd;
  cursor: pointer;
  text-align: left;
}

.group-toggle:hover {
  background: #14181e;
  color: #e0e5ec;
}

.group-toggle svg {
  width: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 160ms ease;
}

.node-group.open .group-toggle svg {
  transform: rotate(90deg);
}

.group-name {
  overflow: hidden;
  font-size: 0.76rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  color: #5f6975;
  font:
    0.64rem/1 "SFMono-Regular",
    Consolas,
    monospace;
}

.group-nodes {
  display: none;
  margin: 2px 0 7px;
}

.node-group.open .group-nodes {
  display: grid;
}

.node-link {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 31px;
  border-radius: 6px;
  color: #7f8996;
  font-size: 0.72rem;
  cursor: pointer;
}

.node-link:hover {
  background: #13171c;
  color: #cbd2dc;
}

.node-link.active {
  background: var(--accent-soft);
  color: #dce7ff;
}

.node-link::before {
  content: "";
  position: absolute;
  left: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--node-color, #758090);
}

.node-link.disabled::after {
  content: "Soon";
  margin-left: auto;
  color: #69727d;
  font-size: 0.58rem;
  text-transform: uppercase;
}

.empty-navigation {
  padding: 28px 12px;
  color: #69727d;
  font-size: 0.76rem;
  text-align: center;
}

.docs-content {
  min-width: 0;
  padding: 74px clamp(32px, 6vw, 108px) 120px;
}

.mobile-node-picker {
  display: none;
}

.node-document {
  width: min(100%, 980px);
  margin-inline: auto;
}

.node-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: #69727d;
  font-size: 0.72rem;
}

.node-breadcrumb span:last-child {
  color: #a5adb8;
}

.node-header {
  padding-bottom: 38px;
  border-bottom: 1px solid var(--border);
}

.node-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.node-title-wrap {
  min-width: 0;
}

.node-kicker {
  margin: 0 0 11px;
  color: #8da8e5;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.node-title {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  font-weight: 590;
  letter-spacing: -0.045em;
  line-height: 1;
  text-wrap: balance;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: #b8c0ca;
  font-size: 0.68rem;
  font-weight: 600;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.status-badge.disabled::before {
  background: #d5ad5d;
}

.node-summary {
  max-width: 730px;
  margin: 24px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.node-api {
  display: inline-flex;
  margin-top: 18px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #0f1216;
  color: #8fa7dd;
  font:
    0.72rem/1.4 "SFMono-Regular",
    Consolas,
    monospace;
}

.node-section {
  padding: 42px 0;
  border-bottom: 1px solid var(--border);
}

.node-section:last-child {
  border-bottom: 0;
}

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 610;
  letter-spacing: -0.02em;
}

.section-count {
  color: #626b76;
  font:
    0.68rem/1 "SFMono-Regular",
    Consolas,
    monospace;
}

.port-grid,
.field-grid,
.meta-grid {
  display: grid;
  gap: 10px;
}

.port-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.port-column,
.field-card,
.meta-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16, 18, 22, 0.88);
}

.port-column {
  padding: 17px;
}

.port-column-title {
  margin: 0 0 13px;
  color: #737d89;
  font-size: 0.67rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.port-list {
  display: grid;
  gap: 8px;
}

.port-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #242931;
  border-radius: 6px;
  background: #0d1014;
}

.port-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--port-color, #8290a2);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--port-color, #8290a2) 14%, transparent);
}

.port-label {
  min-width: 0;
  overflow: hidden;
  color: #c2c9d2;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-type {
  color: #66707c;
  font:
    0.62rem/1 "SFMono-Regular",
    Consolas,
    monospace;
}

.empty-value {
  margin: 0;
  color: #626b76;
  font-size: 0.76rem;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-card {
  padding: 17px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field-name {
  color: #d8dde4;
  font-size: 0.8rem;
  font-weight: 600;
}

.field-type {
  padding: 3px 6px;
  border: 1px solid #2c323a;
  border-radius: 4px;
  color: #7e8996;
  font:
    0.61rem/1 "SFMono-Regular",
    Consolas,
    monospace;
}

.field-details {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.field-detail {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  color: #77818d;
  font-size: 0.7rem;
}

.field-detail strong {
  color: #a7afb9;
  font-weight: 500;
}

.field-detail code {
  overflow-wrap: anywhere;
  color: #94aae0;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-card {
  min-width: 0;
  padding: 16px;
}

.meta-label {
  display: block;
  margin-bottom: 7px;
  color: #68727e;
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.meta-value {
  display: block;
  overflow-wrap: anywhere;
  color: #c1c8d1;
  font-size: 0.75rem;
}

.meta-value.code {
  color: #91a9dd;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.generator-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.generator-pill {
  padding: 6px 8px;
  border: 1px solid #2d343d;
  border-radius: 5px;
  background: #101419;
  color: #8f99a5;
  font-size: 0.68rem;
}

.generator-pill.available {
  border-color: rgba(92, 141, 255, 0.32);
  background: rgba(92, 141, 255, 0.08);
  color: #a9c0f5;
}

.error-state {
  padding: 28px;
  border: 1px solid rgba(239, 107, 115, 0.35);
  border-radius: 10px;
  background: rgba(239, 107, 115, 0.06);
}

.error-state h1 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.error-state p {
  margin: 0;
  color: #c1a4a7;
  line-height: 1.7;
}

.error-state code {
  color: #f0b5b9;
}

.loading-state {
  padding-top: 18px;
}

.loading-line,
.loading-card {
  border-radius: 7px;
  background: linear-gradient(90deg, #13161a 25%, #1a1e23 50%, #13161a 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite linear;
}

.loading-line {
  height: 26px;
  margin-bottom: 14px;
}

.loading-line.wide {
  width: 62%;
}

.loading-line.medium {
  width: 42%;
}

.loading-card {
  height: 240px;
  margin-top: 44px;
}

@keyframes loading {
  to {
    background-position: -200% 0;
  }
}

.sidebar-backdrop {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 280px;
  }

  .docs-content {
    padding-inline: 42px;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 62px;
  }

  .container {
    width: min(calc(100% - 32px), var(--container));
  }

  .desktop-nav,
  .header-status {
    display: none;
  }

  .menu-button {
    display: block;
  }

  .mobile-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 59;
    display: grid;
    padding: 14px 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #0d0f12;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 160ms ease,
      transform 160ms ease,
      visibility 160ms ease;
  }

  .mobile-nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .mobile-nav a {
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
    color: #b7bec8;
    font-size: 0.88rem;
  }

  .mobile-nav a:last-child {
    border-bottom: 0;
  }

  .docs-shell {
    display: block;
  }

  .docs-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(88vw, 340px);
    height: auto;
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.sidebar-open .docs-sidebar {
    transform: translateX(0);
  }

  .docs-content {
    padding: 28px 20px 80px;
  }

  .mobile-node-picker {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 38px;
    padding: 0 13px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: rgba(16, 19, 23, 0.92);
    color: #cbd2db;
    cursor: pointer;
    font-size: 0.78rem;
  }

  .mobile-node-picker svg {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
  }

  .node-title-row {
    display: block;
  }

  .status-badge {
    margin-top: 20px;
  }

  .port-grid,
  .field-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    background-size:
      100% 520px,
      30px 30px,
      30px 30px;
  }

  .container {
    width: calc(100% - 24px);
  }

  .docs-content {
    padding-inline: 12px;
  }

  .node-title {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
  }

  .node-summary {
    font-size: 0.94rem;
  }

  .node-section {
    padding-block: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Match the main website header on large screens */
@media (min-width: 1600px) {
  :root {
    --header-height: 76px;
    --container: 1400px;
  }

  .brand {
    font-size: 1rem;
  }

  .desktop-nav a,
  .header-status {
    font-size: 0.88rem;
  }
}

/* Match the main website header on 2K and 4K screens */
@media (min-width: 2200px) {
  :root {
    --header-height: 78px;
    --container: 1680px;
  }

  .desktop-nav a,
  .header-status {
    font-size: 0.9rem;
  }
}
