/*
 * Service CPT single page — hero / introduction / dynamic content sections
 * with a per-section image gallery carousel (Swiper).
 */

.service-single {
	--sv-font: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--sv-heading: #030712;
	--sv-body: #364153;
	--sv-green: #7FB04F;
	--sv-max-width: 1704px;
}

.service-single *,
.service-single *::before,
.service-single *::after {
	box-sizing: border-box;
}

/* =============================================================================
   Hero
   ============================================================================= */

.service-hero {
	position: relative;
	/* Was capped at 1880px, which left ~20px of page background showing down
	   each side on a ~1920px screen — the banner spans the full width instead. */
	max-width: none;
	height: 400px;
	margin: 0 auto;
	border-radius: 20px;
	overflow: hidden;
	background-color: #1B250E;
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
}

.service-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.45) 100%);
}

.service-hero__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var(--sv-max-width);
	margin: 0 auto;
	padding: 0 40px;
}

.service-hero__title {
	margin: 0;
	font-family: var(--sv-font);
	font-size: 52px;
	font-weight: 600;
	line-height: 60px;
	color: #FFFFFF;
}

/* =============================================================================
   Introduction
   ============================================================================= */

.service-introduction {
	padding: 100px 0;
}

.service-introduction__inner {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 60px;
	max-width: 1696px;
	margin: 0 auto;
	padding: 50px 40px;
	background: #F7F7F8;
	border: 1px solid #F1F1F3;
	border-radius: 20px;
}

.service-introduction__text {
	flex: 1 1 400px;
	max-width: 840px;
	font-family: var(--sv-font);
	font-size: 18px;
	font-weight: 400;
	line-height: 28px;
	color: var(--sv-body);
}

.service-introduction__text p {
	margin: 0 0 16px;
}

.service-introduction__text p:last-child {
	margin-bottom: 0;
}

.service-introduction__text a,
.service-section__body a {
	color: var(--sv-green);
	text-decoration: underline;
}

.service-introduction__text a:hover,
.service-introduction__text a:focus-visible,
.service-section__body a:hover,
.service-section__body a:focus-visible {
	color: var(--sv-heading);
}

/* Optional Introduction Section button (button_label + button_url), e.g.
   "View Species Publications" on the Invertebrate Taxonomy service. Matches
   the About page's .about-section__button treatment — that stylesheet isn't
   loaded on service pages, so the few rules are restated rather than pulling
   the whole file in. */
.service-introduction__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 20px;
	color: var(--sv-green);
	font-family: var(--sv-font);
	font-size: 16px;
	font-weight: 500;
	text-decoration: none;
}

.service-introduction__button svg {
	flex-shrink: 0;
}

.service-introduction__button:hover,
.service-introduction__button:focus-visible {
	text-decoration: underline;
	outline: none;
}

.service-introduction__image {
	flex: 0 0 auto;
	width: 696px;
	max-width: 100%;
}

.service-introduction__image img {
	display: block;
	width: 100%;
	height: 549px;
	object-fit: cover;
	border-radius: 20px;
}

/* =============================================================================
   Dynamic content sections
   ============================================================================= */

.service-section {
	padding: 100px 0;
}

.service-section__inner {
	max-width: var(--sv-max-width);
	margin: 0 auto;
	padding: 0 40px;
}

.service-section__heading {
	margin: 0 0 24px;
	font-family: var(--sv-font);
	font-size: 42px;
	font-weight: 600;
	line-height: 50px;
	color: var(--sv-heading);
}

.service-section__body {
	max-width: 100%;
	margin: 0 0 40px;
	font-family: var(--sv-font);
	font-size: 18px;
	font-weight: 400;
	line-height: 24px;
	color: var(--sv-body);
}

.service-section__body p {
	margin: 0 0 16px;
}

.service-section__body p:last-child {
	margin-bottom: 0;
}

/* =============================================================================
   Gallery carousel
   ============================================================================= */

.service-gallery-carousel {
	position: relative;
	padding: 0 44px;
}

/* Swiper defaults .swiper-wrapper to flex + stretch already, but stated
   explicitly here since equal card height (regardless of caption length)
   depends on it — see .service-gallery-carousel__card's height:100% below. */
.service-gallery-carousel .swiper-wrapper {
	align-items: stretch;
}

.service-gallery-carousel .swiper-slide {
	height: auto;
	display: flex;
	width: 408px;
}

.service-gallery-carousel__card {
	background: #FFFFFF;
	border-radius: 20px;
	box-shadow: 0 0 0 1px #E8E8E8;
	padding: 20px;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	transition: transform .3s ease;
}

.service-gallery-carousel__card:hover {
	transform: translateY(-4px);
}

.service-gallery-carousel__image {
	position: relative;
	width: 100%;
	height: 358px;
	max-width: 368px;
	border-radius: 20px;
	overflow: hidden;
	background: #000;
	flex-shrink: 0;
}

