/*
 * PVCF Schedule Tweaks: readable sessions on the openevent theme's schedule
 * grid. The grid rules are desktop only (>=1200px), the breakpoint where the
 * theme switches to its timed grid. Below that the theme shows a one-room list;
 * the only rules there are the room switcher (.pvcf-roomnav) at the end.
 *
 * --pvcf-sched-hour is set inline by the plugin from Tools > PVCF Schedule.
 * --pvcf-lines is set per session by schedule.js (how many lines fit).
 */
@media (min-width: 1200px) {

	/* The theme measures this row to size the whole grid (pixels per hour). */
	.schedule__marking li {
		height: calc(var(--pvcf-sched-hour, 88px) - 1px);
	}

	/* Each hour label sits at the bottom of its row, and the first row doubles
	   as the room-name header gap (53px in the theme). Shift the label column
	   up so the labels stay level with their sessions. */
	.schedule__marking {
		top: calc(53px - var(--pvcf-sched-hour, 88px));
	}

	/* The theme gives every session a fixed 3px transparent top/bottom border as
	   the gap, which shrinks short blocks out of proportion (a 15-minute block
	   lost 14% of its height, an hour block 3%). Drop it so every block is its
	   true size; back-to-back sessions are separated by a 2px white line drawn
	   inside the block instead. (.schedule__venue li is the theme's selector.) */
	.schedule__venue li.schedule__frame-li {
		border-top-width: 0;
		border-bottom-width: 0;
	}

	/* Time runs inline before the title, clamped to the lines that fit. */
	.schedule__frame-li .schedule__track {
		display: block;
		height: 100%;
		min-height: 0;
		margin: 0;
		padding: 2px 8px 1px 9px;
		box-shadow: inset 0 2px 0 #fff;
		overflow: hidden;
		box-sizing: border-box;
		border-left-width: 5px;
		font-size: 13.5px;
		line-height: 16px;
		overflow-wrap: anywhere;
	}

	/* schedule.js wraps the time + title in .pvcf-text. The clamp alone adds the
	   ellipsis but leaves later lines visible in any spare height, so the box
	   is also cut to exactly the lines that fit. */
	.schedule__frame-li .pvcf-text {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: var(--pvcf-lines, 1);
		max-height: calc(var(--pvcf-lines, 1) * 16px);
		overflow: hidden;
	}

	.schedule__frame-li.pvcf-open .pvcf-text {
		display: block;
		max-height: none;
		-webkit-line-clamp: unset;
		overflow: visible;
	}

	.schedule__frame-li .schedule__track-time,
	.schedule__frame-li .schedule__track b {
		display: inline;
		width: auto;
		line-height: 16px;
	}

	.schedule__frame-li .schedule__track-time {
		margin-right: 4px;
		font-size: 11.5px;
		opacity: .75;
		white-space: nowrap;
	}

	.schedule__frame-li .schedule__track b {
		font-size: 13.5px;
	}

	/* Tall blocks (schedule.js adds .pvcf-roomy at 80px+): bigger text, the
	   time on its own line, and a little space above so it isn't jammed into
	   the top of a mostly empty block. Line height must match LINE_ROOMY. */
	.schedule__frame-li.pvcf-roomy .schedule__track {
		padding: 8px 10px 4px 11px;
	}

	.schedule__frame-li.pvcf-roomy .pvcf-text {
		max-height: calc(var(--pvcf-lines, 1) * 19px);
		line-height: 19px;
	}

	.schedule__frame-li.pvcf-roomy .schedule__track-time {
		display: block;
		margin: 0;
		font-size: 13px;
		line-height: 19px;
	}

	.schedule__frame-li.pvcf-roomy .schedule__track b {
		font-size: 15.5px;
		line-height: 19px;
	}

	/* 12-hour hour labels: the theme reads the original "HH:MM" text, so it
	   stays in the DOM (hidden) and the label is drawn from data-pvcf-label. */
	.schedule__marking span[data-pvcf-label] {
		font-size: 0;
		white-space: nowrap;
	}

	.schedule__marking span[data-pvcf-label]::after {
		content: attr(data-pvcf-label);
		font-size: 14px;
		line-height: 16px;
	}

	/* Overlapping sessions in one room share the column in lanes (schedule.js
	   sets left/width inline). The theme's 2px side borders give the gap.
	   Hovering a lane that doesn't fit widens it to the full column. */
	.schedule__frame-li.pvcf-split .schedule__track {
		padding-left: 6px;
		padding-right: 4px;
	}

	.schedule__frame-li.pvcf-split.pvcf-open {
		left: 0 !important;
		width: 100% !important;
	}

	/* Hover / keyboard focus on a session that doesn't fit: show it in full,
	   on top of whatever is below it. schedule.js adds .pvcf-open and an opaque
	   copy of the track colour. */
	.schedule__frame-li.pvcf-open {
		z-index: 20;
	}

	.schedule__frame-li.pvcf-open .schedule__track {
		display: block;
		height: auto;
		min-height: 100%;
		padding-top: 3px;
		padding-bottom: 5px;
		overflow: visible;
		box-shadow: inset 0 2px 0 #fff, 0 6px 16px rgba(0, 0, 0, .28);
	}

	/* Room-name bar pinned under the site header while the grid scrolls by. */
	.pvcf-roombar {
		display: none;
		position: fixed;
		z-index: 9;
		background: #fff;
		box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
	}

	.pvcf-roombar.is-on {
		display: block;
	}

	.pvcf-roombar__viewport {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		overflow: hidden;
	}

	.pvcf-roombar__track {
		display: flex;
		height: 100%;
		will-change: transform;
	}

	.pvcf-roombar__item {
		flex: none;
		box-sizing: border-box;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		text-align: center;
	}

	.pvcf-roombar__nav {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 4px;
	}

	.pvcf-roombar__btn {
		width: 30px;
		height: 30px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: #000;
		color: #fff;
		font-size: 18px;
		line-height: 30px;
		cursor: pointer;
	}

	.pvcf-roombar__btn:hover,
	.pvcf-roombar__btn:focus-visible {
		background: #ff00ff;
	}

	.pvcf-roombar__btn[hidden] {
		display: none;
	}
}

