/* ==========================================================================
   HQDM hero globe. Two parts:
   1. .hq-globe (service heroes): the old hqdm.io globe rebuilt in CSS (below, unchanged).
   2. .hq-earth (home hero, v5): realistic night Earth with cyan city lights (bottom of this file).
   ==========================================================================
   HQDM: hero globe (service heroes): the old hqdm.io globe, rotating as on the current site
   (the 3.4 MB Lottie rebuilt in CSS: the world map slides behind a round mask, meridians turn, the map sways ±5°).
   Markup: inc/blocks.php. Decorative (aria-hidden); paused off-screen (site.js); still with reduced motion.
   ========================================================================== */
.hq-globe {
	position: absolute !important;
	margin: 0 !important;
	max-width: none !important;
	left: 50%;
	top: clamp(90px, 9vw, 120px);
	width: min(1040px, calc(100vw + 4px));      /* the orbit (93.6% of the box) stays on screen on every device */
	aspect-ratio: 1;
	translate: -50% 0;
	opacity: .5;                                /* Milan: present, but never louder than the headline */
	/* soft edge outside the orbit only, and a vertical fade so the globe never ends on the hero's bottom edge */
	-webkit-mask: radial-gradient(closest-side, #000 95%, transparent 100%), linear-gradient(#000 40%, transparent 76%);
	-webkit-mask-composite: source-in;
	mask: radial-gradient(closest-side, #000 95%, transparent 100%), linear-gradient(#000 40%, transparent 76%);
	mask-composite: intersect;
	z-index: -1;
	pointer-events: none;
}
@media (max-width: 781px) {
	/* phones: centred on the headline block instead of hanging from the top */
	.hq-globe { top: 47%; translate: -50% -50%; -webkit-mask: radial-gradient(closest-side, #000 95%, transparent 100%), linear-gradient(#000 55%, transparent 92%); -webkit-mask-composite: source-in; mask: radial-gradient(closest-side, #000 95%, transparent 100%), linear-gradient(#000 55%, transparent 92%); mask-composite: intersect; }
}
.hq-globe__glow { position: absolute; inset: 0; border-radius: 50%; opacity: .6; background: radial-gradient(closest-side, rgba(113, 61, 223, .22) 70%, rgba(113, 61, 223, .08) 86%, transparent); }
.hq-globe__sphere {
	position: absolute;
	inset: 6.2%;                                /* Ø 876 of 1000; the orbit (r 468) hugs it, 30 units out */
	border-radius: 50%;
	opacity: .8;                                /* near-solid: the starfield no longer shows through the planet */
	overflow: hidden;
	background: linear-gradient(180deg, #2f2940 0%, #1d1729 70%, #18121f 100%);
	/* thin luminous atmosphere on the lit side */
	box-shadow: inset 0 1px 0 rgba(196, 173, 255, .4), inset 14px 20px 44px -22px rgba(196, 173, 255, .35), 0 0 0 1px rgba(196, 173, 255, .12), 0 -10px 60px -20px rgba(151, 71, 255, .55);
}
.hq-globe__sway { position: absolute; inset: 0; animation: hq-globe-sway 30s ease-in-out infinite alternate; }   /* the map sways ±5°, the orbit stays still (Lottie) */
.hq-globe__map {
	position: absolute;
	top: 0;
	left: 0;
	width: 444.4%;                              /* two map tiles (tile = 2.222 × the sphere) */
	height: 100%;
	background: url("../../img/globe-map.webp?v=2") 0 0 / 50% 100% repeat-x;
	animation: hq-globe-spin 30s linear infinite;
	will-change: transform;
}
.hq-globe__sphere::after {
	/* limb darkening + a soft highlight: the flat map reads as a sphere */
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background:
		radial-gradient(circle at 36% 28%, rgba(255, 255, 255, .1), transparent 42%),
		radial-gradient(circle at 50% 50%, transparent 52%, rgba(10, 3, 24, .55) 86%, rgba(10, 3, 24, .85) 100%);
}
.hq-globe__orbits { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; opacity: .42; }
.hq-globe__orbits :is(path, circle) { fill: none; vector-effect: non-scaling-stroke; }
.hq-globe__line, .hq-globe__ring { stroke: #8f6bf6; stroke-width: 1; }
.hq-globe__dots, .hq-globe__ring-dots { stroke: #b49bff; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0 26; }
.hq-globe__ring { opacity: .8; }
.hq-globe__ring-dots { stroke-dasharray: 0 34; transform-origin: 500px 500px; animation: hq-globe-orbit 120s linear infinite; }
/* Meridians: one turn per 30s, the same as the map. scaleX = sin(longitude): sine-in to the centre line, sine-out to
   the limb. Only the front half (0–50%) shows; the back half is hidden behind the planet. The swap happens at the
   limb, where a meridian lies on the orbit, so it never pops. 8 meridians, 45° apart = 3.75s apart. */
.hq-globe__m {
	transform-origin: 500px 500px;
	animation: hq-globe-turn 30s linear infinite, hq-globe-face 30s linear infinite;
	animation-delay: calc(var(--i) * -3.75s);
}
@keyframes hq-globe-turn {
	0% { transform: scaleX(1); animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
	25% { transform: scaleX(0); animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
	50% { transform: scaleX(-1); animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
	75% { transform: scaleX(0); animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
	100% { transform: scaleX(1); }
}
@keyframes hq-globe-face { 0%, 48% { opacity: 1; } 50%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes hq-globe-spin { to { transform: translateX(-50%); } }
@keyframes hq-globe-sway { from { rotate: -5deg; } to { rotate: 5deg; } }
@keyframes hq-globe-orbit { to { rotate: 360deg; } }
.is-offscreen .hq-globe * { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
	/* one still frame of the same globe: the five front meridians at 45° steps, the back ones hidden */
	.hq-globe * { animation: none !important; }
	.hq-globe__m--1 { transform: scaleX(.707); }
	.hq-globe__m--2 { transform: scaleX(0); }
	.hq-globe__m--3 { transform: scaleX(-.707); }
	.hq-globe__m--4 { transform: scaleX(-1); }
	.hq-globe__m--5, .hq-globe__m--6, .hq-globe__m--7 { display: none; }
}

/* ==========================================================================
   v5 home hero Earth (agent A, from 05-design/earth-proto, approved by Fable 05.11)
   .hq-earth          positioned box (orbit ring at 46.8% of the box, planet = inner 87.6%)
   .hq-earth__halo    cyan atmosphere outside the planet
   .hq-earth__sphere  the planet: still frame as CSS background, WebGL canvas (earth.js) fades in on top
     ::before         scattered violet light, terminator (night side bottom-left), limb darkening, specular top-left
     ::after          inner atmosphere rim (cyan, brighter on the lit top-left)
   .hq-earth__orbit   SVG: 1px ring + brighter cyan arc (static)
   .hq-earth__nodes   4 cyan nodes on the ring, one composited layer turning once per 120s
   Decorative (aria-hidden). Paused off-screen (earth.js .is-paused). Reduced motion: static frame.
   ========================================================================== */
/* r2 (Milan): the whole planet sits inside the hero, so the atmosphere rim and the orbit ring read as one continuous
   360deg circle (no bottom fade). The planet hangs from .hq-earth-anchor, a zero-height box between the lede and the
   CTA (inc/blocks.php), so it is placed against the text whatever the headline wraps to.
   Size: the smaller of 1040px, the viewport width and the first screen's height (minus room for the nav).
   Wide screens and tablets: the planet frames the whole hero copy (centre 9.2% of its width above the anchor).
   Phones: the planet frames label, headline and lede; its bottom edge passes 14px under the lede, above the CTA. */
.hq-earth-anchor { position: relative; z-index: -2; width: 100%; height: 0; margin: 0 !important; pointer-events: none; }
.hq-earth {
	--earth-w: min(1040px, calc(100vw + 4px), max(560px, calc(min(100svh, 940px) - 96px)));
	--earth-dy: calc(var(--earth-w) * -.092);
	position: absolute !important;
	margin: 0 !important;
	max-width: none !important;
	left: 50%;
	top: 0;
	width: var(--earth-w);
	aspect-ratio: 1;
	translate: -50% calc(-50% + var(--earth-dy));
	z-index: -1;
	pointer-events: none;
}
@media (max-width: 560px) {
	.hq-earth { --earth-dy: calc(14px - var(--earth-w) * .438); }
	.hq-hero--earth .hq-hero__actions { margin-top: 44px !important; }
}
.hq-earth__halo,
.hq-earth__sphere { position: absolute; inset: 6.2%; border-radius: 50%; }
.hq-earth__halo {
	/* outer atmosphere: 40px cyan haze (scaled with the box so phones keep it inside the 6.2% margin) */
	box-shadow:
		0 0 calc(var(--earth-w) * .038) 2px var(--cyan-18),
		0 0 calc(var(--earth-w) * .014) 0 rgba(58, 209, 255, .28),
		calc(var(--earth-w) * -.008) calc(var(--earth-w) * -.006) calc(var(--earth-w) * .02) 0 rgba(103, 232, 249, .22);
}
.hq-earth__sphere {
	overflow: hidden;
	background: #070314 url("../../img/earth-still.webp") center / 100% 100% no-repeat;
	isolation: isolate;
}
.hq-earth__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .8s var(--ease); }
.hq-earth.is-live .hq-earth__canvas { opacity: 1; }
.hq-earth__sphere::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 50%;
	background:
		radial-gradient(circle at 30% 20%, rgba(170, 236, 255, .14), rgba(170, 236, 255, .05) 24%, transparent 46%),
		radial-gradient(circle at 34% 30%, rgba(92, 70, 200, .22), rgba(70, 50, 170, .12) 55%, rgba(40, 24, 110, .06) 80%),
		radial-gradient(120% 120% at 8% 100%, rgba(4, 1, 12, .82) 0%, rgba(4, 1, 12, .5) 34%, transparent 62%),
		radial-gradient(circle at 50% 50%, transparent 62%, rgba(6, 2, 18, .35) 88%, rgba(6, 2, 18, .6) 100%);
}
.hq-earth__sphere::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: 50%;
	/* inner rim: 6px cyan glow all round, stronger on the lit top-left */
	box-shadow:
		inset 0 0 6px 1px var(--cyan-60),
		inset 12px 10px 30px -8px var(--cyan-60),
		inset 0 0 90px -18px rgba(58, 209, 255, .45);
	/* r2: brighter on the lit top-left, never below 70% anywhere, so the rim closes all the way round */
	-webkit-mask: radial-gradient(130% 130% at 14% 22%, #000 52%, rgba(0, 0, 0, .7) 80%);
	mask: radial-gradient(130% 130% at 14% 22%, #000 52%, rgba(0, 0, 0, .7) 80%);
}
.hq-earth__orbit { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hq-earth__orbit circle { fill: none; vector-effect: non-scaling-stroke; }
.hq-earth__ring { stroke: rgba(255, 255, 255, .2); stroke-width: 1; }
.hq-earth__arc { stroke: url(#hq-earth-arc); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(103, 232, 249, .9)); }   /* v5 review: one step brighter */
.hq-earth__nodes { position: absolute; inset: 0; animation: hq-earth-orbit 120s linear infinite; }
.hq-earth__nodes i {
	position: absolute;
	left: calc(50% - 4px);
	top: calc(50% - 4px);
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #e6fdff;
	box-shadow: 0 0 6px 2px var(--cyan-60), 0 0 24px 6px var(--cyan-18);   /* v5 review: 2-step glow, 6px inner + 24px outer */
	transform: rotate(var(--a)) translateY(calc(var(--earth-w) * -.468));   /* r = 46.8% of the box: on the ring */
}
.hq-earth__nodes i:nth-child(1) { --a: -38deg; }
.hq-earth__nodes i:nth-child(2) { --a: 62deg; }
.hq-earth__nodes i:nth-child(3) { --a: 146deg; }
.hq-earth__nodes i:nth-child(4) { --a: 248deg; }
@keyframes hq-earth-orbit { to { rotate: 360deg; } }
.hq-earth.is-paused .hq-earth__nodes, .is-offscreen .hq-earth__nodes { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .hq-earth__nodes { animation: none; } }

/* ==========================================================================
   v5 r2: the Earth hero composition, shared by home (.hq-hero--home) and About (.hq-hero--about); both carry
   .hq-hero--earth (inc/blocks.php adds the .hq-earth markup, assets.php loads earth.js + galaxy.js). Moved here from
   home.css so the two heroes never drift apart.
   ========================================================================== */
.hq-hero--earth {
	min-height: min(100svh, 940px);
	display: grid;
	align-content: center;
	padding-bottom: var(--section-tight);
	isolation: isolate;
	overflow: clip;
}
.hq-hero--earth::after {
	/* soft violet light above the planet (the two-light ambient supplies the side light) */
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 70%;
	background: radial-gradient(48% 60% at 50% 0%, rgba(113, 61, 223, .24), transparent 72%);
	z-index: -2;
	pointer-events: none;
}
.hq-hero--earth::before {
	/* violet haze on both sides of the Earth (mockup): the phase 2 left light + its violet mirror on the right (the
	   ambient recipe's strength), fading out towards the bottom of the hero */
	content: "";
	position: absolute;
	inset: 0;
	z-index: -3;
	pointer-events: none;
	background:
		var(--light-l),
		radial-gradient(42% 60% at 0% 62%, rgba(151, 71, 255, .12), transparent 72%),
		radial-gradient(44% 64% at 100% 58%, rgba(151, 71, 255, .18), transparent 72%);
	-webkit-mask: linear-gradient(#000 60%, transparent);
	mask: linear-gradient(#000 60%, transparent);
}
.hq-galaxy { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); }
.hq-galaxy.is-on { opacity: .8; }
.hq-hero--earth .hq-hero__content { position: relative; z-index: 0; display: grid; justify-items: center; text-align: center; }
.hq-hero--earth .hq-hero__content::before {
	/* legibility: a soft dark ellipse behind the text block, so the planet can run near full strength */
	content: "";
	position: absolute;
	inset: -12% -14% -10%;
	z-index: -1;
	pointer-events: none;
	background: radial-gradient(closest-side, rgba(8, 3, 22, .7), rgba(8, 3, 22, .6) 46%, rgba(8, 3, 22, .24) 78%, transparent);
}
.hq-hero--earth :is(h1, .hq-lede, .hq-logos__title) { text-shadow: 0 0 18px rgba(8, 3, 22, .9), 0 0 4px rgba(8, 3, 22, .7); }
@media (max-width: 781px) { .hq-hero--earth .hq-hero__content::before { inset: -10% -6% -8%; } }
.hq-hero--earth .hq-label { margin-bottom: var(--sp-5); }
.hq-hero--earth .hq-hero__content > .hq-glowbar { margin-top: var(--sp-5); }
.hq-hero--about .hq-lede { max-width: 30em; text-wrap: balance; }
/* About: the same first-screen height as home (service.css gives centred page heroes 92svh, which pushed the ring under the nav) */
.hq-hero--earth.hq-hero--about { min-height: min(100svh, 940px) !important; }
/* the logo row paints above the planet and the text ellipse (both live in the positioned content box) */
.hq-hero--earth .hq-logos { position: relative; z-index: 1; }
.hq-hero--earth .hq-logos__title { color: var(--c-text-strong); white-space: nowrap; }   /* one line on phones: the rails shrink, not the label */
/* critic m6: between 900 and 1100px the 80px H1 reached the rim; cap it to the planet's width */
@media (min-width: 900px) and (max-width: 1100px) { .hq-hero--home .hq-display { font-size: min(var(--fs-display), 6.2vw); } }
/* the starfield's haze fades out before the hero ends (no 2-level step at the hero floor) */
.hq-galaxy { -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }

/* r3b (Milan 09.11): on phones the planet's centre sits on the vertical middle of the hero text (label to lede), so the
   copy reads as centred inside the planet on home and About. The zero-height anchor spans the text rows of the
   content grid and centres itself there; the planet hangs from it with no extra offset. The CTA clears the ring. */
@media (max-width: 560px) {
	.hq-hero--earth .hq-hero__content > * { grid-column: 1; }   /* one column: the anchor overlaps the text rows */
	.hq-hero--earth .hq-hero__content > .hq-label { grid-row: 1; }
	.hq-hero--earth .hq-hero__content > h1 { grid-row: 2; }
	.hq-hero--earth .hq-hero__content > .hq-glowbar { grid-row: 3; }
	.hq-hero--earth .hq-hero__content > .hq-lede { grid-row: 4; }
	.hq-hero--earth .hq-hero__content > .hq-earth-anchor { grid-row: 1 / 5; grid-column: 1; align-self: center; }
	.hq-hero--earth .hq-hero__content > .hq-hero__actions { grid-row: 5; }
	.hq-earth { --earth-dy: 0px; }
	.hq-hero--earth .hq-hero__content { margin-top: 80px !important; }   /* Milan: the planet a little lower (the hero centres its content, so ~40px) */
	/* the ring's bottom is 46.8% of the box under the text middle; the text half height is at least ~110px, plus a 24px gap */
	.hq-hero--earth .hq-hero__actions { margin-top: max(72px, calc((100vw + 4px) * .468 - 86px)) !important;   /* --earth-w lives on .hq-earth; on phones it equals 100vw + 4px */ }
}
