/**
 * Chronicle Archive Hub
 * Year cards landing + filtered archive list
 */

/* -------------------------------------------------------------------------
   Layout & container
   ------------------------------------------------------------------------- */
.cah.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.cah-main {
	outline: none;
}

/* -------------------------------------------------------------------------
   Header (landing + archive)
   ------------------------------------------------------------------------- */
.cah-header {
	text-align: center;
	margin-bottom: 2.5rem;
}

.cah-header-archive {
	text-align: left;
	margin-bottom: 3.5rem;
	padding: 0;
}

.cah-back {
	margin-bottom: 0.75rem;
	font-size: 0.9375rem;
}

.cah-back a {
	color: #555;
	text-decoration: none;
}

.cah-back a:hover {
	color: #1a1a1a;
	text-decoration: underline;
}

.cah-title {
	font-size: clamp(1.75rem, 4vw, 4.25rem);
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 0.5rem;
	letter-spacing: -0.02em;
}

.cah-lead {
	font-size: 1.0625rem;
	color: #555;
	margin: 0 auto;
	line-height: 1.5;
	max-width: 50%;
}

.cah-header-archive .cah-lead {
	margin: 0 0;
	max-width: 50%;
}

/* -------------------------------------------------------------------------
   Year grid (landing)
   ------------------------------------------------------------------------- */
.cah-year-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.cah-year-card {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	padding: 2rem 1.5rem;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	text-decoration: none;
	color: #1a1a1a;
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.cah-year-card:hover {
	border-color: #0073aa;
	box-shadow: 0 6px 20px rgba(0, 115, 170, 0.12);
	transform: translateY(-2px);
	color: #0073aa;
}

.cah-year-card:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.cah-year-card-value {
	display: block;
}

/* -------------------------------------------------------------------------
   Filters (archive view)
   ------------------------------------------------------------------------- */
.cah-filters-wrap {
	background: #f6f7f8;
	border-radius: 10px;
	padding: 0;
	margin-bottom: 2rem;
	border: 1px solid #e8e8e8;
	/* Allow custom dropdowns (like month range) to overflow visually */
	overflow: visible;
}

/* Collapsible filter toggle button */
.cah-filters-collapsible {
	width: 100%;
	max-width: 100%;
}

.cah-filters-collapsible .cah-filters-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
	text-align: left;
	transition: background-color 0.2s ease;
	font-family: 'PT Serif', 'Assistant', serif;
}

.cah-filters-collapsible .cah-filters-toggle:hover {
	background-color: rgba(0, 0, 0, 0.03);
}

.cah-filters-collapsible .cah-filters-toggle:focus {
	outline: 2px solid #0073aa;
	outline-offset: -2px;
}

.cah-filters-toggle-text {
	flex: 1;
}

.cah-filters-toggle-icon {
	width: 16px;
	height: 16px;
	transition: transform 0.3s ease;
	flex-shrink: 0;
	margin-left: 0.5rem;
	color: #555;
}

.cah-filters-collapsible.cah-filters-expanded .cah-filters-toggle-icon {
	transform: rotate(180deg);
}

/* Filter content (collapsible) */
.cah-filters-content {
	padding: 1.25rem 1.5rem;
	border-top: 1px solid #e8e8e8;
}

.cah-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 1.5rem;
	align-items: flex-end;
}

.cah-filter-group {
	flex: 0 1 auto;
	min-width: 140px;
}

.cah-filter-group--month-range {
	min-width: 220px;
}

.cah-filter-group--year-range {
	min-width: 220px;
}

.cah-label {
	display: block;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #444;
	margin-bottom: 0.35rem;
}

.cah-select {
	width: 100%;
	min-width: 140px;
	padding: 0.5rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.4;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	color: #1a1a1a;
}

.cah-select:focus {
	border-color: #0073aa;
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.cah-input {
	width: 100%;
	min-width: 320px;
	padding: 0.5rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.4;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	color: #1a1a1a;
}

.cah-input:focus {
	border-color: #0073aa;
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.cah-month-range-wrapper {
	position: relative;
}

.cah-month-range-input {
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px 8px;
	padding-right: 28px;
}

.cah-month-range-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	z-index: 50;
	min-width: 100%;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 0.75rem 0.75rem 0.6rem;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
	display: none;
}

.cah-month-range-open .cah-month-range-dropdown {
	display: block;
}

.cah-month-range-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.25rem;
	margin-bottom: 0.5rem;
}

