/* Modal component — generic dialog chrome for the whole site, driven by
   assets/js/modal.js, plus the session-fragment content styling.

   Block name is `.agenda-modal`, NOT `.modal`: the site already owns `.modal`
   via assets/css/lib/sabe/component.dialog.css (in bundle.config.json, so it
   loads on every page). That rule set carries `opacity: 0; pointer-events:
   none` until a `data-open="true"` its own JS never sets here — a modal of
   ours using `.modal` inherited both, i.e. it opened invisibly and locked the
   page scroll. Renaming is the fix that does not depend on load order.

   Speaker-fragment content lives in speaker.modal.css.
   1rem = 1px (6.25% root). */

/* ---------------------------------------------------------------- chrome */

.agenda-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.agenda-modal[hidden] {
	display: none;
}

.agenda-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.agenda-modal__panel {
	position: relative;
	background: #fff;
	max-width: 720rem;
	width: calc(100% - 32rem);
	max-height: 85vh;
	overflow-y: auto;
	border-radius: 8px;
	padding: 32rem;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.agenda-modal__close {
	position: absolute;
	top: 8rem;
	right: 8rem;
	background: transparent;
	border: 0;
	font-size: 29rem;
	line-height: 1;
	cursor: pointer;
	width: 35rem;
	height: 35rem;
}

.agenda-modal__close:hover {
	color: #c00;
}

.agenda-modal__loading,
.agenda-modal__error {
	text-align: center;
	padding: 32rem;
	color: #666;
}

/* Injected into a fragment's footer when this modal was opened from another
   one (stacking). The auto margin pushes it to the left while the footer's
   own link stays at the right edge. */
.agenda-modal__back-link {
	margin-right: auto;
	color: #555;
	text-decoration: none;
}

.agenda-modal__back-link:hover {
	text-decoration: underline;
	color: #2c5aa0;
}

/* Reserve the scrollbar gutter up-front so locking body scroll when a modal
   opens can't shift the page sideways. */
html {
	scrollbar-gutter: stable;
}

body.agenda-modal-open {
	overflow: hidden;
}

/* Print rule lives here rather than in agenda.print.css because this file
   ships with every page that can open a modal — speaker pages and the
   speakerlist block never load the agenda bundle. */
@media print {
	.agenda-modal {
		display: none;
	}
}

/* -------------------------------------------------- session fragment body */
/* Content of /session-popup/{page-id} (session-modal-content.php). The "Back
   to programme" link is omitted there: the close button (×, ESC, backdrop)
   replaces that affordance inside the modal. */

.session-modal__header {
	margin-bottom: 19rem;
}

.session-modal__title {
	margin: 6rem 0 10rem;
	line-height: 1.25;
	font-size: 22rem;
}

.session-modal__detail-link {
	border-top: 1px solid #eee;
	padding-top: 16rem;
	margin-top: 16rem;
	text-align: right;
}
