/* Agenda — seasonal scroll (page-agenda.php) */

body.page-template-page-agenda {
	overflow-x: clip;
}

/* No "back to top" button (theme footer) on the agenda */
body.page-template-page-agenda #goTop {
	display: none !important;
}

/* Header overlays the video (as in the design): take the header-row spacer
   out of the flow instead of letting it push the agenda down */
body.page-template-page-agenda .pages .header-row {
	position: absolute !important;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 10;
}

.rv-agenda {
	--rv-text: #4a3225;
	--rv-card-bg: rgba(255, 255, 255, 0.5);
	--rv-card-w: 368px;
	--rv-gap: 16px;
	--rv-vh: 100vh;
	/* Scroll distance for each pair of cards */
	--rv-step: calc(var(--rv-vh) / 3);

	position: relative;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	/* Clips the fixed stage to this element, so it never covers the footer */
	clip-path: inset(0);
	isolation: isolate;
	color: var(--rv-text);
	font-family: Montserrat, sans-serif;
}

@supports (height: 100svh) {
	.rv-agenda { --rv-vh: 100svh; }
}

/* Stage ---------------------------------------------------------------- */

.rv-agenda__stage {
	position: fixed;
	/* Starts below the header; --rv-header-bottom is measured in JS */
	inset: var(--rv-header-bottom, 0px) 0 0 0;
	z-index: 0;
	background: #b2c39d;
	pointer-events: none;
}

.rv-agenda__layer {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0;
}

/* Layers swap instantly: loops and transitions share their boundary frames,
   so a cross-fade would only show the stage background through both */
.rv-agenda__layer.is-active { opacity: 1; }

.rv-agenda__layer video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.rv-agenda__layer video.is-ready { opacity: 1; }

/* Content -------------------------------------------------------------- */

.rv-agenda__content {
	position: relative;
	z-index: 1;
	padding-bottom: calc(var(--rv-vh) * 0.4);
}

/* A season is only scroll distance: one --rv-step per pair of cards
   (per card on mobile, see the media query below) */
.rv-agenda__season {
	height: calc(var(--rv-pairs, 1) * var(--rv-step));
}

/* Scroll distance used to scrub the transition clip between two seasons */
.rv-agenda__transition {
	height: calc(var(--rv-vh) * 1.5);
}

/* Accessible list ------------------------------------------------------ */

/* All items for screen readers; shown as a panel when reached with the
   keyboard (the animated cards are aria-hidden and out of the tab order) */
.rv-agenda__list {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.rv-agenda__list:focus-within {
	position: fixed;
	z-index: 3;
	top: calc(var(--rv-header-bottom, 0px) + var(--rv-gap));
	right: var(--rv-gap);
	width: min(420px, calc(100vw - 2 * var(--rv-gap)));
	height: auto;
	max-height: calc(100vh - var(--rv-header-bottom, 0px) - 2 * var(--rv-gap));
	overflow: auto;
	clip: auto;
	white-space: normal;
	padding: 24px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 8px 24px rgba(74, 50, 37, 0.2);
}

.rv-agenda__list h2 {
	margin: 16px 0 8px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.5;
}

.rv-agenda__list h2:first-child {
	margin-top: 0;
}

.rv-agenda__list ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rv-agenda__list li {
	display: flex;
	flex-direction: column;
	padding: 6px 0;
	font-size: 14px;
	line-height: 1.5;
}

.rv-agenda__list a {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
}

.rv-agenda__list a:focus-visible {
	outline: 2px solid var(--rv-text);
	outline-offset: 2px;
}

.rv-agenda__list small {
	font-size: 13px;
	opacity: 0.8;
}

/* Cards stay fixed at the bottom of the screen; every pair of a season
   shares the same two slots and the active pair cross-fades in (JS sets
   .is-active from scroll position, the fade itself is time-based) */
.rv-agenda__cards {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	display: grid;
	grid-template-columns: repeat(2, var(--rv-card-w));
	gap: var(--rv-gap);
	justify-content: end;
	padding: var(--rv-gap);
	pointer-events: none;
}

.rv-agenda__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 167px;
	padding: 24px;
	border-radius: 8px;
	background: var(--rv-card-bg);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	grid-row: 1;
	grid-column: 1;
	position: relative;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.5s ease, visibility 0s linear 0.5s, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.rv-agenda__card:nth-child(even) {
	grid-column: 2;
}

.rv-agenda__card.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 0.5s ease, visibility 0s, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* With a link the whole card is clickable (the title link is stretched over it) */
.rv-agenda__card--link .rv-agenda__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
}

