/* The help page (help.html). Builds on style.css. */

.help {
  /* Graph lines: categorical slots 1–4, validated for this surface. A fifth
     line (Robo's walk has one) is neutral grey with its own dashes. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #7c768c;
  --grid: #e8e4f0;
  --axis: #b9b3c8;
  --code-bg: #efecf7;
}

@media (prefers-color-scheme: dark) {
  .help {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #8f88a3;
    --grid: #2c2739;
    --axis: #4a445c;
    --code-bg: #2a2538;
  }
}

main.guide {
  display: block;
  max-width: 880px;
  padding: 8px 24px 48px;
}

.guide section {
  margin-top: 28px;
}

.guide h2 {
  font-size: 19px;
  margin: 0 0 8px;
  scroll-margin-top: 12px;
}

.guide p,
.guide li {
  max-width: 72ch;
}

.guide li + li {
  margin-top: 6px;
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 4px;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.toc a,
.see a,
.guide a {
  color: var(--accent);
}

.see a + a {
  margin-left: 10px;
}

.table-scroll {
  overflow-x: auto;
}

.guide table {
  border-collapse: collapse;
  margin: 8px 0 4px;
  background: var(--panel);
  font-size: 14px;
}

.guide th,
.guide td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}

.guide table.numbers td:not(:first-child) {
  font-variant-numeric: tabular-nums;
}

.caption {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin-top: 4px;
}

/* ---- graphs ---------------------------------------------------------------- */

figure.graph {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 560px;
}

figure.graph figcaption {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.plot {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
}

.plot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.plot .grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.plot .axis {
  stroke: var(--axis);
  stroke-width: 1;
}

.plot .tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.plot .cursor {
  stroke: var(--muted);
  stroke-width: 1;
}

.series {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* A dash pattern for each series, so lines differ without colour too. */
.series.s1 {
  stroke: var(--series-1);
}

.series.s2 {
  stroke: var(--series-2);
  stroke-dasharray: 7 4;
}

.series.s3 {
  stroke: var(--series-3);
  stroke-dasharray: 1.5 4;
}

.series.s4 {
  stroke: var(--series-4);
  stroke-dasharray: 10 4 2 4;
}

.series.s5 {
  stroke: var(--series-5);
  stroke-dasharray: 4 3 4 7;
}

.dot {
  stroke: var(--panel);
  stroke-width: 2;
}

.dot.s1 {
  fill: var(--series-1);
}

.dot.s2 {
  fill: var(--series-2);
}

.dot.s3 {
  fill: var(--series-3);
}

.dot.s4 {
  fill: var(--series-4);
}

.dot.s5 {
  fill: var(--series-5);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.legend .key {
  width: 26px;
  height: 8px;
}

.readout {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-height: 1.45em;
}

.shapes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.shapes figure.graph {
  margin: 0;
}

@media (max-width: 720px) {
  main.guide {
    padding: 4px 16px 32px;
  }
}

/* ---- blocks list ---------------------------------------------------------- */

.block-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 10px;
  align-items: start;
}

.block-list h3 {
  grid-column: 1 / -1;
  margin: 12px 0 0;
}

.guide pre.block-code {
  max-width: 72ch;
}

/* Pictures of code (data-picture): each picture beside the code that draws it. */
.samples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.samples.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}

/* In a narrow grid cell: the picture and its caption side by side, the code under them. */
figure.code-sample {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    'picture caption'
    'code code';
  gap: 8px 10px;
  align-items: start;
  margin: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* In a wide one (the tutorial's ideas): the code beside the picture, the caption under them. */
.samples.wide figure.code-sample {
  grid-template-areas:
    'picture code'
    'caption caption';
}

figure.code-sample canvas {
  grid-area: picture;
}

figure.code-sample pre {
  grid-area: code;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--code-bg);
  font-size: 12px;
  line-height: 1.45;
  /* Short snippets: wrap, never a scroll bar. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

figure.code-sample pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

figure.code-sample figcaption {
  grid-area: caption;
  align-self: center;
  font-size: 13px;
}

/* Your first character: the steps' code, with a Copy button above each. */
pre.tutorial-code {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  max-width: 100%;
  font-size: 13px;
  line-height: 1.45;
}

pre.tutorial-code code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
}

.try {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
