/* Shared speaker bio modal — only what Tailwind utilities cannot express: the
   native <dialog> reset, its backdrop, and the body scroll lock. Everything
   structural is utilities + DS tokens in includes/speaker-modal.php. Zero hex.

   Loaded via the `ampeco-speaker-modal` handle, which BOTH ampeco/tw-speakers
   (the listing grid) and ampeco/tw-agenda (session cards) name in block.json,
   so WP enqueues it once on any page carrying either block. */

/* A <dialog> ships with a UA border, padding, `width: fit-content` and centring
   margins. Strip all of it and let it own the viewport; the panel inside does
   the sizing. `height: 100%` + overflow-y here (not on <html>) is what makes a
   long bio scroll INSIDE the modal while the page behind stays put. */
dialog.speaker-modal {
	width: 100%;
	max-width: 100%;
	height: 100%;
	max-height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	overflow-y: auto;
	overscroll-behavior: contain;
	color: var(--c-ink);

	/* --radius-lg is CONTESTED at runtime. Two Tailwind bundles load together on
	   these pages: ampeco-base.css publishes the DS value (16px) on :root, and
	   framix-site-blocks/tailwind/dist/blocks.css publishes Tailwind's own default
	   (.5rem) on :root afterwards — so the later sheet wins and every `rounded-lg`
	   silently renders 8px. Re-declare the DS value on this scope so `rounded-lg`
	   means what the design says without touching either shared bundle. (Only `lg`
	   collides; xs/sm/m/xxl carry DS names Tailwind has no default for. Recorded in
	   design/tailwind.md.) */
	--radius-lg: 16px;
}

dialog.speaker-modal::backdrop {
	background: color-mix(in srgb, var(--p-midnight-700, #15253b) 55%, transparent);
}

/* Scroll lock. The dialog is in the top layer, so without this the page behind
   still scrolls under the pointer. Set on <html> by speaker-modal.js. */
html.speaker-modal-open,
html.speaker-modal-open body {
	overflow: hidden;
}

/* The nds icon helper returns an <svg> sized by width/height attributes; give it
   a predictable box inside the flex rows regardless of the theme's svg rules.
   `__li` is the LinkedIn mark overlaid on the photo tile — it rides along with
   the shared photo helper, so its rule belongs here rather than with the grid. */
.speaker-modal__close svg,
.speaker-modal__li svg {
	display: block;
	flex: none;
}

.speaker-modal__close {
	transition: color 0.2s ease;
}

.speaker-modal__close:hover,
.speaker-modal__close:focus-visible {
	color: var(--c-ink-brand);
}

/* Bio prose: the block sets the paragraph rhythm with a flex gap, so kill any
   inherited list/typography margins that would double it. */
.speaker-modal__bio > :first-child {
	margin-top: 0;
}

.speaker-modal__bio > :last-child {
	margin-bottom: 0;
}

/* Motion: fade the modal in where the browser supports it. Removing the dialog
   from the top layer is instant, so only the entry is animated — a closing
   animation needs `transition-behavior: allow-discrete` and degrades badly
   without it. */
@media (prefers-reduced-motion: no-preference) {
	dialog.speaker-modal[open] {
		animation: speaker-modal-in 0.18s ease-out;
	}

	@keyframes speaker-modal-in {
		from {
			opacity: 0;
			transform: translateY(8px);
		}

		to {
			opacity: 1;
			transform: translateY(0);
		}
	}
}
