.docs {
  --code-bg: #0a1526;
  --code-border: rgba(255, 255, 255, 0.08);
  --rule: rgba(255, 255, 255, 0.09);
}

.docs .docs-layout {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  padding-block: 24px 64px;
}

/* sidebar */

.docs-nav {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding-right: 10px;
}
.docs-nav-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}
.nav-section + .nav-section { margin-top: 26px; }
.nav-section-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 10px;
  margin-bottom: 8px;
}
.docs-nav ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.docs-nav a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.4;
}
.docs-nav a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.docs-nav a.active { background: rgba(47, 180, 182, 0.15); color: var(--text); font-weight: 700; }
.docs-nav .num { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 16px; }
.docs-nav a.active .num { color: var(--accent); }

/* page */

.docs-main { max-width: 780px; padding-bottom: 24px; }
.chapter-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.chapter-mark span { font-weight: 600; letter-spacing: 1.4px; color: var(--text-dim); }
.chapter-mark span::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); margin-right: 12px; vertical-align: middle; }

.docs-main h1 { font-size: 42px; font-weight: 800; letter-spacing: -1px; line-height: 1.12; margin-bottom: 20px; }
.docs-main h2 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0 0 16px;
  padding-top: 34px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 24px;
}
.docs-main h2:not(:first-child) { margin-top: 56px; }
.docs-main h3 { font-size: 20px; font-weight: 700; margin: 38px 0 10px; }
.docs-main h4 { font-size: 16px; font-weight: 700; margin: 28px 0 8px; color: var(--text-soft); }
.docs-main p { font-size: 16.5px; line-height: 1.8; color: var(--text-soft); margin-bottom: 20px; }
.docs-main p.lead-in { font-size: 18px; margin-bottom: 8px; }
.docs-main ul, .docs-main ol { color: var(--text-soft); font-size: 16.5px; line-height: 1.8; padding-left: 24px; margin-bottom: 24px; }
.docs-main li { margin-bottom: 10px; padding-left: 4px; }
.docs-main li::marker { color: var(--accent); }

/* inline and block code */

.docs-main li > code, .docs-main p > code, .docs-main td > code, .docs-main th > code,
.docs-main h2 > code, .docs-main h3 > code, .docs-main h4 > code, .docs-main blockquote code {
  background: rgba(47, 180, 182, 0.11);
  border: 1px solid rgba(47, 180, 182, 0.2);
  color: #9fe4e5;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.88em;
  white-space: nowrap;
}
.docs-main pre {
  position: relative;
  /* A little wider than the text column, so a full line of Kotlin fits without scrolling. */
  width: calc(100% + 40px);
  margin: 0 -20px 28px;
  padding: 54px 20px 22px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 14px;
  overflow-x: auto;
}
.docs-main pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 11px 20px 10px;
  border-bottom: 1px solid var(--code-border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 14px 14px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.docs-main pre code {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  color: #dfe9ea;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre;
}

pre .k { color: #7fd4d6; }
pre .t { color: #9cc7f5; }
pre .s { color: #f5c07a; }
pre .n { color: #c3b2f7; }
pre .c { color: rgba(255, 255, 255, 0.4); font-style: italic; }

/* tables, quotes, images */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 28px;
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.docs-main table { border-collapse: collapse; width: 100%; font-size: 15px; }
.docs-main th, .docs-main td {
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  color: var(--text-soft);
  line-height: 1.6;
  vertical-align: top;
}
.docs-main thead th { color: var(--text); font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, 0.03); }
.docs-main tbody tr:last-child td { border-bottom: 0; }
.docs-main tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.docs-main blockquote {
  margin: 0 0 28px;
  padding: 16px 22px;
  border-left: 3px solid var(--accent);
  background: rgba(47, 180, 182, 0.08);
  border-radius: 0 12px 12px 0;
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.7;
}
.docs-main img { max-width: 100%; border-radius: 14px; margin: 8px 0 24px; }
.docs-main hr { border: 0; border-top: 1px solid var(--rule); margin: 44px 0; }

/* on this page */

.onthispage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  padding: 20px 24px;
  margin-bottom: 44px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--card-bg);
  font-size: 14.5px;
}
.onthispage span {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin-bottom: 2px;
}
.onthispage a { color: var(--text-soft); }
.onthispage a:hover { color: var(--accent); }

/* pager */

.pager { display: flex; gap: 16px; margin-top: 64px; }
.pager a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text);
  font-weight: 700;
}
.pager a:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--text); }
.pager a span { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.6px; }
.pager .next { text-align: right; }

