.fr-doc {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.fr-toc {
  position: sticky;
  top: .75rem;
  padding: .5rem;
}

.fr-toc__head {
  padding: .5rem .625rem .75rem;
  font-family: var(--font-heading);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--stone-400);
}

.fr-toc__item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .4375rem .625rem;
  font-family: var(--font-heading);
  font-size: .78125rem;
  font-weight: 600;
  color: var(--stone-500);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.fr-toc__item:hover {
  color: var(--stone-900);
  background: var(--ivory);
}

.fr-toc__num {
  font-family: var(--font-mono);
  font-size: .625rem;
  font-weight: 700;
  color: var(--stone-300);
  transition: color var(--transition-fast);
}

.fr-toc__item.is-active {
  color: var(--gold);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--gold) 12%, var(--white)) 0%,
    color-mix(in srgb, var(--gold) 4%, transparent) 100%);
}

.fr-toc__item.is-active .fr-toc__num {
  color: var(--gold);
}

.fr-toc__item.is-active:before {
  content: "";
  position: absolute;
  top: .3125rem;
  bottom: .3125rem;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--gold), color-mix(in srgb, var(--gold) 25%, transparent));
}

.fr-dochead {
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--stone-200);
}

.fr-dochead__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--stone-900);
}

.fr-dochead__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .1875rem .75rem;
  margin-top: .625rem;
  font-size: .6875rem;
  color: var(--stone-400);
}

.fr-dochead__meta b {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--stone-600);
}

.fr-dochead__lead {
  margin: 1rem 0 0;
  font-size: .875rem;
  line-height: 1.65;
  color: var(--stone-600);
}

.fr-sec {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--stone-100);
  scroll-margin-top: 1rem;
}

.fr-sec:last-child {
  border-bottom: none;
}

.fr-sec__title {
  display: flex;
  align-items: baseline;
  gap: .625rem;
  margin: 0 0 1rem;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--stone-900);
}

.fr-sec__num {
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 700;
  color: var(--gold);
}

.fr-sec p {
  margin: 0 0 .875rem;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--stone-600);
}

.fr-sec p:last-child {
  margin-bottom: 0;
}

.fr-sec a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: rgb(var(--gold-rgb) / .35);
  text-underline-offset: .1875rem;
}

.fr-call {
  display: flex;
  gap: .75rem;
  margin: 1rem 0;
  padding: .875rem 1rem;
  background: linear-gradient(180deg, var(--white) 0%, var(--ivory) 100%);
  border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: 0 0 0 1px var(--stone-200);
}

.fr-call svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: .1875rem;
  color: var(--gold);
}

.fr-call__body {
  min-width: 0;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--stone-600);
}

.fr-call__body b {
  display: block;
  margin-bottom: .1875rem;
  font-family: var(--font-heading);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--stone-400);
}

.fr-call--danger {
  border-left-color: var(--red);
}

.fr-call--danger svg {
  color: var(--red);
}

.fr-table {
  width: 100%;
  margin: 1rem 0 0;
  border-collapse: collapse;
  font-size: .8125rem;
}

.fr-table th {
  padding: .5rem .625rem;
  font-family: var(--font-heading);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--stone-400);
  border-bottom: 1px solid var(--stone-200);
}

.fr-table td {
  padding: .625rem;
  color: var(--stone-600);
  border-bottom: 1px dashed var(--stone-200);
}

.fr-table tr:last-child td {
  border-bottom: none;
}

.fr-table td:first-child {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--stone-800);
}

.fr-table td:last-child,
.fr-table th:last-child {
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.fr-docfoot {
  padding: 1.25rem 1.75rem;
  background: linear-gradient(180deg, transparent 0%, var(--ivory) 100%);
  border-top: 1px solid var(--stone-200);
}

.fr-docfoot p {
  margin: 0 0 .875rem;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--stone-500);
}

.fr-up {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--gold);
  background: linear-gradient(180deg, var(--white) 0%, var(--bone) 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--has-border-inset, #fff),
    0 0 0 1px rgb(var(--gold-rgb) / .4),
    0 8px 24px #00000026;
  transition: transform .2s cubic-bezier(.16, 1, .3, 1), box-shadow var(--transition-base);
}

.fr-up:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 var(--has-border-inset, #fff),
    0 0 0 1px rgb(var(--gold-rgb) / .7),
    0 12px 28px rgb(var(--gold-rgb) / .25);
}

.fr-up svg {
  width: 1.125rem;
  height: 1.125rem;
}

[data-theme="dark"] .fr-dochead,
[data-theme="dark"] .fr-sec,
[data-theme="dark"] .fr-docfoot,
[data-theme="dark"] .fr-table th,
[data-theme="dark"] .fr-table td {
  border-color: var(--stone-200);
}

[data-theme="dark"] .fr-docfoot {
  background: var(--ivory);
}

[data-theme="dark"] .fr-toc__item:hover {
  background: var(--parchment);
}

[data-theme="dark"] .fr-call,
[data-theme="dark"] .fr-up {
  background: linear-gradient(180deg, var(--parchment) 0%, var(--ivory) 100%);
  box-shadow: inset 0 1px 0 #ffffff0f, 0 0 0 1px var(--stone-300);
}

[data-theme="dark"] .fr-call {
  border-left: 2px solid var(--gold);
}

[data-theme="dark"] .fr-call--danger {
  border-left-color: var(--red);
}

[data-theme="dark"] .fr-up {
  box-shadow: inset 0 1px 0 #ffffff0f,
    0 0 0 1px rgb(var(--gold-rgb) / .4),
    0 8px 24px #00000059;
}

@media (max-width: 64rem) {
  .fr-doc {
    grid-template-columns: minmax(0, 1fr);
  }
  .fr-toc {
    position: static;
    display: flex;
    gap: .125rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .fr-toc::-webkit-scrollbar {
    display: none;
  }
  .fr-toc__head {
    display: none;
  }
  .fr-toc__item {
    flex-shrink: 0;
  }
  .fr-toc__item.is-active:before {
    display: none;
  }
}

@media (max-width: 40rem) {
  .fr-dochead,
  .fr-sec,
  .fr-docfoot {
    padding-left: 1.125rem;
    padding-right: 1.125rem;
  }
  .fr-dochead__title {
    font-size: 1.25rem;
  }
  .fr-table {
    display: block;
    overflow-x: auto;
  }
  .fr-up {
    right: .75rem;
    bottom: .75rem;
  }
}
