/*
 * Sacred Roots blocks. Colors and fonts come from the theme's presets so a theme refresh restyles these too.
 */

/* Prayer times */
.sr-prayer-times__line {
	margin: 0;
}

.sr-prayer-times__item {
	white-space: nowrap;
}

.sr-editor-note {
	font-size: 0.8rem;
	opacity: 0.7;
}

/* Upcoming events */
.sr-upcoming__year {
	margin: 0 0 1.5rem;
	font-weight: 700;
	font-size: 1.5rem;
	text-align: center;
}

.sr-upcoming__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sr-upcoming__item {
	display: flex;
	gap: 1.25rem;
	align-items: flex-start;
	margin-bottom: 2rem;
}

.sr-upcoming__thumb {
	flex: 0 0 110px;
}

.sr-upcoming__thumb img {
	display: block;
	width: 110px;
	height: auto;
}

.sr-upcoming__title {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	line-height: 1.25;
}

/* No underline on hover (owner request, #42). */
.sr-upcoming__title a,
.sr-upcoming__title a:hover {
	text-decoration: none;
}

.sr-upcoming__meta {
	margin: 0;
	font-size: 0.85rem;
	opacity: 0.85;
}

/* Month calendar */
.sr-cal__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.sr-cal__month {
	margin: 0;
	font-size: 2rem;
	font-weight: 400;
}

.sr-cal__arrow {
	padding: 0 0.5rem;
	font-size: 2rem;
	line-height: 1;
	text-decoration: none;
}

.sr-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 4px;
}

.sr-cal__weekday {
	padding-bottom: 0.75rem;
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-align: center;
	text-transform: uppercase;
}

.sr-cal__day {
	position: relative; /* The hover preview is placed against the day's box. */
	min-height: 7.5rem;
	padding: 0.6rem;
	background: color-mix(in srgb, currentColor 5%, transparent);
	font-size: 0.8rem;
	line-height: 1.3;
}

.sr-cal__day--blank {
	background: color-mix(in srgb, currentColor 3%, transparent);
}

.sr-cal__day--today {
	background: color-mix(in srgb, currentColor 12%, transparent);
}

.sr-cal__date {
	margin-bottom: 0.5rem;
	text-align: right;
}

.sr-cal__date-long {
	display: none;
}

.sr-cal__entry {
	margin-bottom: 0.6rem;
}

/* The negative margin keeps the text where it was; the padding gives the hover tint some room. */
.sr-cal__event {
	display: block;
	margin: -0.15rem -0.25rem;
	padding: 0.15rem 0.25rem;
	border-radius: 2px;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

/* No underline on hover (owner request, #42); :hover also beats the theme's link hover rule. A light tint
   shows which entry the preview belongs to (#186). */
.sr-cal__event:hover,
.sr-cal__event:focus-visible {
	background: color-mix(in srgb, currentColor 10%, transparent);
	text-decoration: none;
}

/* Long titles stop at three lines with an ellipsis, so they don't stretch the week (#186). */
.sr-cal__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow-wrap: anywhere;
}

/*
 * Preview with the full title, time and place, over the next days (like Squarespace's homepage calendar):
 * on hover, and when the entry has keyboard focus. Not on touch screens, where a tap opens the event.
 * It doesn't take the pointer, so moving on to another entry shows that one's preview instead.
 */
.sr-cal__preview {
	display: none;
	position: absolute;
	z-index: 20;
	top: 0;
	left: calc(100% + 4px);
	box-sizing: border-box;
	width: 15rem;
	min-height: 100%;
	padding: 1rem 1.1rem;
	background: color-mix(in srgb, var(--wp--preset--color--black) 7%, var(--wp--preset--color--base));
	color: var(--wp--preset--color--black);
	font-size: 0.85rem;
	line-height: 1.35;
	text-align: left;
	pointer-events: none;
}

/* Fridays and Saturdays open to the left, so the preview stays on the page. */
.sr-cal__day:nth-child(7n + 6) .sr-cal__preview,
.sr-cal__day:nth-child(7n) .sr-cal__preview {
	right: calc(100% + 4px);
	left: auto;
}

.sr-cal__preview p {
	margin: 0;
}

.sr-cal__preview-title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.15rem;
	line-height: 1.25;
}

.sr-cal__preview .sr-cal__preview-when,
.sr-cal__preview .sr-cal__preview-place {
	margin-top: 0.75rem;
}

@media (hover: hover) {
	.sr-cal__entry:hover .sr-cal__preview {
		display: block;
	}
}

.sr-cal__entry:has(.sr-cal__event:focus-visible) .sr-cal__preview {
	display: block;
}

.sr-cal__time {
	display: block;
	font-weight: 700;
}

.sr-cal__more {
	margin-top: 1rem;
	text-align: right;
}

/* Phones: the grid becomes a list of days that have events. */
@media (max-width: 600px) {
	.sr-cal__grid {
		display: block;
	}

	.sr-cal__weekday,
	.sr-cal__day--blank,
	.sr-cal__day--empty {
		display: none;
	}

	.sr-cal__day {
		min-height: 0;
		margin-bottom: 4px;
		font-size: 1rem;
	}

	.sr-cal__date {
		font-weight: 700;
		text-align: left;
	}

	.sr-cal__date-long {
		display: inline;
	}

	.sr-cal__time {
		display: inline;
		margin-right: 0.5em;
	}

	/* The time and title share the three lines here. */
	.sr-cal__event {
		display: -webkit-box;
		overflow: hidden;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.sr-cal__title {
		display: inline;
	}

	/* The preview (keyboard focus) opens under the entry, across the list. */
	.sr-cal__day {
		position: static;
	}

	.sr-cal__entry {
		position: relative;
	}

	.sr-cal__preview,
	.sr-cal__day:nth-child(n) .sr-cal__preview {
		top: calc(100% + 4px);
		right: 0;
		left: 0;
		width: auto;
		min-height: 0;
	}
}
