/* Conference Programme – front-end styles.
 *
 * Colours are exposed as custom properties. Override from your theme with e.g.
 *   .cp-programme, .cp-speakers, .cp-modal { --cp-accent: #7a1f3d; }
 */

:where(.cp-programme, .cp-speakers, .cp-modal) {
	--cp-accent: #2a5d9f;
	--cp-accent-contrast: #ffffff;
	--cp-text: currentColor; /* inherit the theme's text colour */
	--cp-modal-text: #1f2933; /* the modal floats over the page, so it keeps a safe default */
	--cp-muted: #5f6b7a;
	--cp-border: #e1e5ea;
	--cp-bg: #ffffff;
	--cp-surface: #f6f8fa;
	--cp-break-bg: #eef0f3;
	--cp-break-text: #5f6b7a;
	--cp-chip-bg: #f1f3f5;
	--cp-chip-hover: #e3e7eb;
	--cp-date-bg: var(--cp-bg);
	--cp-backdrop: rgba(15, 23, 42, 0.6);
	--cp-focus: #f59e0b;
	--cp-radius: 8px;
	--cp-sticky-offset: 0px;
}

/* ------------------------------------------------------------------ */
/* Programme                                                           */
/* ------------------------------------------------------------------ */

/* Headings are plain h2/h3/h4 and take the theme's font, size and weight;
   only spacing and a few accents are set here. */

.cp-programme {
	color: var(--cp-text);
	line-height: 1.5;
}

.cp-programme__header {
	margin-bottom: 1.5rem;
}

.cp-programme__title {
	margin: 0 0 0.25rem;
}

.cp-programme__note {
	margin: 0;
	color: var(--cp-muted);
	font-size: 0.95em;
}

.cp-programme__empty,
.cp-speakers__empty {
	color: var(--cp-muted);
}

.cp-editor-notice {
	padding: 0.75rem 1rem;
	border: 1px dashed #c0392b;
	background: #fdf3f2;
	color: #7b241c;
}

/* Day: two columns, sticky date on the left ------------------------- */

.cp-day {
	display: grid;
	grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
	column-gap: 1.5rem;
	align-items: start;
	margin-top: 2.5rem;
	padding-top: 1rem;
	border-top: 3px solid var(--cp-accent);
}

.cp-day:first-of-type {
	margin-top: 0;
}

.cp-day__date {
	position: -webkit-sticky;
	position: sticky;
	top: var(--cp-sticky-offset);
	align-self: start;
	background: var(--cp-date-bg);
	padding: 0.25rem 0 1rem;
	z-index: 2;
}

.cp-day__label {
	margin: 0;
	font-weight: 700;
	line-height: 1.15;
}

.cp-day__weekday {
	color: var(--cp-accent);
}

.cp-day__daymonth {
	font-weight: 700;
	color: var(--cp-muted);
}

.cp-day__sessions {
	min-width: 0;
}

/* Block sub-heading -------------------------------------------------- */

.cp-block {
	margin: 1.5rem 0 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--cp-surface);
	border-left: 4px solid var(--cp-accent);
	border-radius: 0 var(--cp-radius) var(--cp-radius) 0;
}

.cp-block:first-child {
	margin-top: 0;
}

.cp-block__title {
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.cp-block__chair {
	margin: 0.25rem 0 0;
	font-size: 0.95em;
	color: var(--cp-muted);
}

.cp-block__chair-label {
	font-weight: 600;
}

/* Session row -------------------------------------------------------- */

.cp-session {
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--cp-border);
	line-height: 1.35;
}

/* Time sits on its own line above the title. */
.cp-session__time {
	margin: 0;
	color: var(--cp-accent);
	font-size: 1.5em;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.3;
	white-space: nowrap;
}

.cp-session__time-sep {
	margin: 0 0.15em;
}

.cp-session__time-tbc {
	color: var(--cp-muted);
	font-weight: 400;
}

.cp-session__title {
	margin: 0.1rem 0 0;
	font-size: 1.2em;
	font-weight: 600;
	line-height: 1.2;
}

.cp-session__speakers {
	margin: 0.2rem 0 0;
	line-height: 1.4;
}

.cp-session__speakers-label {
	font-weight: 600;
}

/* Keeps a name and its comma on the same line. */
.cp-session__speaker {
	white-space: nowrap;
}

/* Breaks: simple grey row ------------------------------------------- */

.cp-session--break {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.15rem 0.9rem;
	margin: 0.5rem 0;
	padding: 0.5rem 0.75rem;
	border-bottom: 0;
	border-radius: var(--cp-radius);
	background: var(--cp-break-bg);
	color: var(--cp-break-text);
	font-size: 0.95em;
}

.cp-session--break .cp-session__time {
	margin: 0;
	color: inherit;
	font-weight: 500;
}

.cp-session--break .cp-session__title {
	font-size: 1em;
	font-weight: 500;
}

/* Abstract: spans the full session row so lines stay readable. --------- */

.cp-session__abstract {
	margin-top: 0.5rem;
	line-height: 1.5;
}

.cp-session__abstract > :first-child {
	margin-top: 0;
}

