/*
 * GuestLens documentation: the sidebar and the previous/next links. Shared by
 * the offline guide and the online docs. Only the inside of the sidebar is
 * styled here; where it sits (fixed, sticky, a drawer) is up to the page.
 */
.sb {
  --sb-ink: #241c35;
  --sb-soft: #3d3450;
  --sb-muted: #756e85;
  --sb-line: #eae3d9;
  --sb-bg: #ffffff;
  --sb-hover: #f2ede5;
  --sb-brand: #c9573a;
  --sb-brand-dark: #a8432a;
  --sb-tint: #f9e8e1;
  --sb-thumb: #d9d1c4;
  --sb-thumb-hover: #a49db1;

  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sb-bg);
  font-family: inherit;
  color: var(--sb-soft);
}

.sb [hidden] {
  display: none !important;
}

/* ── Top: brand, version, close ──────────────────────────── */
.sb-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px 18px;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--sb-ink);
  text-decoration: none;
}

.sb-brand img {
  flex: none;
}

.sb-brand span {
  display: flex;
  flex-direction: column;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.sb-brand small {
  font-size: 12px;
  font-weight: 500;
  color: var(--sb-muted);
}

.sb-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sb-ink);
}

.sb-version {
  flex: none;
  margin-inline-start: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--sb-tint);
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-brand-dark);
}

/* Shown by the page only when the sidebar is a drawer. */
.sb-close {
  display: none;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--sb-line);
  border-radius: 9px;
  background: #fff;
  color: var(--sb-soft);
  cursor: pointer;
}

.sb-close svg {
  width: 18px;
  height: 18px;
}

/* ── Search ──────────────────────────────────────────────── */
.sb-search {
  position: relative;
  flex: none;
  margin: 0 14px 10px;
}