.cah-month-range-month {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.4rem 0.3rem;
	border-radius: 4px;
	border: none;
	font-size: 0.8125rem;
	background: #f2f4f7;
	color: #333;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cah-month-range-month:hover {
	background: #e2e7ee;
}

.cah-month-range-month.is-selected-from,
.cah-month-range-month.is-selected-to {
	background: #0073aa;
	color: #fff;
}

.cah-month-range-month.is-in-range {
	background: #d6e9f4;
	color: #004d73;
}

.cah-month-range-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
}

.cah-year-range-wrapper {
	position: relative;
}

.cah-year-range-input {
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px 8px;
	padding-right: 28px;
}

.cah-year-range-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	z-index: 50;
	min-width: 100%;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 0.75rem 0.75rem 0.6rem;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
	display: none;
}

.cah-year-range-open .cah-year-range-dropdown {
	display: block;
}

.cah-year-range-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	max-height: 220px;
	overflow-y: auto;
}

.cah-year-range-year {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 3rem;
	padding: 0.35rem 0.5rem;
	border-radius: 4px;
	border: none;
	font-size: 0.875rem;
	background: #f2f4f7;
	color: #333;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cah-year-range-year:hover {
	background: #e2e7ee;
}

.cah-year-range-year.is-selected-from,
.cah-year-range-year.is-selected-to {
	background: #0073aa;
	color: #fff;
}

.cah-year-range-year.is-in-range {
	background: #d6e9f4;
	color: #004d73;
}

.cah-year-range-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.cah-filter-search {
	min-width: 340px;
	flex: 1 1 340px;
}

.cah-filter-actions {
	display: flex;
	gap: 0.5rem;
	align-items: flex-end;
	flex-wrap: wrap;
}

.cah-btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	border-radius: 6px;
	text-decoration: none;
	cursor: pointer;
	border: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.cah-btn-primary {
	background: #0073aa !important;
	color: #fff;
}

.cah-btn-primary:hover {
	background: #005a87;
	color: #fff;
}

.cah-btn-secondary {
	background: #fff;
	color: #555;
	border: 1px solid #ccc;
}

.cah-btn-secondary:hover {
	background: #f0f0f0;
	color: #1a1a1a;
}

/* -------------------------------------------------------------------------
   Results
   ------------------------------------------------------------------------- */
.cah-results-count {
	font-size: 0.9375rem;
	color: #555;
	margin: 0 0 1.25rem;
}

.cah-results-count strong {
	color: #1a1a1a;
}

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

.cah-list-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid #eee;
}

.cah-list-item:last-child {
	border-bottom: none;
}

.cah-item {
	padding: 1.25rem 0;
}

.cah-item-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-bottom: 0.35rem;
	font-size: 0.8125rem;
	color: #666;
}

.cah-item-type,
.publication-type-badge {
	display: inline-block;
	padding: 0.2rem 0.5rem;
	background: #e8eef2;
	color: #005a87;
	border-radius: 4px;
	font-weight: 600;
}

.publication-type-badge--overlay {
	position: absolute;
	top: 10px;
	left: 10px;
}

.blog-post-thumbnail-zone {
	position: relative;
}

.cah-item-date {
	font-variant-numeric: tabular-nums;
}

.cah-item-region {
	color: #555;
}

.cah-item-title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
	line-height: 1.35;
}

.cah-item-title a {
	color: #1a1a1a;
	text-decoration: none;
}

.cah-item-title a:hover {
	color: #0073aa;
	text-decoration: underline;
}

