:root {
  --bg-dark: #212223;
  --bg-sidebar: #212223;
  --bg-content: #212223;
  --text-main: #cccccc;
  --text-muted: #cccccc;
  --accent: #bff2f2;
  --font: "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

.doc-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  padding: 1rem 1.2rem;
  border-right: 1px solid #2c2c2c;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  background: #2a2a2a;
  color: #fff;
  border: none;
  padding: 8px 12px;
  font-size: 18px;
  border-radius: 4px;
}

/* desktop only */
@media (min-width: 769px) {
  .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 15rem;
  }

  .brand {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
  }
  .toc {
    flex: 1;
    max-width: 10%;
  }
  .tocr {
    flex: 1;
    max-width: 25%;
  }
}

.main-content {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-content);
  padding: 2rem 3rem;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  font-size: 0.875rem;
  font-weight: 400;
  text-wrap: balance;
  border-radius: 0.375rem;
}

.sidebar-nav ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  text-decoration: none;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  color: var(--text-main);
  transition: background 0.2s;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 400;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  border-left-style: solid;
  border-left-width: 1px;
  border-left-color: var(--accent);
}

.sidebar-nav .sub-menu {
  padding-left: 1rem;
  margin-top: 0.25rem;
  border-left-width: 1px;
  border-left-style: solid;
  border-left-color: var(--accent);
}

.sidebar-nav li.open > .sub-menu {
  max-height: 500px;
}

.sub-menu {
  padding-left: 2px !important;
  margin-left: 20px !important;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: #00000020;
}

.sub-menu.open {
  max-height: 500px;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px solid #2b2b2b;
}

.doc-body h1,
.doc-body h2,
.doc-body h3 {
  color: var(--accent);
  margin-top: 1rem;
  line-height: 1.5rem;
  gap: 1rem;
}

.doc-body h4 {
  color: var(--accent);
  margin-top: 1rem;
  line-height: 1.5rem;
  gap: 1rem;
}

.doc-body p {
  color: var(--text-muted);
  line-height: 1.7;
  margin: 1rem 0;
}

.doc-body pre {
  background-color: #2b2b2b;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9rem;
  margin: 1.5rem 0;
}

