/**
 * Front-end styles for the calendar and event lists.
 * Colors come from the --ch-* custom properties emitted by CH_Events_Palette,
 * with literal fallbacks so this file still reads correctly on its own.
 */

.ch-cal,
.ch-upcoming,
.ch-archive {
	--ch-c-brand: var( --ch-brand, #961c20 );
	--ch-c-tint: var( --ch-brand-tint, #f5e8e9 );
	--ch-c-ink: var( --ch-black, #000000 );
	--ch-c-ink60: var( --ch-ink-60, #444444 );
	--ch-c-rule: var( --ch-rule, #dddddd );
	--ch-f-head: var( --ch-font-heading, inherit );
	--ch-f-body: var( --ch-font-body, inherit );
	--ch-wt-head: var( --ch-w-heading, 500 );
	--ch-wt-body: var( --ch-w-body, 400 );
	font-family: var( --ch-f-body );
	font-weight: var( --ch-wt-body );
	font-size: 16px;
	color: var( --ch-c-ink );
}

/* ---------------------------------------------------------------- toolbar */

.ch-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	padding-bottom: 14px;
	margin-bottom: 18px;
	border-bottom: 2px solid var( --ch-c-ink );
}

.ch-views {
	display: inline-flex;
	border: 1px solid var( --ch-c-ink );
	border-radius: 100px;
	overflow: hidden;
}
.ch-viewbtn {
	appearance: none;
	background: #fff;
	border: 0;
	padding: 8px 18px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	cursor: pointer;
	color: var( --ch-c-ink );
	line-height: 1;
}
.ch-viewbtn + .ch-viewbtn {
	border-left: 1px solid var( --ch-c-rule );
}
.ch-viewbtn.is-active {
	background: var( --ch-c-ink );
	color: #fff;
}
.ch-viewbtn:hover:not( .is-active ) {
	background: var( --ch-c-tint );
}

.ch-nav {
	display: inline-flex;
	gap: 4px;
}
.ch-navbtn {
	appearance: none;
	background: #fff;
	border: 1px solid var( --ch-c-rule );
	border-radius: 3px;
	min-width: 32px;
	height: 32px;
	padding: 0 10px;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	color: var( --ch-c-ink );
}
.ch-navbtn:hover {
	border-color: var( --ch-c-brand );
	color: var( --ch-c-brand );
}
.ch-navbtn-today {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.ch-period {
	font-size: 18px;
	font-family: var( --ch-f-head );
	font-weight: var( --ch-wt-head );
}

.ch-filters {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-left: auto;
}
.ch-aud {
	padding: 6px 10px;
	border: 1px solid var( --ch-c-rule );
	border-radius: 3px;
	font-size: 13px;
	background: #fff;
	color: var( --ch-c-ink );
}
.ch-routine-toggle {
	font-size: 13px;
	color: var( --ch-c-ink60 );
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	white-space: nowrap;
}

.ch-cal-body.is-loading {
	opacity: .45;
	transition: opacity .15s ease;
}

/* ------------------------------------------------------------------ grids */

.ch-grid {
	display: grid;
	gap: 1px;
	background: var( --ch-c-rule );
	border: 1px solid var( --ch-c-rule );
}
.ch-grid-month,
.ch-grid-week {
	grid-template-columns: repeat( 7, 1fr );
}

.ch-grid-head {
	background: #fafafa;
	padding: 8px 6px;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var( --ch-c-ink60 );
	text-align: center;
}

.ch-cell {
	background: #fff;
	min-height: 104px;
	padding: 6px;
	display: flex;
	flex-direction: column;
	gap: 3px;
}
.ch-cell.is-outside {
	background: #fbfbfb;
}
.ch-cell.is-outside .ch-cell-num {
	color: #b5b5b5;
}
.ch-cell.is-today {
	background: var( --ch-c-tint );
}
.ch-cell.is-today .ch-cell-num {
	background: var( --ch-c-brand );
	color: #fff;
	border-radius: 50%;
	width: 22px;
	height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.ch-cell-num {
	font-size: 12px;
	font-weight: 700;
	color: var( --ch-c-ink60 );
	line-height: 22px;
}
.ch-cell-head {
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var( --ch-c-ink60 );
	margin-bottom: 4px;
}
.ch-grid-week .ch-cell {
	min-height: 150px;
}

/* ------------------------------------------------------------------ chips */

.ch-chip {
	display: block;
	padding: 4px 6px;
	border-left: 3px solid var( --ch-c-brand );
	background: #f7f7f7;
	font-size: 12px;
	line-height: 1.32;
	text-decoration: none;
	color: var( --ch-c-ink );
	border-radius: 2px;
}
a.ch-chip:hover {
	background: var( --ch-c-tint );
}
.ch-chip.is-routine {
	border-left-color: #bdbdbd;
	background: #fafafa;
	color: var( --ch-c-ink60 );
}
.ch-chip.is-cancelled .ch-chip-title {
	text-decoration: line-through;
	opacity: .6;
}
.ch-chip-time {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: var( --ch-c-brand );
}
.ch-chip.is-routine .ch-chip-time {
	color: #888;
}
.ch-chip-title {
	display: block;
}
.ch-chip-date {
	display: block;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var( --ch-c-ink60 );
}
.ch-chip-flag {
	display: inline-block;
	margin-top: 2px;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var( --ch-c-brand );
	background: var( --ch-c-tint );
	padding: 1px 5px;
	border-radius: 2px;
}

/* ------------------------------------------------------------- list view */

/*
 * The list view reuses the .ch-event-* classes from the shared list renderer,
 * so the server-rendered fallback and the JS view are visually identical --
 * the swap on boot must not move anything. Only the day heading and the
 * routine dimming are specific to this view.
 */

.ch-list-day {
	margin: 26px 0 10px;
	padding-bottom: 5px;
	border-bottom: 1px solid var( --ch-c-rule );
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var( --ch-c-brand );
	font-family: var( --ch-f-head );
}
.ch-listview .ch-list-day:first-child {
	margin-top: 0;
}

.ch-listview .ch-event-item {
	padding-bottom: 16px;
	margin-bottom: 16px;
}
.ch-listview .ch-event-item:last-child {
	border-bottom: 0;
	margin-bottom: 0;
	padding-bottom: 4px;
}

/* Routine services sit quieter than real events in a list. */
.ch-listview .ch-event-item.is-routine .ch-event-title {
	font-size: 16px;
}
.ch-listview .ch-event-item.is-routine .ch-event-date {
	color: var( --ch-c-ink60 );
}

.ch-event-item.is-cancelled .ch-event-title {
	text-decoration: line-through;
	opacity: .6;
}

/* --------------------------------------------- upcoming / fallback list */

.ch-event-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.ch-event-item {
	display: flex;
	gap: 16px;
	/* Thumbnail centres against the text block, not pinned to its top. */
	align-items: center;
	padding-bottom: 20px;
	margin-bottom: 20px;
	border-bottom: 1px solid var( --ch-c-rule );
}
.ch-event-item:last-child {
	border-bottom: 0;
	margin-bottom: 0;
}
.ch-event-thumb {
	flex: 0 0 160px;
	max-width: 160px;
}
.ch-event-thumb img {
	width: 100%;
	height: auto;
	display: block;
	/*
	 * Smaller than the banner's 20px deliberately. The same radius on a 160px
	 * card eats the corners rather than softening them.
	 */
	border-radius: var( --ch-thumb-radius, 12px );
}
.ch-event-body {
	flex: 1;
	min-width: 0;
}
.ch-event-date {
	display: block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var( --ch-c-brand );
	margin-bottom: 3px;
}
.ch-event-title {
	margin: 0 0 4px;
	font-size: 18px;
	line-height: 1.3;
	font-family: var( --ch-f-head );
	font-weight: var( --ch-wt-head );
}
.ch-event-title a {
	color: var( --ch-c-ink );
	text-decoration: none;
}
.ch-event-title a:hover {
	color: var( --ch-c-brand );
}
.ch-event-loc {
	margin: 0 0 4px;
	font-size: 13px;
	color: var( --ch-c-ink60 );
}
.ch-event-excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var( --ch-c-ink60 );
}

.ch-empty-note {
	color: var( --ch-c-ink60 );
	font-style: italic;
}

.ch-upcoming-more {
	text-align: center;
	margin-top: 22px;
}
.ch-btn {
	display: inline-block;
	background: #fff;
	color: var( --ch-c-ink );
	border: 2px solid var( --ch-c-ink );
	border-radius: 100px;
	padding: 13px 34px;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1;
	transition: background .2s ease, color .2s ease;
}
.ch-btn:hover {
	background: var( --ch-c-ink );
	color: #fff;
}

/* ----------------------------------------------------------------- mobile */

@media ( max-width: 980px ) {
	.ch-filters {
		margin-left: 0;
		width: 100%;
	}
}

@media ( max-width: 767px ) {
	.ch-cell {
		min-height: 74px;
		padding: 4px;
	}
	.ch-chip-title {
		font-size: 11px;
	}
	.ch-grid-week {
		grid-template-columns: 1fr;
	}
	.ch-grid-week .ch-cell {
		min-height: 0;
	}
	.ch-event-item {
		flex-direction: column;
		/* Centring is for the side-by-side layout only. Stacked, it would
		   centre the image horizontally and shrink it. */
		align-items: stretch;
	}
	.ch-event-thumb {
		flex: none;
		max-width: 100%;
		width: 100%;
	}
	.ch-period {
		font-size: 16px;
	}
}

/* ------------------------------------------------------- single event page */

.ch-single {
	--ch-f-head: var( --ch-font-heading, inherit );
	--ch-f-body: var( --ch-font-body, inherit );
	--ch-wt-head: var( --ch-w-heading, 500 );
	--ch-wt-body: var( --ch-w-body, 400 );
	--ch-c-brand: var( --ch-brand, #961c20 );
	--ch-c-tint: var( --ch-brand-tint, #f5e8e9 );
	--ch-c-ink: var( --ch-black, #000000 );
	--ch-c-ink60: var( --ch-ink-60, #444444 );
	--ch-c-rule: var( --ch-rule, #dddddd );
	color: var( --ch-c-ink );
}

/*
 * Banner width comes from Events Settings > Event page layout, via the
 * --ch-hero-* properties CH_Events_Palette emits. The fallbacks reproduce the
 * original fixed layout, so the stylesheet still works standalone.
 *
 * Centred with left/transform rather than auto margins, because the point of
 * the control is that the banner may end up WIDER than Divi's content area, and
 * auto margins collapse to zero the moment a block exceeds its parent. left:50%
 * puts the left edge at the parent's centre; translateX(-50%) pulls it back by
 * half its OWN rendered width, which centres it whether it is narrower or wider
 * and stays correct when max-width does the capping.
 *
 * THE HORIZONTAL MARGINS MUST STAY 0. Do not "tidy" this to margin: 0 auto.
 * Auto margins centre the box first, and then left/transform apply a second,
 * equal offset on top -- the two sum to exactly the free space, which lands the
 * banner flush against the right edge of the content area. That was the 0.12.0
 * bug. The offsets are the centring mechanism; auto margins are a competing one.
 *
 * No comma-bearing CSS function here: min() and clamp() would be tidier but must
 * never appear anywhere this could be pasted into a Divi field.
 */
.ch-single-hero {
	box-sizing: border-box;
	width: var( --ch-hero-w, 100% );
	max-width: var( --ch-hero-max, 1080px );
	margin: 0 0 28px;
	position: relative;
	left: 50%;
	transform: translateX( -50% );
}
/*
 * Rounded corners follow NewHomePageCustom.css: 20px on media, and SQUARE once
 * the image runs edge to edge -- a radius against the browser edge reads as a
 * rendering fault rather than a choice. The homepage does exactly this at its
 * mobile breakpoint.
 *
 * Which tiers are edge to edge is not something CSS can work out for itself; it
 * depends on the width settings. So CH_Events_Palette sets --ch-hero-radius to
 * 0 for any breakpoint where the banner fills the screen.
 */
.ch-single-hero img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var( --ch-hero-radius, 20px );
}

/*
 * The text column only ever narrows, so it needs no centring escape -- auto
 * margins are enough. border-box is explicit because this element has
 * horizontal padding and a percentage width; Divi does set it globally, but
 * relying on the theme for that would make the column 40px wider than asked.
 */
.ch-single-inner {
	box-sizing: border-box;
	width: var( --ch-text-w, 100% );
	max-width: var( --ch-text-max, 760px );
	margin: 0 auto;
	padding: 0 20px 60px;
}

.ch-single-date {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var( --ch-c-brand );
}
.ch-single-time {
	margin-left: 8px;
	color: var( --ch-c-ink60 );
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: none;
}

.ch-single-title {
	margin: 0 0 8px;
	font-size: 34px;
	line-height: 1.2;
	font-family: var( --ch-f-head );
	font-weight: var( --ch-wt-head );
}
.ch-single-loc {
	margin: 0 0 22px;
	font-size: 15px;
	color: var( --ch-c-ink60 );
}

.ch-single-body {
	font-size: 17px;
	line-height: 1.65;
	/*
	 * Body copy is normal weight, full stop. Divi's own content styling can
	 * inherit a heavier weight into this region; bold should come from the
	 * editor -- a <strong> the author actually chose -- and nowhere else.
	 */
	font-family: var( --ch-f-body );
	font-weight: var( --ch-wt-body );
}
.ch-single-body p,
.ch-single-body li,
.ch-single-body td {
	font-weight: var( --ch-wt-body );
}
.ch-single-body strong,
.ch-single-body b {
	font-weight: 700;
}
.ch-single-body h2,
.ch-single-body h3,
.ch-single-body h4 {
	font-family: var( --ch-f-head );
	font-weight: var( --ch-wt-head );
	line-height: 1.25;
}
.ch-single-body img {
	max-width: 100%;
	height: auto;
}
/* Produced by CH_Events_Divi when it converts an et_pb_image module. */
.ch-single-body .ch-figure {
	margin: 24px 0;
}
.ch-single-body .ch-figure img {
	display: block;
	border-radius: var( --ch-thumb-radius, 12px );
}
.ch-single-body .ch-inline-cta {
	margin: 24px 0;
}
.ch-single-body .ch-rule {
	margin: 28px 0;
	border: 0;
	border-top: 1px solid var( --ch-c-rule, #e3e3e3 );
}
.ch-single-body a {
	color: var( --ch-c-brand );
}

.ch-single-cta {
	margin: 28px 0 0;
	/* Two buttons sit here when an event has both. Wrap rather than overflow. */
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
/*
 * Outline sibling to ch-btn-solid. .ch-btn already supplies the pill shape,
 * border and padding, so this only needs to say it is not filled in.
 */
.ch-btn-outline {
	background: #fff;
	border-color: var( --ch-c-brand );
	color: var( --ch-c-brand );
}
.ch-btn-outline:hover {
	background: var( --ch-c-brand );
	border-color: var( --ch-c-brand );
	color: #fff;
}
.ch-btn-solid {
	background: var( --ch-c-brand );
	border-color: var( --ch-c-brand );
	color: #fff;
}
.ch-btn-solid:hover {
	background: var( --ch-brand-dark, #7b171a );
	border-color: var( --ch-brand-dark, #7b171a );
	color: #fff;
}

.ch-single-dates {
	margin-top: 36px;
	padding-top: 20px;
	border-top: 1px solid var( --ch-c-rule );
}
.ch-single-dates h2 {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var( --ch-c-ink60 );
	margin: 0 0 10px;
}
.ch-single-dates ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
	gap: 6px 18px;
}
.ch-single-dates li {
	display: flex;
	gap: 10px;
	align-items: baseline;
	font-size: 14px;
	padding: 4px 0;
	border-bottom: 1px solid #f2f2f2;
}
.ch-single-dates li.is-cancelled .ch-d-date,
.ch-single-dates li.is-cancelled .ch-d-time {
	text-decoration: line-through;
	opacity: .55;
}
.ch-d-date {
	font-weight: 700;
	min-width: 84px;
}
.ch-d-time {
	color: var( --ch-c-ink60 );
}

.ch-single-aud {
	margin-top: 28px;
}
.ch-aud-chip {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 4px 11px;
	background: var( --ch-c-tint );
	color: var( --ch-c-brand );
	border-radius: 100px;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
}

@media ( max-width: 767px ) {
	.ch-single-title {
		font-size: 26px;
	}
	.ch-single-inner {
		padding: 0 16px 40px;
	}
	.ch-single-hero {
		margin-bottom: 20px;
	}
}

/* ------------------------------------------------------ subscribe block */

.ch-subscribe {
	margin: 36px 0 8px;
	padding: 22px 24px;
	border: 1px solid var( --ch-c-rule, #e3e3e3 );
	border-radius: var( --ch-thumb-radius, 12px );
	text-align: center;
}
.ch-subscribe-alt {
	margin: 14px 0 0;
	font-size: 13px;
	color: var( --ch-c-ink60, #666 );
}
/*
 * The address has to be selectable and must not push the layout sideways on a
 * phone. break-all rather than a horizontal scroll: a URL broken across two
 * lines is still copyable, a URL that widens the page is not.
 */
.ch-subscribe-url {
	display: inline-block;
	margin-top: 4px;
	padding: 3px 7px;
	background: #f4f4f4;
	border-radius: 4px;
	font-size: 12px;
	word-break: break-all;
	user-select: all;
}

/* --------------------------------------------------------- events archive */

.ch-archive-inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 40px 20px 60px;
}
.ch-archive-head {
	margin-bottom: 26px;
}
.ch-archive-title {
	margin: 0;
	font-size: 34px;
	line-height: 1.2;
	font-family: var( --ch-f-head );
	font-weight: var( --ch-wt-head );
}
.ch-archive-desc {
	margin: 8px 0 0;
	font-size: 16px;
	color: var( --ch-ink-60, #444444 );
}

@media ( max-width: 767px ) {
	.ch-archive-title {
		font-size: 26px;
	}
	.ch-archive-inner {
		padding: 24px 16px 40px;
	}
}


/* ------------------------------------------------------ audience picker */

.ch-audpick {
	position: relative;
	font-size: 13px;
}
.ch-audpick-sum {
	list-style: none;
	cursor: pointer;
	padding: 6px 28px 6px 11px;
	border: 1px solid var( --ch-c-rule );
	border-radius: 3px;
	background: #fff;
	white-space: nowrap;
	position: relative;
	user-select: none;
}
.ch-audpick-sum::-webkit-details-marker {
	display: none;
}
.ch-audpick-sum::after {
	content: '';
	position: absolute;
	right: 11px;
	top: 50%;
	width: 6px;
	height: 6px;
	margin-top: -4px;
	border-right: 1.5px solid var( --ch-c-ink60 );
	border-bottom: 1.5px solid var( --ch-c-ink60 );
	transform: rotate( 45deg );
	transition: transform .15s ease;
}
.ch-audpick[open] .ch-audpick-sum::after {
	transform: rotate( -135deg );
	margin-top: -1px;
}
.ch-audpick-sum:hover {
	border-color: var( --ch-c-brand );
}
.ch-audpick-label {
	font-weight: 600;
}

.ch-audpick-panel {
	position: absolute;
	z-index: 30;
	top: calc( 100% + 4px );
	left: 0;
	min-width: 210px;
	background: #fff;
	border: 1px solid var( --ch-c-rule );
	border-radius: 3px;
	box-shadow: 0 6px 18px rgba( 0, 0, 0, .1 );
	padding: 6px;
}
.ch-audpick-panel label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 2px;
	cursor: pointer;
	white-space: nowrap;
}
.ch-audpick-panel label:hover {
	background: var( --ch-c-tint );
}
.ch-audpick-all {
	font-weight: 700;
	border-bottom: 1px solid var( --ch-c-rule );
	margin-bottom: 4px;
	padding-bottom: 8px !important;
}

@media ( max-width: 767px ) {
	.ch-audpick-panel {
		left: auto;
		right: 0;
	}
}


/*
 * Micro-labels keep their own heavier weights on purpose.
 *
 * The uppercase chrome -- view buttons, day names, date labels -- is set small
 * and letter-spaced, and at 500 it reads as washed out rather than quiet. These
 * are interface furniture, not content, so they take the heading FAMILY but
 * their own weight.
 */
.ch-viewbtn,
.ch-grid-head,
.ch-cell-head,
.ch-list-day,
.ch-event-date,
.ch-chip-flag,
.ch-aud-chip,
.ch-single-date,
.ch-btn,
.ch-single-dates h2 {
	font-family: var( --ch-f-head );
}
