/*
 * Hero globe widget (inc/elementor/hero-globe-widget.php).
 * The globe column sits on the left, cut by the screen edge; the title, text and buttons on the right.
 * Colours come from tokens.css through data-theme. Selectors carry .kl-hero twice where the
 * Elementor Kit styles h1, links and buttons, so the section keeps its own colours.
 */

.kl-hero {
	--kl-split: 46%;
	--kl-content-w: 600px;
	--kl-globe-area-h: 70vw;
	--kl-scroll: 0;
	--kl-globe-inset: 0px;
	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: var(--kl-split) minmax(0, 1fr);
	align-items: center;
	/* Fills the screen below the header; index.js sets --kl-header-h from the real header */
	min-height: max(520px, calc(100vh - var(--kl-header-h, 136px)));
	min-height: max(520px, calc(100svh - var(--kl-header-h, 136px)));
	overflow: hidden;
	background:
		radial-gradient(ellipse 55% 70% at 18% 50%, color-mix(in srgb, var(--bg) 86%, var(--gold)) 0%, transparent 72%),
		radial-gradient(ellipse 130% 110% at 25% 50%, var(--bg) 45%, var(--bg-alt) 100%);
	color: var(--fg);
}

/* The foot of the globe column is kept free for the arrows, so their text never sits on the globe */
.kl-hero:has(.kl-hero__nav) { --kl-globe-inset: 96px; }

/* Canvas behind everything; drag sideways turns the globe, vertical swipes still scroll the page */
.kl-hero__stage {
	position: absolute;
	inset: 0;
	z-index: 0;
	touch-action: pan-y;
	-webkit-tap-highlight-color: transparent;
}
.kl-hero__canvas { display: block; width: 100%; height: 100%; }
.kl-hero.is-dragging,
.kl-hero.is-dragging .kl-hero__stage { cursor: grabbing; user-select: none; }

/* Layout box the script measures to place the globe; clicks pass through to the canvas */
.kl-hero__globe-area {
	position: relative;
	z-index: 1;
	align-self: stretch;
	min-height: 100%;
	pointer-events: none;
}

/* Text column */
.kl-hero__content {
	position: relative;
	z-index: 2;
	grid-column: 2;
	width: 100%;
	max-width: var(--kl-content-w);
	padding: clamp(var(--space-5), 8vh, var(--space-8)) var(--space-5) clamp(var(--space-5), 8vh, var(--space-8)) var(--space-4);
	transform: translate3d(0, calc(var(--kl-scroll) * -72px), 0);
	opacity: calc(1 - var(--kl-scroll) * 1.25);
}

.kl-hero .kl-hero__eyebrow {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin: 0 0 var(--space-4);
	color: var(--eyebrow);
	font-size: var(--type-eyebrow-size);
	line-height: var(--type-eyebrow-line);
	font-weight: var(--type-eyebrow-weight);
	letter-spacing: var(--type-eyebrow-tracking);
	text-transform: uppercase;
}
.kl-hero .kl-hero__eyebrow::before {
	content: "";
	flex: none;
	width: 40px;
	height: 1px;
	background: var(--rule);
}

.kl-hero .kl-hero__title {
	margin: 0 0 var(--space-5);
	color: var(--heading);
	font-family: var(--font-serif);
	font-size: clamp(var(--type-h1-mobile-size), 3.3vw, 54px);
	line-height: var(--type-h1-line);
	font-weight: var(--type-h1-weight);
	letter-spacing: -0.005em;
	text-wrap: balance;
}
.kl-hero .kl-hero__title::after {
	content: "";
	display: block;
	width: 56px;
	height: 2px;
	margin-top: 20px;
	background: var(--rule);
	transform-origin: left center;
}

.kl-hero .kl-hero__text {
	margin: 0;
	max-width: 34em;
	color: var(--fg);
	font-size: var(--type-lead-size);
	line-height: var(--type-lead-line);
	text-wrap: pretty;
}

