/**
 * Public booking calendar.
 *
 * Theme neutral, per SPEC section 15. Nothing here assumes Divi or any other
 * theme, and client specific styling belongs in the child theme rather than in
 * this file. Sizes are in rem so the calendar follows whatever the theme sets as
 * its base font size.
 */

.irb-calendar {
	--irb-gap: 0.75rem;
	--irb-border: #d7dbe0;
	--irb-muted: #5c6670;
	--irb-focus: #1e5aa8;

	margin-block: 1.5rem;
}

/* Room filter
   ------------------------------------------------------------------------- */

.irb-calendar__filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--irb-gap);
	margin: 0 0 var(--irb-gap);
	padding: var(--irb-gap);
	border: 1px solid var(--irb-border);
	border-radius: 4px;
}

.irb-calendar__filter-legend {
	padding-inline: 0.35rem;
	font-weight: 600;
}

.irb-calendar__filter-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	line-height: 1.4;
}

.irb-calendar__swatch {
	display: inline-block;
	width: 0.85rem;
	height: 0.85rem;
	border-radius: 2px;
	/* A border so a pale room colour is still visible against a white page. */
	border: 1px solid rgba(0, 0, 0, 0.25);
	flex: 0 0 auto;
}

/*
 * The swatch is decorative. The room name next to it carries the meaning, so
 * that the filter still works for someone who cannot distinguish the colours.
 * SPEC section 17.
 */
.irb-calendar__filter-name {
	white-space: nowrap;
}

/* Status region
   ------------------------------------------------------------------------- */

/*
 * Announced to screen readers when the event count changes. Visible too, since
 * a count of what is on screen is useful to everyone, but kept quiet.
 */
.irb-calendar__status {
	margin: 0 0 var(--irb-gap);
	color: var(--irb-muted);
	font-size: 0.875rem;
	min-height: 1.25rem;
}

.irb-calendar__error {
	margin: 0;
	padding: var(--irb-gap);
	border: 1px solid var(--irb-border);
	border-radius: 4px;
	color: var(--irb-muted);
}

/* Events
   ------------------------------------------------------------------------- */

.irb-event {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.15rem 0.3rem;
	overflow: hidden;
	line-height: 1.3;
}

.irb-event__time {
	font-variant-numeric: tabular-nums;
	font-size: 0.75rem;
	opacity: 0.9;
}

.irb-event__title {
	font-weight: 600;
	font-size: 0.8125rem;
	overflow-wrap: anywhere;
}

.irb-event__room {
	font-size: 0.75rem;
	opacity: 0.9;
	overflow-wrap: anywhere;
}

/*
 * Blackout periods read as unavailable rather than as somebody's booking, and
 * the hatching means they are distinguishable without relying on the grey.
 */
.irb-event--blackout {
	background-image: repeating-linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.18) 0,
		rgba(255, 255, 255, 0.18) 4px,
		transparent 4px,
		transparent 8px
	);
}

/* Keyboard focus
   ------------------------------------------------------------------------- */

.irb-calendar .fc-event:focus-visible,
.irb-calendar__filter-item:focus-within {
	outline: 2px solid var(--irb-focus);
	outline-offset: 2px;
}

/* Small screens
   ------------------------------------------------------------------------- */

@media (max-width: 782px) {
	.irb-calendar__filter {
		flex-direction: column;
		align-items: flex-start;
	}

	.irb-event {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0.4rem;
	}
}

/* Print
   ------------------------------------------------------------------------- */

@media print {
	.irb-calendar__filter,
	.irb-calendar__status {
		display: none;
	}

	.irb-calendar .fc-event {
		border: 1px solid #000 !important;
		background: none !important;
		color: #000 !important;
	}
}
