/* Behind the Math: section pills + readable prose */

.btm-head .page-sub {
  max-width: 40rem;
}

.btm-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.22rem;
  margin: 0 0 1rem;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}

.btm-tabs__tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0.42rem 1.05rem;
  border-radius: 999px;
  text-decoration: none;
  line-height: 1.2;
}

.btm-tabs__tab:hover {
  color: var(--ink);
}

.btm-tabs__tab.is-active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 2px color-mix(in srgb, #000 12%, transparent);
}

.btm-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1.25rem;
  font-size: 0.86rem;
}

.btm-jump a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.btm-jump a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.btm-prose h2 {
  margin-top: 1.75rem;
}

.btm-prose h2:first-child {
  margin-top: 0;
}

.btm-prose h3 {
  margin-top: 1.15rem;
}

.btm-prose .formula {
  margin: 0.75rem 0;
}

/* Formulas catalog: name, one-line what, then the equation */
.btm-formulas__lead {
  margin: 0 0 0.85rem;
  max-width: 42rem;
}

.btm-formulas h2 {
  margin: 1.75rem 0 0.85rem;
  font-size: 1.15rem;
}

.btm-formulas h2:first-of-type {
  margin-top: 0.35rem;
}

.btm-fx {
  padding: 0.85rem 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.btm-fx:last-of-type {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.btm-fx__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 0.2rem;
}

.btm-fx__what {
  font-size: 0.88rem;
  color: var(--ink-2);
  margin: 0 0 0.45rem;
  max-width: 44rem;
}

.btm-fx__eq {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 0.45rem;
  background: color-mix(in srgb, var(--bg-2) 88%, var(--accent) 4%);
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--ink);
}

.btm-formulas__foot {
  margin-top: 1.5rem;
}

.btm-formulas__foot code {
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .btm-tabs {
    width: 100%;
    display: flex;
  }

  .btm-tabs__tab {
    flex: 1 1 auto;
    text-align: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    font-size: 0.8rem;
  }
}
