/* KCM documentation: shared styles of the pages under /docs/ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(to right, #14161a, #1c1f26);
  color: #fff;
  line-height: 1.7;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  background: #ffa500;
  color: #14161a;
  padding: .6rem .9rem;
  border-radius: 10px;
  font-weight: 800;
  z-index: 4000;
}

.skip-link:focus {
  left: 10px;
}

/* ---------- Layout ---------- */

.docs-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 210px;
  gap: 2.2rem;
  align-items: start;
}

.docs-shell.no-toc {
  grid-template-columns: 260px minmax(0, 1fr);
}

/* ---------- Left sidebar ---------- */

.docs-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #1e2129;
  border-left: 4px solid #ffa500;
  border-radius: 0 12px 12px 0;
  padding: 1.1rem 1rem 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  scrollbar-width: thin;
  scrollbar-color: #ffffff22 transparent;
}

.docs-sidebar__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffa500;
  margin-bottom: .6rem;
}

.docs-sidebar__title a {
  color: inherit;
  text-decoration: none;
}

.docs-version {
  font-size: .72rem;
  font-weight: 700;
  color: #14161a;
  background: #ffa500;
  border-radius: 999px;
  padding: .1rem .5rem;
  white-space: nowrap;
}

.docs-sidebar__search {
  width: 100%;
  padding: .5rem .65rem;
  border-radius: 10px;
  border: 1px solid #ffffff22;
  background: #171a20;
  color: #fff;
  margin-bottom: .8rem;
  font: inherit;
  font-size: .9rem;
  outline: none;
}

.docs-sidebar__search:focus {
  border-color: #ffa50066;
  box-shadow: 0 0 0 3px rgba(255, 165, 0, .12);
}

.docs-sidebar h3 {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9aa0ab;
  margin: 1rem 0 .3rem .45rem;
}

.docs-sidebar ul {
  list-style: none;
  margin: 0;
}

.docs-sidebar li {
  margin: 0;
}

.docs-sidebar a {
  display: block;
  color: #e4e4e4;
  text-decoration: none;
  font-weight: 500;
  font-size: .93rem;
  line-height: 1.35;
  padding: .32rem .45rem;
  border-radius: 8px;
}

.docs-sidebar a:hover {
  background: #ffa50014;
  color: #fff;
}

.docs-sidebar a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(255, 165, 0, .2), rgba(255, 204, 102, .08));
  box-shadow: inset 0 0 0 1px rgba(255, 165, 0, .3);
  color: #ffd27f;
  font-weight: 700;
}

.docs-sidebar .badge {
  font-size: .68rem;
  font-weight: 800;
  color: #ffcc66;
  border: 1px solid #ffcc6655;
  border-radius: 999px;
  padding: 0 .4rem;
  margin-left: .25rem;
  vertical-align: 1px;
}

.docs-menu-toggle {
  display: none;
}

/* ---------- Right "on this page" ---------- */

.docs-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: .85rem;
  padding-left: .9rem;
  border-left: 1px solid #ffffff1a;
}

.docs-toc h2 {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9aa0ab;
  margin-bottom: .5rem;
}

.docs-toc ul {
  list-style: none;
  margin: 0;
}

.docs-toc li {
  margin: 0;
}

.docs-toc a {
  display: block;
  color: #c9ccd2;
  text-decoration: none;
  padding: .22rem 0;
  line-height: 1.35;
}

.docs-toc a.sub {
  padding-left: .8rem;
  font-size: .8rem;
}

.docs-toc a:hover,
.docs-toc a.active {
  color: #ffb347;
}

/* ---------- Content ---------- */

.docs-content {
  min-width: 0;
}

.breadcrumb {
  font-size: .85rem;
  color: #9aa0ab;
  margin-bottom: .6rem;
}

.breadcrumb a {
  color: #ffb347;
  text-decoration: none;
}

