/* ==========================================================================
   ebg elements - disclosure: smooth open and close for core Details
   (<details>, one open at a time with the name attribute). Native, no JS.

   Put .ebg-disclosure on the Details block and the answer in one wrapper,
   .ebg-disclosure__body (a group inside the Details block). ::details-content
   becomes a one-row grid whose row goes from 0fr to 1fr, so the height follows
   the content in every engine that styles ::details-content (Chromium 131,
   Firefox 143, Safari 18.4). interpolate-size would also work, but only
   Chromium has it: Firefox opened the old accordion instantly. Closing animates
   too, because the content-visibility switch waits for the transition
   (allow-discrete), and so does the item a named group closes for you.
   Older engines open instantly.

   Keep padding off .ebg-disclosure__body (padding cannot collapse to 0fr); put
   it on the children. Tune on the item: --ebg-disclosure-dur (0.35s, as
   Bootstrap's collapse in ebg) and --ebg-disclosure-ease (ease).
   ========================================================================== */

@layer components {

	.ebg-disclosure {
		& > summary {
			list-style: none;
			cursor: pointer;
		}

		& > summary::-webkit-details-marker { display: none; }

		&::details-content {
			display: grid;
			grid-template-rows: 0fr;
			@media (prefers-reduced-motion: no-preference) {
				transition:
					grid-template-rows var(--ebg-disclosure-dur, 0.4s) var(--ebg-disclosure-ease, cubic-bezier(0.16, 1, 0.3, 1)),
					content-visibility var(--ebg-disclosure-dur, 0.4s);
				/* separate: in the shorthand older engines drop the whole transition */
				transition-behavior: allow-discrete;
			}
		}

		&[open]::details-content { grid-template-rows: 1fr; }

		& > .ebg-disclosure__body {
			min-block-size: 0;
			overflow: hidden;
			margin: 0;
			padding: 0;
		}
	}

	@media (prefers-reduced-motion: reduce) {
		.ebg-disclosure::details-content { transition: none; }
	}
}
