@import url('kp-fonts.css');

:host, :root {
  color-scheme: dark;
  --docs-nav-width: 220px;
  --docs-header-border: rgba(255, 255, 255, 0.10);
  --docs-nav-bg: rgba(0, 0, 0, 0.28);
  --docs-tab-active-bg: rgba(255, 255, 255, 0.12);
  --docs-tab-hover-bg: rgba(255, 255, 255, 0.06);
  --docs-tab-active-border: color-mix(in srgb, var(--kp-color-accent, #4a90c8) 45%, transparent);
  --docs-tab-active-accent: var(--kp-color-accent, #4a90c8);
  --docs-tab-focus-ring: color-mix(in srgb, var(--kp-color-accent, #4a90c8) 75%, transparent);
  --docs-font-scale: var(--kp-type-scale, 1.25);
  --font-display: var(--kp-font-display, Helvetica, Arial, sans-serif);
  --font-heading: var(--kp-font-heading, Helvetica, Arial, sans-serif);
  --font-body: var(--kp-font-body, Helvetica, Arial, sans-serif);
  --font-mono: var(--kp-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--kp-font-body, Helvetica, Arial, sans-serif);
  background: linear-gradient(rgb(18, 18, 18) 0%, rgb(11, 11, 11) 100%);
  color: var(--kp-color-fg, rgba(255, 255, 255, 0.92));
}

:host {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  color: var(--kp-color-fg, rgba(255, 255, 255, 0.92));
  font-family: var(--kp-font-body, Helvetica, Arial, sans-serif);
}

.docs-app {
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.docs-app.kp-popover-embed {
  background: transparent;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--docs-header-border);
  background: linear-gradient(180deg, rgba(35, 35, 35, 0.55) 0%, rgba(18, 18, 18, 0.2) 100%);
}

/* Outer KeyPilot popover titlebar owns title + close when embedded. */
.docs-app.kp-popover-embed > .header,
.kp-popover-embed .docs-app > .header,
.header[hidden] {
  display: none !important;
}

.header-text {
  min-width: 0;
}

h1 {
  margin: 0;
  font-family: var(--kp-font-heading, Helvetica, Arial, sans-serif);
  font-size: var(--kp-type-h2-size, 18px);
  letter-spacing: var(--kp-type-tracking-titlebar, 0.2px);
}

.sub {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.03) 100%);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.92);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(255,255,255,0.28);
}

.docs-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--docs-nav-width) minmax(0, 1fr);
}

.docs-nav {
  box-sizing: border-box;
  min-height: 0;
  overflow: auto;
  padding: 12px 10px;
  background: var(--docs-nav-bg);
  border-right: 1px solid var(--docs-header-border);
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a #141414;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.docs-search {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  outline: none;
}

.docs-search:focus {
  border-color: #ff8c00;
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.35);
}

.docs-search::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 0 0;
}

.topic-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 0;
}

.topic-btn,
.topic-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 8px 10px;
  padding-left: calc(10px + (var(--topic-depth, 0) * 12px));
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  cursor: pointer;
}

.topic-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding-top: 10px;
  padding-bottom: 4px;
  cursor: default;
}