.sb-search > svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--sb-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.sb-search input {
  width: 100%;
  height: 38px;
  margin: 0;
  padding: 0 34px 0 34px;
  border: 1px solid var(--sb-line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--sb-ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.sb-search input::placeholder {
  color: #a49db1;
}

.sb-search input:focus {
  border-color: var(--sb-brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(201, 87, 58, 0.16);
}

.sb-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.sb-search kbd {
  position: absolute;
  top: 50%;
  right: 9px;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--sb-line);
  border-radius: 5px;
  background: var(--sb-bg);
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--sb-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.sb-search input:focus ~ kbd,
.sb-search input:not(:placeholder-shown) ~ kbd {
  display: none;
}

/* ── The list of pages ───────────────────────────────────── */
.sb-nav {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 6px 8px 28px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;

  /* The scrollbar stays out of sight until the pointer is over the sidebar. */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.2s ease;
}

.sb-nav:hover,
.sb-nav:focus-within {
  scrollbar-color: var(--sb-thumb) transparent;
}

.sb-nav::-webkit-scrollbar {
  width: 10px;
}

.sb-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sb-nav::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-color: transparent;
  background-clip: padding-box;
}

.sb-nav:hover::-webkit-scrollbar-thumb,
.sb-nav:focus-within::-webkit-scrollbar-thumb {
  background-color: var(--sb-thumb);
}

.sb-nav::-webkit-scrollbar-thumb:hover {
  background-color: var(--sb-thumb-hover);
}

.sb-group + .sb-group {
  margin-top: 20px;
}

.sb-label {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sb-muted);
}

.sb-list,
.sb-sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sb-item {
  margin: 1px 0;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--sb-soft);
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.sb-link:hover {
  background: var(--sb-hover);
  color: var(--sb-ink);
}

.sb-ic {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--sb-line);
  border-radius: 8px;
  background: #fff;
  color: var(--sb-muted);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.sb-ic svg {
  width: 16px;
  height: 16px;
}

.sb-link:hover .sb-ic {
  border-color: #d9d1c4;
  color: var(--sb-ink);
}

.sb-link[aria-current='page'] {
  background: var(--sb-tint);
  font-weight: 600;
  color: var(--sb-brand-dark);
}

.sb-link[aria-current='page'] .sb-ic {
  border-color: var(--sb-brand);
  background: var(--sb-brand);
  color: #fff;
}

.sb a:focus-visible,
.sb button:focus-visible {
  outline: 2px solid var(--sb-brand);
  outline-offset: 1px;
}

/*
 * Headings of a page, under its link. The list sits in .sb-fold, a one-row
 * grid: the row grows from 0fr to 1fr, so the list opens and closes smoothly
 * at its real height. The headings fade in one after the other.
 */
.sb-fold {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 0.34s cubic-bezier(0.22, 0.7, 0.2, 1),
    visibility 0s linear 0.34s;
}

.sb-item.is-open > .sb-fold {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 0.34s cubic-bezier(0.22, 0.7, 0.2, 1);
}

/* No vertical margin or padding here: it would keep a gap when closed. */
.sb-sub {
  min-height: 0;
  margin-inline-start: 24px;
  overflow: hidden;
  border-inline-start: 1px solid var(--sb-line);
}

.sb-sub li {
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.sb-sub li:first-child {
  margin-top: 4px;
}

.sb-sub li:last-child {
  margin-bottom: 10px;
}

.sb-item.is-open > .sb-fold li {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.28s ease calc(0.06s + min(var(--i, 0), 8) * 0.03s),
    transform 0.28s ease calc(0.06s + min(var(--i, 0), 8) * 0.03s);
}

.sb-sub a {
  display: block;
  margin-inline-start: -1px;
  padding: 4px 8px 4px 15px;
  border-inline-start: 2px solid transparent;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--sb-muted);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.sb-sub a:hover {
  border-inline-start-color: var(--sb-thumb-hover);
  color: var(--sb-ink);
}

.sb-sub a.is-active {
  border-inline-start-color: var(--sb-brand);
  font-weight: 500;
  color: var(--sb-brand-dark);
}

/* docs.js sets this for a moment, to put the lists in place without motion. */
.sb.is-instant .sb-fold,
.sb.is-instant .sb-sub li {
  transition: none !important;
}

/* While searching, the matching headings of every page show, without motion. */
.sb.is-searching .sb-fold {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: none;
}

.sb.is-searching .sb-sub li {
  opacity: 1;
  transform: none;
  transition: none;
}

.sb.is-searching .sb-fold:not(:has(li:not([hidden]))) {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sb-fold,
  .sb-item.is-open > .sb-fold,
  .sb-sub li,
  .sb-item.is-open > .sb-fold li {
    transition: none;
  }
}

.sb-empty {
  margin: 8px 0;
  padding: 10px;
  font-size: 14px;
  color: var(--sb-muted);
}

/* ── Bottom ──────────────────────────────────────────────── */
.sb-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--sb-line);
  font-size: 13.5px;
}

.sb-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sb-muted);
  text-decoration: none;
}

.sb-foot a:hover {
  color: var(--sb-brand-dark);
}

.sb-foot svg {
  width: 14px;
  height: 14px;
}

/* The dimmed page behind the drawer on small screens. */
.sb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(36, 28, 53, 0.45);
}

/* ── Previous / next ─────────────────────────────────────── */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid #eae3d9;
}

.pager a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid #eae3d9;
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.pager a:hover {
  border-color: #c9573a;
  box-shadow: 0 8px 24px -14px rgba(36, 28, 53, 0.3);
}

.pager span {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.pager small {
  font-size: 12.5px;
  color: #756e85;
}

.pager strong {
  font-size: 15.5px;
  line-height: 1.35;
  color: #241c35;
}

.pager svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: #c9573a;
}

.pager-next {
  grid-column: 2;
  text-align: end;
}

@media (max-width: 600px) {
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-next {
    grid-column: auto;
  }
}