.service-gallery-carousel__image img {
	/* contain (not cover) so the full subject is always visible — these are
	   specimen photos at wildly different aspect ratios; cropping them was
	   cutting subjects off. The image sits centred on the box's own black
	   background (set above) so this never distorts or stretches it. */
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.service-gallery-carousel__caption {
	margin: 16px 0 0;
	font-family: var(--sv-font);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
	color: var(--sv-body);
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	min-height: calc(24px * 5);
	overflow: hidden;
}

.service-gallery-carousel__nav {
	position: absolute;
	/* Centred on the IMAGE area specifically (card padding-top 20px + half
	   the 358px image height), not the whole card+caption block — so the
	   arrows stay level with the photos even though captions vary in
	   length and make cards different heights. */
	top: 199px;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: #FFFFFF;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	color: var(--sv-green);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 2;
	transition: box-shadow .2s ease;
}

.service-gallery-carousel__nav:hover,
.service-gallery-carousel__nav:focus-visible {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
	outline: none;
}

.service-gallery-carousel__nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.service-gallery-carousel__nav--prev {
	left: 0;
}

.service-gallery-carousel__nav--next {
	right: 0;
}

.service-gallery-carousel .swiper-pagination {
	position: static;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding-top: 24px;
}

.service-gallery-carousel .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	/* A light grey (#E8E8E8) reads fine on white section backgrounds but
	   nearly disappears on the peach (#FCECD8) ones — this dark-ink-at-low-
	   opacity reads clearly on both. */
	background: rgba(27, 37, 14, 0.22);
	opacity: 1;
	border-radius: 50px;
	margin: 0;
	flex-shrink: 0;
	transition: all .3s ease;
}

.service-gallery-carousel .swiper-pagination-bullet-active {
	width: 34px;
	height: 10px;
	background: var(--sv-green);
	border-radius: 50px;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1400px) {
	.service-hero {
		height: 320px;
	}

	.service-hero__title {
		font-size: 40px;
		line-height: 48px;
	}

	.service-introduction__inner {
		padding: 40px 24px;
	}

	.service-introduction__image {
		width: 480px;
	}

	.service-introduction__image img {
		height: 380px;
	}

	.service-section {
		padding: 60px 0;
	}

	.service-section__inner {
		padding: 0 24px;
	}
}

/* 1024.98px, not a bare 1024px — iPad Pro portrait reports exactly 1024px
   CSS width, and browsers' fractional device-pixel-ratio rounding can make
   an exact "max-width: 1024px" query fail to match on that exact device,
   leaving .service-hero without its side margins/radius/height overrides
   below. The rest of this theme's breakpoints already use a .98px fraction
   for this reason (see hero-banner.css, our-expertise.css). */
@media (max-width: 1024.98px) {
	.service-introduction {
		padding: 60px 0;
	}

	.service-hero {
		height: 260px;
		border-radius: 16px;
		margin-left: 24px;
		margin-right: 24px;
	}

	.service-hero__title {
		font-size: 32px;
		line-height: 40px;
	}

	.service-introduction__inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 32px;
	}

	/* align-items: flex-start above means flex items no longer stretch to
	   the container's cross-axis width, so without an explicit width the
	   text block sized itself to its own content instead of the available
	   width — pushing the whole page wider than the viewport and causing a
	   horizontal scrollbar. */
	.service-introduction__text {
		width: 100%;
	}

	.service-introduction__image {
		width: 100%;
	}

	.service-introduction__image img {
		height: auto;
		aspect-ratio: 696 / 549;
	}

	.service-section__heading {
		font-size: 32px;
		line-height: 40px;
	}

	.service-gallery-carousel .swiper-slide {
		width: 320px;
	}

	.service-gallery-carousel__image {
		height: 280px;
		max-width: 100%;
	}

	.service-gallery-carousel__nav {
		top: 160px; /* 20px card padding + half of 280px image height */
	}
}

@media (max-width: 640px) {
	.service-hero {
		margin-left: 16px;
		margin-right: 16px;
		height: 200px;
		border-radius: 12px;
	}

	.service-hero__inner {
		padding: 0 20px;
	}

	.service-hero__title {
		font-size: 26px;
		line-height: 32px;
	}

	.service-introduction {
		padding: 40px 0;
	}

	.service-introduction__inner {
		padding: 24px 20px;
	}

	.service-section {
		padding: 40px 0;
	}

	.service-section__inner {
		padding: 0 20px;
	}

	.service-section__heading {
		font-size: 26px;
		line-height: 32px;
	}

	.service-gallery-carousel {
		padding: 0;
	}

	.service-gallery-carousel .swiper-slide {
		width: 260px;
	}

	.service-gallery-carousel__image {
		height: 220px;
	}

	.service-gallery-carousel__nav {
		width: 40px;
		height: 40px;
		top: 130px; /* 20px card padding + half of 220px image height */
	}

	.service-gallery-carousel__nav--prev {
		left: 0;
	}

	.service-gallery-carousel__nav--next {
		right: 0;
	}
}
