/**
 * COD Cambridge
 * Sermon archive V2: hero, search + filters toolbar, filter drawer, compact cards, card action menu.
 * Loaded only on the sermon archive (see inc/sermon-archive.php).
 *
 * Palette: #154734 green, #c7ea46 lime, #e5e1da off-white, #101512 dark, #f4f2ed page.
 *
 * NOTE on specificity: the Elementor kit styles every <button> (filled background, square
 * corners, padding, letter-spacing, lime text on hover/focus). Button rules below are prefixed
 * with "html" and mark background / color / border-radius as !important so the kit and the
 * Hello Elementor reset cannot override them.
 */

:root {
	--cod-sa-green: #154734;
	--cod-sa-lime: #c7ea46;
	--cod-sa-lime-hover: #b6da38;
	--cod-sa-offwhite: #e5e1da;
	--cod-sa-dark: #101512;
	--cod-sa-page: #f4f2ed;
	--cod-sa-line: rgba(16, 21, 18, 0.14);
	--cod-sa-gutter: 24px;
	--cod-sa-width: 1280px;
}

.cod-sermon-toolbar .screen-reader-text,
.cod-sermon-hero .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}

html.cod-no-scroll {
	overflow: hidden;
}

/* ------------------------------------------------------------------ buttons */

html a.cod-sa-btn,
html button.cod-sa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 26px;
	border: 0;
	border-radius: 999px !important;
	background: var(--cod-sa-lime) !important;
	color: var(--cod-sa-green) !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

html a.cod-sa-btn:hover,
html button.cod-sa-btn:hover {
	background: var(--cod-sa-lime-hover) !important;
	color: var(--cod-sa-green) !important;
}

html a.cod-sa-btn:focus-visible,
html button.cod-sa-btn:focus-visible {
	outline: 3px solid var(--cod-sa-offwhite);
	outline-offset: 3px;
}

html a.cod-sa-btn.cod-sa-btn--dark,
html button.cod-sa-btn.cod-sa-btn--dark {
	background: var(--cod-sa-green) !important;
	color: var(--cod-sa-offwhite) !important;
}

html a.cod-sa-btn.cod-sa-btn--dark:hover,
html button.cod-sa-btn.cod-sa-btn--dark:hover {
	background: #0f3a2a !important;
	color: var(--cod-sa-offwhite) !important;
}

html a.cod-sa-btn.cod-sa-btn--dark:focus-visible,
html button.cod-sa-btn.cod-sa-btn--dark:focus-visible {
	outline-color: var(--cod-sa-green);
}

/* --------------------------------------------------------------------- hero
 * Editorial banner: max 1280px wide, 600px tall on desktop. The sermon artwork itself fills the banner
 * (object-fit: cover). The thumbnails carry their own title typography (left) and the preacher (right),
 * so the banner height is chosen to keep the crop small (about 17% of the height at desktop, less on
 * tablet). The title is deliberately not repeated as text.
 */

.cod-sermon-hero {
	position: relative;
	width: calc(100% - (2 * var(--cod-sa-gutter)));
	max-width: var(--cod-sa-width);
	height: 600px;
	margin: 28px auto 0;
	overflow: hidden;
	border-radius: 26px;
	background: linear-gradient(90deg, #0f3a2a 0%, var(--cod-sa-green) 50%, #0f3a2a 100%);
	color: var(--cod-sa-offwhite);
}

.cod-sermon-hero__media,
.cod-sermon-hero__shade {
	position: absolute;
	inset: 0;
}

/* "html ... img": Elementor's global `.elementor img { height: auto }` would otherwise break the fill. */
html .cod-sermon-hero img.cod-sermon-hero__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center 47%;
}

/* Lower-portion shade only, for legibility of the metadata. */
.cod-sermon-hero__shade {
	background: linear-gradient(180deg, rgba(16, 21, 18, 0) 58%, rgba(16, 21, 18, 0.72) 100%);
}

.cod-sermon-hero__content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	z-index: 2;
	padding: 0 32px 24px;
	box-sizing: border-box;
}

html .cod-sermon-hero p {
	margin: 0;
}

