/* Collapsibles, site-wide (linked from base.html and base_tailwind.html).
 *
 * Many <summary> elements are styled display:flex, which drops the browser's
 * own disclosure triangle, so a collapsed section showed no sign it opens.
 * Every summary now gets one chevron instead: pointing right when closed,
 * turned 90 degrees (pointing down) when open. The native marker is hidden so
 * no summary shows two.
 *
 * Opt out with `class="no-chevron"`; a summary that holds its own icon (an
 * <svg>) is left alone. */

details > summary:not(.no-chevron):not(:has(svg)) {
  cursor: pointer;
  list-style: none;
}

details > summary:not(.no-chevron):not(:has(svg))::-webkit-details-marker {
  display: none;
}

details > summary:not(.no-chevron):not(:has(svg))::before {
  content: "";
  display: inline-block;
  flex: none;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.6em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  vertical-align: 0.12em;
  opacity: 0.8;
}

details[open] > summary:not(.no-chevron):not(:has(svg))::before {
  transform: rotate(45deg);
}

details > summary:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

@media (prefers-reduced-motion: reduce) {
  details > summary::before {
    transition: none;
  }
}