.topic-group:hover {
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.topic-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-visual {
  --topic-accent: 120, 180, 255;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 24px;
  height: 24px;
  border: 1px solid rgba(var(--topic-accent), 0.32);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    rgba(var(--topic-accent), 0.14);
  color: rgba(var(--topic-accent), 0.98);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.topic-btn[data-accent="green"] .topic-visual { --topic-accent: 74, 222, 128; }
.topic-btn[data-accent="blue"] .topic-visual { --topic-accent: 96, 190, 255; }
.topic-btn[data-accent="amber"] .topic-visual { --topic-accent: 245, 171, 74; }
.topic-btn[data-accent="indigo"] .topic-visual { --topic-accent: 137, 147, 255; }
.topic-btn[data-accent="rose"] .topic-visual { --topic-accent: 255, 117, 140; }
.topic-btn[data-accent="cyan"] .topic-visual { --topic-accent: 91, 226, 241; }
.topic-btn[data-accent="violet"] .topic-visual { --topic-accent: 194, 130, 255; }

.topic-shortcut {
  width: auto;
  max-width: 48px;
  padding: 0 5px;
  font-family: var(--kp-font-kbd, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.topic-icon-svg {
  width: 14px;
  height: 14px;
}

.topic-btn:hover {
  background: var(--docs-tab-hover-bg);
}

.topic-btn[aria-current="page"] {
  background: var(--docs-tab-active-bg);
  border-color: var(--docs-tab-active-border);
  box-shadow: inset 3px 0 0 var(--docs-tab-active-accent);
  color: rgba(255, 255, 255, 0.96);
}

.topic-btn:focus,
.topic-btn:focus-visible,
.topic-group:focus,
.topic-group:focus-visible {
  outline: none;
}

.topic-placeholder {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: rgba(255, 210, 150, 0.85);
  border: 1px solid rgba(255, 140, 0, 0.28);
  background: rgba(255, 140, 0, 0.08);
  border-radius: 999px;
  padding: 1px 6px;
}

.docs-empty {
  margin: 8px 2px 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.docs-main {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 28px;
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a #141414;
}

.docs-article {
  max-width: 760px;
}

.docs-article .muted {
  color: rgba(255, 255, 255, 0.6);
  font-size: calc(13px * var(--docs-font-scale));
}

.docs-article h1 {
  font-family: var(--kp-font-display, var(--kp-font-heading, Helvetica, Arial, sans-serif));
  font-size: calc(var(--kp-type-h1-size, 22px) * var(--docs-font-scale, 1.25));
  font-weight: var(--kp-type-weight-bold, 700);
  letter-spacing: var(--kp-type-tracking-display, 0.02em);
  text-transform: var(--kp-type-transform-display, none);
  margin: 0 0 12px;
}

.docs-article h2 {
  font-family: var(--kp-font-heading, Helvetica, Arial, sans-serif);
  font-size: calc(var(--kp-type-h2-size, 16px) * var(--docs-font-scale, 1.25));
  font-weight: var(--kp-type-weight-semibold, 600);
  margin: 22px 0 8px;
  letter-spacing: var(--kp-type-tracking-titlebar, 0.2px);
}

.docs-article h3 {
  font-family: var(--kp-font-subhead, Helvetica, Arial, sans-serif);
  font-size: calc(var(--kp-type-h3-size, 14px) * var(--docs-font-scale, 1.25));
  margin: 18px 0 6px;
}

.docs-article p,
.docs-article li {
  font-family: var(--kp-font-body, Helvetica, Arial, sans-serif);
  font-size: calc(var(--kp-type-body-size, 13px) * var(--docs-font-scale, 1.25));
  line-height: var(--kp-type-leading-prose, 1.55);
  color: var(--kp-color-fg, rgba(255, 255, 255, 0.88));
}

.docs-article p {
  margin: 0 0 10px;
}

.docs-article ul,
.docs-article ol {
  margin: 0 0 12px;
  padding-left: 1.35em;
}

.docs-article li + li {
  margin-top: 4px;
}

.docs-article em {
  color: rgba(255, 210, 150, 0.92);
  font-style: italic;
}

.docs-article strong {
  color: rgba(255, 255, 255, 0.98);
  font-weight: 600;
}

.docs-article code {
  font-family: var(--kp-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: calc(var(--kp-type-code-size, 12px) * var(--docs-font-scale, 1.25));
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.docs-article kbd {
  display: inline-block;
  box-sizing: border-box;
  min-width: 1.7em;
  margin: 0 1px;
  padding: 1px 5px 2px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom-color: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: linear-gradient(180deg, #343434 0%, #1c1c1c 100%);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: var(--kp-font-kbd, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.84em;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.docs-article .table-scroll {
  width: 100%;
  margin: 0 0 16px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.docs-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(12px * var(--docs-font-scale));
  line-height: 1.45;
}

.docs-article th,
.docs-article td {
  padding: 8px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

.docs-article th:last-child,
.docs-article td:last-child {
  border-right: 0;
}

.docs-article tr:last-child td {
  border-bottom: 0;
}

.docs-article th {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.96);
  font-size: calc(11px * var(--docs-font-scale));
  font-weight: 700;
  letter-spacing: 0.2px;
}

.docs-article tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.docs-article td {
  color: rgba(255, 255, 255, 0.84);
}

.docs-article .article-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 12px 0 18px;
}

.docs-article .article-column {
  min-width: 0;
  padding: 0 14px 4px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.docs-article .article-column > h2:first-child,
.docs-article .article-column > h3:first-child {
  margin-top: 14px;
}

.docs-article a {
  color: rgba(140, 190, 255, 0.95);
  text-decoration: none;
}

.docs-article a:hover {
  text-decoration: underline;
}

.docs-article .error {
  color: rgba(255, 150, 150, 0.95);
}

@media (max-width: 720px) {
  :root {
    --docs-nav-width: 190px;
  }

  .docs-main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .docs-article .article-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* NCT dark pro scrollbars (nav + article). */
.docs-nav::-webkit-scrollbar,
.docs-main::-webkit-scrollbar,
.docs-article .table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.docs-nav::-webkit-scrollbar-corner,
.docs-main::-webkit-scrollbar-corner,
.docs-article .table-scroll::-webkit-scrollbar-corner {
  background: #141414;
}
.docs-nav::-webkit-scrollbar-track,
.docs-main::-webkit-scrollbar-track,
.docs-article .table-scroll::-webkit-scrollbar-track {
  background: #141414;
  border-left: 1px solid #111;
  border-top: 1px solid #111;
}
.docs-nav::-webkit-scrollbar-thumb,
.docs-main::-webkit-scrollbar-thumb,
.docs-article .table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #555 0%, #4a4a4a 45%, #3a3a3a 100%);
  border: 1px solid #111;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  min-height: 28px;
  min-width: 28px;
}
.docs-nav::-webkit-scrollbar-thumb:hover,
.docs-main::-webkit-scrollbar-thumb:hover,
.docs-article .table-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #666 0%, #5c5c5c 45%, #444 100%);
}
.docs-nav::-webkit-scrollbar-thumb:active,
.docs-main::-webkit-scrollbar-thumb:active,
.docs-article .table-scroll::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #4a90c8 0%, #3a6a94 100%);
  border-color: #2a4a66;
}