/* One metadata cluster: eyebrow, 6px, speaker + date, 16px, button. */
html .cod-sermon-hero p.cod-sermon-hero__eyebrow {
	margin: 0 0 6px;
	color: var(--cod-sa-lime);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

html .cod-sermon-hero p.cod-sermon-hero__meta {
	margin: 0 0 16px;
	color: var(--cod-sa-offwhite);
	font-size: 15px;
	line-height: 1.4;
}

html .cod-sermon-hero a.cod-sa-btn {
	margin: 0;
	padding: 11px 24px;
}

@media (max-width: 1180px) {
	.cod-sermon-hero {
		height: 540px;
	}
}

@media (max-width: 1024px) {
	.cod-sermon-hero {
		height: 500px;
		border-radius: 24px;
	}

	.cod-sermon-hero__content {
		padding: 0 28px 26px;
	}
}

@media (max-width: 820px) {
	.cod-sermon-hero {
		height: 400px;
	}
}

/* Mobile: artwork on top at full 16:9, metadata panel below (nothing overlays the artwork). */
@media (max-width: 767px) {
	.cod-sermon-hero {
		display: flex;
		flex-direction: column;
		height: auto;
		min-height: 392px;
		margin-top: 20px;
		border-radius: 22px;
		background: var(--cod-sa-green);
	}

	.cod-sermon-hero__media {
		position: relative;
		inset: auto;
		flex: 0 0 auto;
		aspect-ratio: 16 / 9;
	}

	.cod-sermon-hero__shade {
		display: none;
	}

	.cod-sermon-hero__content {
		position: static;
		flex: 1 1 auto;
		justify-content: center;
		padding: 22px 20px 24px;
	}
}

/* ------------------------------------------------------------ intro copy width */

html .elementor-element.cod-sermon-intro__text {
	max-width: 780px !important;
}

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

.cod-sermon-toolbar {
	width: 100%;
	max-width: var(--cod-sa-width);
	margin: 0 auto;
	box-sizing: border-box;
}

.cod-sermon-toolbar__row {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
}

/* Desktop: a compact search (max 680px) with the Filters button beside it, left aligned. */
.cod-sermon-toolbar__search {
	position: relative;
	flex: 1 1 auto;
	max-width: 680px;
	min-width: 0;
}

@media (max-width: 1024px) {
	.cod-sermon-toolbar__search {
		max-width: none;
	}
}

html .cod-sermon-toolbar input.cod-sermon-toolbar__input {
	display: block;
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 0 52px 0 22px;
	border: 1px solid var(--cod-sa-line);
	border-radius: 999px;
	background: #fff;
	color: var(--cod-sa-dark);
	font-family: inherit;
	font-size: 16px;
	box-sizing: border-box;
	-webkit-appearance: none;
	appearance: none;
}

.cod-sermon-toolbar__input::placeholder {
	color: rgba(16, 21, 18, 0.62);
	opacity: 1;
}

html .cod-sermon-toolbar input.cod-sermon-toolbar__input:focus-visible {
	outline: 2px solid var(--cod-sa-green);
	outline-offset: 2px;
	border-color: var(--cod-sa-green);
}

.cod-sermon-toolbar__input::-webkit-search-cancel-button {
	display: none;
}

html button.cod-sermon-toolbar__submit {
	position: absolute;
	top: 50%;
	right: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--cod-sa-green) !important;
	line-height: 1;
	letter-spacing: normal;
	cursor: pointer;
	transform: translateY(-50%);
}

html button.cod-sermon-toolbar__submit:hover {
	background: rgba(21, 71, 52, 0.08) !important;
	color: var(--cod-sa-green) !important;
}

html button.cod-sermon-toolbar__submit:focus-visible,
html button.cod-sermon-toolbar__filters:focus-visible,
html button.cod-sermon-drawer__close:focus-visible,
html button.cod-fgroup__toggle:focus-visible,
html .cod-sermon-drawer__reset:focus-visible {
	outline: 2px solid var(--cod-sa-green);
	outline-offset: 2px;
}

html button.cod-sermon-toolbar__filters {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
	height: 48px;
	padding: 0 22px;
	border: 1px solid var(--cod-sa-green);
	border-radius: 999px !important;
	background: transparent !important;
	color: var(--cod-sa-green) !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

html button.cod-sermon-toolbar__filters:hover {
	background: var(--cod-sa-green) !important;
	color: var(--cod-sa-offwhite) !important;
}

.cod-sermon-toolbar__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--cod-sa-lime);
	color: var(--cod-sa-green);
	font-size: 12px;
	font-weight: 700;
	box-sizing: border-box;
}

