/* .docs-layout wraps the sidebar + the actual page (.docs-page or
   .docs-reference) as siblings, so both need to be in this @scope's root
   list even though .docs-page/.docs-reference are nested inside
   .docs-layout now, not top-level themselves. .docs-index (the plain
   listing page) has no sidebar and stays its own top-level root. */
@scope (.docs-layout, .docs-index) {
  :scope {
    max-width: calc(var(--content-width) + 16rem);
    margin: 0 auto;
    padding: 2rem 1rem;
  }
  .docs-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
  }
  .docs-sidebar {
    flex: 0 0 14rem;
    position: sticky;
    top: 1rem;
  }
  /* This project's first real responsive breakpoint beyond dark-mode —
     a fixed-width sidebar sitting beside the article has no graceful
     fallback on a narrow viewport otherwise; everywhere else so far has
     gotten by on fluid/flex-wrap layouts alone, but a two-column docs
     page genuinely needs one. */
  @media (max-width: 48rem) {
    .docs-layout {
      flex-direction: column;
    }
    .docs-sidebar {
      position: static;
      flex-basis: auto;
      width: 100%;
    }
  }
  .docs-sidebar-section {
    margin-bottom: 1.5rem;
  }
  .docs-sidebar-section h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.6;
    margin: 0 0 0.5rem;
  }
  .docs-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .docs-sidebar li {
    margin-bottom: 0.35rem;
  }
  .docs-sidebar a {
    font-size: 0.9rem;
  }
  .docs-sidebar a[aria-current='page'] {
    color: var(--color-text);
    font-weight: 600;
  }
  .docs-page,
  .docs-reference {
    flex: 1 1 auto;
    min-width: 0;
  }
  .docs-version {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0 0 1rem;
  }
  .docs-toc {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
    border-radius: 0.5rem;
    font-size: 0.9rem;
  }
  .docs-toc h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.6;
    margin: 0 0 0.5rem;
  }
  .docs-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .docs-toc li {
    margin-bottom: 0.35rem;
  }
  .docs-toc .toc-level-3 {
    padding-left: 1rem;
  }
  .docs-toc .toc-level-4 {
    padding-left: 2rem;
  }
  .docs-prev-next {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
    font-size: 0.9rem;
  }
  h1 {
    font-size: 2rem;
  }
  .breadcrumb {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
  }
  a {
    color: var(--color-accent);
  }
  img {
    max-width: 100%;
    height: auto;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
  }
  th,
  td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
  }
  th {
    font-weight: 600;
  }
  code {
    background: color-mix(in srgb, var(--color-text) 8%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
  }
  .edit-link {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
    font-size: 0.9rem;
  }
  .changelog {
    list-style: none;
    padding: 0;
  }
  .changelog li {
    padding: 0.35rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  }
  .changelog time {
    opacity: 0.6;
    font-size: 0.9rem;
  }
}
