/*
 * Sermon Archive — Public Styles
 * ────────────────────────────────
 * Scoped to .sermon-archive, .sermon-search, and .sermon-viewer.
 * Uses relative units so it scales with any theme font size.
 */

/* ════════════════════════════════════════════════════════════════════════════
   SEARCH  — compact bar, minimal vertical space
   ════════════════════════════════════════════════════════════════════════════ */

.sermon-search {
	margin-bottom: 1.25rem;
}

.sermon-search__label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
	font-size: 0.875rem;
}

/* When embedded inside [sermon_library], label is visually hidden */
.sermon-search--compact .sermon-search__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.sermon-search__input-group {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.sermon-search__input {
	flex: 1;
	min-width: 0;
	padding: 0.375rem 0.625rem;
	font-size: 0.875rem;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	line-height: 1.4;
}
.sermon-search__input:focus {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
	border-color: #2271b1;
}

.sermon-search__submit {
	flex-shrink: 0;
	padding: 0.375rem 0.85rem;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 0.875rem;
	cursor: pointer;
	white-space: nowrap;
}
.sermon-search__submit:hover,
.sermon-search__submit:focus-visible {
	background: #135e96;
	outline: 2px solid #135e96;
	outline-offset: 2px;
}

.sermon-search__clear {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	background: #dcdcde;
	color: #50575e;
	text-decoration: none;
	font-size: 1rem;
	font-weight: bold;
	line-height: 1;
}
.sermon-search__clear:hover {
	background: #c3c4c7;
	color: #1d2327;
}

/* ── Search results ──────────────────────────────────────────────────────── */

.sermon-search__results {
	margin-top: 1rem;
}

.sermon-search__count {
	color: #50575e;
	font-size: 0.8rem;
	margin-bottom: 0.75rem;
}

.sermon-search__no-results {
	padding: 1rem;
	background: #f9f9f9;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	text-align: center;
	color: #50575e;
	font-size: 0.875rem;
}

.sermon-search__result-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* When search results replace the archive listing (compact/inline mode),
   the wrapper must mirror .sermon-archive so grid, padding, and margins
   are identical to the normal listing. */
.sermon-search__inline-results {
	margin-top: 0.5rem;
}

/* The results div adds margin-top that isn't present in the archive;
   remove it so the first item aligns exactly as it does in the archive. */
.sermon-search__inline-results .sermon-search__results {
	margin-top: 0;
}

.sermon-search__highlight {
	background: #fff3cd;
	padding: 0 2px;
	border-radius: 2px;
}

/* ════════════════════════════════════════════════════════════════════════════
   ARCHIVE  — two-column desktop grid, single column on tablet/phone
   ════════════════════════════════════════════════════════════════════════════ */

.sermon-archive {
	margin-top: 0.5rem;
}

/* Month section */
.sermon-archive__month {
	margin-bottom: 1.75rem;
}

.sermon-archive__month-heading {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #646970;
	border-bottom: 2px solid #dcdcde;
	padding-bottom: 0.3rem;
	margin: 0 0 0.75rem;
}

/* Two-column grid for the list of items within a month */
.sermon-archive__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0;
}

/* Each item is a card-like row */
.sermon-archive__item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.65rem 0.75rem 0.65rem 0;
	border-bottom: 1px solid #f0f0f1;
}

/* Right column items get a left padding to create visual separation */
.sermon-archive__item:nth-child(even) {
	padding-left: 1rem;
	border-left: 1px solid #f0f0f1;
}

.sermon-archive__item-main {
	flex: 1;
	min-width: 0;
	text-align: left;
}

/* Title */
.sermon-archive__title {
	font-size: 0.8rem;
	margin: 0 0 0.15rem;
	font-weight: 600;
	line-height: 1.3;
}
.sermon-archive__title a {
	color: #1d2327;
	text-decoration: none;
}
.sermon-archive__title a:hover {
	color: #2271b1;
	text-decoration: underline;
}

/* Meta line: date · speaker · size */
.sermon-archive__meta {
	font-size: 0.75rem;
	color: #646970;
	margin: 0 0 0.2rem;
	text-align: left;
}

.sermon-archive__separator {
	margin: 0 0.15rem;
	color: #c3c4c7;
}

/* Optional description */
.sermon-archive__description {
	font-size: 0.72rem;
	color: #787c82;
	margin: 0;
	line-height: 1.4;
	text-align: left;
}

/* Action buttons stacked vertically, right-aligned */
.sermon-archive__actions {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	flex-shrink: 0;
	align-items: flex-end;
}

.sermon-archive__empty {
	color: #646970;
	padding: 2rem 0;
	text-align: center;
	font-size: 0.875rem;
}

/* ── Shared icon buttons ──────────────────────────────────────────────────── */