.cod-sermon-results {
	margin: 16px 0 0;
	color: rgba(16, 21, 18, 0.72);
	font-size: 15px;
}

html .cod-sermon-results a {
	margin-left: 10px;
}

@media (max-width: 767px) {
	.cod-sermon-toolbar__row {
		flex-direction: column;
		align-items: stretch;
	}

	html button.cod-sermon-toolbar__filters {
		justify-content: center;
		width: 100%;
	}
}

/* ------------------------------------------------------------------- drawer */

.cod-sermon-overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(16, 21, 18, 0.55);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.cod-sermon-overlay.is-open {
	opacity: 1;
}

.cod-sermon-drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: 100vw;
	background: var(--cod-sa-page);
	color: var(--cod-sa-dark);
	transform: translateX(-100%);
	transition: transform 0.25s ease;
}

.cod-sermon-drawer.is-open {
	transform: translateX(0);
}

.cod-sermon-drawer[hidden],
.cod-sermon-overlay[hidden] {
	display: none;
}

.cod-sermon-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid var(--cod-sa-line);
}

html .cod-sermon-drawer h2.cod-sermon-drawer__title {
	margin: 0;
	color: var(--cod-sa-green);
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
}

html button.cod-sermon-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--cod-sa-green) !important;
	line-height: 1;
	letter-spacing: normal;
	cursor: pointer;
}

html button.cod-sermon-drawer__close:hover {
	background: rgba(21, 71, 52, 0.08) !important;
	color: var(--cod-sa-green) !important;
}

.cod-sermon-drawer__body {
	flex: 1 1 auto;
	padding: 8px 24px;
	overflow-y: auto;
}

.cod-fgroup {
	border-bottom: 1px solid var(--cod-sa-line);
}

html button.cod-fgroup__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 16px 0;
	border: 0;
	border-radius: 0 !important;
	background: transparent !important;
	color: var(--cod-sa-dark) !important;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: normal;
	text-align: left;
	white-space: normal;
	cursor: pointer;
}

html button.cod-fgroup__toggle:hover {
	background: transparent !important;
	color: var(--cod-sa-green) !important;
}

.cod-fgroup__toggle svg {
	transition: transform 0.2s ease;
}

.cod-fgroup__toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

.cod-fgroup__panel {
	padding: 0 0 14px;
}

.cod-fgroup__panel[hidden] {
	display: none;
}

.cod-fgroup__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 0;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
}

.cod-fgroup__item input[type="checkbox"] {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--cod-sa-green);
}

.cod-fgroup__item input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--cod-sa-green);
	outline-offset: 2px;
}

.cod-fgroup__label {
	flex: 1 1 auto;
}

.cod-fgroup__count {
	color: rgba(16, 21, 18, 0.6);
	font-size: 13px;
}

.cod-sermon-drawer__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	border-top: 1px solid var(--cod-sa-line);
	background: var(--cod-sa-page);
}

html a.cod-sermon-drawer__reset,
html .cod-sermon-results a {
	color: var(--cod-sa-green);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: normal;
	text-decoration: underline;
	text-decoration-color: var(--cod-sa-lime);
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	transition: text-decoration-thickness 0.15s ease;
}

/* Same link philosophy as the rest of the site: text stays dark green, the lime accent thickens. */
html a.cod-sermon-drawer__reset:hover,
html a.cod-sermon-drawer__reset:focus,
html .cod-sermon-results a:hover,
html .cod-sermon-results a:focus {
	color: var(--cod-sa-green);
	text-decoration-color: var(--cod-sa-lime);
	text-decoration-thickness: 3px;
}