.rv-agenda__card--link:hover {
	background: rgba(255, 255, 255, 0.75);
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(74, 50, 37, 0.15);
}


.rv-agenda__month {
	align-self: flex-start;
	padding: 0 8px;
	border-radius: 289px;
	background: var(--rv-pill, #84e585);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.8;
}

.rv-agenda__title {
	position: static; /* theme sets headings relative; the stretched link must cover the card */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.5;
	min-height: 3em;
}

.rv-agenda__title a {
	color: inherit;
	text-decoration: none;
}

.rv-agenda__location {
	position: static; /* theme sets p relative + z-index, which would sit above the card link */
	z-index: auto;
	display: flex;
	/* Icon sits on the last line, so it lines up across cards whatever the
	   number of lines */
	align-items: flex-end;
	gap: 8px;
	margin: auto 0 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.8;
}

/* Theme sets img { width: 100% } globally */
.rv-agenda__location img {
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	/* Centre it on the last line (14px × 1.8 line-height) */
	margin-bottom: calc((14px * 1.8 - 16px) / 2);
}

/* Scroll hint ------------------------------------------------------------ */

.rv-agenda__hint {
	position: fixed;
	left: 32px;
	bottom: 32px;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 16px 8px 8px;
	border-radius: 289px;
	background: var(--rv-card-bg);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.rv-agenda__hint.is-hidden { opacity: 0; }

.rv-agenda__hint-mouse {
	position: relative;
	flex: 0 0 auto;
	width: 20px;
	height: 30px;
	border: 2px solid currentColor;
	border-radius: 10px;
}

.rv-agenda__hint-mouse::after {
	content: "";
	position: absolute;
	top: 5px;
	left: 50%;
	width: 4px;
	height: 6px;
	margin-left: -2px;
	border-radius: 2px;
	background: currentColor;
	animation: rv-agenda-wheel 1.6s ease-in-out infinite;
}

@keyframes rv-agenda-wheel {
	0%   { opacity: 0; transform: translateY(0); }
	30%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(10px); }
}

/* Touch screens: scrolling down is a swipe up, so the dot travels upwards */
@keyframes rv-agenda-swipe {
	0%   { opacity: 0; transform: translateY(10px); }
	30%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(0); }
}

@media (pointer: coarse) {
	.rv-agenda__hint-mouse::after {
		animation-name: rv-agenda-swipe;
	}
}

@media only screen and (max-width: 800px) {
	/* One card at a time: all cards share a single slot */
	.rv-agenda__season {
		height: calc(var(--rv-count, 1) * var(--rv-step));
	}

	.rv-agenda__cards {
		grid-template-columns: minmax(0, 1fr);
	}

	.rv-agenda__card:nth-child(even) {
		grid-column: 1;
	}

	/* Hint at the top, just below the header */
	.rv-agenda__hint {
		left: 50%;
		top: calc(var(--rv-header-bottom, 0px) + 16px);
		bottom: auto;
		transform: translateX(-50%);
		gap: 8px;
		padding: 6px 14px 6px 8px;
		font-size: 13px;
	}

	.rv-agenda__hint-mouse {
		width: 14px;
		height: 22px;
		border-width: 1.5px;
		border-radius: 7px;
	}

	.rv-agenda__hint-mouse::after {
		top: 4px;
		width: 3px;
		height: 5px;
		margin-left: -1.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rv-agenda__card,
	.rv-agenda__card.is-active {
		transition: none;
	}

	.rv-agenda__hint-mouse::after {
		animation: none;
	}
}

/* Shown when the options page has no items (the header overlays the top) */
.rv-agenda-empty {
	padding: 160px 16px 80px;
	text-align: center;
}