.docs-content h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: .6rem;
  background: linear-gradient(to right, #ffa500, #ffcc66);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.docs-content .lead {
  font-size: 1.1rem;
  color: #dcdcdc;
  margin-bottom: 1.2rem;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.8rem;
}

.pill {
  background: #1e2129;
  border: 1px solid #ffffff14;
  border-left: 3px solid #ffa500;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  color: #e9e9e9;
}

.docs-content h2 {
  font-size: 1.65rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin: 2.6rem 0 .8rem;
  padding-top: .4rem;
  color: #ffa500;
  border-top: 1px solid #ffffff12;
}

.docs-content h2:first-of-type {
  border-top: none;
}

.docs-content h3 {
  font-size: 1.2rem;
  margin: 1.8rem 0 .5rem;
  color: #ffcc66;
}

.docs-content h4 {
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #e0b25c;
  margin: 1.3rem 0 .4rem;
}

.docs-content h2 .anchor,
.docs-content h3 .anchor {
  opacity: 0;
  margin-left: .4rem;
  font-size: .8em;
  color: #ffa50099;
  text-decoration: none;
}

.docs-content h2:hover .anchor,
.docs-content h3:hover .anchor,
.docs-content .anchor:focus {
  opacity: 1;
}

.docs-content p {
  margin-bottom: 1rem;
  color: #f1f1f1;
}

.docs-content ul,
.docs-content ol {
  margin: .4rem 0 1.2rem 1.4rem;
}

.docs-content li {
  margin-bottom: .45rem;
  color: #f1f1f1;
}

.docs-content li > ul,
.docs-content li > ol {
  margin-top: .4rem;
  margin-bottom: .4rem;
}

.docs-content a,
.docs-content a:visited {
  color: #ffb347;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.docs-content a:hover {
  color: #ffd27f;
}

.docs-content strong {
  color: #fff;
}

kbd {
  font-family: inherit;
  font-size: .85em;
  background: #2a2e38;
  border: 1px solid #ffffff22;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 .35rem;
}

code {
  font-family: 'Fira Code', Consolas, 'Courier New', monospace;
  color: #ffdd99;
  font-size: .9em;
  overflow-wrap: anywhere;
}

pre {
  position: relative;
  background: #11141c;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  overflow: auto;
  border: 1px solid #ffffff11;
  box-shadow: inset 0 0 12px #0006;
  margin: .5rem 0 1.2rem;
  line-height: 1.55;
}

pre code {
  font-size: .86rem;
  overflow-wrap: normal;
  white-space: pre;
}

pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7d8390;
}

pre[data-lang] {
  padding-top: 1.9rem;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #1e2129;
  border: 1px solid #ffffff22;
  color: #ffcc66;
  padding: .2rem .55rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: .78rem;
  font-family: inherit;
}

.copy-btn:hover {
  border-color: #ffa50066;
}

.copy-btn.copied {
  color: #14161a;
  background: #ffa500;
  border-color: #ffa500;
}

/* Callouts */

.callout {
  background: #1e2129;
  border: 1px solid #ffffff14;
  border-left: 4px solid #ffbb33;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin: 1.2rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-title {
  display: block;
  font-weight: 800;
  color: #ffcc66;
  margin-bottom: .3rem;
}

.callout.warn {
  border-left-color: #ff6b4a;
}

.callout.warn .callout-title {
  color: #ff9a80;
}

.callout.info {
  border-left-color: #4aa8ff;
}

.callout.info .callout-title {
  color: #8cc8ff;
}

.callout.roadmap {
  border: 1px dashed #ffa50088;
  border-left: 4px dashed #ffa500;
  background: #1b1e25;
}

/* Edition tags */

.ed {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  border-radius: 999px;
  padding: .05rem .5rem;
  margin: 0 .15rem;
  vertical-align: 2px;
  white-space: nowrap;
  border: 1px solid;
}

.ed-all {
  color: #8be28b;
  border-color: #8be28b66;
}