.sermon-archive__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sermon-archive__btn svg {
	display: block;
	flex-shrink: 0;
}

.sermon-archive__btn--view {
	background: #2271b1;
	color: #fff !important;
	border: 1px solid #2271b1;
}
.sermon-archive__btn--view:hover,
.sermon-archive__btn--view:focus-visible {
	background: #135e96;
	border-color: #135e96;
	color: #fff !important;
}

.sermon-archive__btn--download {
	background: #fff;
	color: #2271b1 !important;
	border: 1px solid #c3c4c7;
}
.sermon-archive__btn--download:hover,
.sermon-archive__btn--download:focus-visible {
	background: #f0f6fc;
	border-color: #2271b1;
	color: #135e96 !important;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.sermon-archive__pagination {
	margin-top: 1.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid #dcdcde;
}

.sermon-archive__page-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
}

.sermon-archive__page-item a {
	display: inline-block;
	padding: 0.25rem 0.6rem;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	color: #2271b1;
	text-decoration: none;
	font-size: 0.8rem;
}
.sermon-archive__page-item a:hover {
	background: #f0f6fc;
}
.sermon-archive__page-item--current a {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

/* ════════════════════════════════════════════════════════════════════════════
   VIEWER
   ════════════════════════════════════════════════════════════════════════════ */

.sermon-viewer {
	max-width: 100%;
}

.sermon-viewer__back {
	margin-bottom: 0.75rem;
	font-size: 0.8rem;
}
.sermon-viewer__back a {
	color: #2271b1;
	text-decoration: none;
}
.sermon-viewer__back a:hover {
	text-decoration: underline;
}

.sermon-viewer__header {
	margin-bottom: 1rem;
}

/* Reduced from 1.5rem to match archive title weight */
.sermon-viewer__title {
	font-size: 1.15rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
}

.sermon-viewer__meta {
	font-size: 0.78rem;
	color: #646970;
	margin: 0 0 0.4rem;
}

.sermon-viewer__sep {
	margin: 0 0.1rem;
}

/* Reduced from 0.9rem */
.sermon-viewer__description {
	color: #50575e;
	font-size: 0.8rem;
	margin: 0 0 0.75rem;
	line-height: 1.55;
}

.sermon-viewer__actions {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.sermon-viewer__download-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.3rem 0.75rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: #2271b1 !important;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
.sermon-viewer__download-btn:hover {
	background: #f0f6fc;
	border-color: #2271b1;
	color: #135e96 !important;
}

/* ── PDF embed ────────────────────────────────────────────────────────────── */

.sermon-viewer__embed-wrapper {
	width: 100%;
	margin-top: 0.75rem;
}

.sermon-viewer__object {
	display: block;
	width: 100%;
	min-height: 800px;
	border: 1px solid #dcdcde;
	background: #f6f6f6;
}

.sermon-viewer__fallback {
	padding: 3rem 2rem;
	text-align: center;
}
.sermon-viewer__fallback p {
	color: #50575e;
	margin-bottom: 1rem;
}

.sermon-viewer__no-file {
	padding: 2rem;
	text-align: center;
	color: #50575e;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #f9f9f9;
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   Tablet  ≤ 900px  → single column
   Phone   ≤ 600px  → same single column, smaller viewer
   ════════════════════════════════════════════════════════════════════════════ */

/* Tablet and below: collapse to single column */
@media (max-width: 900px) {
	.sermon-archive__list {
		grid-template-columns: 1fr;
	}

	/* Remove the even-item left border/padding in single-column mode */
	.sermon-archive__item:nth-child(even) {
		padding-left: 0;
		border-left: none;
	}
}

/* Phone */
@media (max-width: 600px) {

	/* 10px side padding to match Kubio's mobile content inset */
	.sermon-archive,
	.sermon-search,
	.sermon-search__inline-results {
		padding-left: 10px;
		padding-right: 10px;
	}

	.sermon-archive__item {
		flex-direction: column;
		gap: 0.5rem;
	}
	.sermon-archive__actions {
		flex-direction: row;
		align-items: center;
	}
	.sermon-viewer__title {
		font-size: 1.2rem;
	}
	.sermon-viewer__object {
		min-height: 60vh;
	}

	/* Search bar: keep input and button on one row, button stays auto width */
	.sermon-search__input-group {
		flex-wrap: nowrap;
	}
	.sermon-search__input {
		min-width: 0;
		flex: 1;
		font-size: 0.8rem;
		padding: 0.35rem 0.5rem;
	}
	.sermon-search__submit {
		flex-shrink: 0;
		flex: none;
		padding: 0.35rem 0.65rem;
		font-size: 0.8rem;
		/* Show only the icon on very narrow screens */
	}
	.sermon-search__submit span:last-child {
		display: none; /* hide "Search" text, keep emoji icon */
	}
}
