/* Kawan docs: builds on styles.css (tokens, buttons, footer). */

.docs {
  background: var(--bg);
}

/* ---------- Top bar ---------- */

.docs-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgb(251 248 246 / 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 var(--line);
}
.docs-nav__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
  width: min(1440px, 100% - 2rem);
  margin-inline: auto;
}
.docs-nav .nav__brand {
  flex: none;
}
.docs-nav .nav__brand img {
  height: 30px;
  width: auto;
}
.docs-nav__label {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgb(59 51 213 / 0.1);
  color: var(--indigo);
  font-weight: 900;
  font-size: 0.85rem;
  text-decoration: none;
}
.docs-nav .nav__actions {
  margin-left: auto;
}

/* ---------- Search ---------- */

.docs-search {
  position: relative;
  flex: 0 1 380px;
  margin-left: 1rem;
}
.docs-search > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.docs-search input {
  width: 100%;
  height: 40px;
  padding: 0 2.5rem 0 2.3rem;
  border: 0;
  border-radius: 12px;
  background: rgb(11 17 64 / 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    background-color 0.2s,
    box-shadow 0.2s;
}
.docs-search input::placeholder {
  color: var(--ink-3);
}
.docs-search input:focus {
  outline: none;
  background: var(--surface);
  box-shadow:
    0 0 0 3px rgb(91 140 255 / 0.35),
    var(--shadow-sm);
}
.docs-search kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 0.4rem;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-3);
  font: 700 0.75rem/1.5 var(--font-body);
}
.docs-search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  border-radius: 16px;
  background: var(--surface);
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1px var(--line);
}
.docs-search__results a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  text-decoration: none;
}
.docs-search__results a:hover,
.docs-search__results a[aria-selected='true'] {
  background: rgb(59 51 213 / 0.08);
}
.docs-search__results strong {
  display: block;
  font-weight: 800;
}
.docs-search__results small {
  display: block;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.4;
}
.docs-search__results mark {
  background: rgb(91 140 255 / 0.22);
  color: inherit;
  border-radius: 3px;
}
.docs-search__empty {
  padding: 0.8rem;
  color: var(--ink-2);
  font-size: 0.92rem;
}

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

.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: clamp(1.5rem, 3vw, 3.5rem);
  width: min(1440px, 100% - 2rem);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.sidebar__desktop {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 0.5rem;
}
.sidebar__mobile {
  display: none;
}
.sidebar__group + .sidebar__group {
  margin-top: 1.6rem;
}
.sidebar__title {
  margin-bottom: 0.4rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.sidebar ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sidebar a {
  display: block;
  padding: 0.42rem 0.75rem;
  border-radius: 10px;
  color: var(--ink-2);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition:
    background-color 0.15s,
    color 0.15s;
}
.sidebar a:hover {
  background: rgb(11 17 64 / 0.05);
  color: var(--ink);
}
.sidebar a[aria-current='page'] {
  background: rgb(59 51 213 / 0.1);
  color: var(--indigo);
}

.docs-main {
  min-width: 0;
  max-width: 760px;
}

.docs-aside .toc {
  position: sticky;
  top: 88px;
}
.toc__title {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.toc ul {
  margin: 0;
  padding: 0 0 0 0.85rem;
  list-style: none;
  border-left: 2px solid var(--line);
}
.toc a {
  display: block;
  padding: 0.25rem 0;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s;
}
.toc a:hover,
.toc a.is-active {
  color: var(--indigo);
}

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

.prose {
  font-size: 1.05rem;
  line-height: 1.75;
}
.prose .kicker {
  margin-bottom: 0.4rem;
}
.prose h1 {
  font-size: clamp(2.1rem, 1.6rem + 2vw, 2.9rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.prose h1 + p {
  font-size: 1.15rem;
  color: var(--ink-2);
}
.prose h2 {
  margin: 2.6rem 0 0.8rem;
  font-size: 1.55rem;
  font-weight: 850;
}
.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.2rem;
}
.prose h2,
.prose h3 {
  position: relative;
  scroll-margin-top: 90px;
}
.prose .anchor {
  position: absolute;
  left: -1.1em;
  padding-right: 0.3em;
  color: var(--ink-3);
  font-weight: 700;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose .anchor:focus {
  opacity: 1;
}
.prose p,
.prose ul,
.prose ol,
.prose .table-wrap,
.prose blockquote {
  margin: 0 0 1.1rem;
}
.prose ul,
.prose ol {
  padding-left: 1.4rem;
}
.prose li + li {
  margin-top: 0.3rem;
}
.prose li > ul,
.prose li > ol {
  margin: 0.3rem 0 0;
}
.prose a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgb(46 85 214 / 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.prose a:hover {
  text-decoration-color: currentColor;
}
.prose strong {
  font-weight: 800;
}
.prose code,
.prose kbd {
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: rgb(11 17 64 / 0.06);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
}
.prose kbd {
  box-shadow: inset 0 -1px 0 var(--line);
}
.prose pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: var(--navy);
  color: #e8ebff;
}
.prose pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--line);
  background: var(--surface);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
}
.prose th,
.prose td {
  padding: 0.7rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.prose th {
  background: rgb(11 17 64 / 0.03);
  font-weight: 800;
}
.prose tr:last-child td {
  border-bottom: 0;
}

.prose blockquote {
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  border-left: 4px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}
.callout--tip {
  border-left-color: #34c759 !important;
  background: rgb(52 199 89 / 0.07) !important;
}
.callout--note {
  border-left-color: var(--sky) !important;
  background: rgb(91 140 255 / 0.08) !important;
}
.callout--important {
  border-left-color: #ff9500 !important;
  background: rgb(255 149 0 / 0.09) !important;
}

.docs-updated {
  margin-top: 2.5rem;
  color: var(--ink-3);
  font-size: 0.88rem;
  font-weight: 700;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.pager__link {
  display: grid;
  gap: 0.15rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: var(--surface);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--line);
  text-decoration: none;
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
.pager__link:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-md),
    inset 0 0 0 1px rgb(59 51 213 / 0.2);
}
.pager__link small {
  color: var(--ink-3);
  font-weight: 800;
  font-size: 0.8rem;
}
.pager__link span {
  color: var(--indigo);
  font-weight: 800;
}
.pager__link--next {
  text-align: right;
}

.docs .footer {
  background: rgb(255 255 255 / 0.4);
}

.prose .docs-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  border-radius: 14px;
  background: var(--navy);
  margin: 1.25rem 0 0.75rem;
}

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

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .docs-aside {
    display: none;
  }
}

@media (max-width: 820px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1rem;
  }
  .sidebar__desktop {
    display: none;
  }
  .sidebar__mobile {
    display: block;
    border-radius: 14px;
    background: var(--surface);
    box-shadow:
      var(--shadow-sm),
      inset 0 0 0 1px var(--line);
  }
  .sidebar__mobile summary {
    padding: 0.8rem 1rem;
    font-weight: 800;
    cursor: pointer;
  }
  .sidebar__mobile nav {
    padding: 0 0.5rem 1rem;
  }
  .docs-nav__home,
  .docs-search kbd {
    display: none;
  }
  .docs-search {
    margin-left: 0;
  }
  .prose .anchor {
    display: none;
  }
}

@media (max-width: 560px) {
  .docs-nav__label {
    display: none;
  }
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }
}
