/*
 * Interactive Moon map (Missions page): markup from [cds_moon_map]
 * (inc/moon-map.php), behaviour in moon-map.js. Loaded only on pages that
 * use the shortcode. Layout follows the prototype: mission list | globe |
 * detail panel on desktop; list beside globe on tablet; globe, panel, list
 * on phones. The section carries cds-always-dark, so the colour variables
 * keep their dark values in light mode (the globe is drawn for a dark sky).
 *
 * Literal colours (pixel plan chunk 07): the prototype hard-codes this component's
 * palette, and the band is always dark, so the literals match it in both themes and
 * don't depend on which colour variables Divi prints on the Missions page.
 */

.cds-moon[hidden],
.cds-moon [hidden] {
	display: none !important;
}

/* The static map and list are the no-JavaScript fallback. */
.cds-moon-on .cds-moon-static {
	display: none !important;
}

.cds-moon {
	width: 100%;
	display: grid;
	grid-template-columns: 256px minmax(0, 1fr);
	grid-template-areas: "list globe";
	column-gap: var(--gvid-cds-gap-md, 32px);
	row-gap: var(--gvid-cds-gap-md, 32px);
	align-items: start;
	color: var(--gcid-cds-body);
	font-family: var(--gvid-cds-font-body), sans-serif;
	font-weight: 400; /* Divi's body is 500; the prototype component is 400 (MISSIONS-N01) */
}

.cds-moon.has-selection {
	grid-template-columns: 256px minmax(0, 1fr) 340px;
	grid-template-areas: "list globe panel";
}

.cds-moon__list {
	grid-area: list;
	min-width: 0;
}

.cds-moon__globe {
	grid-area: globe;
	position: relative;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gvid-cds-gap-xs, 16px);
}

.cds-moon__panel {
	grid-area: panel;
	min-width: 0;
	align-self: center;
}

.cds-moon:not(.has-selection) .cds-moon__panel {
	display: none;
}

/* ---------- Desktop: the prototype's band and layout (pixel plan chunk 07) ----------
 * Applies only while the script runs (.cds-moon-on on the section), so the no-JavaScript
 * fallback keeps the section's Divi settings. Divi limitations: a section's padding and
 * row width can't depend on the script state, and Divi has no fr/flex-share layout for a
 * shortcode's markup. Literal colours: the band is always dark and these are the
 * prototype's fixed values (MISSIONS-11, -12, -13, -14).
 */
@media (min-width: 1100px) {
	html body .et_builder_inner_content .et_pb_section.cds-moon-on {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
		background-color: #050505 !important; /* beats the Section Default preset's !important fill (0,3,0) */
		background-image: radial-gradient(ellipse 1000px 520px at 50% -10%, rgba(91, 110, 214, 0.07) 0%, rgba(91, 110, 214, 0) 62%);
	}

	html body .et_pb_section.cds-moon-on > .et_pb_row {
		width: calc(100% - 96px) !important; /* !important: the Row preset prints width 100%, which left the band with no side inset below 1376px (and at 1440 once the cap became 1440px; client corrections 16 Nov) */
		max-width: 1440px; /* the content width, 1440px since the client corrections of 16 Nov (was the prototype's 1280px) */
		padding-left: 0 !important; /* the row preset's 48px gutter; the prototype's band inset is the 48px beside the content */
		padding-right: 0 !important;
	}

	/* The band has no visible heading in the prototype; screen readers keep it (WCAG 1.3.1). */
	.cds-moon-on .cds-moon-heading {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: 0;
		padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.cds-moon,
	.cds-moon.has-selection {
		display: flex;
		align-items: flex-start;
		position: relative;
		min-height: 620px;
		padding-bottom: 56px;
		column-gap: 0;
	}

	.cds-moon__list {
		/* Client corrections 16 Nov 2026 (E2), approved deviation from v6.5's 256px: 12px wider so the
		 * longest word ("Constellation", about 108px) fits the label (99px broke it mid-word as
		 * "Constellatio / n"); labels are now 111px, as at tablet widths. Plus a classic scroll
		 * bar's width, measured by moon-map.js (--cds-moon-sb, 0 with overlay scroll bars). */
		width: calc(268px + var(--cds-moon-sb, 0px));
		flex-shrink: 0;
		box-sizing: border-box;
		padding: 56px 28px 0 0;
	}

	.cds-moon__globe {
		flex: 1;
		align-self: stretch;
		justify-content: center;
		padding-top: 56px;
	}

	.cds-moon.has-selection .cds-moon__globe {
		padding-right: 24px;
	}

	/* Pause (WCAG 2.2.2, site only) sits under the globe without moving it. */
	.cds-moon__pause {
		position: absolute;
		left: 50%;
		bottom: 0;
		transform: translateX(-50%);
	}

	.cds-moon__panel,
	.cds-moon:not(.has-selection) .cds-moon__panel {
		display: block;
		width: 340px;
		flex-shrink: 0;
		align-self: center;
		box-sizing: content-box;
		padding-top: 56px;
	}

	/* Open: the panel takes its width at once and fades and slides in over 0.3s; closed:
	 * it collapses at once, as in the prototype (MISSIONS-64, -70). */
	.cds-moon__panel {
		opacity: 1;
		transform: none;
		transition: opacity 0.3s, transform 0.3s;
	}

	.cds-moon:not(.has-selection) .cds-moon__panel {
		width: 0;
		overflow: hidden;
		opacity: 0;
		transform: translateX(20px);
	}
}

/* ---------- Mission list ---------- */

.cds-moon__eyebrow {
	margin: 0 0 18px;
	padding: 0;
	font-family: var(--gvid-cds-font-mono), monospace;
	font-size: 12px;
	line-height: normal;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--gcid-cds-muted);
}