/* Phones/tablets (<1200px): room name + previous/next above the one-room
   list. schedule.js pins it under the site header (.is-fixed) while the list
   scrolls; a spacer holds its place. CSS sticky can't be used: the theme's
   div.site has overflow:hidden. */
.pvcf-roomnav {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 8px;
	padding: 8px 0;
	background: #fff;
}

.pvcf-roomnav.is-fixed {
	position: fixed;
	z-index: 9;
	margin: 0;
	box-shadow: 0 4px 6px -4px rgba(0, 0, 0, .25);
}

.pvcf-roomnav[hidden] {
	display: none;
}

.pvcf-roomnav__label {
	flex: 1;
	min-width: 0;
	text-align: center;
	line-height: 1.2;
}

.pvcf-roomnav__label strong {
	display: block;
	overflow: hidden;
	font-size: 18px;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.pvcf-roomnav__label span {
	display: block;
	font-size: 12px;
	color: #777;
}

.pvcf-roomnav__btn {
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #000;
	color: #fff;
	font-size: 22px;
	line-height: 40px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.pvcf-roomnav__btn:disabled {
	opacity: .25;
	cursor: default;
}

/* The theme's list gives the time a fixed 90px box (sized for "21:00 -
   22:00"), so 12-hour times like "9:00–10:00 PM" wrapped. */
@media (max-width: 1199px) {
	.schedule__frame-li .schedule__track-time[data-pvcf-12h] {
		width: auto;
		white-space: nowrap;
	}
}

@media (min-width: 1200px) {
	.pvcf-roomnav,
	.pvcf-roomnav-spacer {
		display: none;
	}
}