/* index */

.docs-main .section-heading { font-size: 20px; letter-spacing: 0; margin-top: 48px; padding-top: 26px; margin-bottom: 18px; }
.docs-main .section-heading:first-of-type { margin-top: 34px; }
.docs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
.docs-cards h3 { display: flex; gap: 12px; align-items: baseline; font-size: 17px; margin: 0 0 8px; }
.docs-cards p { font-size: 15px; line-height: 1.65; margin: 0; }
.docs-cards .num { color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }

@media (max-width: 1080px) {
  .docs .docs-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 44px; }
}

@media (max-width: 980px) {
  .docs .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .docs-nav { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 20px; }
  .nav-section + .nav-section { margin-top: 18px; }
  .docs-nav ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-cards { grid-template-columns: minmax(0, 1fr); }
  .docs-main h1 { font-size: 33px; }
  .docs-main h2 { font-size: 24px; }
  .onthispage { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .docs-main pre { width: 100%; margin-inline: 0; }
}

@media (max-width: 560px) {
  .docs-nav ol { grid-template-columns: minmax(0, 1fr); }
  .docs-main pre { padding: 52px 16px 18px; }
  .docs-main pre::before { padding-inline: 16px; }
  .pager { flex-direction: column; }
}

.docs-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.docs-nav::-webkit-scrollbar { width: 6px; }
.docs-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
.docs-nav::-webkit-scrollbar-track { background: transparent; }
.docs-main pre::-webkit-scrollbar { height: 8px; }
.docs-main pre::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 4px; }

/* search */

.docs-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.docs-search input {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.docs-search input::placeholder { color: var(--text-dim); }
.docs-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(47, 180, 182, 0.08);
}
.docs-search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.5); }
.docs-search kbd {
  position: absolute;
  right: 10px;
  padding: 1px 6px;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  pointer-events: none;
}
.docs-search input:focus + kbd { opacity: 0; }

.search-results { display: flex; flex-direction: column; gap: 2px; }
.search-results a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  line-height: 1.35;
}
.search-results a strong { color: var(--text); font-size: 14px; font-weight: 700; }
.search-results a span { color: var(--text-dim); font-size: 12px; }
.search-results a:hover, .search-results a.active { background: rgba(47, 180, 182, 0.14); color: var(--text); }
.search-results .no-results { color: var(--text-dim); font-size: 14px; padding: 8px 10px; margin: 0; }

/* copy button */

.docs-main pre .copy {
  position: absolute;
  top: 7px;
  right: 10px;
  z-index: 1;
  padding: 3px 10px;
  border: 1px solid var(--code-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.docs-main pre:hover .copy, .docs-main pre .copy:focus-visible { opacity: 1; }
.docs-main pre .copy:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.28); }
.docs-main pre .copy.done { opacity: 1; color: var(--accent); border-color: var(--accent); }

/* heading anchors */

.docs-main h2 .anchor, .docs-main h3 .anchor {
  margin-left: 10px;
  color: var(--text-dim);
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.docs-main h2:hover .anchor, .docs-main h3:hover .anchor,
.docs-main h2 .anchor:focus-visible, .docs-main h3 .anchor:focus-visible { opacity: 1; }
.docs-main h2 .anchor:hover, .docs-main h3 .anchor:hover { color: var(--accent); }

@media (max-width: 980px) {
  .docs-search kbd { display: none; }
}

@media (hover: none) {
  .docs-main pre .copy { opacity: 1; }
  .docs-main h2 .anchor, .docs-main h3 .anchor { opacity: 0.5; }
}
