/* The help pages (help/), on top of the website's own styles.css: the
   contents and search down the side, and the article's type. The pages
   themselves are made by scripts/build-help.mjs. */

.nav-links a[aria-current='page'] {
  color: var(--accent-text);
}

.help-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  padding-top: 48px;
  padding-bottom: 112px;
}

/* Down the side: search, then the contents. What search hides stays hidden,
   whatever display the rules below give it. */
.help-side [hidden] {
  display: none !important;
}

/* Down the side: search, then the contents. */
/* It scrolls on its own when it's taller than the window, with a slim
   scrollbar kept clear of the contents rather than across them. */
.help-side {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 0 16px 24px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-gutter: stable;
  font-size: 15px;
}

.help-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.help-search label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.help-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.help-search input:focus-visible {
  outline-offset: 1px;
}

.help-results {
  margin-bottom: 24px;
}

.help-results ol {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-results a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.help-results a:hover,
.help-results a:focus-visible {
  background: var(--surface-alt);
}

.help-results strong {
  display: block;
  font-weight: 700;
}

.help-results .where {
  display: block;
  font-size: 13px;
  color: var(--accent-text);
  font-weight: 600;
}

.help-results .snippet {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.help-results mark {
  background: var(--tint);
  color: inherit;
  border-radius: 3px;
}

.help-results p {
  color: var(--muted);
}

.help-topics-group {
  margin: 28px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.help-topics-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-topics-list a {
  display: block;
  padding: 7px 0 7px 16px;
  border-left: 2px solid var(--line);
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

.help-topics-list a:hover {
  color: var(--accent-text);
  border-left-color: var(--line-strong);
}

.help-topics-list a[aria-current='page'] {
  border-left-color: var(--red);
  color: var(--accent-text);
  font-weight: 700;
}

/* In a narrow window the contents fold away, above the article. */
.help-topics-small {
  display: none;
}

.help-topics-small summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.help-topics-small[open] summary {
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-top: 24px;
  }
  .help-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
  }
  .help-topics {
    display: none;
  }
  .help-topics-small {
    display: block;
  }
}

/* The article */
.help-article {
  max-width: 800px;
  min-width: 0;
  line-height: 1.75;
}

.breadcrumb {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.help-article h1 {
  margin-bottom: 28px;
  font-size: clamp(32px, 4.5vw, 46px);
  font-weight: 800;
}

.help-article h2 {
  margin: 64px 0 20px;
  font-size: 27px;
  font-weight: 800;
}

.help-article h3 {
  margin: 40px 0 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.help-article h2 + h3 {
  margin-top: 20px;
}

.heading-link {
  margin-left: 4px;
  color: var(--line-strong);
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
}

:is(h2, h3):hover .heading-link,
.heading-link:focus-visible {
  opacity: 1;
}

.help-article p,
.help-article ul,
.help-article ol,
.help-article pre,
.help-article blockquote,
.help-article .table-wrap {
  margin: 0 0 22px;
}

.help-article ul,
.help-article ol {
  padding-left: 1.4em;
}

.help-article li {
  margin-bottom: 10px;
}

.help-article li > ul,
.help-article li > ol,
.help-article li > p {
  margin-top: 10px;
  margin-bottom: 10px;
}

.help-article strong {
  font-weight: 700;
}

.help-article code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.86em;
  overflow-wrap: break-word;
}

.help-article pre {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  overflow-x: auto;
  line-height: 1.5;
}

.help-article pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  overflow-wrap: normal;
  white-space: pre;
}

.help-article blockquote {
  padding: 20px 24px;
  border-left: 4px solid var(--red);
  border-radius: 0 14px 14px 0;
  background: var(--tint);
}

.help-article blockquote p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.help-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.help-article th,
.help-article td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.help-article th {
  background: var(--surface-alt);
  font-weight: 700;
}

.help-article tbody tr:last-child td {
  border-bottom: 0;
}

.help-article td:first-child {
  font-weight: 600;
}

/* An article's name in a table stays on one line ("Comments and mark-up"). */
@media (min-width: 901px) {
  .help-article td:first-child a {
    white-space: nowrap;
  }
}

/* Previous and next, at the foot of each article. */
.help-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.help-pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.help-pager a:hover {
  border-color: var(--line-strong);
  background: var(--surface-alt);
}

.help-pager span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

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

@media (max-width: 560px) {
  .help-pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .help-pager-next {
    grid-column: 1;
  }
  .help-article h2 {
    font-size: 24px;
  }
}
