/* Testing guide (/guide/): table of contents, numbered steps, formula line and byline.
   Loaded before style.css, so every rule here is more specific than the .prose rule it adjusts. */

.prose h2[id],
.prose li[id] {
  scroll-margin-top: 128px;
}

.prose .toc {
  margin: 4px 0 24px;
  padding: 14px 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.prose .toc__title {
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--text);
}

.prose .toc ol {
  margin: 0;
  padding-left: 1.5em;
  columns: 2;
  column-gap: 32px;
}

.prose .toc li {
  margin: 2px 0;
  break-inside: avoid;
}

.prose .toc a {
  color: var(--text-2);
  text-decoration: none;
}

.prose .toc a:hover,
.prose .toc a:focus-visible {
  color: var(--down);
  text-decoration: underline;
}

.prose ol.steps {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 18px;
  counter-reset: step;
}

.prose ol.steps > li {
  position: relative;
  counter-increment: step;
  margin: 0;
  padding: 0 0 16px 44px;
}

.prose ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--down);
  color: #fff;
  font-family: var(--font-num);
  font-weight: 600;
  font-size: 15px;
  line-height: 28px;
  text-align: center;
}

/* A thin line joins the step numbers. */
.prose ol.steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13.5px;
  top: 34px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}

.prose .steps__name {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.prose tbody th {
  background: none;
  color: var(--text);
  white-space: normal;
  min-width: 6em;
}

/* Two-group comparison: a narrow label column and two equal columns that wrap, so it never needs
   a sideways scroll, even at phone width. */
.prose table.compare {
  table-layout: fixed;
}

.prose table.compare th:first-child {
  width: 6.5em;
}

.prose table.compare td {
  overflow-wrap: break-word;
}

.prose .formula {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-weight: 600;
  text-align: center;
}

.prose .article-meta {
  margin: 28px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13.5px;
}

@media (max-width: 640px) {
  .prose .toc ol {
    columns: 1;
  }
  .prose table th,
  .prose table td {
    padding: 8px 7px;
  }
  .prose table thead th,
  .prose table thead th.num {
    white-space: normal;
  }
  .prose table.compare th:first-child {
    width: 5.4em;
  }
  .prose h2[id],
  .prose li[id] {
    scroll-margin-top: 16px;
  }
}