.cds-moon ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cds-moon .cds-moon__missions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 560px;
	overflow-y: auto;
	padding: 0 6px 0 0; /* the prototype's scrollbar gutter; .cds-moon ul set 0 before (MISSIONS-N02) */
	scrollbar-width: thin;
	scrollbar-color: #33343A transparent;
}

.cds-moon__missions li {
	margin: 0;
	padding: 0;
}

.cds-moon__missions li::before {
	content: none;
}

.cds-moon__btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	padding: 14px;
	text-align: left;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid #26272B;
	border-radius: 10px;
	color: var(--gcid-cds-text);
	font: inherit;
}

.cds-moon__btn[aria-pressed="true"] {
	border-color: rgba(91, 110, 214, 0.6);
	background: rgba(91, 110, 214, 0.07);
}

/* Hover wins over the selected look, as the prototype's !important hover does. Instant. */
.cds-moon__btn:hover {
	border-color: rgba(91, 110, 214, 0.55);
	background: rgba(91, 110, 214, 0.06);
}

/* WCAG 2.4.7: the scroller would clip a ring drawn outside the button, so it sits inside. */
.cds-moon .cds-moon__btn:focus-visible {
	outline-offset: -3px;
}

.cds-moon__btn-label {
	flex: 1;
	min-width: 0;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gcid-cds-text);
}

/* Status pills: completed missions in accent, upcoming in gold, ongoing in grey. */
.cds-moon__status {
	flex-shrink: 0;
	white-space: nowrap;
	padding: 4px 10px;
	border-radius: var(--gvid-cds-radius-pill, 100px);
	font-family: var(--gvid-cds-font-mono), monospace;
	font-size: 10px;
	line-height: normal;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #B0B0B4;
	background: rgba(255, 255, 255, 0.06);
}

.cds-moon__status--complete {
	color: #9AA7F2;
	background: rgba(91, 110, 214, 0.08);
}

.cds-moon__status--upcoming {
	color: #D8A03A;
	background: rgba(216, 160, 58, 0.12);
}

/* ---------- Legend ---------- */

.cds-moon__legend {
	margin-top: 36px;
	padding-top: 22px;
	border-top: 1px solid #26272B;
}

.cds-moon__legend .cds-moon__eyebrow {
	margin-bottom: 14px;
	letter-spacing: 0.2em;
	/* The prototype's #6E6E73 is 3.8:1 on the dark panel (WCAG 1.4.3); #8A8A90 is 5.6:1. Chunk 09. */
	color: #8A8A90;
}

.cds-moon__legend ul {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cds-moon__legend li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	font-size: 13px;
	line-height: normal;
	color: #B0B0B4;
}

.cds-moon__key {
	display: inline-block;
	flex-shrink: 0;
	width: 8px;
	height: 8px;
}

.cds-moon__key--selected {
	transform: rotate(45deg);
	background: rgba(255, 196, 56, 0.25);
	border: 1px solid rgba(255, 196, 56, 0.8);
}

.cds-moon__key--site {
	border-radius: 50%;
	background: rgba(91, 110, 214, 0.55);
}

/* ---------- Globe ---------- */

.cds-moon__canvas {
	display: block;
	width: 100%;
	max-width: 480px;
	height: auto;
	aspect-ratio: 1 / 1;
}