.cah-item-excerpt {
	font-size: 0.9375rem;
	color: #555;
	margin: 0;
	line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------------- */
.cah-pagination {
	margin-top: 2rem;
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.cah-pagination a,
.cah-pagination span {
	display: inline-block;
	min-width: 2.25rem;
	padding: 0.4rem 0.5rem;
	text-align: center;
	font-size: 0.9375rem;
	text-decoration: none;
	color: #0073aa;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
}

.cah-pagination a:hover {
	background: #f0f6f9;
	border-color: #0073aa;
}

.cah-pagination .current {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

.cah-pagination .prev,
.cah-pagination .next {
	font-weight: 600;
}

/* -------------------------------------------------------------------------
   Empty state
   ------------------------------------------------------------------------- */
.cah-empty {
	text-align: center;
	color: #666;
	font-size: 1rem;
	padding: 2rem 1rem;
	margin: 0;
}

/* -------------------------------------------------------------------------
   Sidebar layout (filters in right column, sticky, vertical)
   Used on: page-publications, page-posts-archive, CPT archives. Not chronicle hub.
   ------------------------------------------------------------------------- */
/* Stretch sidebar column to row height so sticky has room to stick while content scrolls */
.cah--sidebar .cah-row-with-sidebar {
	align-items: stretch;
}

.cah--sidebar .cah-sidebar {
	position: relative;
	display: flex;
	flex-direction: column;
}

/* Sticky filter panel: stays in view as user scrolls up/down */
.cah--sidebar .cah-sidebar .cah-filters-wrap,
.cah--sidebar .cah-filters-wrap--sidebar {
	position: sticky;
	top: 7rem;
	align-self: flex-start;
}

/* Vertical form in sidebar: stack all controls */
.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filters,
.cah--sidebar .cah-filters-wrap--sidebar .cah-filters {
	flex-direction: column;
	align-items: stretch;
	gap: 0.75rem 0;
}

.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-group,
.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-group {
	min-width: 0;
	flex: none;
}

.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-search,
.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-search {
	min-width: 0;
	flex: none;
}

.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-input,
.cah--sidebar .cah-filters-wrap--sidebar .cah-input {
	min-width: 0;
	width: 100%;
}

.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-select,
.cah--sidebar .cah-filters-wrap--sidebar .cah-select {
	min-width: 0;
	width: 100%;
}

.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-actions,
.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

/* Sidebar filter box: compact padding, fits narrow column */
.cah--sidebar .cah-sidebar .cah-filters-wrap,
.cah--sidebar .cah-filters-wrap--sidebar {
	padding: 1rem 1.25rem;
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
	/* Sidebar stacks below content; filters no longer sticky */
	.cah--sidebar .cah-sidebar .cah-filters-wrap,
	.cah--sidebar .cah-filters-wrap--sidebar {
		position: static;
		margin-top: 1.5rem;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filters,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filters {
		flex-wrap: wrap;
		flex-direction: row;
		align-items: flex-end;
		gap: 1rem 1.25rem;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-group,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-group {
		min-width: 140px;
		flex: 0 1 auto;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-search,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-search {
		flex: 1 1 100%;
		min-width: 0;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-input,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-input {
		min-width: 200px;
	}
}

@media (max-width: 640px) {
	.cah-year-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 1rem;
	}

	.cah-year-card {
		min-height: 120px;
		padding: 1.5rem 1rem;
		font-size: 1.5rem;
	}

	/* Center title in archive view (chronicle hub when year selected) */
	.cah-header-archive .cah-title {
		text-align: center;
	}

	/* Collapsible filters: full width on mobile */
	.cah-filters-collapsible {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	.cah-filters-collapsible .cah-filters-toggle {
		padding: 0.875rem 1.25rem;
		font-size: 0.9375rem;
	}

	.cah-filters-content {
		padding: 1rem 1.25rem;
	}

	.cah-filters {
		flex-direction: column;
		align-items: stretch;
	}

	.cah-filter-group {
		min-width: 0;
		width: 100%;
	}

	.cah-filter-group--month-range {
		min-width: 0;
	}

	.cah-filter-group--year-range {
		min-width: 0;
	}

	.cah-month-range-dropdown {
		left: 0;
		right: 0;
		min-width: 0;
	}

	/* Remove flex: 1 1 340px from search filter on mobile */
	.cah-filter-search {
		flex: none;
		min-width: 0;
		width: 100%;
	}

	.cah-filter-actions {
		justify-content: flex-start;
		width: 100%;
	}

	/* CPT archives: filters at bottom should be full width */
	.cah--sidebar .cah-sidebar .cah-filters-wrap,
	.cah--sidebar .cah-filters-wrap--sidebar {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filters,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filters {
		flex-direction: column;
		align-items: stretch;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-group,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-group {
		min-width: 0;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-filter-search,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-filter-search {
		flex: none;
		min-width: 0;
		width: 100%;
	}

	.cah--sidebar .cah-sidebar .cah-filters-wrap .cah-input,
	.cah--sidebar .cah-filters-wrap--sidebar .cah-input {
		min-width: 0;
	}
}

/* -------------------------------------------------------------------------
   Weekly Digest Archive - Hide featured images
   ------------------------------------------------------------------------- */
.archive-weekly_digest .blog-post-thumbnail-zone,
.archive-weekly_digest .blog-post-thumbnail,
.archive-weekly_digest .weekly-digest-archive-item .blog-post-thumbnail-zone {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	overflow: hidden !important;
	margin: 0 !important;
	padding: 0 !important;
}