/* Buttons are the shared .btn and .btn--outline of base.css */
.kl-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	margin-top: var(--space-6);
}

/* Facts */
.kl-hero .kl-hero__facts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-4) 0;
	margin: var(--space-6) 0 0;
	padding: var(--space-4) 0 0;
	border-top: 1px solid var(--border);
	list-style: none;
}
.kl-hero__facts li {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-inline: var(--space-4);
	border-left: 1px solid var(--border);
}
.kl-hero__facts li:first-child { padding-left: 0; border-left: 0; }
.kl-hero__facts strong {
	color: var(--heading);
	font-size: var(--type-h3-size);
	line-height: 1.15;
	font-weight: 500;
}
.kl-hero__facts span {
	color: var(--fg-muted);
	font-size: var(--type-caption-size);
	line-height: var(--type-caption-line);
}

/* Location arrows, at the foot of the globe column */
.kl-hero__nav {
	position: absolute;
	left: var(--space-5);
	bottom: var(--space-5);
	z-index: 2;
	max-width: calc(100% - var(--space-5) * 2);
	pointer-events: auto;
}
.kl-hero__nav[hidden] { display: none; }
.kl-hero .kl-hero__nav-heading {
	margin: 0 0 var(--space-2);
	color: var(--eyebrow);
	font-size: var(--type-eyebrow-size);
	line-height: var(--type-eyebrow-line);
	font-weight: var(--type-eyebrow-weight);
	letter-spacing: var(--type-eyebrow-tracking);
	text-transform: uppercase;
}
.kl-hero__nav-row { display: flex; align-items: center; gap: var(--space-2); }
.kl-hero .kl-hero__nav-btn {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-none);
	background: color-mix(in srgb, var(--bg) 70%, transparent);
	color: var(--accent);
	cursor: pointer;
	transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.kl-hero .kl-hero__nav-btn:hover {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
}
.kl-hero .kl-hero__nav-btn svg { width: 20px; height: 20px; }
.kl-hero .kl-hero__nav-place {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: var(--space-3);
	margin: 0 0 0 var(--space-3);
	line-height: 1.3;
	text-shadow: 0 0 12px var(--bg);
}
.kl-hero__nav-count {
	grid-row: span 2;
	align-self: center;
	color: var(--fg-muted);
	font-size: var(--type-caption-size);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.06em;
	white-space: nowrap;
}
.kl-hero__nav-name { color: var(--fg); font-size: var(--type-body-size); font-weight: 500; white-space: nowrap; }
.kl-hero__nav-meta { color: var(--fg-muted); font-size: var(--type-caption-size); white-space: nowrap; }
.kl-hero__nav-meta:empty { display: none; }
.kl-hero__nav-place.is-changing .kl-hero__nav-name,
.kl-hero__nav-place.is-changing .kl-hero__nav-meta { animation: kl-hero-swap .6s cubic-bezier(.22, .61, .36, 1) both; }

/* Callout pinned to a city or to the office */
.kl-hero__callout {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 8px 14px 9px;
	border: 1px solid var(--border-strong);
	background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
	color: var(--fg);
	white-space: nowrap;
	pointer-events: none;
	translate: -50% calc(-100% - 12px);
	opacity: 0;
	transition: opacity .3s ease;
	will-change: transform;
}
.kl-hero__callout::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 100%;
	width: 1px;
	height: 12px;
	background: var(--rule);
}
.kl-hero__callout.is-visible { opacity: 1; }
.kl-hero__callout.is-hidden { opacity: 0; }
.kl-hero__callout-name { font-size: var(--type-body-size); font-weight: 600; line-height: 1.25; }
.kl-hero__callout-meta { color: var(--fg-muted); font-size: var(--type-caption-size); line-height: 1.35; }
.kl-hero__callout-meta:empty { display: none; }

