/**
 * TH Events Calendar View.
 * Scoped replacement UI for The Events Calendar month archive.
 */

.th-ecal {
	--th-ecal-green: #4db247;
	--th-ecal-green-dark: #15803d;
	--th-ecal-green-soft: #eef9f0;
	--th-ecal-blue: #2563eb;
	--th-ecal-ink: #101828;
	--th-ecal-text: #667085;
	--th-ecal-muted: #98a2b3;
	--th-ecal-line: #e5e7eb;
	--th-ecal-line-strong: #d8dee8;
	--th-ecal-bg: #f7f8fa;
	--th-ecal-card: #ffffff;
	--th-ecal-shadow: 0 18px 46px -32px rgba(16, 24, 40, 0.48), 0 2px 8px rgba(16, 24, 40, 0.06);
	--th-ecal-shadow-soft: 0 1px 3px rgba(16, 24, 40, 0.08);

	box-sizing: border-box;
	width: min(1176px, calc(100% - 48px));
	margin: 0 auto;
	padding: 48px 0 80px;
	color: var(--th-ecal-ink);
	font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.th-ecal *,
.th-ecal *::before,
.th-ecal *::after {
	box-sizing: inherit;
}

.th-ecal a {
	color: inherit;
	text-decoration: none;
}

.th-ecal button {
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.th-ecal__shell {
	width: 100%;
}

.th-ecal__toolbar {
	display: grid;
	grid-template-columns: 44px minmax(0, auto) 44px auto;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 0 0 22px;
}

.th-ecal__month {
	min-width: 220px;
	margin: 0;
	text-align: center;
	font-size: 32px;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0;
	color: var(--th-ecal-ink);
}

.th-ecal__nav,
.th-ecal__today {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--th-ecal-line);
	background: #fff;
	background-image: none;
	color: var(--th-ecal-ink);
	box-shadow: var(--th-ecal-shadow-soft);
	cursor: pointer;
	transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

body .th-ecal button.th-ecal__nav {
	background: #fff !important;
	background-image: none !important;
	border-color: var(--th-ecal-line) !important;
	color: var(--th-ecal-ink) !important;
	-webkit-text-fill-color: var(--th-ecal-ink) !important;
	box-shadow: var(--th-ecal-shadow-soft) !important;
}

body .th-ecal button.th-ecal__today {
	background: var(--th-ecal-green-soft) !important;
	background-image: none !important;
	border-color: rgba(77, 178, 71, 0.28) !important;
	color: var(--th-ecal-green-dark) !important;
	-webkit-text-fill-color: var(--th-ecal-green-dark) !important;
	box-shadow: var(--th-ecal-shadow-soft) !important;
}

body .th-ecal button.th-ecal__nav:hover,
body .th-ecal button.th-ecal__nav:focus,
body .th-ecal button.th-ecal__nav:active,
body .th-ecal button.th-ecal__today:hover,
body .th-ecal button.th-ecal__today:focus,
body .th-ecal button.th-ecal__today:active {
	background-image: none !important;
	border-color: rgba(77, 178, 71, 0.55) !important;
	color: var(--th-ecal-green-dark) !important;
	-webkit-text-fill-color: var(--th-ecal-green-dark) !important;
}

body .th-ecal button.th-ecal__nav:hover,
body .th-ecal button.th-ecal__nav:focus,
body .th-ecal button.th-ecal__nav:active {
	background: #fff !important;
}

body .th-ecal button.th-ecal__today:hover,
body .th-ecal button.th-ecal__today:focus,
body .th-ecal button.th-ecal__today:active {
	background: #e5f7e8 !important;
}

.th-ecal__nav {
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 999px;
}

.th-ecal__today {
	min-height: 40px;
	padding: 0 16px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	color: var(--th-ecal-green-dark);
	border-color: rgba(77, 178, 71, 0.28);
	background: var(--th-ecal-green-soft);
}

.th-ecal__nav:hover,
.th-ecal__today:hover {
	border-color: rgba(77, 178, 71, 0.55);
	box-shadow: 0 8px 18px -14px rgba(21, 128, 61, 0.8);
	color: var(--th-ecal-green-dark);
	transform: translateY(-1px);
}

.th-ecal__nav:focus-visible,
.th-ecal__today:focus-visible,
.th-ecal__event:focus-visible,
.th-ecal__agenda-card:focus-visible {
	outline: 0;
	box-shadow: 0 0 0 3px rgba(77, 178, 71, 0.24), var(--th-ecal-shadow-soft);
}

.th-ecal__icon {
	display: block;
	width: 18px;
	height: 18px;
	flex: none;
}

.th-ecal__desktop {
	display: block;
}

.th-ecal__weekdays {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
	margin: 0 0 8px;
	padding: 0 2px;
}

.th-ecal__weekday {
	padding: 0 10px 8px;
	font-size: 12px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #8a96a8;
}

.th-ecal__grid {
	position: relative;
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
	align-items: stretch;
}

.th-ecal__day {
	position: relative;
	min-width: 0;
	min-height: 156px;
	padding: 12px;
	border: 1px solid var(--th-ecal-line);
	border-radius: 10px;
	background: var(--th-ecal-card);
	box-shadow: 0 1px 1px rgba(16, 24, 40, 0.02);
	overflow: visible;
	z-index: 1;
}

.th-ecal__day:hover {
	z-index: 8;
}

.th-ecal__day--outside {
	background: #fbfcfd;
}

.th-ecal__day--outside .th-ecal__day-number {
	color: #c5ccd6;
}

.th-ecal__day--today {
	border-color: rgba(77, 178, 71, 0.78);
	box-shadow: 0 0 0 1px rgba(77, 178, 71, 0.1), 0 10px 22px -20px rgba(21, 128, 61, 0.7);
}

.th-ecal__day-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 32px;
}

.th-ecal__day-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 999px;
	font-size: 24px;
	font-weight: 750;
	line-height: 1;
	letter-spacing: 0;
	color: #343b4a;
}