@media (max-width: 767px) {
	.cod-sermon-drawer {
		width: 92vw;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cod-sermon-drawer,
	.cod-sermon-overlay {
		transition: none;
	}
}

/* -------------------------------------------------------------------- cards
 * Add the CSS class "cod-sermon-card" to the loop-item root container (template 17779).
 * Title (heading with the post link) gets "cod-sermon-card__title".
 * The title link is stretched over the whole card; the action menu sits above it.
 */

.cod-sermon-card {
	position: relative;
	overflow: visible !important;
	border: 1px solid transparent;
	border-radius: 24px;
	background: transparent;
	transition: border-color 0.16s ease, background-color 0.16s ease;
}

/* Same philosophy as the Events cards: open on the page at rest; on hover a warm cream surface appears
 * around the inset artwork and the edge moves toward dark green. No lift, no shadow, artwork stays static. */
.cod-sermon-card:hover {
	border-color: rgba(21, 71, 52, 0.22);
	background: #e8e4dc;
}

.cod-sermon-card:has(.cod-sermon-card__title a:focus-visible) {
	outline: 2px solid var(--cod-sa-green);
	outline-offset: 2px;
}

.cod-sermon-card .elementor-widget-image img {
	display: block;
	width: 100%;
	height: auto !important;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: 14px !important;
}

/* Elementor widget wrappers are position: relative; the stretched link must anchor to the card instead. */
.cod-sermon-card .cod-sermon-card__title,
.cod-sermon-card .cod-sermon-card__title .elementor-widget-container {
	position: static !important;
}

/* Title + speaker read as one cluster: a tight title line-height, natural wrapping for long titles. */
html .cod-sermon-card__title .elementor-heading-title {
	line-height: 1.3 !important;
	overflow-wrap: break-word;
}

/* Equal-height cards in each grid row, whatever the title length. */
.elementor-loop-container .e-loop-item > .cod-sermon-card {
	height: 100%;
}

html .cod-sermon-card__title a {
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	line-height: inherit;
	text-decoration: none;
}

.cod-sermon-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 24px;
}

.cod-sermon-card__title a:focus-visible {
	outline: none;
}

.cod-sermon-card__meta {
	padding-right: 48px;
}

/* Speaker + date: natural name typography, secondary to the title (the kit adds link tracking to <a>). */
/* !important: Elementor emits per-widget heading typography at higher specificity. */
html .cod-sermon-card__meta .elementor-heading-title,
html .cod-sermon-card__meta .elementor-heading-title a {
	color: rgba(16, 21, 18, 0.74) !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	line-height: 1.45 !important;
	letter-spacing: 0 !important;
	text-decoration: none;
	pointer-events: none;
}

html .cod-sermon-card__meta + .cod-sermon-card__meta .elementor-heading-title {
	font-size: 13px !important;
	color: rgba(16, 21, 18, 0.62) !important;
}

/* ------------------------------------------------------------- action menu */

.cod-card-actions {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 3;
}

html button.cod-card-actions__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--cod-sa-green) !important;
	line-height: 1;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

html button.cod-card-actions__btn:hover,
html .cod-card-actions.is-open button.cod-card-actions__btn {
	background: rgba(21, 71, 52, 0.1) !important;
	color: var(--cod-sa-green) !important;
}

html button.cod-card-actions__btn:focus-visible,
html .cod-card-actions__menu button:focus-visible {
	outline: 2px solid var(--cod-sa-green);
	outline-offset: 2px;
}

.cod-card-actions__menu {
	position: absolute;
	right: 0;
	bottom: calc(100% + 6px);
	z-index: 4;
	min-width: 180px;
	margin: 0;
	padding: 4px;
	border: 1px solid var(--cod-sa-line);
	border-radius: 12px;
	background: #fff;
	list-style: none;
}

.cod-card-actions__menu[hidden] {
	display: none;
}

.cod-card-actions__menu li {
	margin: 0;
	padding: 0;
}

html .cod-card-actions__menu button {
	display: block;
	width: 100%;
	padding: 8px 12px;
	border: 0;
	border-radius: 8px !important;
	background: transparent !important;
	color: var(--cod-sa-dark) !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	letter-spacing: normal;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
}

html .cod-card-actions__menu button:hover,
html .cod-card-actions__menu button:focus-visible {
	background: rgba(199, 234, 70, 0.28) !important;
	color: var(--cod-sa-dark) !important;
}

/* -------------------------------------------------------------------- toast */

.cod-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	z-index: 100000;
	padding: 12px 20px;
	border-radius: 999px;
	background: var(--cod-sa-green);
	color: var(--cod-sa-offwhite);
	font-size: 15px;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.cod-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}
