/* Readable paper navigation, with small ink gestures on real controls. */
body main :is(.reading .reading-related, .case-page .case-navigation) a::after {
  content: '';
  display: inline-block;
  inline-size: 17px;
  block-size: 17px;
  margin-inline-start: 9px;
  vertical-align: -.2em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M3 10h13M11 5l5 5-5 5' stroke='%230b3a95' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The line is an accent, not a mask: the contents remain visible without JS. */
body main .reading details.article-toc > summary {
  position: relative;
}
body main .reading details.article-toc > summary::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  block-size: 2px;
  background: #0b3a95;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left center;
}
body main .reading details.article-toc[open] > summary::after {
  transform: scaleX(1);
}

/* Replace the existing instant plus/minus stroke with a reversible one.
   Specificity matches the template's scoped rules; the rest stays native. */
body main .depth .editorial-row.editorial-row > summary svg .vertical {
  display: inline;
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(1);
}
body main .depth .editorial-row.editorial-row.editorial-row[open] > summary svg .vertical {
  display: inline;
  transform: scaleY(0);
}

@media (prefers-reduced-motion: no-preference) {
  body main :is(.reading .reading-related, .case-page .case-navigation) a::after {
    transition: transform 220ms cubic-bezier(.23, 1, .32, 1);
  }
  body main .reading details.article-toc > summary::after,
  body main .depth .editorial-row.editorial-row > summary svg .vertical,
  body main .depth .reading-map summary svg {
    transition: transform 220ms cubic-bezier(.23, 1, .32, 1);
  }
  /* Keyboard feedback should stay immediate. */
  body main .reading details.article-toc > summary:focus-visible::after,
  body main .depth .editorial-row.editorial-row > summary:focus-visible svg .vertical,
  body main .depth .reading-map summary:focus-visible svg {
    transition: none;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body main :is(.reading .reading-related, .case-page .case-navigation) a:hover::after {
    transform: translateX(4px);
  }
  body main .reading details.article-toc:not([open]) > summary:hover::after {
    transform: scaleX(.42);
  }
  body main .depth .editorial-row.editorial-row > summary:hover svg {
    transform: translateX(3px);
  }
}

/* touch-motion.js removes the temporary class on release, cancel and scroll. */
@media (hover: none) and (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  body main :is(.reading .reading-related, .case-page .case-navigation) a:is(:active, .motion-touch-active)::after {
    transform: translateX(4px);
  }
  body main .reading details.article-toc:not([open]) > summary:is(:active, .motion-touch-active)::after {
    transform: scaleX(.42);
  }
  body main .depth .editorial-row.editorial-row > summary:is(:active, .motion-touch-active) svg {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body main :is(.reading .reading-related, .case-page .case-navigation) a::after,
  body main .reading details.article-toc > summary::after,
  body main .depth .editorial-row.editorial-row > summary svg,
  body main .depth .editorial-row.editorial-row > summary svg .vertical,
  body main .depth .reading-map summary svg {
    transition: none;
  }
}