.th-ecal__day--today .th-ecal__day-number {
	background: transparent;
	color: var(--th-ecal-green-dark);
	box-shadow: none;
}

.th-ecal__events {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 10px;
}

.th-ecal__event {
	position: relative;
	display: block;
	min-width: 0;
	padding: 9px 10px 9px 11px;
	border: 1px solid rgba(77, 178, 71, 0.18);
	border-left: 3px solid var(--th-ecal-green);
	border-radius: 8px;
	background: #f6fbf7;
	color: var(--th-ecal-ink);
	transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.th-ecal__event:hover {
	border-color: rgba(77, 178, 71, 0.44);
	background: #f4fbf5;
	box-shadow: 0 10px 22px -18px rgba(16, 24, 40, 0.45);
	transform: translateY(-1px);
	z-index: 20;
}

.th-ecal__event-time {
	display: block;
	margin-bottom: 3px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--th-ecal-green-dark);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.th-ecal__event-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.32;
	color: #202938;
}

.th-ecal__event-details {
	display: block;
	position: absolute;
	top: calc(100% + 7px);
	left: -1px;
	right: -1px;
	z-index: 30;
	padding: 10px 11px;
	border: 1px solid rgba(77, 178, 71, 0.24);
	border-left: 3px solid var(--th-ecal-green);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 18px 34px -22px rgba(16, 24, 40, 0.6), 0 4px 12px rgba(16, 24, 40, 0.08);
	opacity: 0;
	margin-top: 0;
	overflow: hidden;
	pointer-events: none;
	transform: translateY(-4px);
	visibility: hidden;
	transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.th-ecal__event:hover .th-ecal__event-details,
.th-ecal__event:focus-visible .th-ecal__event-details {
	opacity: 1;
	transform: translateY(0);
	visibility: visible;
}

.th-ecal__event-desc,
.th-ecal__event-venue {
	min-height: 0;
}

.th-ecal__event-desc {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.45;
	color: var(--th-ecal-text);
}

.th-ecal__event-venue {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 7px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.25;
	color: #475467;
}

.th-ecal__event-venue .th-ecal__icon {
	width: 13px;
	height: 13px;
	color: var(--th-ecal-blue);
}

.th-ecal__empty {
	margin: 18px 0 0;
	padding: 18px 20px;
	border: 1px solid var(--th-ecal-line);
	border-radius: 10px;
	background: #fff;
	color: var(--th-ecal-text);
	text-align: center;
	box-shadow: var(--th-ecal-shadow-soft);
}

.th-ecal__empty p,
.th-ecal__noscript {
	margin: 0;
}

.th-ecal__mobile {
	display: none;
}

.th-ecal__noscript {
	margin-top: 14px;
	padding: 12px 14px;
	border: 1px solid var(--th-ecal-line);
	border-radius: 8px;
	background: #fff;
	color: var(--th-ecal-text);
	font-size: 14px;
}

.th-ecal.is-loading .th-ecal__viewport {
	position: relative;
}

.th-ecal.is-loading .th-ecal__viewport::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.58);
	backdrop-filter: blur(1px);
	pointer-events: none;
}

@media (max-width: 1024px) {
	.th-ecal {
		width: min(100% - 32px, 920px);
		padding-top: 36px;
	}

	.th-ecal__day {
		min-height: 136px;
		padding: 10px;
	}

	.th-ecal__day-number {
		width: 30px;
		height: 30px;
		font-size: 21px;
	}

	.th-ecal__event {
		padding: 8px;
	}
}

