/**
 * Lectern front-end styles.
 *
 * "Designed cards with subtle identity": layout, spacing, and one accent color,
 * with card surfaces derived from the theme's own text color (via color-mix) so
 * everything adapts to any light or dark theme instead of fighting it.
 *
 * Churches can override the accent by setting --lectern-accent in their theme.
 */

:root {
	--lectern-accent: #2b6777;
	--sk-radius: 14px;
	--sk-gap: 1.6rem;
}

/* ============================ ARCHIVE ============================
 * The plugin's own archive template (sermon post-type + our taxonomies).
 * Block themes don't constrain our <main> the way they do their own blocks,
 * so we center and pad it ourselves for a sensible width on any theme.
 */
.lectern-archive {
	max-width: 1120px;
	margin: 0 auto;
	padding: 2.4rem 1.3rem 3.5rem;
	box-sizing: border-box;
}

.lectern-archive__head { margin-bottom: 0.5rem; }

.lectern-archive__title {
	margin: 0;
	font-size: clamp(1.7rem, 3.2vw, 2.4rem);
	line-height: 1.15;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

.lectern-archive__title::after {
	content: "";
	display: block;
	width: 3rem;
	height: 3px;
	margin-top: 0.7rem;
	border-radius: 3px;
	background: var(--lectern-accent);
}

.lectern-archive__desc {
	margin-top: 0.9rem;
	max-width: 60ch;
	opacity: 0.8;
	line-height: 1.6;
}

.lectern-archive .lectern-list { margin-top: 1.9rem; }

/* Pagination on the archive. */
.lectern-archive .navigation.pagination { margin-top: 2.4rem; }
.lectern-archive .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
}
.lectern-archive .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.2em;
	padding: 0.4em 0.7em;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
	border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.lectern-archive .page-numbers:hover {
	color: var(--lectern-accent);
	border-color: color-mix(in srgb, var(--lectern-accent) 55%, transparent);
}
.lectern-archive .page-numbers.current {
	background: var(--lectern-accent);
	border-color: var(--lectern-accent);
	color: #fff;
}

/* ============================ SERMON LIST ============================ */

.lectern-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
	gap: var(--sk-gap);
	margin: 1.5rem 0;
}

/* Explicit column counts (when the block/shortcode sets `columns`). */
.lectern-cols-1 { grid-template-columns: 1fr; }
.lectern-cols-2 { grid-template-columns: repeat(2, 1fr); }
.lectern-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lectern-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 640px) {
	.lectern-list { grid-template-columns: 1fr; }
}

.lectern-item {
	display: flex;
	flex-direction: column;
	border-radius: var(--sk-radius);
	background: rgba(128, 128, 128, 0.05);
	background: color-mix(in srgb, currentColor 4%, transparent);
	border: 1px solid rgba(128, 128, 128, 0.18);
	border: 1px solid color-mix(in srgb, currentColor 13%, transparent);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 26px -20px rgba(0, 0, 0, 0.55);
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.lectern-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06), 0 20px 44px -22px rgba(0, 0, 0, 0.6);
	border-color: color-mix(in srgb, var(--lectern-accent) 50%, transparent);
}

.lectern-item__thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: color-mix(in srgb, currentColor 8%, transparent);
}

