/**
 * Single case study styles.
 *
 * @package SH_Case_Studies
 */

/*
 * The hero, the document panel (.sh-cs-single, the <article>) and the request
 * form are siblings in the markup — not nested — so the theme's global
 * `article{max-width:1200px}` rule can't cap the two full-bleed sections.
 * These shared tokens and the box-sizing reset are scoped to all three
 * rather than to .sh-cs-single alone, since custom properties don't cross
 * sibling boundaries.
 */
:root {
	--sh-cs-green: #00853e;
	--sh-cs-green-dark: #006e33;
	--sh-cs-panel: #f1f2f2;
	--sh-cs-ink: #3c3c3c;
	--sh-cs-max: 1180px;
}

:is(.sh-cs-single__hero, .sh-cs-single, .sh-cs-single__request) {
	box-sizing: border-box;
}

:is(.sh-cs-single__hero, .sh-cs-single, .sh-cs-single__request) *,
:is(.sh-cs-single__hero, .sh-cs-single, .sh-cs-single__request) *::before,
:is(.sh-cs-single__hero, .sh-cs-single, .sh-cs-single__request) *::after {
	box-sizing: inherit;
}

/* -------------------------------------------------------------------------
 * Hero
 * ---------------------------------------------------------------------- */

/*
 * Height matches the banner on the case studies listing page (.slider .slide
 * in the theme, min-height 670/550/auto at the same breakpoints below).
 */
.sh-cs-single__hero {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 670px;
	padding: 64px 24px;
	background-color: #16324f;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

@media (min-width: 1920px) {
	.sh-cs-single__hero {
		min-height: 550px;
	}
}

/* Darkening wash so the title stays readable over any featured image. */
.sh-cs-single__hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(11, 40, 66, 0.88) 0%, rgba(11, 40, 66, 0.6) 55%, rgba(11, 40, 66, 0.35) 100%);
}

.sh-cs-single__hero--plain::before {
	background: none;
}

.sh-cs-single__hero-inner {
	position: relative;
	width: 100%;
	max-width: var(--sh-cs-max);
	margin: 0 auto;
}

.sh-cs-single__hero-title {
	max-width: 620px;
	margin: 0;
	color: #fff;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
}

/* -------------------------------------------------------------------------
 * Document panel
 * ---------------------------------------------------------------------- */

.sh-cs-single__body {
	padding: 72px 24px;
	background-color: #fff;

	/* Subtle dotted field, as in the design. */
	background-image: radial-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px);
	background-size: 22px 22px;
}

.sh-cs-single__panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 48px;
	align-items: center;
	max-width: var(--sh-cs-max);
	margin: 0 auto;
	padding: 40px;
	border-radius: 10px;
	background: var(--sh-cs-panel);
}

.sh-cs-single__panel--no-preview {
	grid-template-columns: minmax(0, 1fr);
	max-width: 860px;
}

.sh-cs-single__preview {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sh-cs-single__preview-frame {
	position: relative;
	width: 100%;
	max-width: 420px;
	min-height: 200px;
	background: #fff;
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
	line-height: 0;
}

.sh-cs-single__pdf-canvas {
	display: block;
	width: 100%;
	height: auto;
}

/* Spinner shown while pdf.js fetches and renders the current page. */
.sh-cs-single__preview-frame.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid var(--sh-cs-panel);
	border-top-color: var(--sh-cs-green);
	border-radius: 50%;
	animation: sh-cs-single-spin 0.7s linear infinite;
}

@keyframes sh-cs-single-spin {
	to { transform: rotate(360deg); }
}

.sh-cs-single__preview-frame.is-error {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 260px;
	padding: 24px;
}

.sh-cs-single__pdf-fallback-link {
	color: var(--sh-cs-green);
	font-size: 16px;
	font-weight: 600;
	line-height: normal;
	text-decoration: underline;
}

