/* The help pages at /docs. Loaded after landing.css, whose tokens, buttons and wordmark these
   pages share; everything here is the docs' own layout and prose. */

/* landing.css hides horizontal overflow on html and body, which makes body a scroll container
   and stops the sidebar sticking. `clip` hides it the same way without scrolling anything. */
html:has(.docs-body),
.docs-body {
  overflow-x: clip;
}
.docs-body {
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.005em;
}
html:has(.docs-body) {
  scroll-padding-top: 88px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
}
.skip-link:focus {
  top: 12px;
}

/* ---- Top bar ---- */
.docs-nav {
  position: sticky;
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--line-2);
}
.docs-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding-inline: clamp(16px, 3vw, 32px);
}
.docs-nav__left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.docs-nav__label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.docs-nav__label:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}
.docs-nav .btn {
  padding: 10px 18px;
  font-size: 14px;
}
.docs-nav .nav__signin {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
}

/* ---- Three columns: contents, the page, "On this page" ---- */
.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1320px;
  margin-inline: auto;
}
.docs-sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 28px 16px 48px clamp(16px, 3vw, 32px);
  border-right: 1px solid var(--line-2);
  scrollbar-width: thin;
}
.docs-main {
  display: grid;
  grid-template-columns: minmax(0, 740px) 200px;
  justify-content: center;
  gap: 56px;
  padding: 40px clamp(16px, 4vw, 56px) 80px;
}

.docs-nav-list__group + .docs-nav-list__group {
  margin-top: 22px;
}
.docs-nav-list__heading {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 6px 10px;
}
.docs-nav-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink-2);
}
.docs-nav-list a:hover {
  color: var(--ink);
  background: var(--bg-2);
}
.docs-nav-list a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}
.docs-nav-list__premium {
  font-size: 11px;
  color: var(--accent);
}

/* On a phone the contents fold into a disclosure above the page. */
.docs-menu {
  display: none;
}

/* ---- The article ---- */
.doc {
  min-width: 0;
}
.doc__section {
  margin-bottom: 14px;
}
.doc__title {
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: 1.08;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.doc__badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent-ink);
  background: color-mix(in oklch, var(--accent) 22%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 45%, transparent);
}
.doc__badge--small {
  font-size: 10px;
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: 2px;
}
.doc__lede {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* A legal page's effective date (`pages/legal.ejs`). */
.doc__updated {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
}

.doc__body {
  margin-top: 28px;
}
.doc__body > * + * {
  margin-top: 16px;
}
.doc__body h2,
.doc-overview h2 {
  font-size: 26px;
  line-height: 1.2;
  margin-top: 48px;
  padding-top: 8px;
}
.doc__body h3 {
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-top: 32px;
}
.doc__body h4 {
  font-size: 16px;
  line-height: 1.4;
  margin-top: 24px;
}
.doc__body h2 + *,
.doc__body h3 + *,
.doc__body h4 + * {
  margin-top: 10px;
}
.doc-anchor {
  color: inherit;
}
.doc-anchor:hover::after {
  content: " #";
  color: var(--ink-3);
}
.doc__body p,
.doc__body li {
  color: var(--ink-2);
}
.doc__body strong {
  color: var(--ink);
  font-weight: 700;
}
.doc__body a:not(.doc-anchor) {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.doc__body a:not(.doc-anchor):hover {
  text-decoration-thickness: 2px;
}
.doc__body ul,
.doc__body ol {
  padding-left: 22px;
}
.doc__body li + li {
  margin-top: 6px;
}
.doc__body li > ul,
.doc__body li > ol {
  margin-top: 6px;
}
.doc__body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin-block: 40px;
}
.doc__body img {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}

.doc__body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  /* landing.css keeps its inline code on one line; in prose a long attribute has to wrap. */
  white-space: normal;
  overflow-wrap: anywhere;
}
.doc__body pre {
  padding: 16px 18px;
  border-radius: var(--r-sm);
  background: var(--dk-bg-2);
  border: 1px solid var(--line);
  color: var(--dk-ink);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.doc__body pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.doc__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.doc__body th,
.doc__body td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
}
.doc__body th {
  font-weight: 700;
  color: var(--ink);
  background: var(--bg-2);
}
.doc__body tr:last-child td {
  border-bottom: 0;
}
.doc__body td {
  color: var(--ink-2);
}