.ed-starter {
  color: #8cc8ff;
  border-color: #8cc8ff66;
}

.ed-team {
  color: #ffcc66;
  border-color: #ffcc6666;
}

.ed-ent {
  color: #f0a0ff;
  border-color: #f0a0ff66;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: .6rem 0 1.4rem;
  border-radius: 10px;
  border: 1px solid #ffffff14;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: #1a1d24;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: .55rem .8rem;
  border-bottom: 1px solid #ffffff10;
}

th {
  background: #232731;
  color: #ffcc66;
  font-weight: 700;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

td code {
  white-space: nowrap;
}

td.wrap code {
  white-space: normal;
}

/* Cards (docs home) */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.card {
  display: block;
  background: #1e2129;
  border: 1px solid #ffffff14;
  border-top: 3px solid #ffa500;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  text-decoration: none !important;
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #ffa50066;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
}

.card strong {
  display: block;
  color: #ffcc66;
  font-size: 1.02rem;
  margin-bottom: .25rem;
}

.card span {
  display: block;
  color: #d4d4d4;
  font-weight: 400;
  font-size: .9rem;
  line-height: 1.5;
}

/* Steps */

ol.steps {
  counter-reset: step;
  list-style: none;
  margin-left: 0;
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 1rem;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .05rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #ffa50022;
  border: 1px solid #ffa50088;
  color: #ffcc66;
  font-weight: 800;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Screenshots */

.screenshot {
  margin: 1.4rem 0;
  background: #0f1219;
  border-radius: 10px;
  border: 1px solid #ffffff12;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.screenshot a {
  display: block;
  cursor: zoom-in;
}

.screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

.screenshot figcaption {
  padding: .7rem 1rem;
  font-size: .88rem;
  color: #d9d9d9;
  background: linear-gradient(90deg, #1d202a, #161922);
  border-top: 1px solid #ffffff0f;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .88);
  padding: 2rem;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.lightbox.show {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: min(1200px, 100%);
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 25px 55px rgba(0, 0, 0, .6);
}

.lightbox button {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Previous / next */

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid #ffffff14;
}

.page-nav a {
  flex: 1 1 0;
  display: block;
  background: #1e2129;
  border: 1px solid #ffffff14;
  border-radius: 10px;
  padding: .7rem 1rem;
  text-decoration: none !important;
}

.page-nav a:hover {
  border-color: #ffa50066;
}

.page-nav a.next {
  text-align: right;
}

.page-nav small {
  display: block;
  color: #9aa0ab;
  font-weight: 500;
  font-size: .78rem;
}

.page-nav span {
  color: #ffcc66;
  font-weight: 700;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #ffa50066;
  background: #1e2129;
  color: #ffa500;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.back-to-top.show {
  display: flex;
}

:focus-visible {
  outline: 3px solid rgba(255, 165, 0, .65);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .docs-shell,
  .docs-shell.no-toc {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 860px) {
  html {
    scroll-padding-top: 70px;
  }

  .docs-shell,
  .docs-shell.no-toc {
    display: block;
    padding: 1rem 1rem 3rem;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
    border-radius: 12px;
    margin-bottom: 1.4rem;
    padding: .7rem .9rem;
  }

  .docs-menu-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    color: #ffa500;
    font: inherit;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    padding: .2rem 0;
  }

  .docs-menu-toggle .chev {
    transition: transform .2s ease;
  }

  .docs-sidebar.open .docs-menu-toggle .chev {
    transform: rotate(180deg);
  }

  .docs-sidebar__body {
    display: none;
    margin-top: .6rem;
  }

  .docs-sidebar.open .docs-sidebar__body {
    display: block;
  }

  .docs-sidebar__title {
    display: none;
  }

  .docs-content h1 {
    font-size: 1.85rem;
  }

  .docs-content h2 {
    font-size: 1.35rem;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav a.next {
    text-align: left;
  }
}
