/* What the help pages add to the site's own stylesheet (site.css), which has
   the colors, fonts, icons, header, footer and long-text styles. Only what a
   long guide needs that the site's pages don't: its page header, menus,
   search, steps, callouts, tables and room to jump to a section.

   Three widths: a phone (under 860px) has a bar with All pages and search and
   folds "On this page"; a mid-size screen puts the page list on the left; a
   wide one (1200px and up) adds "On this page" as a column on the right. */

/* A jump to a section on a long page lands at once; the site's smooth scroll takes seconds here. */
html {
  scroll-behavior: auto;
}

/* The search box and its results stay hidden until the script shows them. */
.help-search[hidden],
.help-search-panel[hidden] {
  display: none;
}

/* ---------- The navy band: the site's name, then the page's title ---------- */

.help-band {
  border-top: 6px solid var(--mint);
  background: var(--navy);
}

.site-footer a {
  color: var(--on-navy);
}

.help-hero {
  background: var(--navy);
  color: var(--on-navy-muted);
}

.help-hero-text {
  grid-area: page;
  max-width: 760px;
  padding-block: var(--space-2) var(--space-12);
}

.help-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 20px;
}

.help-crumbs li + li::before {
  content: '›';
  margin-right: var(--space-2);
}

.help-crumbs a {
  color: var(--on-navy-muted);
}

.help-crumbs a:hover {
  color: var(--on-navy);
}