.cp-session__abstract > :last-child {
	margin-bottom: 0;
}

.cp-session p {
	margin-bottom: 0;
}

.cp-session__abstract p {
	margin-top: 0;
	margin-bottom: 0;
}

/* No bottom margins anywhere, so consecutive paragraphs are separated from
   above instead — keeps multi-paragraph abstracts readable. */
.cp-session__abstract p + p {
	margin-top: 1em;
}

/* Sub-headings inside an abstract (e.g. one per short talk). Kept bold so
   they still read as headings on themes whose headings are light-weight. */
.cp-session__abstract h5,
.cp-session__abstract h6 {
	margin: 1.25rem 0 0.35rem;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.35;
}

.cp-session__abstract > h5:first-child,
.cp-session__abstract > h6:first-child {
	margin-top: 0;
}

/* Speaker links: plain underlined text that opens the bio modal. ------ */

.cp-speaker-link {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cp-accent);
	font: inherit;
	line-height: inherit;
	text-align: left;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

.cp-speaker-link:hover {
	text-decoration-thickness: 2px;
}

.cp-speaker-link:focus-visible,
.cp-speaker-card:focus-visible,
.cp-modal__close:focus-visible {
	outline: 3px solid var(--cp-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Speakers grid                                                       */
/* ------------------------------------------------------------------ */

.cp-speakers {
	color: var(--cp-text);
}

.cp-speakers__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: 1.75rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cp-speakers__item {
	margin: 0;
	padding: 0;
}

.cp-speaker-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	margin: 0;
	padding: 0.5rem;
	border: 1px solid transparent;
	border-radius: var(--cp-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cp-speaker-card:hover {
	background: var(--cp-surface);
	border-color: var(--cp-border);
}

.cp-speaker-card__media {
	display: block;
	width: 7.5rem;
	height: 7.5rem;
	margin-bottom: 0.75rem;
}

.cp-speaker-card__photo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: var(--cp-accent);
	color: var(--cp-accent-contrast);
	font-size: 1.75rem;
	font-weight: 700;
}

.cp-speaker-card__name {
	font-weight: 600;
	line-height: 1.25;
}

.cp-speaker-card__affiliation {
	margin-top: 0.25rem;
	font-size: 0.85em;
	color: var(--cp-muted);
	line-height: 1.3;
}

/* ------------------------------------------------------------------ */
/* Bio modal                                                           */
/* ------------------------------------------------------------------ */

html.cp-modal-open {
	overflow: hidden;
	padding-right: var(--cp-scrollbar-width, 0px);
}

.cp-modal {
	--cp-text: var(--cp-modal-text);
	box-sizing: border-box;
	width: min(40rem, calc(100vw - 2rem));
	max-width: 100%;
	max-height: min(85vh, 100% - 2rem);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: var(--cp-radius);
	background: var(--cp-bg);
	color: var(--cp-text);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

.cp-modal::backdrop {
	background: var(--cp-backdrop);
}

/* Fallback backdrop for browsers without <dialog> support. */
.cp-modal--fallback {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10000;
}

.cp-modal__fallback-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: var(--cp-backdrop, rgba(15, 23, 42, 0.6));
}

.cp-modal__inner {
	position: relative;
	box-sizing: border-box;
	max-height: min(85vh, calc(100vh - 2rem));
	overflow: auto;
	padding: 1.75rem;
	line-height: 1.5;
}

.cp-modal__close {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 2.25rem;
	height: 2.25rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--cp-chip-bg);
	color: var(--cp-text);
	font: inherit;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

.cp-modal__close:hover {
	background: var(--cp-chip-hover);
}

.cp-modal__header {
	display: flex;
	align-items: flex-start;
	gap: 1.25rem;
	padding-right: 2.5rem;
	margin-bottom: 1rem;
}

.cp-modal__photo {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 6rem;
	height: 6rem;
	border-radius: 50%;
	object-fit: cover;
	background: var(--cp-accent);
	color: var(--cp-accent-contrast);
	font-size: 1.5rem;
	font-weight: 700;
}

.cp-modal__title {
	margin: 0 0 0.25rem;
	line-height: 1.2;
}

.cp-modal__affiliation {
	margin: 0 0 0.35rem;
	color: var(--cp-muted);
}

.cp-modal__website {
	color: var(--cp-accent);
	word-break: break-all;
}

.cp-modal__bio > :first-child {
	margin-top: 0;
}

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

.cp-modal__status {
	padding: 2rem 0;
	text-align: center;
	color: var(--cp-muted);
}

.cp-modal__status--error {
	color: #b42318;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.cp-day {
		grid-template-columns: minmax(0, 1fr);
		column-gap: 0;
	}

	.cp-day__date {
		z-index: 5;
		margin: 0 0 0.75rem;
		padding: 0.6rem 0;
		border-bottom: 1px solid var(--cp-border);
	}

}

@media (max-width: 479px) {
	.cp-modal__header {
		flex-direction: column;
		gap: 0.75rem;
	}

	.cp-modal__inner {
		padding: 1.25rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cp-speaker-card {
		transition: none;
	}
}
