/*
 * The Help page (help.php). Everything here is on top of site.css and uses
 * its colour names, so both themes work. The only fixed colours are the
 * little pictures of label sheets: paper is always white and print is always
 * black (--sheet and --sheet-ink), as on every label preview.
 *
 *   .help-layout     the list of what's on the page, and the help beside it
 *   .help-toc        that list ("On this page")
 *   .help-section    one topic, with a hairline above it
 *   .help-causes     the three "why labels print off" cards with pictures
 *   .help-sheet      a small picture of a label sheet
 *   .help-browsers   the print settings, one card per browser or device
 *   .help-settings   "Scale: 100" rows inside those cards
 *   .help-pair       two short blocks side by side (accounts, privacy)
 */

/* ---- The page: what's on it, then the help itself ------------------------- */
.help-layout { display: grid; gap: 28px; }
.help-layout > * { min-width: 0; }
.help-body { max-width: 50rem; }

/* "On this page". On phones and tablets: a box of links at the top that wrap
   like chips. On wide screens (below): a column that stays in view. */
.help-toc { padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.help-toc-title { margin: 0 0 10px; color: var(--muted); font: 600 .75rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.help-toc ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.help-toc a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-small);
  color: var(--ink); font-size: .9rem; font-weight: 500; line-height: 1.2; text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.help-toc a:hover { border-color: var(--ink); }
@media (pointer: coarse) {
  .help-toc a { min-height: 44px; }
}

@media (min-width: 1040px) {
  .help-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 56px; align-items: start; }
  .help-toc {
    position: sticky; top: calc(var(--header-h) + 24px);
    /* As tall as the window under the header, and ending above the cookie question while that shows. */
    max-height: calc(100vh - var(--header-h) - 48px - var(--banner-space, 0px)); overflow-y: auto;
    /* The list scrolls inside itself in a short window; the room around it keeps a link's focus ring from being cut off. */
    margin: -6px; padding: 6px; border: 0; border-radius: 0; background: none;
  }
  .help-toc ol { display: block; }
  .help-toc a {
    display: flex; min-height: 34px; padding: 6px 12px;
    border: 0; border-left: 2px solid var(--line); border-radius: 0;
    color: var(--muted);
  }
  .help-toc a:hover { border-left-color: var(--field-line); color: var(--ink); }
  .help-toc a[aria-current] { border-left-color: var(--brand); background: none; color: var(--ink); font-weight: 650; }
}

/* ---- One topic --------------------------------------------------------------- */
.help-section { margin: 0; padding: 40px 0 8px; border-top: 1px solid var(--line); }
.help-section:first-child { padding-top: 0; border-top: 0; }
.help-section > h2 { margin-bottom: .6em; font-size: 1.55rem; }
.help-section h3 { margin-top: 1.5em; }
.help-section .card h3, .help-section .step-list h3 { margin-top: 0; }
.help-section li { margin-bottom: .45em; }
.help-section .step-list > li, .help-toc li { margin-bottom: 0; }
/* A plain list with a little more air than the browser's own. */
.help-list { padding-left: 1.2em; }
.help-list > li::marker { color: var(--muted); }
/* A short line that sums a topic up, set off from the text around it. */
.help-key { padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: var(--radius-small); background: var(--card); }
.help-key > :last-child { margin-bottom: 0; }

/* ---- Why labels print off: three cards, each with a picture --------------------- */
.help-causes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.help-cause { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 16px; }
.help-cause h3 { margin: 0 0 8px; }
.help-cause p { margin: 0 0 8px; font-size: .95rem; }
.help-cause p:last-child { margin-bottom: 0; }
.help-cause-word { display: block; margin-bottom: 4px; color: var(--muted); font: 600 .72rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
/* The grey "desk" the little sheet lies on, as under every label preview. */
.help-cause-picture { display: grid; place-items: center; padding: 14px; border-radius: var(--radius-small); background: var(--desk); }
/* The sheet: white paper, the labels in a pale grey, and what was printed in black on top. */
.help-sheet { display: block; width: 100%; max-width: 150px; height: auto; filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--sheet-ink) 20%, transparent)); }
.help-sheet-paper { fill: var(--sheet); }
.help-sheet-label { fill: color-mix(in srgb, var(--sheet-ink) 14%, var(--sheet)); }
.help-sheet-print { fill: none; stroke: var(--sheet-ink); stroke-width: 1.4; }
@media (max-width: 760px) {
  /* Tablets held upright: one card per row, with the picture beside the words. */
  .help-causes { grid-template-columns: minmax(0, 1fr); }
  .help-cause { flex-direction: row; align-items: flex-start; }
  .help-cause-picture { flex: none; width: 150px; }
}
@media (max-width: 560px) {
  /* Phones: the picture on top again, so the words get the full width. */
  .help-cause { flex-direction: column; align-items: stretch; }
  .help-cause-picture { width: auto; padding: 12px; }
  .help-sheet { max-width: 120px; }
}

/* ---- Print settings, one card per browser or device ------------------------------ */
.help-browsers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.help-browser { margin: 0; padding: 18px 18px 16px; }
.help-browser h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; }
.help-browser > p { margin: 0 0 10px; font-size: .95rem; }
.help-browser > p:last-child { margin-bottom: 0; }
/* The visitor's own browser: first, full width, with the accent on its edge. */
.help-browser.is-yours { grid-column: 1 / -1; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand), var(--shadow); }
@media (max-width: 700px) {
  .help-browsers { grid-template-columns: minmax(0, 1fr); }
}

/* "Scale: 100" rows. The setting's name as it reads in the print window, then what to choose. */
.help-settings { margin: 0 0 12px; }
.help-settings > div { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.help-settings > div:last-child { border-bottom: 1px solid var(--line); }
.help-settings dt { font-weight: 650; }
.help-settings dd { margin: 0; color: var(--muted); }
.help-settings dd strong { color: var(--ink); }
/* The wide card has room for the longest name ("Headers and footers") on one line. */
@media (min-width: 701px) {
  .help-browser.is-yours .help-settings > div { grid-template-columns: 11rem minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .help-settings > div { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Small pieces -------------------------------------------------------------- */
/* Two short blocks side by side: accounts and privacy. */
.help-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.help-pair > .card { margin: 0; }
.help-pair h3 { margin-top: 0; }
@media (max-width: 700px) {
  .help-pair { grid-template-columns: minmax(0, 1fr); }
}
/* The sizes table: on a phone its column headings may wrap, so the table fits without scrolling sideways. */
.help-section .table-wrap th { white-space: normal; }
/* A number that has to be read digit by digit. */
.help-code { font-family: var(--mono); font-size: .95em; white-space: nowrap; }
/* The questions: keep a long answer to a comfortable line length, and the link after it in one piece. */
.help-section .faq-list details > p { max-width: 44rem; }
.help-section .faq-list a { white-space: nowrap; }

@media print {
  .help-layout { display: block; }
  .help-section { padding-top: 20px; }
  .help-cause, .help-browser { break-inside: avoid; }
}