.help-hero h1 {
  margin-top: var(--space-3);
  color: var(--on-navy);
  font-family: var(--font-display);
  font-size: clamp(30px, 1.2vw + 25px, 40px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.help-summary {
  max-width: 62ch;
  margin-top: var(--space-3);
  font-size: 18px;
  line-height: 1.55;
}

.help-summary a,
.help-summary strong {
  color: var(--on-navy);
}

.help-updated {
  margin-top: var(--space-4);
  font-size: 14px;
  line-height: 20px;
}

/* ---------- Columns ---------- */

.help-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'page';
  column-gap: var(--space-8);
}

.help-layout {
  align-items: start;
  padding-block: var(--space-8) var(--space-12);
}

.help-page {
  grid-area: page;
  max-width: 760px;
  min-width: 0;
}

.help-side,
.help-rail {
  display: none;
}

@media (min-width: 860px) {
  .help-columns {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas: 'side page';
  }

  .help-layout {
    padding-block: var(--space-12);
  }

  /* The search box stays put; the page list under it scrolls on its own, so
     the search results can spill over the page instead of being cut off. */
  .help-side {
    display: flex;
    flex-direction: column;
    grid-area: side;
    position: sticky;
    top: var(--space-4);
    max-height: calc(100vh - 2 * var(--space-4));
  }

  .help-menu {
    min-height: 0;
    overflow-y: auto;
    /* Room for the focus ring inside the scrolling box. */
    padding: 2px;
  }

  .help-bar {
    display: none;
  }
}

@media (min-width: 1200px) {
  .help-columns {
    grid-template-columns: 220px minmax(0, 1fr) 200px;
    grid-template-areas: 'side page rail';
    column-gap: var(--space-12);
  }

  .help-rail {
    display: block;
    grid-area: rail;
    position: sticky;
    top: var(--space-4);
    max-height: calc(100vh - 2 * var(--space-4));
    overflow-y: auto;
  }

  .help-contents {
    display: none;
  }
}

/* ---------- Headings and text ---------- */

.help-page h2,
.help-page h3 {
  font-family: var(--font-display);
  font-weight: 600;
  scroll-margin-top: var(--space-4);
}

.help-page h2 {
  font-size: 26px;
  line-height: 32px;
}

.help-page h3 {
  font-size: 20px;
  line-height: 28px;
}

.help-page a {
  color: var(--blue);
  text-decoration: underline;
}

.help-page a:hover {
  color: var(--blue-strong);
}

.help-page ol ol,
.help-page ol ul,
.help-page ul ol,
.help-page ul ul {
  margin-top: var(--space-2);
}

/* ---------- Steps: numbered circles joined by a line ---------- */

.help-page ol {
  padding-left: 0;
  list-style: none;
}

.help-page ol > li {
  position: relative;
  min-height: 26px;
  padding-left: 40px;
}

/* The list's own counter, so a list that starts at 3 still shows 3. */
.help-page ol > li::before {
  content: counter(list-item);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.help-page ol > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 12.5px;
  top: 30px;
  bottom: calc(-1 * var(--space-2) + 4px);
  width: 1px;
  background: var(--line-strong);
}

/* On-screen names in a step look like the keys and buttons they name. */
.help-page ol li strong:not(.help-lead) {
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: 0.95em;
  font-weight: 600;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- The lists of sections and pages ---------- */

.help-contents {
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}

.help-contents summary {
  padding: var(--space-3) var(--space-4);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.help-contents-count {
  color: var(--ink-subtle);
  font-weight: 500;
}

.help-contents ul {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4) calc(var(--space-4) + 1.25em);
}

.help-contents li + li {
  margin-top: var(--space-1);
}

.help-toc {
  font-size: 14px;
  line-height: 20px;
}

.help-toc-title,
.help-menu-title {
  margin: 0;
  color: var(--ink);
  font-size: inherit;
  line-height: inherit;
  font-weight: 600;
}

.help-toc ul {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.help-toc a {
  display: block;
  padding: var(--space-1) 0 var(--space-1) var(--space-3);
  border-left: 2px solid var(--line);
  color: var(--ink-muted);
  text-decoration: none;
}

.help-toc a:hover {
  color: var(--blue-strong);
}

.help-toc a[aria-current] {
  border-left-color: var(--blue);
  color: var(--blue-strong);
  font-weight: 600;
}

.help-menu-group {
  margin: var(--space-4) 0 0;
  padding-inline: var(--space-2);
  color: var(--ink-subtle);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.help-menu,
.help-menu-fold {
  font-size: 15px;
  line-height: 22px;
}

.help-menu ul,
.help-menu-fold ul {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
}

.help-menu li + li,
.help-menu-fold li + li {
  margin-top: var(--space-1);
}

.help-menu a,
.help-menu-fold a {
  display: block;
  padding: var(--space-1) var(--space-2);
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
}

.help-menu a:hover,
.help-menu-fold a:hover {
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.help-menu a[aria-current='page'],
.help-menu-fold a[aria-current='page'] {
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-weight: 600;
}

/* ---------- The phone bar: All pages and search ---------- */

.help-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.help-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
}

.help-pages-fold > summary {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.help-pages-fold > summary::-webkit-details-marker {
  display: none;
}

.help-pages-fold > summary::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: var(--space-2);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.help-pages-fold[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.help-menu-fold {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--space-2) var(--gutter) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.help-menu-fold .help-menu-group:first-child {
  margin-top: var(--space-2);
}

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

.help-search {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-subtle);
}

.help-side .help-search {
  flex: none;
  margin-bottom: var(--space-4);
}

/* In the phone bar the results span the bar's full width, not just the box's. */
.help-bar .help-search {
  position: static;
}

.help-side .help-search-panel {
  right: auto;
  width: 360px;
}

.help-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

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

.help-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.help-search input::placeholder {
  color: var(--ink-subtle);
}

.help-search-panel {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: 5;
  min-width: 260px;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.help-search-status {
  padding: var(--space-2) var(--space-3);
  color: var(--ink-subtle);
  font-size: 13px;
  line-height: 18px;
}

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

.help-search-results a {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: 8px;
  text-decoration: none;
}

.help-search-results a:hover,
.help-search-results a:focus-visible {
  background: var(--blue-soft);
}

.help-result-title {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.help-result-where {
  display: block;
  color: var(--ink-subtle);
  font-size: 13px;
  line-height: 18px;
}

.help-search-results mark {
  border-radius: 2px;
  background: var(--amber-soft);
  color: inherit;
}

/* ---------- Callouts: a tip, something important, or a fix ---------- */

.help-page .callout {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--callout-line);
  border-radius: 10px;
  background: var(--callout-soft);
}

.callout-icon {
  margin-top: 3px;
  color: var(--callout-ink);
}

.callout-body > :first-child {
  margin-top: 0;
}

.help-page .callout-body > p:nth-child(2) {
  margin-top: 0;
}

.callout-label {
  color: var(--callout-ink);
  font-size: 14px;
  line-height: 22px;
  font-weight: 700;
}

.callout-tip {
  --callout-line: var(--blue);
  --callout-soft: var(--blue-soft);
  --callout-ink: var(--blue-strong);
}

.callout-important {
  --callout-line: var(--amber-line);
  --callout-soft: var(--amber-soft);
  --callout-ink: var(--amber);
}

.callout-troubleshooting {
  --callout-line: var(--rust);
  --callout-soft: var(--rust-soft);
  --callout-ink: var(--rust);
}

/* The yellow line token is dim on a dark page; its text yellow reads there. */
@media (prefers-color-scheme: dark) {
  .callout-important {
    --callout-line: var(--amber);
  }
}

/* ---------- The home page's "Where to start" cards ---------- */

.help-page .help-start {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: 0;
  list-style: none;
}

.help-page .help-start li {
  margin: 0;
}

@media (min-width: 560px) {
  .help-page .help-start {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.help-page .help-start-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  height: 100%;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink-muted);
  text-decoration: none;
}

.help-page .help-start-card:hover {
  border-color: var(--blue);
  color: var(--ink-muted);
}

.help-start-title {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.help-start-line {
  display: block;
  font-size: 15px;
  line-height: 22px;
}

/* ---------- Tables ---------- */

.table-wrap {
  margin-top: var(--space-4);
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.table-wrap th,
.table-wrap td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--line-strong);
}

/* On a phone each row is a small card, with the column's name over each value. */
@media (max-width: 599px) {
  .table-wrap {
    overflow: visible;
  }

  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap tr {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-raised);
  }

  .table-wrap tr + tr {
    margin-top: var(--space-2);
  }

  .table-wrap td {
    padding: var(--space-1) 0;
    border: 0;
  }

  .table-wrap td[data-label]:not([data-label=''])::before {
    content: attr(data-label);
    display: block;
    color: var(--ink-subtle);
    font-size: 12px;
    line-height: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
}

/* ---------- The end of a page: next and previous, and support ---------- */

.help-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-12);
}

.help-page .help-pager a {
  display: block;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
}

.help-page .help-pager a:hover {
  border-color: var(--blue);
}

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

.help-pager-label {
  display: block;
  color: var(--ink-subtle);
  font-size: 13px;
  line-height: 18px;
}

.help-pager-title {
  display: block;
  font-weight: 600;
}

.help-stuck {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-radius: 10px;
  background: var(--surface-sunken);
}

.help-page .help-stuck p {
  margin-top: 0;
}

.help-stuck-title {
  color: var(--ink);
  font-weight: 700;
}

.help-page .help-stuck-email {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- On a phone ---------- */

@media (max-width: 859px) {
  /* A jump to a section lands below the sticky bar, not under it. */
  .help-page [id] {
    scroll-margin-top: calc(56px + var(--space-4));
  }

  .help-hero-text {
    padding-block: var(--space-6) var(--space-8);
  }

  .help-summary {
    font-size: 17px;
  }

  .help-page h2 {
    font-size: 23px;
    line-height: 30px;
  }

  .help-page h3 {
    font-size: 19px;
    line-height: 26px;
  }
}

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

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

/* ---------- Pictures of the side panel ---------- */

.help-shot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
  margin: var(--space-6) 0 0;
}

.help-shot img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
