/*
 * Happening front-end styles.
 * Inherits the theme's fonts and text color. One accent, taken from the
 * block theme palette when available. Override --happening-accent to rebrand.
 */

.happening {
	/* Block theme palette, then Astra, then Kadence, then our default. Divi is set inline from its options. */
	--happening-accent: var(--wp--preset--color--primary, var(--wp--preset--color--accent, var(--ast-global-color-0, var(--global-palette1, #1d4e89))));
	--happening-on-accent: #fff;
	--happening-line: rgba(128, 128, 128, 0.3);
	--happening-soft: rgba(128, 128, 128, 0.08);
	--happening-radius: 4px;
}

@supports (color: color-mix(in srgb, red, blue)) {
	.happening {
		--happening-line: color-mix(in srgb, currentColor 18%, transparent);
		--happening-soft: color-mix(in srgb, currentColor 6%, transparent);
	}
}

.happening .screen-reader-text,
.happening-calendar .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Details ------------------------------------------------------------ */

.happening-details {
	margin: 0 0 1.75em;
	padding: 0.15em 0 0.15em 1em;
	border-left: 3px solid var(--happening-accent);
}

.happening-details dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.4em 1.5em;
	margin: 0;
}

.happening-details dt {
	font-weight: 600;
}

.happening-details dd {
	margin: 0;
}

.happening-details__address {
	opacity: 0.8;
}

.happening-details--compact {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1.25em;
	font-size: 0.95em;
}

.happening-details--compact .happening-details__when {
	font-weight: 600;
}

@media (max-width: 480px) {
	.happening-details dl {
		grid-template-columns: 1fr;
		gap: 0.1em;
	}
	.happening-details dd {
		margin-bottom: 0.6em;
	}
}

/* Registration form -------------------------------------------------- */

.happening-rsvp {
	margin: 2.5em 0 1em;
	padding: 1.5em;
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
}

.happening-rsvp__title {
	margin-top: 0;
}

.happening-rsvp__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 0 1.25em;
}

.happening-rsvp .happening-field {
	margin: 0 0 1em;
}

.happening-rsvp label {
	display: block;
	margin-bottom: 0.3em;
	font-size: 0.9em;
	font-weight: 600;
}

.happening-rsvp input[type="text"],
.happening-rsvp input[type="email"],
.happening-rsvp input[type="tel"],
.happening-rsvp input[type="number"],
.happening-rsvp select,
.happening-rsvp textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 0.55em 0.65em;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
}

.happening-rsvp input:focus-visible,
.happening-button:focus-visible,
.happening-calendar a:focus-visible,
.happening-list a:focus-visible {
	outline: 2px solid var(--happening-accent);
	outline-offset: 2px;
}

.happening-rsvp__pay {
	margin: 0 0 1em;
	font-size: 0.92em;
	opacity: 0.85;
}

.happening-rsvp__actions {
	margin: 0.5em 0 0;
}

/* Shape at low specificity so a block theme can restyle it. Colors are
   pinned so classic themes' link colors can't make the text unreadable. */
:where(.happening-button) {
	display: inline-block;
	padding: 0.7em 1.4em;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border: 0;
	border-radius: var(--happening-radius);
	cursor: pointer;
}

body:not(.happening-theme-buttons) .happening .happening-button,
body:not(.happening-theme-buttons) .happening .happening-button:visited {
	color: var(--happening-on-accent);
	background: var(--happening-accent);
	border-radius: var(--happening-radius);
	text-decoration: none;
}

body:not(.happening-theme-buttons) .happening .happening-button:hover,
body:not(.happening-theme-buttons) .happening .happening-button:focus-visible {
	color: var(--happening-on-accent);
	filter: brightness(1.1);
}

/* Theme-buttons mode on classic themes without button styles: keep it usable. */
.happening-theme-buttons .happening a.happening-button:not([class*="wp-block"]) {
	text-decoration: none;
}

.happening-list .happening-button {
	padding: 0.5em 1.1em;
	font-size: 0.9em;
}

.happening-badge {
	display: inline-block;
	padding: 0.35em 0.8em;
	font-size: 0.85em;
	font-weight: 600;
	background: var(--happening-soft);
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
}

.happening-more {
	font-weight: 600;
}

.happening-hp {
	position: absolute !important;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.happening-notice {
	margin: 0 0 1.25em;
	padding: 0.8em 1em;
	background: var(--happening-soft);
	border-left: 3px solid currentColor;
}

.happening-notice--success {
	border-left-color: #2e7d32;
}

.happening-notice--error {
	border-left-color: #c62828;
}

.happening-notice--info {
	border-left-color: var(--happening-accent);
}

.happening-cancel .happening-rsvp__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75em 1.5em;
}

.happening-rsvp__closed {
	margin: 0;
	font-weight: 600;
}

/* List ---------------------------------------------------------------- */

.happening-list,
#left-area ul.happening-list,
.entry-content ul.happening-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.happening-list__item {
	display: grid;
	grid-template-columns: 4rem 1fr;
	gap: 1.25rem;
	align-items: start;
	padding: 1.1rem 0;
	border-bottom: 1px solid var(--happening-line);
}

.happening-list__item:first-child {
	border-top: 1px solid var(--happening-line);
}

.happening-date {
	display: block;
	padding-top: 0.15em;
	text-align: center;
	line-height: 1;
}

.happening-date__day {
	display: block;
	font-size: 2.1rem;
	font-weight: 700;
	font-variant-numeric: lining-nums;
	color: var(--happening-accent);
}

.happening-date__month {
	display: block;
	margin-top: 0.3em;
	font-size: 0.85rem;
}

.happening-list__title {
	margin: 0 0 0.3em;
	font-size: 1.2em;
	line-height: 1.3;
}

.happening-list__meta {
	margin: 0;
	font-size: 0.92em;
	opacity: 0.85;
}

.happening-list__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	margin-top: 0.75em;
}

