/**
 * Churchill Author Single — profile header and article grid.
 *
 * Follows the approved design: a wide grey-backed portrait beside the profile
 * detail with icon-only contact links top-right, then a light-blue section
 * heading, a filter bar matching the theme's archive pages, and the theme's
 * three-column card grid.
 *
 * Brand values come from the theme's :root with a fallback, so the block also
 * renders correctly inside the editor iframe where those vars may not have
 * loaded yet.
 */

.cas-author {
	padding: 50px 0;
}

/* ── Profile header ─────────────────────────────────────────────────────── */

.cas-profile {
	display: grid;
	/* Square portrait (author images are cropped 1:1 on upload), capped so
	   it never towers over the profile text on wide screens. */
	grid-template-columns: minmax(0, min(38%, 460px)) 1fr;
	gap: 46px;
	align-items: start;
	margin-bottom: 60px;
	margin-top: 120px;
}

/* Grey plate behind the cut-out portrait, as in the design. */
.cas-profile__media {
	background: #d9d9d9;
	border-radius: 20px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
}

.cas-profile__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	display: block;
}

/* Name and the contact icons share a row. */
.cas-profile__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 18px;
}

.cas-profile__name {
	margin: 0;
	font-size: 40px;
	font-weight: 700 !important;
	line-height: 1.05;
	color: var(--lightblue, #0082C2);
}

/* Contact icons */

.cas-contact {
	display: flex;
	align-items: center;
	gap: 16px;
	list-style: none;
	margin: 6px 0 0;
	padding: 0;
	flex-shrink: 0;
}

.cas-contact__link {
	display: block;
	color: var(--orange, #E55300);
	text-decoration: none;
	transition: 0.3s;
}

.cas-contact__link svg {
	display: block;
	width: 30px;
	height: 30px;
	fill: currentColor;
}

.cas-contact__link:hover {
	color: var(--magenta, #D31566);
	transition: 0.3s;
}

.cas-contact__link:focus-visible {
	outline: 3px solid var(--lightblue, #0082C2);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Job Title: / Expertise: rows — bold dark-blue label, value alongside. */

.cas-profile__row {
	margin: 0 0 12px;
	font-size: 22px;
	line-height: 1.35;
	color: var(--darkblue, #233060);
}

.cas-profile__key {
	font-weight: 700;
}

.cas-profile__val {
	font-weight: 700;
}

/* Expertise reads lighter than its label, per the design. */
.cas-profile__val--light {
	font-weight: 400;
	color: var(--grey, #4D5858);
}

.cas-profile__about {
	margin: 28px 0 12px;
	font-size: 22px;
	font-weight: 700 !important;
	color: var(--darkblue, #233060);
}

.cas-profile__desc {
	color: var(--grey, #4D5858);
	font-size: 17px;
	line-height: 1.6;
}

.cas-profile__desc p {
	margin: 0 0 16px;
}

.cas-profile__desc p:last-child {
	margin-bottom: 0;
}

/* ── Section heading ────────────────────────────────────────────────────── */

.cas-posts__heading {
	margin: 0 0 10px;
	font-size: 40px;
	font-weight: 700 !important;
	color: var(--lightblue, #0082C2);
}

/* ── Filter bar ─────────────────────────────────────────────────────────── */

/* Mirrors .archive-loop .filtering-area so the two read as one system. */
.cas-filters {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 20px 0 30px;
}

.cas-filters__field {
	display: flex;
	align-items: center;
	gap: 8px;
}

.cas-filters__label {
	font-size: 22px;
	font-weight: 600;
	color: var(--darkblue, #233060);
	white-space: nowrap;
}

.cas-filters__select {
	padding: 5px 30px;
	border: 1px solid var(--lightblue, #0082C2);
	border-radius: 3px;
	color: var(--purple, #6F2A7F);
	background: #fff;
	cursor: pointer;
	/* Native selects refuse to shrink below their longest option, which is what
	   pushes the bar into overflow on narrow screens. */
	min-width: 0;
	max-width: 100%;
}

.cas-filters__select:focus-visible {
	outline: 3px solid var(--lightblue, #0082C2);
	outline-offset: 2px;
}

.cas-filter-btn {
	padding: 5px 60px;
	border-radius: 50px;
	border: 1px solid var(--darkblue, #233060);
	background-color: var(--darkblue, #233060);
	color: #fff;
	font-size: 15px;
	cursor: pointer;
	transition: 0.3s;
}

.cas-filter-btn:hover {
	background-color: var(--green, #006937);
	border-color: var(--green, #006937);
	transition: 0.3s;
}

.cas-filter-btn:focus-visible {
	outline: 3px solid var(--lightblue, #0082C2);
	outline-offset: 2px;
}

/* ── Article grid ───────────────────────────────────────────────────────── */

/* The list carries .loop-content, so the theme's flex grid applies. These
   rules scope the card chrome to this block without touching the theme. */
/*
 * Grid rather than flex: every card in a row then shares the tallest card's
 * height for free, and a short last row keeps the column width of a full one
 * instead of stretching to fill.
 *
 * --cas-cols is the single knob the media queries turn; minmax(0, 1fr) rather
 * than a percentage basis so the columns stay equal regardless of content
 * width (a long unbroken title cannot widen its own column).
 */
.cas-posts__list {
	display: grid;
	grid-template-columns: repeat(var(--cas-cols, 3), minmax(0, 1fr));
	gap: 40px 3.5%;
	align-items: stretch;
	transition: opacity 0.2s;
	margin-bottom: 70px;
}
.cas-posts{
	margin-bottom: 30px;
}
.cas-posts__list:focus {
	outline: none;
}

.cas-author.is-loading .cas-posts__list {
	opacity: 0.55;
}

.cas-author .cas-item {
	/* Height comes from the grid row, so the card fills it rather than
	   sizing to its own content — this is what keeps buttons aligned. */
	height: 100%;
	border-radius: 20px;
	border: 1px solid var(--lightgrey, #efefef);
	background: #fff;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.cas-author .cas-item:nth-child(odd) .blog-details {
	background: #fff;
}
/* The design shows every card on the same light-grey body, so unlike the
   theme's archive we do not alternate on :nth-child(odd). */
.cas-author .cas-item .blog-details {
	background: var(--lightgrey, #efefef);
	padding: 20px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.cas-author .cas-item .blog-featured-image {
	display: block;
	width: 100%;
	height: 200px;
	border-radius: 0;
	background-color: var(--lightgrey, #efefef);
	background-size: cover;
	background-position: center;
}

.cas-author .cas-item .blog-date {
	font-size: 15px;
	color: var(--grey, #4D5858);
	margin-bottom: 8px;
}

.cas-author .cas-item .blog-title {
	margin: 0 0 10px;
	font-size: 21px;
	font-weight: 700 !important;
	line-height: 1.25;
	color: var(--darkblue, #233060);
	min-height: 0;
	display: block;
}

.cas-author .cas-item .blog-title a {
	color: inherit;
	text-decoration: none;
	transition: 0.3s;
}

.cas-author .cas-item .blog-title a:hover {
	color: var(--magenta, #D31566);
	transition: 0.3s;
}

.cas-author .cas-item .excerpt {
	margin-bottom: 20px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--grey, #4D5858);
	display: block;
	min-height: 0;
}

/* Pink pill, pushed to the bottom so buttons line up across a row. */
.cas-author .cas-item .btn.blog-btn {
	margin-top: auto;
	align-self: flex-start;
	position: static;
	padding: 4px 26px;
	border: 2px solid var(--magenta, #D31566);
	border-radius: 50px;
	background: transparent;
	color: var(--magenta, #D31566);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: 0.3s;
}

.cas-author .cas-item .btn.blog-btn:hover {
	background-color: var(--magenta, #D31566) !important;
	border-color: var(--magenta, #D31566) !important;
	color: #fff !important;
	transition: 0.3s;
}

.cas-author .cas-item .btn.blog-btn:focus-visible {
	outline: 3px solid var(--lightblue, #0082C2);
	outline-offset: 2px;
}

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

.cas-pagination {
	display: flex;
	justify-content: center;
	margin-top: 10px;
}

.cas-more {
	border: 2px solid var(--magenta, #D31566);
	border-radius: 50px;
	background: transparent;
	color: var(--magenta, #D31566);
	padding: 9px 40px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: 0.3s;
}

.cas-more:hover:not(:disabled) {
	background: var(--magenta, #D31566);
	color: #fff;
	transition: 0.3s;
}

.cas-more:disabled {
	opacity: 0.6;
	cursor: default;
}

.cas-more[hidden] {
	display: none;
}

.cas-pages {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.cas-page {
	min-width: 42px;
	border: 2px solid #dfe3e6;
	border-radius: 50px;
	background: transparent;
	color: var(--grey, #4D5858);
	padding: 7px 14px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: 0.3s;
}

.cas-page:hover {
	border-color: var(--lightblue, #0082C2);
	color: var(--lightblue, #0082C2);
	transition: 0.3s;
}

.cas-page.is-active {
	background: var(--darkblue, #233060);
	border-color: var(--darkblue, #233060);
	color: #fff;
}

.cas-more:focus-visible,
.cas-page:focus-visible {
	outline: 3px solid var(--lightblue, #0082C2);
	outline-offset: 2px;
}

/* ── Shared ─────────────────────────────────────────────────────────────── */

.cas-empty {
	grid-column: 1 / -1;
	padding: 30px;
	border: 1px dashed #cfd6db;
	border-radius: 12px;
	color: #7b8585;
	text-align: center;
	margin: 0 0 30px;
}

.cas-empty--error {
	border-color: var(--magenta, #D31566);
	color: var(--magenta, #D31566);
}

.cas-author .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media screen and (max-width: 1620px) {
	.cas-author {
		padding: 50px 20px;
	}
}

@media screen and (max-width: 1200px) {
	.cas-profile__name,
	.cas-posts__heading {
		font-size: 32px;
	}

	.cas-profile__row,
	.cas-profile__about,
	.cas-filters__label {
		font-size: 19px;
	}

	.cas-filters {
		flex-wrap: wrap;
		justify-content: flex-start;
		gap: 16px 24px;
	}

	/* Grow to share the row, but never below a readable select width. */
	.cas-filters__field {
		flex: 1 1 260px;
	}

	.cas-filters__select {
		flex: 1;
	}

	.cas-filters__action {
		flex-basis: 100%;
		display: flex;
		justify-content: flex-start;
	}
}

@media screen and (max-width: 1000px) {
	.cas-profile {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.cas-profile__media {
		width: 100%;
		max-width: 420px;
	}

	.cas-posts__list {
		--cas-cols: 2;
	}

	/*
	 * Two fields per row rather than one: the labels are short and the selects
	 * do not need the full width, so a single stack just makes the user scroll
	 * past the filters to reach the posts.
	 */
	.cas-filters__field {
		flex: 1 1 calc(50% - 12px);
		flex-wrap: wrap;
		gap: 4px;
	}

	.cas-filters__label {
		flex-basis: 100%;
		text-align: left;
	}

	.cas-filters__select {
		width: 100%;
		text-align: left;
	}
}

@media screen and (max-width: 640px) {
	.cas-profile__top {
		flex-direction: column;
		gap: 12px;
	}

	.cas-contact {
		margin-top: 0;
	}

	.cas-profile__name,
	.cas-posts__heading {
		font-size: 27px;
	}

	/*
	 * Two columns are held all the way down rather than collapsing to one.
	 * The gap and the internal padding tighten instead, so the cards stay
	 * legible without the list turning into a very long single stack.
	 */
	.cas-posts__list {
		--cas-cols: 2;
		gap: 24px 3%;
	}

	.cas-author .cas-item .blog-details {
		padding: 14px;
	}

	.cas-author .cas-item .blog-featured-image {
		height: 130px;
	}

	.cas-author .cas-item .blog-title {
		font-size: 17px;
	}

	.cas-author .cas-item .excerpt {
		font-size: 14px;
		margin-bottom: 16px;
	}

	.cas-author .cas-item .blog-date {
		font-size: 13px;
	}

	.cas-author .cas-item .btn.blog-btn {
		padding: 4px 18px;
		font-size: 14px;
	}

	/*
	 * Filters on phones.
	 *
	 * The bar becomes a single stacked column: at this width two selects side
	 * by side leave each too narrow to read its own option text. Labels drop to
	 * the body-text scale (22px was sized for the desktop bar and dominated the
	 * screen), and every control gets a 44px min-height so it is comfortably
	 * tappable rather than the 5px-padded desktop size.
	 */
	.cas-filters {
		gap: 14px;
		padding: 16px 0 24px;
	}

	.cas-filters__field {
		flex: 1 1 100%;
		gap: 6px;
	}

	.cas-filters__label {
		font-size: 16px;
	}

	.cas-filters__select {
		width: 100%;
		min-height: 44px;
		padding: 8px 14px;
		font-size: 16px; /* iOS zooms the page for anything under 16px. */
		border-radius: 6px;
	}

	.cas-filters__action {
		margin-top: 2px;
	}

	.cas-filter-btn {
		width: 100%;
		min-height: 44px;
		padding: 10px 20px;
		font-size: 16px;
	}

}

@media (prefers-reduced-motion: reduce) {
	.cas-posts__list,
	.cas-contact__link,
	.cas-item .btn.blog-btn {
		transition: none;
	}
}