.doc__body blockquote {
  margin-inline: 0;
  padding-left: 16px;
  border-left: 3px solid var(--line);
}
.callout {
  padding: 14px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.callout p {
  margin: 0;
}
.callout p + p {
  margin-top: 8px;
}
.callout__label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.callout--tip {
  border-color: color-mix(in oklch, var(--brand) 35%, transparent);
  background: color-mix(in oklch, var(--brand) 7%, var(--bg));
}
.callout--tip .callout__label {
  color: var(--brand);
}
.callout--premium {
  border-color: color-mix(in oklch, var(--accent) 45%, transparent);
  background: color-mix(in oklch, var(--accent) 9%, var(--bg));
}
.callout--premium .callout__label {
  color: var(--accent-ink);
}
.callout--warning {
  border-color: color-mix(in oklch, oklch(0.62 0.19 28) 45%, transparent);
  background: color-mix(in oklch, oklch(0.62 0.19 28) 7%, var(--bg));
}
.callout--warning .callout__label {
  color: oklch(0.58 0.19 28);
}

/* ---- Cards: a section's pages, or the question types ---- */
.doc-cards {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.doc-overview h2 + .doc-cards {
  margin-top: 14px;
}
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition:
    border-color 0.2s,
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
.doc-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.doc-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.doc-card__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ---- Previous / next ---- */
.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line-2);
}
.doc-pager__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.doc-pager__link:hover {
  border-color: var(--brand);
}
.doc-pager__link--next {
  text-align: right;
  grid-column: 2;
}
.doc-pager__dir {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.doc-pager__title {
  font-weight: 600;
  color: var(--ink);
}

/* ---- On this page ---- */
.docs-toc {
  position: sticky;
  top: 104px;
  align-self: start;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
  font-size: 13.5px;
}
.docs-toc__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.docs-toc a {
  display: block;
  padding: 4px 0 4px 12px;
  line-height: 1.4;
  color: var(--ink-3);
}
.docs-toc a:hover {
  color: var(--ink);
}

.docs-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px clamp(16px, 3vw, 32px);
  border-top: 1px solid var(--line-2);
  font-size: 14px;
  color: var(--ink-3);
}
.docs-footer a:hover {
  color: var(--ink);
}

/* ---- Narrower screens ---- */
@media (max-width: 1200px) {
  .docs-main {
    grid-template-columns: minmax(0, 760px);
  }
  .docs-toc {
    display: none;
  }
}
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .docs-sidebar,
  .docs-nav__links,
  .docs-nav .nav__signin {
    display: none;
  }
  .docs-menu {
    display: block;
    position: sticky;
    top: 64px;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--line-2);
  }
  .docs-menu > summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    font-size: 15px;
  }
  .docs-menu > summary::-webkit-details-marker {
    display: none;
  }
  .docs-menu > summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--ink-3);
  }
  .docs-menu[open] > summary::after {
    content: "▴";
  }
  .docs-menu__section {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
  }
  .docs-menu__title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .docs-menu .docs-nav-list {
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    padding: 4px 8px 20px;
  }
  .docs-main {
    padding: 28px 16px 64px;
  }
}
/* landing.css hides the sign-up button on a phone behind its burger menu, which the docs don't
   have, so it stays. */
@media (max-width: 720px) {
  .docs-nav .nav__right > .btn {
    display: inline-flex;
  }
}
@media (max-width: 520px) {
  .docs-nav__inner {
    padding-inline: 16px;
  }
  .docs-nav .brand__name {
    display: none;
  }
  .doc__lede {
    font-size: 17px;
  }
  .doc-pager {
    grid-template-columns: 1fr;
  }
  .doc-pager__link--next {
    grid-column: 1;
  }
}