.happening-list__seats {
	font-size: 0.9em;
	font-weight: 600;
}

/* List with images: image | date | body */
.happening-list__item.has-image {
	grid-template-columns: 9rem 4rem 1fr;
}

.happening-list__image {
	display: block;
}

/* Keeps rows and cards aligned when an event has no featured image. */
.happening-list__image--empty {
	aspect-ratio: 4 / 3;
	background: var(--happening-soft);
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
}

.happening-list--cards .happening-list__image--empty {
	display: grid;
	place-items: center;
	aspect-ratio: 16 / 9;
	text-decoration: none;
	color: var(--happening-accent);
	background: var(--happening-soft);
	border: 0;
	border-bottom: 1px solid var(--happening-line);
	border-radius: 0;
}

@supports (color: color-mix(in srgb, red, blue)) {
	.happening-list--cards .happening-list__image--empty {
		background: color-mix(in srgb, var(--happening-accent) 10%, transparent);
	}
}

.happening-list__placeholder-date {
	text-align: center;
	line-height: 1;
}

.happening-list__placeholder-date .happening-date__day {
	display: block;
	font-size: 3.5rem;
	font-weight: 700;
}

.happening-list__placeholder-date .happening-date__month {
	display: block;
	margin-top: 0.35em;
	font-size: 1rem;
	font-weight: 600;
}

.happening-list__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--happening-radius);
}

@media (max-width: 600px) {
	.happening-list__item.has-image {
		grid-template-columns: 4rem 1fr;
	}
	.happening-list__item.has-image .happening-list__image {
		grid-column: 1 / -1;
	}
	.happening-list:not(.happening-list--cards) .happening-list__image--empty {
		display: none;
	}
}

/* Cards ------------------------------------------------------------------ */

.happening-list--cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
	gap: 1.5rem;
}

.happening-list--cards .happening-list__item,
.happening-list--cards .happening-list__item.has-image {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
}

.happening-list--cards .happening-list__item:first-child {
	border-top: 1px solid var(--happening-line);
}

.happening-list--cards .happening-list__image img {
	aspect-ratio: 16 / 9;
	border-radius: 0;
}

.happening-list--cards .happening-list__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 1.1rem 1.2rem 1.25rem;
}

.happening-list__kicker {
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.85em;
	font-weight: 700;
	color: var(--happening-accent);
}

.happening-list--cards .happening-list__actions {
	margin-top: auto;
	padding-top: 0.9em;
}

/* Calendar ------------------------------------------------------------ */

.happening-calendar__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	margin-bottom: 0.75em;
}

.happening-calendar__title {
	margin: 0;
	font-size: 1.35em;
	text-align: center;
}

