main[data-terms-page] {
  padding-bottom: var(--section-space);
}

.terms-header {
  padding-top: var(--section-space);
}

.terms-header__grid,
.terms-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px;
  background: var(--color-grid);
}

.terms-header__intro,
.terms-header__scope,
.terms-rail,
.terms-document {
  min-width: 0;
  background: var(--color-panel);
}

.terms-header__intro {
  grid-column: span 8;
  padding: var(--space-10);
}

.terms-header__scope {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
}

.terms-header__intro > :last-child,
.terms-header__scope > :last-child,
.terms-rail > :last-child,
.terms-document > :last-child {
  margin-block-end: 0;
}

.terms-header__title {
  max-width: 12ch;
}

.terms-header__lead {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--color-text);
  font-size: var(--text-lead);
  line-height: 1.5;
}

.terms-current-marker {
  color: var(--color-green-bright);
}

.terms-scope-row,
.terms-document-status,
.terms-principle,
.terms-confirmation {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: var(--space-3);
  border-top: var(--border-grid);
  padding-top: var(--space-4);
}

.terms-scope-row .status {
  flex: 0 1 auto;
}

.terms-scope-row p,
.terms-document-status p,
.terms-principle p,
.terms-confirmation p {
  min-width: 0;
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.terms-reading-note {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-2);
  border-top: var(--border-grid);
  padding-top: var(--space-4);
}

.terms-reading-note p {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.terms-body-section {
  padding-top: var(--section-space);
}

.terms-rail {
  grid-column: span 3;
  align-self: start;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6);
}

.terms-index {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0;
}

.terms-index h2 {
  margin-bottom: var(--space-4);
  font-size: var(--text-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.terms-index a {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
  border-top: var(--border-grid);
  padding: var(--space-3) 0;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
  text-decoration: none;
}

.terms-index a:last-child {
  border-bottom: var(--border-grid);
}

.terms-index a::before {
  flex: 0 0 1.8rem;
  color: var(--color-muted);
  content: attr(data-index);
  font-variant-numeric: tabular-nums;
}

.terms-index a:hover,
.terms-index a[aria-current="true"] {
  color: var(--color-green-bright);
}

.terms-index a[aria-current="true"]::before {
  color: var(--color-green-bright);
}

.terms-rail__note {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-2);
  border-top: var(--border-grid);
  padding-top: var(--space-4);
}

.terms-rail__note p {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.terms-document {
  grid-column: 5 / span 8;
  min-width: 0;
}

.terms-clause {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-4);
  border-bottom: var(--border-grid);
  padding: var(--space-8) var(--space-10);
}

.terms-clause:last-child {
  border-bottom: 0;
}

.terms-clause__label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: var(--leading-meta);
  text-transform: uppercase;
}

.terms-clause__number {
  color: var(--color-green-bright);
  font-variant-numeric: tabular-nums;
}

.terms-clause h2 {
  margin: 0;
}

.terms-copy {
  min-width: 0;
}

.terms-copy--70 {
  max-width: 70ch;
}

.terms-copy--68 {
  max-width: 68ch;
}

.terms-copy--72 {
  max-width: 72ch;
}

.terms-copy--66 {
  max-width: 66ch;
}

.terms-copy--64 {
  max-width: 64ch;
}

.terms-copy p:last-child {
  margin-bottom: 0;
}

.terms-attendance-list,
.terms-rule-grid {
  display: grid;
  min-width: 0;
  gap: 0;
  border-top: var(--border-grid);
}

.terms-attendance-list > li {
  display: block;
  min-width: 0;
  border-bottom: var(--border-grid);
  padding: var(--space-3) 0 var(--space-3) var(--space-6);
  color: var(--color-text);
}

.terms-attendance-list {
  margin: 0;
  padding-left: 0;
  list-style-position: inside;
}

.terms-rule-grid__row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(8rem, 2fr) minmax(0, 6fr);
  gap: var(--space-4);
  border-bottom: var(--border-grid);
  padding: var(--space-3) 0;
}

.terms-rule-grid__label {
  min-width: 0;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: var(--leading-meta);
  text-transform: uppercase;
}

.terms-rule-grid__row p {
  min-width: 0;
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.terms-current-document {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  border: var(--border-active);
  padding: var(--space-2) var(--space-3);
  color: var(--color-green-bright);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: var(--leading-meta);
  text-transform: uppercase;
}

.terms-close {
  padding-bottom: 0;
}

.terms-close .terms-clause {
  border-top: var(--border-grid);
}

@media (min-width: 56.25rem) {
  .terms-rail {
    position: sticky;
    top: var(--space-6);
  }
}

@media (max-width: 56.1875rem) {
  .terms-header__grid,
  .terms-layout {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .terms-header__intro {
    grid-column: span 8;
  }

  .terms-header__scope {
    grid-column: span 8;
  }

  .terms-rail,
  .terms-document {
    grid-column: span 8;
  }

  .terms-rail {
    gap: var(--space-5);
  }
}

@media (max-width: 39.9375rem) {
  .terms-header {
    padding-top: var(--space-6);
  }

  .terms-header__grid,
  .terms-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .terms-header__intro,
  .terms-header__scope,
  .terms-rail,
  .terms-document {
    grid-column: 1;
  }

  .terms-header__intro,
  .terms-header__scope,
  .terms-rail,
  .terms-clause {
    padding: var(--space-4);
  }

  .terms-header__intro {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .terms-header__intro .eyebrow,
  .terms-header__intro h1 {
    margin-bottom: 0;
  }

  .terms-header__title {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
  }

  .terms-scope-row,
  .terms-document-status,
  .terms-principle,
  .terms-confirmation {
    flex-direction: column;
    gap: var(--space-2);
  }

  .terms-clause {
    gap: var(--space-3);
  }

  .terms-clause h2 {
    font-size: clamp(1.5rem, 8vw, 1.85rem);
  }

  .terms-rule-grid__row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
    padding: var(--space-4) 0;
  }

  .terms-attendance-list > li {
    padding: var(--space-3) 0 var(--space-3) var(--space-5);
  }
}

@media print {
  html,
  body {
    background: #fff;
    color: #111;
  }

  main[data-terms-page] {
    color: #111;
  }

  .terms-header__grid,
  .terms-layout {
    display: block;
    background: transparent;
  }

  .terms-header__intro,
  .terms-header__scope,
  .terms-rail,
  .terms-document {
    border: 0;
    background: #fff;
    color: #111;
  }

  .terms-header__intro,
  .terms-header__scope,
  .terms-rail,
  .terms-clause {
    padding: 0 0 1.25rem;
  }

  .terms-rail {
    margin-bottom: 1.25rem;
  }

  .terms-clause,
  .terms-header__intro,
  .terms-header__scope {
    break-inside: avoid;
  }

  .terms-clause h2,
  .terms-index h2 {
    color: #111;
    break-after: avoid;
  }

  .terms-copy,
  .terms-copy--70,
  .terms-copy--68,
  .terms-copy--72,
  .terms-copy--66,
  .terms-copy--64 {
    max-width: none;
  }

  .terms-index a,
  .terms-clause__label,
  .terms-current-document,
  .terms-current-marker,
  .terms-rule-grid__label,
  .terms-scope-row p,
  .terms-document-status p,
  .terms-principle p,
  .terms-confirmation p,
  .terms-rail__note p,
  .terms-rule-grid__row p {
    color: #111;
  }
}
