/**
 * Terms & Conditions page (page-terms-and-conditions.php).
 *
 * Scoped to .qehs-terms / .qehs-terms-* so nothing here affects other
 * pages. Uses the existing QEHS tokens and the global .qehs-container.
 *
 * Hero blending: the supplied illustration is a fully opaque photo, so it
 * is placed on the right and MASKED — fully transparent at its left edge,
 * opaque from ~45% — so it dissolves into the navy hero gradient with no
 * visible box or hard edge. On narrow screens it moves below the text and
 * fades in from the top instead.
 */

.qehs-terms {
	--qehs-terms-hero-a: #0E2645;
	--qehs-terms-hero-b: #1B3A5E;
	--qehs-terms-card-border: #E5EAF0;
	--qehs-terms-body: #46505E;
	--qehs-terms-num-bg: #E3EEFA;
	--qehs-terms-icon-bg: #F1F5FA;
	--qehs-terms-active-bg: #EEF6E5;

	background-color: var(--qehs-background-alt);
	overflow-x: clip;
}

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

.qehs-terms-hero {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 300px;
	background: linear-gradient(100deg, var(--qehs-terms-hero-a) 0%, var(--qehs-terms-hero-b) 60%, #24466D 100%);
	color: #FFFFFF;
	overflow: hidden;
}

.qehs-terms-hero__media {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 58%;
	pointer-events: none;
	-webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 20%, #000 48%);
	mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 20%, #000 48%);
}

.qehs-terms-hero__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 62% 55%;
}

/* A light navy wash ties the photo's blues to the hero's navy. */
.qehs-terms-hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(14, 38, 69, 0.55) 0%, rgba(14, 38, 69, 0.12) 55%, rgba(14, 38, 69, 0.08) 100%);
}

.qehs-terms-hero__inner {
	position: relative;
	z-index: 1;
	padding-block: var(--qehs-space-lg) var(--qehs-space-2xl);
}

.qehs-terms-hero__breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--qehs-space-sm);
	margin-bottom: var(--qehs-space-lg);
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.78);
}

.qehs-terms-hero__breadcrumb a {
	display: inline-block;
	margin-block: -8px;
	padding-block: 8px;
	color: #FFFFFF;
	font-weight: 600;
	text-decoration: none;
}

.qehs-terms-hero__breadcrumb a:hover,
.qehs-terms-hero__breadcrumb a:focus-visible {
	text-decoration: underline;
}

.qehs-terms-hero__breadcrumb a:focus-visible {
	outline: 2px solid #FFFFFF;
	outline-offset: 3px;
	border-radius: 2px;
}

.qehs-terms-hero__title {
	margin: 0 0 var(--qehs-space-md);
	max-width: 560px;
	font-size: clamp(2rem, 3.2vw, 2.75rem);
	font-weight: 800;
	line-height: 1.15;
	color: #FFFFFF;
}

.qehs-terms-hero__text {
	margin: 0;
	max-width: min(560px, 42vw);
	font-size: 1.05rem;
	line-height: 1.65;
	color: rgba(255, 255, 255, 0.9);
}

.qehs-terms-hero__updated {
	margin: var(--qehs-space-md) 0 0;
	font-size: 0.85rem;
	color: rgba(255, 255, 255, 0.72);
}

/* ---------------- Layout ---------------- */

.qehs-terms-layout {
	display: grid;
	grid-template-columns: minmax(220px, 23%) minmax(0, 1fr);
	gap: var(--qehs-space-lg);
	align-items: start;
	padding-block: var(--qehs-space-lg) var(--qehs-space-2xl);
}

/* ---------------- On This Page ---------------- */

.qehs-terms-toc {
	position: sticky;
	top: var(--qehs-space-lg);
	padding: var(--qehs-space-md) var(--qehs-space-sm);
	border: 1px solid var(--qehs-terms-card-border);
	border-radius: 12px;
	background-color: var(--qehs-background);
}

.qehs-terms-toc__title {
	margin: 0 0 var(--qehs-space-sm);
	padding-inline: 12px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--qehs-primary);
}