.happening-calendar__grid {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.happening-calendar__grid th {
	padding: 0.4em;
	font-size: 0.85em;
	font-weight: 600;
	text-align: left;
}

.happening-calendar__grid th abbr {
	text-decoration: none;
}

.happening-calendar__day {
	height: 6.5em;
	padding: 0.4em;
	vertical-align: top;
	border: 1px solid var(--happening-line);
}

.happening-calendar__day.is-outside {
	background: var(--happening-soft);
}

.happening-calendar__day.is-outside .happening-calendar__num {
	opacity: 0.5;
}

.happening-calendar__num {
	display: inline-grid;
	place-items: center;
	min-width: 1.9em;
	height: 1.9em;
	font-size: 0.85em;
	font-variant-numeric: tabular-nums;
}

.happening-calendar__day.is-today .happening-calendar__num {
	font-weight: 700;
	color: var(--happening-on-accent);
	background: var(--happening-accent);
	border-radius: 999px;
}

.happening-calendar__label {
	display: none;
}

.happening-calendar__event {
	display: -webkit-box;
	margin-top: 0.3em;
	padding: 0.2em 0.4em;
	overflow: hidden;
	font-size: 0.8em;
	line-height: 1.3;
	color: inherit;
	text-decoration: none;
	overflow-wrap: anywhere;
	hyphens: auto;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2; /* Wrap to two lines, then trim. */
	line-clamp: 2;
	background: var(--happening-soft);
	border-left: 2px solid var(--happening-accent);
}

.happening-calendar__event:hover {
	text-decoration: underline;
}

/* Phones: the grid becomes an agenda of days that have events. */
@media (max-width: 640px) {
	.happening-calendar__grid,
	.happening-calendar__grid tbody,
	.happening-calendar__grid tr,
	.happening-calendar__day {
		display: block;
		width: auto;
	}

	.happening-calendar__grid thead {
		display: none;
	}

	.happening-calendar__day {
		height: auto;
		padding: 0.75em 0;
		border: 0;
		border-bottom: 1px solid var(--happening-line);
		background: none !important;
	}

	.happening-calendar__day:not(.has-events) {
		display: none;
	}

	.happening-calendar__num {
		display: none;
	}

	.happening-calendar__label {
		display: block;
		font-weight: 600;
	}

	.happening-calendar__event {
		display: block;
		padding: 0.45em 0.6em;
		font-size: 0.95em;
		-webkit-line-clamp: unset;
		line-clamp: none;
	}
}

/* Checkout ------------------------------------------------------------ */

.happening-pay__summary {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.35em 1.5em;
	margin: 0 0 1em;
}

.happening-pay__summary dt {
	font-weight: 600;
}

.happening-pay__summary dd {
	margin: 0;
}

.happening-pay__total {
	font-size: 1.2em;
	font-weight: 700;
}

.happening-pay__hold {
	margin: 0 0 1.25em;
	font-size: 0.9em;
	opacity: 0.85;
}

.happening-pay__paypal {
	max-width: 26rem;
}

.happening-pay__status {
	min-height: 1.4em;
	margin: 0.5em 0 0;
	font-size: 0.92em;
}

.happening-pay__status.is-error {
	color: #c62828;
	font-weight: 600;
}

.happening-pay__or {
	display: flex;
	align-items: center;
	gap: 0.75em;
	max-width: 26rem;
	margin: 1em 0;
	font-size: 0.85em;
	opacity: 0.7;
}

.happening-pay__or::before,
.happening-pay__or::after {
	content: "";
	flex: 1;
	border-top: 1px solid var(--happening-line);
}

.happening-button-secondary {
	padding: 0.65em 1.25em;
	font: inherit;
	font-weight: 600;
	color: inherit;
	background: transparent;
	border: 1px solid var(--happening-line);
	border-radius: var(--happening-radius);
	cursor: pointer;
}

.happening-button-secondary:hover {
	background: var(--happening-soft);
}

/* Custom questions ---------------------------------------------------- */

.happening-rsvp .happening-field--wide {
	grid-column: 1 / -1;
}

.happening-rsvp .happening-field--check label {
	display: flex;
	align-items: flex-start;
	gap: 0.5em;
	font-weight: 400;
}

.happening-rsvp .happening-field--check input {
	margin-top: 0.3em;
}

.happening-field__optional {
	font-weight: 400;
	opacity: 0.7;
}

.happening-field__help {
	display: block;
	margin-top: 0.3em;
	font-size: 0.85em;
	opacity: 0.8;
}

/* Hide the theme's author/publish-date line on events (Settings → General). */
.happening-hide-meta .type-happening_event .post-meta,
.happening-hide-meta .type-happening_event .entry-meta,
.happening-hide-meta .type-happening_event .posted-on,
.happening-hide-meta .type-happening_event .byline,
.happening-hide-meta .type-happening_event ul.meta,
.happening-hide-meta.single-happening_event .wp-block-post-date,
.happening-hide-meta.single-happening_event .wp-block-post-author,
.happening-hide-meta.single-happening_event .wp-block-post-author-name,
.happening-hide-meta.post-type-archive-happening_event .wp-block-post-date,
.happening-hide-meta.post-type-archive-happening_event .wp-block-post-author-name {
	display: none !important;
}

/* Add to calendar ----------------------------------------------------- */

.happening-addcal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
	margin: 0 0 1.5em;
}

.happening-addcal__label {
	font-weight: 600;
	margin-right: 0.25em;
}

.happening .happening-addcal__link,
.happening .happening-addcal__link:visited,
.happening.happening-addcal a.happening-addcal__link {
	display: inline-block;
	padding: 0.45em 0.9em;
	font-size: 0.9em;
	line-height: 1.2;
	text-decoration: none;
	color: inherit;
}

/* Events archive page (classic themes). */
.happening-archive {
	margin: 0 auto 3em;
}
/* Themes without their own content container (e.g. Twenty Nineteen) get a centered column. */
.happening-archive--contained {
	box-sizing: border-box;
	max-width: 1100px;
	padding: 2em 1.25rem 0;
}
.happening-archive__header {
	margin-bottom: 1.5em;
}
.happening-archive__title {
	margin: 0 0 .25em;
}
.happening-archive .navigation.pagination {
	margin-top: 2em;
}

/* Events archive template (block themes). */
.happening-archive-block {
	padding-top: 2em;
	padding-bottom: 3em;
}