/* Without WebGL (or JavaScript) the shield stands alone on a plain disc */
.kl-hero__fallback,
.kl-hero__globe-area::before {
	position: absolute;
	left: 50%;
	top: 50%;
	translate: -50% -50%;
	opacity: 0;
	animation: kl-hero-fade .8s 2.5s ease-out forwards;
}
.kl-hero__fallback { width: clamp(72px, 8vw, 112px); height: auto; }
.kl-hero__globe-area::before {
	content: "";
	width: min(78%, 64vh);
	aspect-ratio: 1;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--bg) 80%, var(--gold)) 0%, var(--bg-alt) 70%);
}
.kl-hero.is-live .kl-hero__fallback,
.kl-hero.is-live .kl-hero__globe-area::before { display: none; }
.kl-hero--static .kl-hero__fallback,
.kl-hero--static .kl-hero__globe-area::before { animation-delay: 0s; }

/* Tablets and phones: the globe above, the arrows under it, the text below.
   --kl-globe-inset keeps the foot of the column free for the arrows; the script leaves it out of the globe. */
@media (max-width: 1024px) {
	.kl-hero {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto;
		align-items: start;
	}
	.kl-hero:has(.kl-hero__nav) { --kl-globe-inset: 104px; }
	.kl-hero__globe-area {
		grid-column: 1;
		grid-row: 1;
		min-height: 0;
		height: calc(var(--kl-globe-area-h) + var(--kl-globe-inset));
	}
	.kl-hero__content {
		grid-column: 1;
		grid-row: 2;
		justify-self: center;
		max-width: min(var(--kl-content-w), 100%);
		padding: var(--space-5) var(--space-4) var(--space-7);
	}
	/* Lined up with the text column below */
	.kl-hero__nav { left: max(var(--space-4), calc((100% - var(--kl-content-w)) / 2 + var(--space-4))); bottom: var(--space-3); }
}

@media (max-width: 767px) {
	.kl-hero .kl-hero__text { font-size: var(--type-body-mobile-size); line-height: var(--type-body-mobile-line); }
	.kl-hero__content { padding: var(--space-4) var(--space-3) var(--space-6); }
	.kl-hero__actions { margin-top: var(--space-5); }
	.kl-hero__actions .btn { flex: 1 1 auto; }
	.kl-hero__facts li { padding-inline: var(--space-3); }
	.kl-hero__facts strong { font-size: var(--type-h3-mobile-size); }
	.kl-hero__nav { left: var(--space-3); right: var(--space-3); bottom: var(--space-2); max-width: none; }
	.kl-hero .kl-hero__nav-btn { width: 40px; height: 40px; }
	.kl-hero__nav-name { font-size: var(--type-body-mobile-size); }
}

/* Entrances: a 24px rise and fade, once */
@media (prefers-reduced-motion: no-preference) {
	.kl-hero__content > * { animation: kl-hero-rise .8s cubic-bezier(.22, .61, .36, 1) both; }
	.kl-hero__content > :nth-child(1) { animation-delay: .35s; }
	.kl-hero__content > :nth-child(2) { animation-delay: .5s; }
	.kl-hero__content > :nth-child(3) { animation-delay: .65s; }
	.kl-hero__content > :nth-child(4) { animation-delay: .8s; }
	.kl-hero__content > :nth-child(5) { animation-delay: .95s; }
	.kl-hero .kl-hero__title::after { animation: kl-hero-rule 1s 1.1s cubic-bezier(.22, .61, .36, 1) both; }
	.kl-hero__nav:not([hidden]) { animation: kl-hero-rise .8s 2.2s cubic-bezier(.22, .61, .36, 1) both; }
}

@media (prefers-reduced-motion: reduce) {
	.kl-hero__content { transform: none; opacity: 1; }
	.kl-hero__callout { transition: none; }
}

@keyframes kl-hero-rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes kl-hero-rule { from { transform: scaleX(0); } }
@keyframes kl-hero-fade { to { opacity: 1; } }
@keyframes kl-hero-swap { from { opacity: 0; transform: translateY(6px); } }

/* Burgundy ground: the plain brand colour. The glow around the globe makes the gradient. */
.kl-hero[data-theme="burgundy"] { background: var(--bg); }
