/* ─────────────────────────────────────────────────────────────────────────
   About as the site's one docs page. docs.js builds the sidebar; the page
   opts in with <body class="docs">. On wide screens the sidebar is fixed on
   the left and the top bar runs full width beside it; below 1024px the
   floating bar comes back and the sidebar sits at the top of the page as a
   contents card. Colours are the clean theme's tokens, so night mode follows.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --docs-side: 272px;
  --docs-bar: 64px;
}

html:has(body.docs) {
  scroll-padding-top: 84px;
}

.docs-side [hidden] {
  display: none !important;
}

.docs-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── The sidebar ── */

.docs-side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--docs-side);
  display: flex;
  flex-direction: column;
  background: var(--page);
  border-right: 1px solid var(--line);
  text-align: left;
}

.docs-top {
  display: flex;
  align-items: center;
  height: var(--docs-bar);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.docs-top .brand {
  text-decoration: none;
}

.docs-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 16px 14px 6px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-faint);
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.docs-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.docs-search .docs-icon {
  width: 16px;
  height: 16px;
}

.docs-search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
  color: var(--ink);
  font: 400 14px/1 var(--font-body);
}

.docs-search input::placeholder {
  color: var(--ink-faint);
}

.docs-search input::-webkit-search-cancel-button {
  display: none;
}

.docs-search kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-deep);
  color: var(--ink-faint);
  font: 500 11px/1 var(--font-body);
  white-space: nowrap;
}

.docs-nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 14px 28px;
  scrollbar-width: thin;
}

.docs-group + .docs-group {
  margin-top: 6px;
}

.docs-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: 600 14px/1.2 var(--font-display);
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
}

.docs-group-head:hover {
  background: var(--paper-deep);
}

.docs-group-head .docs-icon {
  color: var(--ink-soft);
}

.docs-group-head .docs-icon:last-child {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--ink-faint);
  transition: transform 0.15s ease;
}

.docs-group-head[aria-expanded="false"] .docs-icon:last-child {
  transform: rotate(-90deg);
}

.docs-list,
.docs-toc {
  display: grid;
  gap: 1px;
  margin: 2px 0 8px 19px;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--line);
  list-style: none;
}

.docs-toc {
  margin: 2px 0 6px 10px;
}

.docs-list a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font: 400 14px/1.35 var(--font-body);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.docs-list a:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.docs-list > li > a[aria-current] {
  background: var(--paper-deep);
  color: var(--ink);
  font-weight: 600;
}

.docs-toc a {
  padding: 5px 10px;
  font-size: 13px;
}

.docs-toc a.is-here {
  color: var(--accent-deep);
  font-weight: 500;
}

.docs-empty {
  margin: 8px 10px;
  color: var(--ink-faint);
  font-size: 13px;
}

.docs-empty a {
  color: var(--accent-deep);
}

/* ── The top bar: the section's name on the left ── */

.docs-here {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: 600 16px/1 var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.docs-here .docs-icon {
  width: 20px;
  height: 20px;
  color: var(--ink-soft);
}

/* ── The sections below About's own ── */

.doc-more {
  width: min(860px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 6vh;
}

.doc-sec {
  display: grid;
  justify-items: center;
  margin-top: 0;
  padding-top: 96px;
  text-align: center;
}

.doc-sec .kicker {
  margin-bottom: 14px;
}

.doc-from,
.doc-card {
  width: 100%;
  margin-top: 28px;
  text-align: left;
}

.doc-from > .about-lede,
.doc-from > .fine {
  margin-inline: auto;
  text-align: center;
}

.doc-card {
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  color: var(--ink-soft);
}

.doc-card + .doc-card {
  margin-top: 16px;
}

.doc-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font: 700 19px/1.25 var(--font-display);
  letter-spacing: -0.01em;
}

.doc-card h2 {
  margin: 22px 0 8px;
  color: var(--ink);
  font: 700 15px/1.3 var(--font-display);
}

.doc-card p,
.doc-card li {
  font-size: 15px;
  line-height: 1.6;
}

.doc-card p {
  margin: 0 0 10px;
}

.doc-card ol,
.doc-card ul {
  margin: 8px 0 0;
  padding-left: 1.3em;
}

.doc-card li + li {
  margin-top: 6px;
}

.doc-card strong {
  color: var(--ink);
}

.doc-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--paper-deep);
  color: var(--ink);
  font: 13px var(--font-mono);
  overflow-wrap: anywhere;
}

.doc-actions,
.doc-card .mac-actions,
.doc-card .lx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 6px;
}

.doc-card .buy {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  text-decoration: none;
}

.doc-card .btn-quiet {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}

.doc-card .btn-quiet:hover {
  background: var(--paper-deep);
}

.doc-card .mac-note,
.doc-card .lx-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
  font-size: 14px;
}

.doc-from.faq {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 28px 0 0;
  padding: 0;
  content-visibility: visible;
  justify-items: stretch;
}

/* Five plan cards: three and two in the column, one row when there is room. */
#pricing .pl-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media (min-width: 1400px) {
  #pricing .doc-from {
    --wide: min(1120px, calc(100vw - var(--docs-side) - 64px));
    justify-self: start;
    width: var(--wide);
    margin-left: calc((100% - var(--wide)) / 2);
  }

  #pricing .pl-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.doc-fallback a {
  color: var(--accent-deep);
  font-weight: 600;
}

/* ── Wide screens: sidebar fixed, top bar beside it ── */

@media (min-width: 1024px) {
  body.docs .nav,
  body.docs .nav.has-menu,
  body.docs .nav.has-menu.is-scrolled {
    inset: 0 0 auto var(--docs-side);
    width: auto;
    max-width: none;
    height: var(--docs-bar);
    margin: 0;
    padding: 0 20px 0 32px;
    justify-content: flex-start;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    background: color-mix(in srgb, var(--page) 88%, transparent);
  }

  body.docs .nav .nav-left {
    margin-right: auto;
  }

  body.docs .nav .brand {
    display: none;
  }

  body.docs .docs-here {
    display: inline-flex;
  }

  body.docs main,
  body.docs .site-foot {
    margin-left: var(--docs-side);
  }
}

/* ── Narrow screens: the sidebar is a contents card at the top ── */

@media (max-width: 1023px) {
  .docs-side {
    position: static;
    width: min(860px, calc(100% - 32px));
    margin: 88px auto 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
  }

  .docs-top,
  .docs-toc,
  .docs-search kbd {
    display: none !important;
  }

  .docs-search {
    margin: 14px 14px 4px;
  }

  .docs-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 4px 12px;
    padding: 8px 10px 14px;
    overflow: visible;
  }

  .docs-group + .docs-group {
    margin-top: 0;
  }

  .docs-empty {
    grid-column: 1 / -1;
  }

  body.docs .docs-side + .about {
    padding-top: 56px;
  }
}

@media (max-width: 480px) {
  .docs-nav {
    gap: 2px 6px;
    padding: 6px 6px 12px;
  }

  .docs-group-head {
    gap: 8px;
    padding: 8px 6px;
  }

  .docs-list {
    margin-left: 14px;
    padding-left: 6px;
  }

  .docs-list a {
    padding: 6px 8px;
    font-size: 13.5px;
  }
}

@media (max-width: 330px) {
  .docs-nav {
    grid-template-columns: 1fr;
  }
}
