/* The how-to page: a list of steps beside the guide itself. */
.howto {
  padding-top: calc(var(--header-height) + clamp(2.5rem, 1.5rem + 4vw, 5rem));
}

.howto__head h1 {
  max-width: 16ch;
  font-size: clamp(2.6rem, 1.4rem + 4.6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.02em;
}

.howto__lede {
  max-width: 38rem;
  margin-top: 1.5rem;
  font-size: var(--text-lede);
}

.howto__layout {
  display: grid;
  gap: 3rem;
  margin-top: var(--space-block);
}

/* ---------- The list of steps ---------- */

.toc {
  font-size: var(--text-small);
}

.toc ol {
  --row: 2.1rem;
  --at: 0;
  position: relative;
  counter-reset: step;
  padding-left: 1.5rem;
}

.toc li {
  height: var(--row);
  counter-increment: step;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.toc > p a {
  display: inline;
  padding-left: 1.5rem;
}

/* SceneMill's playhead, lying on its side: it travels down the list to the
   step being read, as the one in the timeline travels along the clips. */
.toc ol::before {
  content: "";
  position: absolute;
  top: calc((var(--row) - 0.85rem) / 2);
  left: 0;
  width: 0.75rem;
  height: 0.85rem;
  background: var(--accent);
  clip-path: polygon(0 0, 50% 0, 100% 50%, 50% 100%, 0 100%);
  opacity: 0;
  transform: translateY(calc(var(--at) * var(--row)));
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), opacity var(--duration-fast) ease;
}

.toc ol:has(a[aria-current="true"])::before {
  opacity: 1;
}

.toc ol:has(li:nth-child(2) a[aria-current="true"]) { --at: 1; }
.toc ol:has(li:nth-child(3) a[aria-current="true"]) { --at: 2; }
.toc ol:has(li:nth-child(4) a[aria-current="true"]) { --at: 3; }
.toc ol:has(li:nth-child(5) a[aria-current="true"]) { --at: 4; }
.toc ol:has(li:nth-child(6) a[aria-current="true"]) { --at: 5; }
.toc ol:has(li:nth-child(7) a[aria-current="true"]) { --at: 6; }
.toc ol:has(li:nth-child(8) a[aria-current="true"]) { --at: 7; }
.toc ol:has(li:nth-child(9) a[aria-current="true"]) { --at: 8; }
.toc ol:has(li:nth-child(10) a[aria-current="true"]) { --at: 9; }

@media (prefers-reduced-motion: reduce) {
  .toc ol::before {
    transition: none;
  }
}

.toc ol a::before {
  content: counter(step);
  min-width: 1.2em;
  font-variant-numeric: tabular-nums;
}

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

.toc a[aria-current="true"] {
  color: var(--text);
}

.toc > p {
  margin-top: 1rem;
}

@media (min-width: 1100px) {
  .howto__layout {
    grid-template-columns: 15rem minmax(0, 54rem);
    gap: 5rem;
  }

  .toc {
    position: sticky;
    top: calc(var(--header-height) + 2.5rem);
    align-self: start;
  }
}

/* ---------- The steps ---------- */

.step {
  position: relative;
  padding-bottom: clamp(3rem, 2rem + 4vw, 5.5rem);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.step + .step {
  padding-top: clamp(3rem, 2rem + 4vw, 5.5rem);
  border-top: 1px solid var(--border);
}

.step__number {
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.step h2 {
  font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem);
  line-height: 1.05;
}

.step > p:not(.step__number),
.step > ul {
  max-width: 44rem;
  margin-top: 1.25rem;
}

.step b {
  color: var(--text);
  font-weight: 600;
}

.step .shot {
  margin: 2rem 0 0;
}

.step .shot img {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-window);
  background: var(--panel);
  box-shadow: var(--shadow-window);
}

.shot--narrow {
  max-width: 40rem;
}

.step figcaption {
  margin-top: 0.9rem;
  font-size: var(--text-small);
  color: var(--text-muted);
}

.ticks {
  display: grid;
  gap: 0.7rem;
  font-size: var(--text-small);
  color: var(--text-soft);
}

.ticks li {
  position: relative;
  padding-left: 1.5rem;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.5em;
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid var(--accent);
  transform: rotate(45deg);
}

.text-link {
  color: var(--accent);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

.text-link:hover {
  color: var(--accent-hover);
}

/* A key, drawn like one. */
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-small);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85em;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
}

/* ---------- Keyboard shortcuts ---------- */

.keys {
  display: grid;
  gap: 2.5rem 3rem;
  margin-top: 2rem;
}

@media (min-width: 700px) {
  .keys {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.keys table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}

.keys caption {
  padding-bottom: 0.6rem;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}

.keys th,
.keys td {
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.keys th {
  width: 48%;
  padding-right: 1rem;
  font-weight: 400;
  white-space: nowrap;
}

.keys td {
  color: var(--text-soft);
}

.howto__end {
  padding-top: 1rem;
}

/* Steps rise into place like the sections of the home page. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
