/* The help page (docs/plans/K16-strona-pomocy.md): a list of topics beside the text. It is
   loaded after app.css and uses its colours and typefaces, so it follows the light and the
   dark theme with the rest of the panel. On a phone the list becomes a strip of pills that
   stays at the top edge. */

.help { --measure: 56rem; }

/* MARK: The sky, with the page's title in it */
.help .sky.plain .column { padding-bottom: 2.25rem; }
.help .sky h1 { margin-top: 1.5rem; font-size: clamp(2rem, 7vw, 2.5rem); line-height: 1.1; }
.help .sky .lead { margin-top: 0.4rem; color: #E9DCEA; }

/* MARK: The list of topics */
.help-body { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); column-gap: 2.75rem; align-items: start; }
.topics { position: sticky; top: 0; padding-top: 2.25rem; }
.topics .label, .help h3 {
  font: 600 0.8125rem/1.3 "Figtree", -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
}
.topics .label { padding: 0 0.9rem; }
/* The list has a position of its own: help.js measures each link from its left edge. */
.topics ul { position: relative; list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.topics a {
  display: block; padding: 0.55rem 0.9rem; border-radius: 0.625rem;
  font-size: 0.9375rem; line-height: 1.35; text-decoration: none; color: var(--ink-soft);
}
.topics a:hover { color: var(--ink); }
/* Where the reader is: butter with aubergine ink, on paper and on night alike. */
.topics a[aria-current] { background: var(--butter); color: #2F1F2E; font-weight: 600; }

/* MARK: A topic */
.help main section { position: relative; scroll-margin-top: 0.5rem; }
/* A place inside a topic that an address may name ("#features"): it stands where the topic
   begins, so the address lands exactly where the topic's own does. */
.help main section > span[id] { position: absolute; top: 0; scroll-margin-top: 0.5rem; }
.help main section > p { max-width: 36rem; }
.head { display: flex; align-items: center; gap: 1.25rem; }
.head > div { flex: 1 1 auto; min-width: 0; }
/* The drawing of a topic, once the panel serves drawings (chapter 5 of the contract). */
.head img { flex: none; display: block; width: 7rem; height: 7rem; }
.help h2 { font-size: 1.875rem; line-height: 1.15; }
.where { margin-top: 0.45rem; font-size: 0.875rem; color: var(--ink-soft); }
.head + p { margin-top: 1.1rem; }
.help h3 { margin: 1.6rem 0 0; }
.help .note { margin-top: 0.9rem; font-size: 0.9375rem; color: var(--ink-soft); }

/* What was said, and what landed in the field. */
.example { margin-top: 1.1rem; max-width: 36rem; border: 1px solid var(--line); border-radius: 0.75rem; overflow: hidden; }
.example > div { padding: 0.75rem 1rem; }
.example .label { display: block; margin-bottom: 0.2rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.example .said { background: var(--ground-quiet); color: var(--ink-soft); font-size: 0.9375rem; }
.example .written { background: var(--butter); color: #2F1F2E; font-weight: 600; }
.example .written .label { font-weight: 600; }

/* Steps in order, each with its number in a plum disc; and points in no order. */
.steps, .points { list-style: none; margin: 0.8rem 0 0; padding: 0; max-width: 36rem; display: flex; flex-direction: column; gap: 0.6rem; }
.steps { counter-reset: step; }
.steps li, .points li { position: relative; padding-left: 2.25rem; line-height: 1.55; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.05rem;
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--action); color: var(--action-ink);
  font-size: 0.8125rem; font-weight: 600; line-height: 1;
}
.points li::before {
  content: "";
  position: absolute; left: 0.55rem; top: 0.6rem;
  width: 0.4rem; height: 0.4rem; border-radius: 50%;
  background: var(--accent);
}

/* MARK: The foot of the page */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding: 1.1rem 0 2.5rem; border-top: 1px solid var(--line); }

/* MARK: On a phone */
@media (max-width: 47.99rem) {
  .help-body { display: block; }
  .topics {
    z-index: 2; margin: 0 -1.25rem; padding: 0.7rem 0;
    background: var(--ground); border-bottom: 1px solid var(--line);
  }
  .topics .label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .topics ul { flex-direction: row; gap: 0.5rem; margin: 0; padding: 0 1.25rem; overflow-x: auto; scrollbar-width: none; }
  .topics ul::-webkit-scrollbar { display: none; }
  .topics li { flex: none; }
  .topics a { padding: 0.45rem 0.8rem; border-radius: 999px; font-size: 0.875rem; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
  .topics a[aria-current] { box-shadow: none; }
  /* The ring around the link that has the keyboard stays inside the strip, which clips. */
  .topics a:focus-visible { outline-offset: -2px; }
  /* A topic an address leads to stops below the strip, not under it. */
  .help main section, .help main section > span[id] { scroll-margin-top: 3.5rem; }
  .help main section { padding: 1.75rem 0; }
  .help h2 { font-size: 1.625rem; }
  .head img { width: 4.75rem; height: 4.75rem; }
}

/* MARK: Where colours are the reader's own, and on paper */
@media (forced-colors: active) {
  .topics a[aria-current] { outline: 2px solid; outline-offset: -2px; }
}
@media print {
  .topics, .masthead { display: none; }
  .help-body { display: block; }
  .help .sky { background: none; color: #2F1F2E; }
  .help .sky .lead { color: inherit; }
  .steps li::before { background: none; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
  .example .said, .example .written { background: none; color: inherit; }
  .help main section { break-inside: avoid; }
}
