/* Make the article contents feel like a usable paper index, while keeping
   native details/summary semantics and the existing ink-line animation. */
body main .reading details.article-toc > summary {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  list-style: none;
}
body main .reading details.article-toc > summary::-webkit-details-marker {
  display: none;
}
body main .reading details.article-toc > summary::before {
  content: '';
  display: block;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid #a5bfd8;
  border-radius: 3px;
  background: rgba(249, 253, 254, .8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m7 10 5 5 5-5' stroke='%230b3a95' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}
body main .reading details.article-toc[open] > summary::before {
  transform: rotate(180deg);
  background-color: #dcecf7;
  border-color: #7da2c8;
}

/* A compact index remains one column on a phone and uses available width on
   larger screens; each link keeps a generous target and a visible underline. */
body main .reading details.article-toc .contents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 0 24px;
}
body main .reading details.article-toc .contents a {
  box-sizing: border-box;
  display: block;
  min-height: 44px;
  padding: 10px 2px;
  line-height: 1.45;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  border-bottom: 1px solid rgba(152, 180, 207, .45);
}
body main .reading details.article-toc .contents a:focus-visible {
  outline: 2px solid #0b3a95;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  body main .reading details.article-toc > summary::before {
    transition: transform 220ms cubic-bezier(.23, 1, .32, 1),
      background-color 180ms ease, border-color 180ms ease;
  }
  body main .reading details.article-toc .contents a {
    transition: background-color 180ms ease, color 180ms ease;
  }
  body main .reading details.article-toc > summary:focus-visible::before {
    transition: none;
  }
}
@media (hover: hover) and (pointer: fine) {
  body main .reading details.article-toc > summary:hover::before,
  body main .reading details.article-toc > summary:focus-visible::before {
    background-color: #dcecf7;
    border-color: #7da2c8;
  }
  body main .reading details.article-toc .contents a:hover {
    background-color: rgba(197, 222, 239, .28);
  }
}
@media (hover: none) and (pointer: coarse) {
  body main .reading details.article-toc > summary:is(:active, .motion-touch-active)::before {
    background-color: #dcecf7;
    border-color: #7da2c8;
  }
  body main .reading details.article-toc .contents a:is(:active, .motion-touch-active) {
    background-color: rgba(197, 222, 239, .28);
  }
}
@media (prefers-reduced-motion: reduce) {
  body main .reading details.article-toc > summary::before,
  body main .reading details.article-toc .contents a { transition: none; }
}

/* Keep long introductions legible without letting them dominate a phone's
   first screen. The original desktop typography remains untouched. */
@media (max-width: 480px) {
  body main .reading.reading.reading > header > .lead,
  body main .reading.reading.reading > article > header > .lead,
  body main .information.information.information > header > .lead {
    font-size: 18px;
    line-height: 1.5;
  }
  body main .catalog.catalog.catalog > header > p {
    font-size: 18px;
    line-height: 1.5;
  }
  body main .intro[data-astro-cid-m5wbbtsn] > p {
    font-size: 19px;
    line-height: 1.5;
  }
}