.lectern-item__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Fallback panel when a sermon has no artwork. */
.lectern-item__ph {
	width: 100%;
	height: 100%;
	display: block;
	background: linear-gradient(135deg,
		color-mix(in srgb, var(--lectern-accent) 55%, #000 10%),
		color-mix(in srgb, var(--lectern-accent) 20%, #000 45%));
}

.lectern-item__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.lectern-item__play span {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: rgba(10, 12, 14, 0.42);
	backdrop-filter: blur(2px);
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid rgba(255, 255, 255, 0.72);
	transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.lectern-item:hover .lectern-item__play span {
	background: var(--lectern-accent);
	border-color: var(--lectern-accent);
	transform: scale(1.07);
}

.lectern-item__play svg { width: 20px; height: 20px; fill: #fff; margin-left: 3px; }

.lectern-badge {
	position: absolute;
	right: 9px;
	bottom: 9px;
	background: rgba(8, 10, 12, 0.74);
	color: #fff;
	font-size: 0.72rem;
	padding: 2px 7px;
	border-radius: 6px;
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
}

.lectern-item__body {
	padding: 1rem 1.05rem 1.15rem;
	display: flex;
	flex-direction: column;
	gap: 0.42rem;
}

.lectern-item__title {
	margin: 0;
	font-size: 1.06rem;
	line-height: 1.3;
	font-weight: 650;
	letter-spacing: -0.005em;
}

.lectern-item__title a { color: inherit; text-decoration: none; }
.lectern-item__title a:hover { color: var(--lectern-accent); }

.lectern-item__excerpt {
	font-size: 0.9rem;
	opacity: 0.82;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---- Meta line (shared by list + single) ------------------------------
 * Each part is unbreakable, so a long series/speaker name wraps as a whole
 * unit to the next line instead of splitting mid-phrase. Separators are
 * added as trailing pseudo-elements so they never orphan at a line start.
 */
.lectern-item__meta,
.lectern-single__meta {
	font-size: 0.8rem;
	opacity: 0.72;
	line-height: 1.5;
	margin: 0.1rem 0;
}

.lectern-meta__part { white-space: nowrap; }
.lectern-meta__part:not(:last-child)::after {
	content: " \00B7"; /* space + middot, trailing */
	opacity: 0.5;
}

.lectern-single__meta { font-size: 0.9rem; opacity: 0.74; margin: 0 0 1.3rem; }
.lectern-single__meta a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}
.lectern-single__meta a:hover { color: var(--lectern-accent); border-color: var(--lectern-accent); }

/* ============================ SINGLE SERMON ============================ */

/* The plugin's designed single-sermon template (SingleTemplate). Block themes
 * don't constrain our <article>, so we center + pad it for a readable measure. */
.lectern-single {
	max-width: 860px;
	margin: 0 auto;
	padding: 2.4rem 1.3rem 3.5rem;
	box-sizing: border-box;
}

.lectern-single__head { margin-bottom: 1.6rem; }
.lectern-single__head .lectern-single__meta { margin: 0; }

.lectern-single__eyebrow {
	margin: 0 0 0.55rem;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--lectern-accent);
}
.lectern-single__eyebrow a { color: inherit; text-decoration: none; }
.lectern-single__eyebrow a:hover { text-decoration: underline; }

.lectern-single__title {
	margin: 0 0 0.7rem;
	font-size: clamp(1.9rem, 3.6vw, 2.7rem);
	line-height: 1.12;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.lectern-single__media { margin: 0 0 1.6rem; }
.lectern-single__media .lectern-video--embed { border-radius: var(--sk-radius); }
.lectern-single__media--art img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var(--sk-radius);
}

.lectern-single__audio { margin: 0 0 1.6rem; }

.lectern-single__content { line-height: 1.7; font-size: 1.02rem; }
.lectern-single__content > :first-child { margin-top: 0; }

.lectern-single__back { margin-top: 2.4rem; }
.lectern-single__back a { text-decoration: none; font-weight: 600; color: var(--lectern-accent); }
.lectern-single__back a:hover { text-decoration: underline; }

.lectern-single__player { margin: 0 0 1.5rem; }
.lectern-single__player .lectern-video--embed { border-radius: var(--sk-radius); }

.lectern-audio,
.lectern-video { margin: 1rem 0; }

.lectern-video--embed {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
}
.lectern-video--embed iframe,
.lectern-video--embed object,
.lectern-video--embed embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
.lectern-audio audio,
.lectern-video video { width: 100%; }

/* Download button */
.lectern-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--lectern-accent);
	color: #fff;
	padding: 0.62em 1.15em;
	border-radius: 9px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.92rem;
	line-height: 1.2;
	box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--lectern-accent) 90%, transparent);
}
.lectern-button:hover,
.lectern-button:focus { color: #fff; opacity: 0.94; }
.lectern-button svg { width: 16px; height: 16px; fill: currentColor; }
.lectern-download { margin: 1.2rem 0 0; }

/* Footer tags as pills */
.lectern-single__footer {
	margin-top: 1.9rem;
	padding-top: 1.2rem;
	border-top: 1px solid color-mix(in srgb, currentColor 13%, transparent);
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}
.lectern-terms { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.lectern-terms__label {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.55;
	margin-right: 0.25rem;
}
.lectern-pill {
	font-size: 0.8rem;
	padding: 0.3em 0.72em;
	border-radius: 999px;
	text-decoration: none;
	color: inherit;
	background: color-mix(in srgb, currentColor 7%, transparent);
	border: 1px solid color-mix(in srgb, currentColor 13%, transparent);
	transition: color 0.15s ease, border-color 0.15s ease;
}
.lectern-pill:hover { color: var(--lectern-accent); border-color: color-mix(in srgb, var(--lectern-accent) 55%, transparent); }

/* ============================ MISC ============================ */

.lectern-empty { font-style: italic; opacity: 0.75; }

/* Fallback link (unembeddable video) */
.lectern-link { display: inline-block; font-weight: 600; text-decoration: none; }
.lectern-link:hover { color: var(--lectern-accent); }

/* Keyboard focus */
.lectern-item__title a:focus-visible,
.lectern-single__meta a:focus-visible,
.lectern-pill:focus-visible,
.lectern-button:focus-visible,
.lectern-item__thumb:focus-visible {
	outline: 2px solid var(--lectern-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.lectern-item,
	.lectern-item__play span { transition: none; }
	.lectern-item:hover { transform: none; }
}

/* ============================ THEME LINK DEFENSE ============================
 * Some themes paint every <a> in a loud brand color and force underlines
 * (e.g. bright orange). Our card titles, meta, and pills are links but should
 * read as Lectern designed them — the theme's own text color for titles,
 * our accent for interaction — regardless of the theme's link styles. These
 * rules use !important narrowly, only on our own components, so churches can
 * still recolor everything through the --lectern-accent variable.
 *
 * Selectors are prefixed with the component container so their specificity
 * clears a theme's own class-level link rules in any load order.
 */
.lectern-list .lectern-item__title a,
.lectern-list .lectern-item__meta a,
.lectern-single .lectern-single__meta a,
.lectern-single .lectern-single__eyebrow a {
	color: inherit !important;
	text-decoration: none !important;
	box-shadow: none !important;
	background: none !important;
}

.lectern-list .lectern-item__title a:hover,
.lectern-list .lectern-item__title a:focus,
.lectern-list .lectern-item__meta a:hover,
.lectern-list .lectern-item__meta a:focus,
.lectern-single .lectern-single__meta a:hover,
.lectern-single .lectern-single__meta a:focus {
	color: var(--lectern-accent) !important;
}

.lectern-single .lectern-single__eyebrow a:hover,
.lectern-single .lectern-single__eyebrow a:focus { text-decoration: underline !important; }

.lectern-list a.lectern-pill,
.lectern-single a.lectern-pill {
	color: inherit !important;
	text-decoration: none !important;
	box-shadow: none !important;
}
.lectern-list a.lectern-pill:hover,
.lectern-list a.lectern-pill:focus,
.lectern-single a.lectern-pill:hover,
.lectern-single a.lectern-pill:focus { color: var(--lectern-accent) !important; }

.lectern-single a.lectern-button,
.lectern-single a.lectern-button:hover,
.lectern-single a.lectern-button:focus {
	color: #fff !important;
	text-decoration: none !important;
}

.lectern-single .lectern-single__back a { color: var(--lectern-accent) !important; text-decoration: none !important; }
.lectern-single .lectern-single__back a:hover,
.lectern-single .lectern-single__back a:focus { text-decoration: underline !important; }