.qehs-terms-toc__list {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.qehs-terms-toc__link {
	display: flex;
	gap: 6px;
	padding: 8px 12px;
	border-left: 3px solid transparent;
	border-radius: 6px;
	color: var(--qehs-terms-body);
	font-size: 0.9rem;
	line-height: 1.35;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.qehs-terms-toc__num {
	flex-shrink: 0;
}

.qehs-terms-toc__link:hover {
	background-color: var(--qehs-background-alt);
	color: var(--qehs-primary);
}

.qehs-terms-toc__link:focus-visible {
	outline: 2px solid var(--qehs-secondary);
	outline-offset: -2px;
}

.qehs-terms-toc__link.is-active {
	border-left-color: var(--qehs-secondary);
	background-color: var(--qehs-terms-active-bg);
	color: var(--qehs-text);
	font-weight: 600;
}

/* ---------------- Section cards ---------------- */

.qehs-terms-sections {
	display: grid;
	gap: 12px;
}

.qehs-terms-card {
	display: grid;
	grid-template-columns: 28px 56px minmax(0, 1fr);
	gap: var(--qehs-space-md);
	align-items: start;
	padding: var(--qehs-space-md) var(--qehs-space-lg);
	border: 1px solid var(--qehs-terms-card-border);
	border-radius: 10px;
	background-color: var(--qehs-background);
	scroll-margin-top: var(--qehs-space-lg);
}

.qehs-terms-card__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background-color: var(--qehs-terms-num-bg);
	color: var(--qehs-primary);
	font-size: 0.85rem;
	font-weight: 700;
}

.qehs-terms-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 10px;
	background-color: var(--qehs-terms-icon-bg);
	color: var(--qehs-primary);
}

.qehs-terms-card__title {
	margin: 2px 0 6px;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--qehs-primary);
}

.qehs-terms-card__body p,
.qehs-terms-card__body li {
	font-size: 0.93rem;
	line-height: 1.65;
	color: var(--qehs-terms-body);
}

.qehs-terms-card__body p {
	margin: 0 0 var(--qehs-space-sm);
}

.qehs-terms-card__body p:last-child {
	margin-bottom: 0;
}

.qehs-terms-card__body ul {
	margin: 0 0 var(--qehs-space-sm);
	padding-left: 20px;
}

.qehs-terms-card__body ul:last-child {
	margin-bottom: 0;
}

.qehs-terms-card__contact a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 32px;
	color: var(--qehs-primary);
	font-weight: 600;
	text-decoration: none;
}

.qehs-terms-card__contact a svg {
	color: var(--qehs-secondary);
}

.qehs-terms-card__contact a:hover,
.qehs-terms-card__contact a:focus-visible {
	text-decoration: underline;
}

.qehs-terms-card__contact a:focus-visible {
	outline: 2px solid var(--qehs-secondary);
	outline-offset: 2px;
	border-radius: 2px;
}

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

@media (max-width: 1100px) {
	.qehs-terms-hero__media {
		width: 52%;
	}
}

/* Single column: navigation becomes a full-width block above the cards. */
@media (max-width: 900px) {
	.qehs-terms-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.qehs-terms-toc {
		position: static;
	}

	.qehs-terms-toc__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--qehs-space-sm);
	}
}

/* Hero stacks: text first, illustration below it, fading in from the
   top so it still blends into the navy (no box, no overlap). */
@media (max-width: 768px) {
	.qehs-terms-hero {
		min-height: 0;
	}

	.qehs-terms-hero__inner {
		order: 1;
		padding-bottom: var(--qehs-space-md);
	}

	.qehs-terms-hero__text {
		max-width: none;
	}

	.qehs-terms-hero__media {
		position: relative;
		order: 2;
		width: 100%;
		height: clamp(150px, 42vw, 280px);
		-webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.5) 30%, #000 65%);
		mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.5) 30%, #000 65%);
	}

	.qehs-terms-hero__media::after {
		background: linear-gradient(180deg, rgba(14, 38, 69, 0.45) 0%, rgba(14, 38, 69, 0.1) 60%);
	}
}

@media (max-width: 560px) {
	.qehs-terms-toc__list {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Number + icon on one row, text full width below. */
	.qehs-terms-card {
		grid-template-columns: 28px 44px minmax(0, 1fr);
		gap: 12px;
		padding: var(--qehs-space-md);
	}

	.qehs-terms-card__icon {
		width: 44px;
		height: 44px;
	}

	.qehs-terms-card__body {
		grid-column: 1 / -1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qehs-terms *,
	.qehs-terms *::before,
	.qehs-terms *::after {
		transition: none !important;
	}
}
