.document {
  display: grid;
  grid-template-columns: minmax(0, var(--width-text));
  justify-content: center;
  padding: var(--space-8) var(--gutter) var(--space-16);
}

.document__updated {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.document__toc {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.document__toc-list {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: var(--space-6);
}

.document__toc-list a {
  display: block;
  padding-block: var(--space-2);
  overflow-wrap: anywhere;
}

.document__section {
  margin-top: var(--space-10);
  scroll-margin-top: var(--space-6);
}

.document__section h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
}

:where(.document__section) p {
  margin-top: var(--space-4);
  font-size: var(--font-size-lg);
  line-height: 1.6;
}

:where(.document__section) ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-left: var(--space-6);
  font-size: var(--font-size-lg);
  line-height: 1.6;
}

:where(.document__section) li > ul,
:where(.document__section) li > p {
  margin-top: var(--space-2);
}

:where(.document__section) a {
  overflow-wrap: anywhere;
}

.document__archive a {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit-min);
}

.document__notice {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  line-height: var(--line-height-base);
}

.document__notice a {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit-min);
  font-weight: var(--font-weight-semibold);
}

.document__scroll {
  max-width: 100%;
  margin-top: var(--space-4);
  overflow-x: auto;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.document__table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

.document__table th,
.document__table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  text-align: left;
  vertical-align: top;
}

.document__table th {
  background: var(--color-surface-2);
  font-weight: var(--font-weight-semibold);
}

.document__table tr:last-child td {
  border-bottom: 0;
}

@media (min-width: 1024px) {
  .document {
    grid-template-columns: minmax(0, var(--width-text)) 16rem;
    column-gap: var(--space-12);
  }

  .document__header,
  .document__body {
    grid-column: 1;
  }

  .document__toc {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: var(--space-6);
    align-self: start;
    max-height: calc(100dvh - 2 * var(--space-6));
    margin-top: 0;
    overflow-y: auto;
  }

  .document__toc-list a {
    min-height: 0;
    padding: var(--space-1) 0;
  }
}

@media (max-width: 639px) {
  .document__scroll {
    overflow-x: visible;
    border: 0;
  }

  .document__table {
    min-width: 0;
  }

  .document__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .document__table tr {
    display: block;
    margin-bottom: var(--space-3);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
  }

  .document__table td {
    display: block;
    padding: var(--space-2) var(--space-4);
    border-bottom: 0;
  }

  .document__table td:first-child {
    padding-top: var(--space-3);
    font-weight: var(--font-weight-semibold);
  }

  .document__table td:last-child {
    padding-bottom: var(--space-3);
  }

  .document__table td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
  }
}
