/* The Settings sidebar (settings/_nav) and the page beside it. Groups under small headings, a
/* plugin's page nested under Plugins. Below 960px it becomes one scrolling row above the page,
/* without headings or nesting. */
@layer components {
  .settings-layout {
    align-items: start;
    display: grid;
    gap: calc(var(--block-space) * 2);
    grid-template-columns: 13rem minmax(0, 1fr);
    margin-inline: 0 auto;
    max-inline-size: min(130ch, 100%);

    @media (max-width: 959px) {
      gap: var(--block-space);
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .settings-layout__page {
    min-inline-size: 0;
  }

  /* Stays put while the page scrolls: never taller than the window, so a long one (a plugin's
  /* list of people) scrolls on its own and the page's scrolling never carries it along. Its links
  /* reach out by their own padding, so their icons and headings line up with the page's title in
  /* the header (Settings, Meetings) above them. */
  .settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    inset-block-start: var(--block-space);
    margin-inline-start: calc(var(--text-small) * -0.75);
    max-block-size: calc(100dvh - var(--block-space) * 2);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: sticky;
    text-align: start;

    @media (max-width: 959px) {
      border-block-end: 1px solid var(--color-ink-lighter);
      flex-direction: row;
      margin-inline-start: 0;
      max-block-size: none;
      overflow-x: auto;
      overflow-y: visible;
      padding-block-end: var(--block-space-half);
      position: static;
    }
  }

  .settings-nav__heading {
    color: var(--color-ink-medium);
    font-size: var(--text-x-small);
    font-weight: 500;
    margin: var(--block-space) 0 0.25em;
    padding-inline: calc(var(--text-small) * 0.75);

    &:first-child {
      margin-block-start: 0;
    }

    @media (max-width: 959px) {
      display: none;
    }
  }

  .settings-nav__list {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    list-style: none;
    margin: 0;
    padding: 0;

    @media (max-width: 959px) {
      flex-direction: row;

      li {
        display: contents;
      }
    }
  }

  .settings-nav__list--nested {
    border-inline-start: 1px solid var(--color-ink-lighter);
    margin-block-start: 0.15em;
    margin-inline-start: 1.25em;
    padding-inline-start: 0.35em;

    @media (max-width: 959px) {
      border: 0;
      display: contents;
    }
  }

  .settings-nav__link {
    --icon-size: 1.05em;

    align-items: center;
    border-radius: var(--radius-control);
    color: var(--color-ink-darker);
    display: flex;
    font-size: var(--text-small);
    font-weight: 500;
    gap: 0.65em;
    padding: 0.4em 0.75em;
    text-decoration: none;
    white-space: nowrap;

    .icon {
      color: var(--color-ink-dark);
      opacity: 0.85;
    }

    &:hover {
      background-color: var(--color-hover);
      color: var(--color-ink);
    }

    &:focus-visible {
      outline: 2px solid var(--color-link);
      outline-offset: 1px;
    }

    &[aria-current="page"] {
      background-color: oklch(var(--lch-ink-darkest) / 7%);
      color: var(--color-ink);

      .icon {
        color: var(--color-ink);
        opacity: 1;
      }
    }
  }

  .settings-nav__link--nested {
    font-weight: 500;
    padding-block: 0.3em;
  }
}