@media (max-width: 760px) {
	.th-ecal {
		width: 100vw;
		max-width: 100vw;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		padding: 16px 12px 42px;
		background: #f8fafc;
		overflow-x: hidden;
		overflow-x: clip;
	}

	.th-ecal__toolbar {
		grid-template-columns: 42px minmax(0, 1fr) 42px;
		width: calc(100vw - 24px);
		max-width: 520px;
		margin: 0 auto 12px;
		gap: 10px;
	}

	.th-ecal__month {
		min-width: 0;
		font-size: 22px;
		font-weight: 800;
	}

	.th-ecal__nav {
		width: 42px;
		height: 42px;
		border-radius: 999px;
	}

	body .th-ecal button.th-ecal__nav {
		background: #fff !important;
		border-color: #e2e8f0 !important;
		color: #475467 !important;
		-webkit-text-fill-color: #475467 !important;
		box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08) !important;
	}

	body .th-ecal button.th-ecal__nav:hover,
	body .th-ecal button.th-ecal__nav:focus,
	body .th-ecal button.th-ecal__nav:active {
		background: #fff !important;
		border-color: rgba(77, 178, 71, 0.5) !important;
		color: var(--th-ecal-green-dark) !important;
		-webkit-text-fill-color: var(--th-ecal-green-dark) !important;
	}

	.th-ecal__today {
		display: none;
	}

	.th-ecal__desktop {
		display: none;
	}

	.th-ecal__mobile {
		display: block;
	}

	.th-ecal__mini-card {
		width: calc(100vw - 24px);
		max-width: 520px;
		margin: 0 auto;
		padding: 14px;
		border: 1px solid var(--th-ecal-line);
		border-radius: 16px;
		background: #fff;
		box-shadow: 0 8px 24px -18px rgba(16, 24, 40, 0.45), 0 1px 3px rgba(16, 24, 40, 0.08);
	}

	.th-ecal__mini-weekdays {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: 5px;
		margin: 0 0 8px;
		text-align: center;
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.08em;
		color: #98a4b5;
	}

	.th-ecal__mini-grid {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
		gap: 5px;
	}

	.th-ecal__mini-day {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		aspect-ratio: 1 / 0.78;
		min-width: 0;
		border: 1px solid var(--th-ecal-line);
		border-radius: 10px;
		background: #fff;
		color: var(--th-ecal-ink);
		font-size: 15px;
		font-weight: 800;
		line-height: 1;
	}

	button.th-ecal__mini-day {
		width: 100%;
		padding: 0;
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
		transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
	}

	body .th-ecal button.th-ecal__mini-day {
		background: #fff !important;
		background-image: none !important;
		border-color: var(--th-ecal-line) !important;
		color: var(--th-ecal-ink) !important;
		-webkit-text-fill-color: var(--th-ecal-ink) !important;
	}

	button.th-ecal__mini-day:hover:not(.is-selected) {
		border-color: rgba(77, 178, 71, 0.55);
		transform: translateY(-1px);
	}

	body .th-ecal button.th-ecal__mini-day:hover:not(.is-selected) {
		border-color: rgba(77, 178, 71, 0.55) !important;
	}

	button.th-ecal__mini-day:focus-visible {
		outline: 0;
		box-shadow: 0 0 0 3px rgba(77, 178, 71, 0.28);
	}

	.th-ecal__mini-day--outside {
		color: #c5ccd7;
		background: #fafbfc;
	}

	.th-ecal__mini-day--today:not(.is-selected) {
		border-color: var(--th-ecal-green);
		color: var(--th-ecal-green-dark);
		background: #fff;
	}

	body .th-ecal button.th-ecal__mini-day--today:not(.is-selected) {
		background: #fff !important;
		border-color: var(--th-ecal-green) !important;
		color: var(--th-ecal-green-dark) !important;
		-webkit-text-fill-color: var(--th-ecal-green-dark) !important;
	}

	.th-ecal__mini-day.is-selected {
		background: var(--th-ecal-green);
		border-color: var(--th-ecal-green);
		color: #fff;
		box-shadow: 0 14px 24px -16px rgba(21, 128, 61, 0.9);
	}

	body .th-ecal button.th-ecal__mini-day.is-selected {
		background: var(--th-ecal-green) !important;
		border-color: var(--th-ecal-green) !important;
		color: #fff !important;
		-webkit-text-fill-color: #fff !important;
	}

	.th-ecal__mini-day--has-events::after {
		content: "";
		position: absolute;
		left: 50%;
		bottom: 5px;
		width: 4px;
		height: 4px;
		border-radius: 999px;
		background: var(--th-ecal-green);
		transform: translateX(-50%);
	}

	.th-ecal__mini-day.is-selected::after {
		background: #fff;
	}

	.th-ecal__agenda {
		display: flex;
		flex-direction: column;
		gap: 14px;
		width: calc(100vw - 24px);
		max-width: 520px;
		margin: 14px auto 0;
	}

	.th-ecal__agenda-group {
		display: block;
	}

	.th-ecal__agenda-date {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		gap: 8px;
		min-height: 28px;
		margin: 0 0 8px;
		padding: 0 2px;
		border: 0;
		border-radius: 0;
		background: transparent;
		color: var(--th-ecal-ink);
		box-shadow: none;
	}

	.th-ecal__agenda-day {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 24px;
		padding: 0 9px;
		border-radius: 999px;
		background: var(--th-ecal-green-soft);
		font-size: 11px;
		font-weight: 900;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: var(--th-ecal-green-dark);
	}

	.th-ecal__agenda-label {
		margin-top: 0;
		font-size: 14px;
		font-weight: 800;
		line-height: 1.2;
		text-align: center;
		color: #475467;
	}

	.th-ecal__agenda-list {
		display: flex;
		flex-direction: column;
		gap: 10px;
		min-width: 0;
	}

	.th-ecal__agenda-card {
		display: flex;
		flex-direction: column;
		min-width: 0;
		padding: 16px;
		border: 1px solid var(--th-ecal-line);
		border-radius: 14px;
		background: #fff;
		box-shadow: 0 8px 22px -18px rgba(16, 24, 40, 0.5), 0 1px 3px rgba(16, 24, 40, 0.08);
		color: inherit;
		transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
	}

	.th-ecal__agenda-card:hover {
		border-color: rgba(77, 178, 71, 0.4);
		transform: translateY(-1px);
	}

	.th-ecal__agenda-card-top {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 12px;
		min-width: 0;
	}

	.th-ecal__agenda-title {
		min-width: 0;
		font-size: 16px;
		font-weight: 800;
		line-height: 1.28;
		color: var(--th-ecal-ink);
		overflow-wrap: anywhere;
	}

	.th-ecal__agenda-arrow {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		border: 1px solid var(--th-ecal-line);
		border-radius: 999px;
		color: var(--th-ecal-green-dark);
		background: var(--th-ecal-green-soft);
		flex: none;
	}

	.th-ecal__agenda-arrow .th-ecal__icon {
		width: 14px;
		height: 14px;
	}

	.th-ecal__agenda-meta {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
		margin-top: 10px;
	}

	.th-ecal__agenda-meta span,
	.th-ecal__agenda-venue {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 28px;
		padding: 5px 8px;
		border: 1px solid var(--th-ecal-line-strong);
		border-radius: 999px;
		background: #fbfcff;
		font-size: 12px;
		font-weight: 700;
		line-height: 1.2;
		color: #58657a;
	}

	.th-ecal__agenda-meta .th-ecal__icon,
	.th-ecal__agenda-venue .th-ecal__icon {
		width: 14px;
		height: 14px;
		color: var(--th-ecal-blue);
	}

	.th-ecal__agenda-venue {
		align-self: flex-start;
		margin-top: 8px;
		max-width: 100%;
	}

	.th-ecal__agenda-excerpt {
		display: none;
	}

	.th-ecal__agenda-cta {
		display: inline-flex;
		align-self: flex-start;
		align-items: center;
		justify-content: center;
		min-height: 30px;
		margin-top: 12px;
		padding: 0;
		border-radius: 999px;
		background: transparent;
		color: var(--th-ecal-green-dark);
		-webkit-text-fill-color: var(--th-ecal-green-dark);
		font-size: 12.5px;
		font-weight: 800;
	}

	.th-ecal__empty--mobile {
		margin-top: 0;
		border-radius: 18px;
	}
}

@media (max-width: 420px) {
	.th-ecal {
		padding-left: 12px;
		padding-right: 12px;
	}

	.th-ecal__mini-card {
		padding: 12px;
		border-radius: 16px;
	}

	.th-ecal__mini-grid {
		gap: 6px;
	}

	.th-ecal__mini-day {
		border-radius: 11px;
		font-size: 14px;
	}

	.th-ecal__agenda-date {
		min-height: 26px;
	}

	.th-ecal__agenda-card {
		padding: 15px;
	}
}

@media (max-width: 520px) {
	.th-ecal__toolbar,
	.th-ecal__mini-card,
	.th-ecal__agenda {
		margin-left: 0;
		margin-right: auto;
		max-width: 366px;
	}
}