.cds-moon__pause {
	margin: 0;
	padding: 7px 14px;
	cursor: pointer;
	background: var(--gcid-cds-surface);
	border: 1px solid var(--gcid-cds-border-2);
	border-radius: var(--gvid-cds-radius-pill, 100px);
	color: var(--gcid-cds-body);
	font-family: var(--gvid-cds-font-mono), monospace;
	font-size: 11px;
	line-height: 1.4;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.cds-moon__pause:hover {
	border-color: var(--gcid-cds-accent);
	color: var(--gcid-cds-text);
}

/* ---------- Detail panel ---------- */

.cds-moon__media {
	position: relative;
	height: 188px;
	overflow: hidden;
	background: #101114;
	border: 1px solid #26272B; /* full border: a dark line under the accent line (MISSIONS-N13) */
	border-radius: 9px 9px 0 0;
}

.cds-moon__media::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: rgba(91, 110, 214, 0.75);
}

.cds-moon__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cds-moon__body {
	padding: 22px 22px 26px;
	background: #101114;
	border: 1px solid #26272B;
	border-top: 0;
	border-radius: 0 0 9px 9px;
}

.cds-moon__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 7px;
}

.cds-moon .cds-moon__title {
	margin: 0;
	padding: 0;
	font-family: var(--gvid-cds-font-heading), sans-serif;
	font-size: 18px; /* Orbitron fitted to the prototype's 17px Nulshock width (MISSIONS-N14) */
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: uppercase; /* Nulshock draws lowercase as capitals */
	color: var(--gcid-cds-text);
}

.cds-moon__head .cds-moon__status {
	margin-top: 3px;
	font-size: 9px;
	line-height: normal;
	letter-spacing: 0.18em;
	padding: 3px 8px;
}

.cds-moon__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0 0 10px;
	padding: 0;
	font-family: var(--gvid-cds-font-mono), monospace;
	font-size: 12px;
	line-height: normal;
}

.cds-moon__customer {
	letter-spacing: 0.1em;
	color: #9AA7F2;
}

.cds-moon__date {
	letter-spacing: 0.08em;
	color: #B0B0B4;
}

/* The prototype's separator: its own item, Plex Sans 14px; it stays at the end of the customer line when the row wraps (MISSIONS-N07). */
.cds-moon__sep {
	font-family: var(--gvid-cds-font-body), sans-serif;
	font-size: 14px;
	letter-spacing: 0;
	color: #55555A;
}

.cds-moon__loc {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 14px;
	padding: 0;
	font-family: var(--gvid-cds-font-mono), monospace;
	font-size: 12px;
	line-height: normal;
	letter-spacing: 0.1em;
	color: #C9A24B;
}

.cds-moon__loc .cds-moon__key {
	width: 6px;
	height: 6px;
}

.cds-moon__desc {
	margin: 0 0 20px;
	padding: 0;
	font-size: 14px;
	line-height: 1.72;
	color: #B0B0B4;
}

.cds-moon a.cds-moon__more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border: 1px solid rgba(91, 110, 214, 0.3);
	border-radius: var(--gvid-cds-radius-pill, 100px);
	background: rgba(91, 110, 214, 0.1);
	color: #9AA7F2;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
}

/* The prototype's hover: button blue, white text, instant (MISSIONS-72). */
.cds-moon a.cds-moon__more:hover {
	background: #4A5CD0;
	color: #FFFFFF;
}

/* The prototype's thin arrow (MISSIONS-N12). */
.cds-moon a.cds-moon__more span {
	font-size: 15px;
	font-weight: 300;
	line-height: 1;
}

/* ---------- Tablet: list beside the globe, panel under the globe ---------- */

@media (max-width: 1099px) {
	.cds-moon,
	.cds-moon.has-selection {
		grid-template-columns: calc(240px + var(--cds-moon-sb, 0px)) minmax(0, 1fr); /* + a classic scroll bar (moon-map.js) */
		grid-template-areas:
			"list globe"
			"list panel";
	}
}

/* ---------- Phone and small tablet: globe, panel, then the list ---------- */

@media (max-width: 980px) {
	.cds-moon,
	.cds-moon.has-selection {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"globe"
			"panel"
			"list";
	}

	.cds-moon .cds-moon__missions {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
		max-height: none;
		overflow: visible;
	}

	.cds-moon__btn-label {
		font-size: 15px;
	}

	.cds-moon__panel {
		align-self: stretch;
		width: 100%;
		max-width: 560px;
		justify-self: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cds-moon__btn,
	.cds-moon__pause,
	.cds-moon a.cds-moon__more,
	.cds-moon__panel {
		transition: none !important;
	}
}
