/* Chapter navigation for fixed policy HTML; loaded after each template theme. */
.section.legal-layout.legal-with-toc {
  display: grid;
  grid-template-columns: clamp(240px, 22vw, 290px) minmax(0, 1fr);
  column-gap: clamp(32px, 4.5vw, 72px);
  row-gap: 36px;
  align-items: start;
}

.legal-layout.legal-with-toc > .legal-index.legal-toc {
  grid-column: 1;
  position: sticky;
  top: var(--legal-toc-top, 32px);
  align-self: start;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  min-width: 0;
  max-height: calc(100vh - var(--legal-toc-top, 32px) - 24px);
  max-height: calc(100dvh - var(--legal-toc-top, 32px) - 24px);
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink, var(--text));
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.legal-layout.legal-with-toc > .legal-copy {
  grid-column: 2;
  min-width: 0;
  max-width: 78ch;
}

.legal-layout.legal-with-toc .legal-toc-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 0 8px 15px;
}

.legal-layout.legal-with-toc .legal-toc-heading h2 {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink, var(--text));
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.025em;
  text-transform: none;
}

.legal-layout.legal-with-toc .legal-toc-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 9px;
  min-height: 38px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: clamp(6px, var(--radius, 10px), 14px);
  background: var(--bg);
  color: var(--ink, var(--text));
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  cursor: pointer;
}

.legal-layout.legal-with-toc .legal-toc-toggle svg {
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  transform: rotate(0deg);
  transition: transform .16s ease;
}

.legal-layout.legal-with-toc .legal-toc-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.legal-layout.legal-with-toc .legal-toc-nav {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: calc(100vh - var(--legal-toc-top, 32px) - 190px);
  max-height: calc(100dvh - var(--legal-toc-top, 32px) - 190px);
  margin: 0;
  padding: 4px;
  border: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
  scroll-padding-block: 8px;
}

.legal-layout.legal-with-toc .legal-toc-nav[hidden] {
  display: none;
}

.legal-layout.legal-with-toc .legal-toc-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-layout.legal-with-toc .legal-toc-list > li {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}

.legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link {
  display: grid;
  grid-template-columns: 1.7em minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: clamp(6px, var(--radius, 10px), 14px);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  transition: color .15s ease, background-color .15s ease;
}

/* Clear decorative link markers and rules inherited from older legal indexes. */
.legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link::before,
.legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link::after,
.legal-layout.legal-with-toc .legal-index.legal-toc .legal-related a::before,
.legal-layout.legal-with-toc .legal-index.legal-toc .legal-related a::after {
  content: none;
  display: none;
}

.legal-layout.legal-with-toc .legal-toc-number {
  padding-top: .13em;
  color: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1.55;
}

.legal-layout.legal-with-toc .legal-toc-label {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link[aria-current="location"] {
  background: var(--surface, var(--bg));
  color: var(--ink, var(--text));
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.legal-layout.legal-with-toc .legal-toc-link[aria-current="location"] .legal-toc-number {
  font-weight: 700;
}

.legal-layout.legal-with-toc .legal-related {
  display: grid;
  gap: 6px;
  flex: 0 0 auto;
  margin: 16px 8px 0;
  padding: 15px 0 0;
  border-top: 1px solid var(--line);
}

.legal-layout.legal-with-toc .legal-index.legal-toc .legal-related a {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-width: 0;
  min-height: 27px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .legal-layout.legal-with-toc .legal-toc-toggle:hover {
    background: var(--surface, var(--bg));
  }

  .legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link:hover {
    background: var(--surface, var(--bg));
    color: var(--ink, var(--text));
  }

  .legal-layout.legal-with-toc .legal-index.legal-toc .legal-related a:hover {
    color: var(--ink, var(--text));
    text-decoration: underline;
    text-underline-offset: .2em;
  }
}

.legal-layout.legal-with-toc .legal-toc-link:focus-visible,
.legal-layout.legal-with-toc .legal-related a:focus-visible,
.legal-layout.legal-with-toc .legal-toc-toggle:focus-visible {
  outline: 2px solid var(--ink, var(--text));
  outline-offset: 2px;
}

.legal-layout.legal-with-toc .legal-copy [id] {
  scroll-margin-top: calc(var(--legal-toc-top, 32px) + 24px);
}

@media (max-width: 900px) {
  .section.legal-layout.legal-with-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .legal-layout.legal-with-toc > .legal-index.legal-toc {
    grid-column: 1;
    position: static;
    max-height: none;
    margin: 0;
    padding: 0 0 22px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .legal-layout.legal-with-toc > .legal-copy {
    grid-column: 1;
    max-width: none;
  }

  .legal-layout.legal-with-toc .legal-toc-heading {
    padding-inline: 0;
    padding-bottom: 10px;
  }

  .legal-layout.legal-with-toc .legal-toc-ready .legal-toc-toggle {
    display: inline-flex;
  }

  /* Static HTML has the complete list. Enhancement only bounds its open panel. */
  .legal-layout.legal-with-toc .legal-toc-nav {
    max-height: none;
    overflow-y: visible;
    padding-inline: 0;
  }

  .legal-layout.legal-with-toc .legal-toc-ready .legal-toc-nav:not([hidden]) {
    max-height: min(60vh, 32rem);
    max-height: min(60dvh, 32rem);
    overflow-y: auto;
    padding-inline: 4px;
  }

  .legal-layout.legal-with-toc .legal-related {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 12px 0 0;
    padding-top: 12px;
  }

  .legal-layout.legal-with-toc .legal-index.legal-toc .legal-related a {
    min-height: 32px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-layout.legal-with-toc .legal-toc-toggle svg,
  .legal-layout.legal-with-toc .legal-index.legal-toc .legal-toc-link {
    transition: none;
  }
}
