.index-section-lists,
.index-section-list,
.index-subsection-lists,
.index-subsection-list {
  display: none;
}

.index-section-lists {
  flex: 1 1 auto;
  flex-direction: column;
  min-block-size: 0;
  border-block-start: 1px solid var(--line);
}

.index-section-list {
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.06rem;
  overflow: auto;
  min-block-size: 0;
  margin: 0;
  padding-inline-start: 0.75rem;
  list-style: none;
}

.index-section-item > a {
  display: flex;
  align-items: center;
  min-block-size: 1.5rem;
  border-inline-start-width: 2px;
  padding: 0.13rem 0.45rem;
  color: var(--base01);
  font-size: 0.66rem;
  line-height: 1.25;
}

.index-subsection-list {
  flex-direction: column;
  margin: 0;
  padding-inline-start: 0.8rem;
  list-style: none;
}

.index-subsection-list a {
  display: flex;
  align-items: center;
  min-block-size: 1.35rem;
  padding: 0.1rem 0.4rem;
  color: var(--base01);
  font-size: 0.58rem;
}

.article-pane:has(.article :target) .article {
  display: none;
}

.article-pane:has(.article :target) .article:has(:target) {
  display: block;
}

/* nav-sections.css selects the current article and its shared section list. */
body:has(.article[id="arachnopress"] :target) .index-section-lists,
body:has(.article[id="arachnopress"] :target)
  .index-section-list[data-article="arachnopress"] {
  display: flex;
}

/* Generated selectors also mark the exact targeted section link. */
body:has(.article[id="arachnopress"] [id="arachnopress-build"]:target)
  .index-section-list[data-article="arachnopress"]
  .index-section-item[data-section="arachnopress-build"] >
  a[href="#arachnopress-build"] {
  background: var(--index-selected-bg);
  border-color: var(--index-selected-border);
  color: var(--index-selected-text);
}

/* A targeted subsection uses a quieter variation of the active palette. */
body:has(.article[id="arachnopress"] [id="arachnopress-articles-build-process"]:target)
  .index-subsection-list[data-section="arachnopress-articles"]
  a[href="#arachnopress-articles-build-process"] {
  background: var(--index-subsection-selected-bg);
  border-color: var(--index-subsection-selected-border);
  color: var(--index-subsection-selected-text);
}

@media (max-width: 960px) and (orientation: landscape) {
  .index-pane .index-article {
    font-size: 0.99rem;
  }

  .index-section-item > a {
    font-size: 0.77rem;
  }

  .index-subsection-list a {
    font-size: 0.66rem;
  }
}

@media (min-width: 961px) and (orientation: landscape) {
  .index-pane .index-article {
    font-size: 1.1rem;
  }

  .index-section-item > a {
    font-size: 0.825rem;
  }

  .index-subsection-list a {
    font-size: 0.715rem;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  :root {
    --mobile-index-height: 9rem;
  }

  .index-pane {
    display: grid;
    grid-template-rows: auto 2.625rem auto 1.125rem;
    align-content: start;
    gap: 0.2rem;
    padding-block-end: 0.125rem;
  }

  .index-pane .index-list {
    grid-row: 2;
    block-size: 100%;
  }

  .index-section-lists {
    grid-row: 3;
    block-size: 2.75rem;
    padding-block-start: 0.25rem;
  }

  .index-subsection-lists {
    grid-row: 4;
    block-size: 2.75rem;
    border-block-start: 1px solid var(--line);
    padding-block-start: 0.25rem;
  }

  /* Generated target rules enlarge the index and move the footer to row 5
     only while this row is visible. */

  .index-pane .index-list,
  .index-section-list,
  .index-subsection-lists > .index-subsection-list {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    white-space: nowrap;
  }

  .index-section-list {
    flex: none;
    flex-direction: row;
  }

  .index-section-item > .index-subsection-list {
    display: none;
  }

  .index-pane .index-list a:focus-visible,
  .index-section-list a:focus-visible {
    outline-offset: -2px;
  }

  .index-footer {
    grid-row: 4;
    align-items: center;
    gap: 0.2rem;
    block-size: 100%;
    padding-block-start: 0;
    overflow: hidden;
    font-size: clamp(0.35rem, 1.5vw, 0.5rem);
  }

  .index-footer .contact-button,
  .index-footer .license-button {
    min-block-size: 1rem;
  }
}

@media (max-width: 360px) and (orientation: portrait),
       (max-height: 330px) and (orientation: landscape) {
  .index-footer p:nth-child(2),
  .index-footer p:nth-child(3) {
    display: none;
  }
}
