/**
 * CHGA Blocks - shared design tokens, typography and controls.
 *
 * Loaded by every CHGA block (front end and editor) so each block file only has
 * to describe its own layout.
 */

:root,
.editor-styles-wrapper {
	--chga-navy: #001f53;
	--chga-navy-deep: #001233;
	--chga-navy-light: #06306f;
	--chga-gold: #cb8302;
	--chga-gold-mid: #d28c10;
	--chga-gold-light: #ffcc6f;
	--chga-grey: #ededed;
	--chga-white: #ffffff;

	--chga-gold-gradient: linear-gradient(100deg, #bd7a02 0%, var(--chga-gold) 22%, var(--chga-gold-mid) 52%, #eec171 100%);
	--chga-gold-gradient-vertical: linear-gradient(180deg, var(--chga-gold) 0%, var(--chga-gold-light) 100%);

	--chga-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

	--chga-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--chga-ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

	--chga-gutter: clamp(1.25rem, 0.6rem + 2.6vw, 4.5rem);
	--chga-container: 1440px;
}

/* -------------------------------------------------------------------------
 * Shared primitives
 * ---------------------------------------------------------------------- */

/*
 * The page's in-section links (Enquire Now, the footer call to action) glide
 * rather than jump. This file only loads on a page that renders a CHGA block, so
 * it never changes scrolling anywhere else, and visitors who have asked for less
 * motion keep the instant jump.
 */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

.chga-block {
	font-family: var(--chga-font);
	box-sizing: border-box;
	/*
	 * Blocks carry an anchor, and the header sticks to the top once the page has
	 * scrolled. Without this an anchor link parks the section underneath it.
	 */
	scroll-margin-top: clamp(4.5rem, 8vw, 6.5rem);
}

.chga-block *,
.chga-block *::before,
.chga-block *::after {
	box-sizing: inherit;
}

/* Zero specificity so block rules can opt out without !important. */
:where(.chga-block) :where(img) {
	max-width: 100%;
	height: auto;
}

/* -------------------------------------------------------------------------
 * Draggable card rows
 *
 * CHGAMotion.slider adds these to a row that has somewhere to scroll to, so a
 * mouse gets the same affordance a touchscreen already has.
 * ---------------------------------------------------------------------- */

.chga-slider-drag {
	cursor: grab;
}

.chga-slider-drag.is-dragging {
	cursor: grabbing;
	/* Otherwise the drag paints a text selection right across the row. */
	user-select: none;
	-webkit-user-select: none;
}

/* Screen reader only text. */
.chga-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Gold button
 * ---------------------------------------------------------------------- */

.chga-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	padding: clamp(0.85rem, 0.7rem + 0.35vw, 1.05rem) clamp(1.5rem, 1rem + 1.6vw, 2.75rem);
	min-height: 3rem;
	font-family: inherit;
	font-size: clamp(0.9375rem, 0.86rem + 0.28vw, 1.125rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.005em;
	color: var(--chga-white);
	text-align: center;
	text-decoration: none;
	background: var(--chga-gold-gradient);
	background-size: 160% 100%;
	background-position: 0% 50%;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	overflow: hidden;
	isolation: isolate;
	transform: translateZ(0);
	transition:
		background-position 0.7s var(--chga-ease),
		box-shadow 0.45s var(--chga-ease),
		transform 0.45s var(--chga-ease);
}

.chga-button::after {
	content: "";
	position: absolute;
	inset: 0 auto 0 -60%;
	width: 45%;
	background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.42) 50%, transparent 100%);
	transform: skewX(-18deg);
	pointer-events: none;
	opacity: 0;
	z-index: -1;
}

.chga-button:hover,
.chga-button:focus-visible {
	color: var(--chga-white);
	background-position: 100% 50%;
	transform: translateY(-2px);
	box-shadow: 0 14px 30px -14px rgba(203, 131, 2, 0.85);
}

.chga-button:active {
	transform: translateY(0);
}

.chga-button:focus-visible {
	outline: 2px solid var(--chga-gold-light);
	outline-offset: 3px;
}

.chga-button--ghost {
	color: var(--chga-navy);
	background: transparent;
	border: 1px solid currentColor;
}

.chga-button--ghost:hover,
.chga-button--ghost:focus-visible {
	color: var(--chga-white);
	background: var(--chga-gold-gradient);
	border-color: transparent;
}

/* -------------------------------------------------------------------------
 * Motion
 *
 * Animated elements are only pre-hidden while the document is flagged as
 * JavaScript enabled, so the block editor preview and no-JS visitors always see
 * the finished layout.
 * ---------------------------------------------------------------------- */

.chga-js .chga-block[data-chga-animate="true"] [data-chga-reveal],
.chga-js .chga-block[data-chga-animate="true"] [data-chga-lines] [data-chga-line] {
	opacity: 0;
}

.chga-js .chga-block[data-chga-animate="true"] [data-chga-rule] {
	transform: scaleX(0);
}

@media (prefers-reduced-motion: reduce) {
	.chga-block[data-chga-animate="true"] [data-chga-reveal],
	.chga-block[data-chga-animate="true"] [data-chga-lines] [data-chga-line],
	.chga-block[data-chga-animate="true"] [data-chga-rule] {
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
	}

	.chga-block *,
	.chga-block *::before,
	.chga-block *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}