.doc-body img {
  max-width: 100%;
  margin: 1rem 0;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.content-section {
  display: none;
  overflow: auto;
}

.content-section.active {
  display: block;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 10px;
  border: 2px solid #1e1e1e;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #444 #1e1e1e; /* thumb color | track color */
}
.info-box {
  display: flex;
  background-color: #1e1e1e;
  border-radius: 6px;
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.label {
  font-weight: 600;
  padding: 12px 16px;
  min-width: 160px;
  border-right: 1px solid #333;
  white-space: nowrap;
  align-content: center;
}
.description {
  padding: 12px 16px;
  flex: 1;
}
.info-notice {
  display: flex;
  align-items: flex-start;
  background-color: #1e1e1e;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  max-width: 800px;
  margin: 24px 5px;
}
.prop-info-box {
  display: grid;
  grid-template-columns: 160px 100px 1fr;
  border: 1px solid #333;
  border-radius: 6px;
  color: #ccc;
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 0;
  margin: 0.2rem;
}
.prop-info-box .col {
  padding: 8px 16px;
  border-top: 1px solid #2a2a2a;
}

.prop-info-box .col.title {
  font-weight: 600;
  color: #fff;
  border-right-style: solid;
  border-right-width: 1px;
  border-right-color: #ffffff17;
}

.prop-info-box .col.type {
  border-right-style: solid;
  border-right-width: 1px;
  border-right-color: #ffffff17;
  text-align: center;
}

.prop-info-box .col:nth-child(-n + 3) {
  border-top: none; /* remove top border from first row */
}
.doc-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid #333;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: auto;
  max-width: 48rem;
}

.doc-nav .nav-item {
  flex: 1 1 0%;
  display: flex;
  padding: 1rem 1.25rem;
  border: 1px solid #444;
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
  flex-direction: row-reverse;
  gap: 1rem;
  align-items: center;
}

.nav-text {
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
}

.doc-nav .nav-item:hover {
  background-color: #222;
  border-color: var(--accent);
}

.nav-item.prev::before {
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.nav-item.next {
  align-items: center;
  text-align: right;
}

.nav-item.next::after {
  color: var(--accent);
  font-size: 1.2rem;
  margin-top: 0.25rem;
}

.nav-label {
  font-size: 0.75rem;
  color: #888;
}

.nav-title {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  line-height: 1.4;
}
.nav-licon {
  display: block;
  background: #667;
  width: 1rem;
  height: 1rem;
  align-items: center;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.info-icon {
  mask: url(https://ka-p.fontawesome.com/releases/v6.6.0/svgs/regular/circle-info.svg?v=2&token=a463935e93);
  mask-repeat: no-repeat;
  mask-position: center center;
  background-color: #ccc;
  width: 16px;
  height: 16px;
  display: block;
  margin-right: 1rem;
  line-height: 1.5;
  min-width: 1.5rem;
}
.svg-icon {
  background-color: #cccccc7c;
  mask-repeat: no-repeat;
  mask-position: center center;
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

.grid-box {
  width: 100%;
  background-color: #1e1e1e;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.025),
    rgba(255, 255, 255, 0.025) 14px,
    transparent 14px,
    transparent 28px
  );
  border: 1px solid #333;
  border-radius: 6px;
  text-align: center;
  padding: 0.2rem 4rem;
  margin: 1rem 0;
}

.grid-box p {
  text-wrap-style: pretty;
  line-height: 1.5;
  font-size: 14px;
}

.link-text {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  transition: color 0.2s;
  display: inline-block;
  margin: 0.3rem;
}

.link-text:hover {
  color: #bee6fd;
}
.toggle-sub {
  justify-content: space-between;
}
.toggle-sub .arrow {
  mask: url(https://ka-p.fontawesome.com/releases/v6.6.0/svgs/regular/chevron-right.svg?v=2&amp;token=a463935e93);
  mask-repeat: no-repeat;
  mask-position: center;
  background-color: #ccc;
  width: 0.75rem;
  height: 0.75rem;
  min-width: 1.5rem;
  margin: 0.25rem;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
  opacity: 0.4;
  margin-left: auto;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 0.15s;
}
.toggle-sub.active .arrow {
  transform: rotate(90deg);
}
.separator {
  border: none;
  height: 1px;
  background-color: #333; /* dark theme compatible */
  margin: 1rem 0; /* optional spacing */
}
.qa-item + .qa-item {
  border-top: 1px solid #2a2a2a;
}

.qa-question {
  background: none;
  color: inherit;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-size: 15px;
  border: none;
  outline: none;
  cursor: pointer;
  position: relative;
}

.qa-question::after {
  content: "›";
  position: absolute;
  right: 16px;
  transition: transform 0.3s ease;
}

.qa-item.open .qa-question::after {
  transform: rotate(90deg);
}

.qa-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #aaa;
  transition: max-height 0.3s ease;
}

.qa-item.open .qa-answer {
  max-height: 200px; /* enough for the answer */
  padding-bottom: 12px;
}
.tooltip-popup {
  position: absolute;
  background-color: #1e1e1e;
  color: #ccc;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; /* prevents accidental hover while hidden */
}
.tooltip-popup.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.tooltip-trigger {
  text-decoration: underline;
  cursor: pointer;
}
.hook-box {
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 14px;
  color: #ccc;
  overflow: hidden;
}
.hook-row {
  display: flex;
  border-top: 1px solid #2a2a2a;
}
.hook-row:first-child {
  border-top: none;
}
.hook-label {
  width: 120px;
  padding: 10px 14px;
  font-weight: 600;
  color: #fff;
  background-color: #2a2a2a;
  border-right: 1px solid #2a2a2a;
}
.hook-value {
  flex: 1;
  padding: 10px 14px;
}

.hook-value code {
  background: #292929;
  padding: 2px 6px;
  border-radius: 4px;
  color: #9cdcfe;
  font-family: Consolas, monospace;
  font-size: 13px;
}
.doc-button {
  background-color: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.doc-button:hover {
  background-color: #333;
  border-color: #555;
  color: #fff;
}

.doc-button:active {
  background-color: #1f1f1f;
  border-color: #666;
}
.iframe-wrapper {
  display: inline-block;
  position: relative;
}
.iframe-wrapper iframe {
  display: block;
}
.iframe-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%; /* match iframe width */
  height: 100%; /* match iframe height */
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #444;
  border-radius: 6px;
  z-index: 10;
}

.spinner {
  animation: rotate 1s linear infinite;
  width: 40px;
  height: 40px;
}

.spinner .path {
  stroke: var(--accent);
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes dash {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}
.zoom-img {
  cursor: zoom-in;
}

.zoom-popup {
  display: none;
  position: absolute;
  width: 200px;
  height: 200px;
  border: 1px solid #cccccc1a;
  background-repeat: no-repeat;
  background-size: 200%;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  transition: opacity 0.15s ease;
  opacity: 0;
}
.zoom-popup.show {
  opacity: 1;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 18, 18, 0.5);
  padding: 12px 24px;
  border-bottom: 1px solid #8a8a8a1e;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo {
  height: 24px;
  width: auto;
}

/* Center: Nav links */
.header-nav {
  display: flex;
  gap: 24px;
}

.header-nav a {
  text-decoration: none;
  color: #ccc;
  font-size: 14px;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: #70cfff;
}

/* Right: Search box */
.header-search .search-box {
  display: flex;
  align-items: center;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}

.search-box input {
  background: transparent;
  border: none;
  color: #ccc;
  margin: 0 8px;
  width: 120px;
  outline: none;
}

#search-results {
  margin-top: 0.5rem;
  background: #0e0e0e52;
  border: 1px solid #33333370;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  position: absolute;
}

.search-hit {
  display: block;
  padding: 0.5rem;
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid #33333396;
  font-size: 14px;
  font-weight: 700;
}

.search-hit:hover {
  background: #2b2b2b;
}

.no-results {
  padding: 0.5rem;
  color: #888;
}
mark {
  background-color: #ffeb3b5a;
  color: inherit;
  font-weight: bold;
}

.external-link::after {
  content: "🡵";
  font-size: 0.8rem;
  width: 0.75rem;
  height: 0.75rem;
  display: inline-block;
  margin-left: 0.25rem;
}
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin-left: 12px;
  padding: 6px;
}

/* mobile only */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
    position: fixed;
    padding: 0.5rem 0.5rem;
    height: 100vh;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .menu-toggle {
    display: block;
  }
  .header-left {
    display: none;
  }
  .header-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 48px;
    margin-left: 3rem;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px 0;
    z-index: 999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    gap: 5px;
  }

  .header-nav.show {
    display: flex;
  }

  .header-link {
    display: block;
    padding: 10px 16px;
    white-space: nowrap;
    color: #ccc;
    text-decoration: none;
  }
  .toc,
  .tocr {
    display: none;
  }
  .main-content {
    padding: 0.5rem 0.5rem;
    flex: none;
    width: 100%;
  }
  .prop-info-box {
    display: flex;
    grid-template-columns: 160px 100px 1fr;
    padding: 8px 0;
    margin: 0.2rem;
    align-items: center;
    flex-direction: column;
  }
  .mobile-menu-toggle {
    display: block;
    margin-left: 4rem;
  }
}
