/* The help's additions on top of styles.css and blog.css (backend/templates/help/, loaded after both): a
   two-column layout with the list of articles beside the article, the index page's cards, walkthrough steps,
   callouts and screenshots. On a phone the list of articles folds into a <details> above the article. */

.help-container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 48px) 24px 80px;
  box-sizing: border-box;
}

.help-home {
  max-width: 860px;
}

.help-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.help-article {
  max-width: 800px;
  min-width: 0;
}

/* ---- The list of articles ---- */
.help-nav {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  font-size: 0.95rem;
}

.help-nav-fold {
  display: none;
}

.help-nav-home {
  margin: 0 0 1rem;
  font-family: var(--font-family-header);
  font-weight: 600;
  font-size: 1.05rem;
}

.help-nav-heading {
  margin: 1.25rem 0 0.5rem;
  font-family: var(--font-family-accent);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-info);
}

.help-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--color-base-300);
}

.help-nav-list a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.9rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  line-height: 1.35;
}

.help-nav-list a:hover {
  border-left-color: var(--color-lime-300);
}

.help-nav-list a[aria-current='page'] {
  border-left-color: var(--color-primary);
  font-weight: 600;
}

/* ---- The index page ---- */
.help-header {
  margin-bottom: 2rem;
}

.help-group {
  margin-top: 2.5rem;
}

.help-group-title {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.help-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.help-card {
  position: relative;
  background: #ffffff;
  border: 2px solid var(--color-base-300);
  padding: 1.1rem 1.25rem 1.25rem;
  transition: border-color 0.2s, background-color 0.2s;
}

/* The whole card lights up: the border, the ground and the title. */
.help-card:hover,
.help-card:focus-within {
  border-color: var(--color-primary);
  background: var(--color-lime-100);
}

.help-card:hover h3 a,
.help-card:focus-within h3 a {
  color: var(--color-lime-800);
}

.help-card h3 {
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
}

/* The whole card is the link: the link's box covers the card, above the text, so the description takes the
   click and the pointing hand too. */
.help-card {
  cursor: pointer;
}

.help-card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.help-card p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* ---- On this page ---- */
.help-toc {
  margin: 0 0 2.5rem;
  padding: 0.75rem 1.25rem 1rem;
  background: var(--color-lime-50);
  border-left: 3px solid var(--color-primary);
}

.help-toc .help-nav-heading {
  margin-top: 0.25rem;
}

.help-toc ol {
  margin: 0;
  padding-left: 1.4em;
  columns: 2 220px;
  column-gap: 2rem;
}

.help-toc li {
  break-inside: avoid;
  padding: 0.15rem 0;
}

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

/* ---- The article ---- */
.help-body h2,
.help-body h3 {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

/* Walkthrough steps: an ordered list is a sequence of steps with lime numerals. */
.help-body ol {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

.help-body ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  min-height: 2rem;
}

.help-body ol > li + li {
  margin-top: 0.9em;
}

.help-body ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-base-content);
  color: var(--color-primary);
  font-family: var(--font-family-header);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}

.help-body ol[start] {
  counter-reset: none;
}

/* A list or figure inside a step keeps the step's indent, and a nested list is ordinary. */
.help-body li > figure {
  margin: 1em 0;
}

.help-body li ol,
.help-body li ul {
  margin-top: 0.5em;
}

.help-body li ol > li {
  padding-left: 2.25rem;
}

.help-body li ol > li::before {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.8rem;
  background: var(--color-base-200);
  color: var(--color-base-content);
}

/* Callouts: a blockquote opening with **Tip:**, **Note:** or **Important:**. */
.help-body blockquote {
  margin: 1.75em 0;
  padding: 0.85em 1.25em;
  border-left: 4px solid var(--color-primary);
  background: var(--color-lime-50);
  border-radius: 0 var(--radius-field) var(--radius-field) 0;
}

.help-body blockquote > * + * {
  margin-top: 0.6em;
}

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

.help-body blockquote > :last-child {
  margin-bottom: 0;
}

.help-body blockquote strong:first-child {
  font-family: var(--font-family-header);
  color: var(--color-lime-900);
}

/* Screenshots: taken at twice the pixel density, sized by their width/height attributes. */
.help-body figure {
  margin: 1.75em 0;
}

.help-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

.help-body figure img {
  border: 1px solid var(--color-base-300);
  border-radius: var(--radius-box);
  box-shadow: 0 6px 20px rgba(39, 62, 71, 0.12);
  background: #ffffff;
}

.help-body figcaption {
  margin-top: 0.75em;
  font-family: var(--font-family-accent);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-slate-500);
}

.help-body table {
  display: table;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--color-base-300);
}

.help-body th {
  background: var(--color-base-content);
  color: var(--color-base-100);
  font-family: var(--font-family-header);
  font-weight: 600;
}

.help-body tbody tr:nth-child(even) {
  background: var(--color-base-100);
}

/* Keyboard keys and console labels written as <kbd>. */
.help-body kbd {
  font-family: var(--font-family-accent);
  font-size: 0.85em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--color-base-300);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #ffffff;
}

/* ---- Previous / next ---- */
.help-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--color-base-300);
}

.help-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--color-base-300);
  background: #ffffff;
  font-family: var(--font-family-header);
  font-weight: 600;
  transition: border-color 0.2s;
}

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

.help-pager span {
  font-family: var(--font-family-accent);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-info);
}

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

/* ---- Still stuck? ---- */
.help-stuck {
  --cut: 18px;
  margin-top: 2.5rem;
  padding: 1.5rem 1.75rem;
  background: var(--color-base-content);
  color: var(--color-base-100);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.help-stuck h2 {
  color: var(--color-primary);
  font-size: 1.3rem;
  margin: 0 0 0.25rem;
}

.help-stuck p {
  margin: 0;
}

.help-stuck a:not(.help-console) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-console {
  --cut: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--color-primary);
  color: var(--color-primary-content);
  font-family: var(--font-family-header);
  font-weight: 600;
  white-space: nowrap;
}

.help-console:hover {
  color: var(--color-primary-content);
  opacity: 0.9;
}

.help-missing {
  margin-top: 1rem;
}

.help-back {
  margin-top: 2rem;
  font-family: var(--font-family-header);
  font-weight: 600;
}

/* ---- Phones and small tablets ---- */
@media (max-width: 900px) {
  .help-container {
    padding: 120px 16px 64px;
  }

  .help-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .help-nav {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .help-nav-full {
    display: none;
  }

  .help-nav-fold {
    display: block;
    border: 1px solid var(--color-base-300);
    background: #ffffff;
    padding: 0.6rem 1rem;
  }

  .help-nav-fold summary {
    cursor: pointer;
    font-family: var(--font-family-header);
    font-weight: 600;
  }

  .help-pager {
    grid-template-columns: 1fr;
  }

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

  .help-toc ol {
    columns: 1;
  }

  /* A wide table scrolls sideways inside the column instead of widening the page. */
  .help-body table {
    display: block;
    overflow-x: auto;
  }

  .help-stuck {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .help-body ol > li {
    padding-left: 2.4rem;
  }
}
