/* Speaker boxes — embeddable "highlighted / keynote speakers" block.
   1rem = 1px (project root font-size 6.25%). BEM. */

:root {
	/* Box background palette. Cycled 1→5 by render order: the content is
	   randomised per request, but the colour order stays fixed. Tune to the
	   brand palette as needed. */
	--bg-box-1: #1f6f78;
	--bg-box-2: #c4561e;
	--bg-box-3: #3a4a7a;
	--bg-box-4: #8a2f4a;
	--bg-box-5: #4f7a34;
}

.speaker-boxes-block {
	margin: 0; /* the block frame owns the outer distance (component.block.css) */
}

/* Optional heading field = a Heading block in its own frame (speakerlist.php);
   same distance to the boxes as between two blocks. */
.speaker-boxes-block > .block--heading + .speaker-boxes {
	margin-top: var(--block-gap);
}

.speaker-boxes {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	/* Fixed steps 1 / 2 / 3 / 6 instead of auto-fill: 6 or 12 speakers never leave
	   a lone card in the last row. 1fr rows: every row as tall as the tallest
	   card, so all boxes have the same size (#8813). Steps follow the layout
	   column (minigrid.css), not the viewport. */
	/* minmax(0, …): long words wrap instead of widening the column */
	/* Steps as custom properties, so the "selected" variant below can size its
	   boxes exactly like a grid column. */
	--cols: 1;
	--gap-x: calc(var(--spacing) * 3);
	--gap-y: var(--line);                        /* rows a whole line apart */
	/* Box height on whole lines, so the content below stays on the line grid.
	   Name max. 2 lines, affiliation max. 4 (line-clamp below) give a safe
	   upper bound: padding 24 + photo + 24 + 48 + 72 + 24. Photo 96 (column
	   below 720px): 288px = 12 lines; photo 120: 312px = 13. The box never
	   grows beyond that; 1fr keeps all rows equal. */
	--box-min: calc(var(--line) * 12);
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	grid-auto-rows: minmax(var(--box-min), 1fr);
	gap: var(--gap-y) var(--gap-x);
}
@container column (width >= 320px) {
	.speaker-boxes { --cols: 2; }
}
@container column (width >= 720px) {
	.speaker-boxes { --cols: 3; --box-min: calc(var(--line) * 13); --gap-x: calc(var(--spacing) * 6); --gap-y: calc(var(--spacing) * 6); }
}
@container column (width >= 1120px) {
	.speaker-boxes { --cols: 6; }
}

/* "Selected speakers" (#8351): a hand-picked, usually short list — one chair,
   four debaters. Same box width as a grid column, but an incomplete row is
   centred instead of left-aligned, so a single box sits in the middle. */
.speaker-boxes--selected {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}
.speaker-boxes--selected > .speaker-box {
	flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap-x)) / var(--cols));
	min-height: var(--box-min);
}

/* Only rendered with debug on: IDs the API does not know. */
.speaker-boxes__missing {
	margin: 0 0 var(--line);
	color: #b00020;
}

.speaker-box {
	display: flex;
	border-radius: 6rem;
	overflow: hidden;
	color: white;
	background: var(--bg-box-1);
}
/* theme.css sets li:last-child { margin-bottom: auto } — an auto margin stops
   the grid from stretching the last box, which then ends shorter (#8813). */
.speaker-boxes > .speaker-box { margin: 0; }
.speaker-box--bg-1 { background: var(--bg-box-1); }
.speaker-box--bg-2 { background: var(--bg-box-2); }
.speaker-box--bg-3 { background: var(--bg-box-3); }
.speaker-box--bg-4 { background: var(--bg-box-4); }
.speaker-box--bg-5 { background: var(--bg-box-5); }

/* Inner wrapper carries the column layout whether the box is a link (<a>) or a
   static (<div>) box, so one selector styles both. */
.speaker-box__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	/* On the line grid: padding one line, photo 5 lines (mobile 4) + one line
	   below it, name on 24px lines — the name stands on a grid line. */
	gap: 0;
	padding: var(--line) calc(var(--spacing) * 3);
	width: 100%;
	color: inherit;
	text-decoration: none;
}
a.speaker-box__inner { cursor: pointer; transition: transform 0.12s ease; }
a.speaker-box__inner:hover,
a.speaker-box__inner:focus { transform: translateY(-2rem); }

.speaker-box__photo { display: block; margin-bottom: var(--line); }
.speaker-box__photo .speaker-avatar {
	width: calc(var(--line) * 4);              /* 96px; from 720px column 120px */
	height: auto;
	aspect-ratio: 1; /* stays round when a narrow box squeezes the width */
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.15);
	display: block;
}
@container column (width >= 720px) {
	.speaker-box__photo .speaker-avatar { width: calc(var(--line) * 5); }   /* 120px */
}

.speaker-box__name {
	font-weight: 700;
	font-size: 15rem;
	line-height: var(--line);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.speaker-box__affiliation {
	font-size: 12rem;
	line-height: calc(var(--spacing) * 4.5);   /* off-grid: 18px (¾ line) for small text inside the box; the box height is on the grid */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
	opacity: 0.9;
}