.sh-cs-single__pdf-status {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sh-cs-single__details {
	color: var(--sh-cs-ink);
}

.sh-cs-single__description {
	margin: 0 0 28px;
	font-size: 18px;
	line-height: 1.65;
}

.sh-cs-single__description > *:last-child {
	margin-bottom: 0;
}

.sh-cs-single__download {
	display: inline-block;
	padding: 14px 30px;
	border-radius: 4px;
	background: var(--sh-cs-green);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.sh-cs-single__download:hover,
.sh-cs-single__download:focus {
	background: var(--sh-cs-green-dark);
	color: #fff;
}

.sh-cs-single__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Request form
 * ---------------------------------------------------------------------- */

.sh-cs-single__request {
	padding: 72px 24px;
	background: var(--sh-cs-green);
	color: #fff;
}

.sh-cs-single__request-inner {
	max-width: 760px;
	margin: 0 auto;
}

.sh-cs-single__request-title {
	margin: 0 0 16px;
	color: #fff;
	font-size: 34px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
}

.sh-cs-single__request-intro {
	margin: 0 0 36px;
	color: #fff;
	font-size: 17px;
	line-height: 1.6;
	text-align: center;
}

.sh-cs-single__request-feedback {
	margin: 0 0 24px;
	padding: 12px 16px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 15px;
	text-align: center;
}

.sh-cs-single__request-feedback.is-error {
	background: #fff;
	color: #b3261e;
}

.sh-cs-single__request-feedback.is-success {
	background: rgba(255, 255, 255, 0.92);
	color: var(--sh-cs-green-dark);
}

.sh-cs-single__form label {
	display: block;
	margin: 0 0 6px;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
}

.sh-cs-single__required {
	font-weight: 400;
}

.sh-cs-single__field {
	margin: 0 0 22px;
}

.sh-cs-single__row--name {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
}

.sh-cs-single__field--unlabeled {
	/* Keeps the "Last" input's top edge aligned with "First"'s, whose label
	   this field visually shares. */
	padding-top: 27px;
}

.sh-cs-single__hint {
	display: block;
	margin-top: 6px;
	color: rgba(255, 255, 255, 0.8);
	font-size: 13px;
}

.sh-cs-single__form input[type="text"],
.sh-cs-single__form input[type="email"],
.sh-cs-single__form input[type="tel"],
.sh-cs-single__form textarea {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 4px;
	background: #fff;
	color: #333;
	font-size: 16px;
	font-family: inherit;
}

.sh-cs-single__form input:focus,
.sh-cs-single__form textarea:focus {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

.sh-cs-single__form textarea {
	min-height: 130px;
	resize: vertical;
}

/* Honeypot: present in the DOM for bots, invisible and unreachable for people. */
.sh-cs-single__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sh-cs-single__form .g-recaptcha {
	margin-bottom: 22px;
}

.sh-cs-single__submit {
	padding: 12px 32px;
	border: 1px solid #d5d5d5;
	border-radius: 4px;
	background: #fff;
	color: #333;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.sh-cs-single__submit:hover {
	background: #f1f1f1;
}

.sh-cs-single__submit:disabled {
	cursor: default;
	opacity: 0.7;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 900px) {
	.sh-cs-single__panel {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
		padding: 28px;
	}

	.sh-cs-single__hero-title {
		max-width: none;
		font-size: 30px;
		text-align: left;
	}

	.sh-cs-single__hero {
		padding: 48px 20px;
	}

	.sh-cs-single__hero::before {
		background: rgba(11, 40, 66, 0.72);
	}

	.sh-cs-single__body,
	.sh-cs-single__request {
		padding: 48px 20px;
	}

	.sh-cs-single__request-title {
		font-size: 26px;
	}

	.sh-cs-single__row--name {
		grid-template-columns: 1fr;
		gap: 22px;
	}

	.sh-cs-single__field--unlabeled {
		padding-top: 0;
	}
}

@media (max-width: 640px) {
	.sh-cs-single__hero {
		min-height: auto;
	}
}
