/* DFS Coach (Design 3): the logo's running figure on a small glass "stage" in the bottom-left gutter.
   Markup: inc/dfs-coach.php; motion and the keep-clear check: js/dfs-coach.js. Author: Haroon, Development, The Loop Marketing. */
.dfs-coach {
	/* As wide as the gutter beside the content column allows (12px+ gap, room for optical overhangs), 56px minimum; js/dfs-coach.js steps it out of view whenever content is under it. */
	--k-size: clamp(56px, calc(max(0px, (100vw - var(--dfs-container, 1360px)) / 2) + var(--dfs-gutter, 20px) - 36px), 104px);
	position: fixed;
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: max(16px, env(safe-area-inset-bottom, 0px));
	z-index: 900; /* under the header (1000), mobile menu overlay (999), quote drawer (9000+) and pop-ups (10000) */
	width: var(--k-size);
	height: var(--k-size);
	pointer-events: none;
	transition: transform var(--dfs-dur) var(--dfs-ease-out), opacity var(--dfs-dur) var(--dfs-ease-out), visibility 0s;
}

/* Steps aside while content is under it, and while a drawer, sheet, menu or pop-up is open.
   Teammates: data-dfs-coach-hide on any open overlay hides it; data-dfs-coach-avoid marks content it must never sit over. */
.dfs-coach.is-away,
.dfs-coach.is-held, /* the floor-plan actor is on screen */
:root:has(.dfs-quote.is-open, .dfs-nav.is-open, .dfs-filters.is-open, [data-dfs-filters-toggle][aria-expanded="true"], [data-dfs-coach-hide], .dfs-sheet-open, body.dfs-overflow-hidden, body.dfs-nav-open) .dfs-coach {
	transform: translateY(12px);
	opacity: 0;
	visibility: hidden;
	transition: transform var(--dfs-dur-fast) var(--dfs-ease-in-out), opacity var(--dfs-dur-fast) var(--dfs-ease-in-out), visibility 0s linear var(--dfs-dur-fast);
}

/* Glass plate: navy tint + blur and a thin periwinkle border; the logo's orange orbit is the only drawing behind the figure. */
.dfs-coach__plate {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border: 1px solid color-mix(in srgb, var(--dfs-periwinkle) 45%, transparent);
	border-radius: 14px;
	background: color-mix(in srgb, var(--dfs-navy) 64%, transparent);
	-webkit-backdrop-filter: blur(10px) saturate(1.2);
	backdrop-filter: blur(10px) saturate(1.2);
	box-shadow: 0 10px 24px -16px color-mix(in srgb, var(--dfs-black) 80%, transparent);
	transform-origin: 0 100%;
	transition: transform var(--dfs-dur) var(--dfs-ease-out), opacity var(--dfs-dur) var(--dfs-ease-out), visibility 0s;
}
.dfs-coach__plate,
.dfs-coach__toggle { animation: dfs-coach-in var(--dfs-dur-slow) var(--dfs-ease-out) calc(var(--dfs-dur-hero) * .9) backwards; }
@keyframes dfs-coach-in { from { opacity: 0; transform: translateY(16px) scale(.92); } }

/* The figure reversed out of the logo (white, far side periwinkle) with the logo's orange orbit; equipment in muted steel. */
.dfs-coach__svg { display: block; width: 100%; height: 100%; fill: var(--dfs-white); }
:is(.dfs-coach, .dfs-plan-actor) [data-b] { transform-box: view-box; }
:is(.dfs-coach, .dfs-plan-actor) .k-back { fill: var(--dfs-periwinkle); }
:is(.dfs-coach, .dfs-plan-actor) .k-n { fill: color-mix(in srgb, var(--dfs-periwinkle) 62%, var(--dfs-navy)); }
:is(.dfs-coach, .dfs-plan-actor) .k-o { fill: var(--dfs-orange); }
:is(.dfs-coach, .dfs-plan-actor) .k-pw { fill: var(--dfs-white); }
.dfs-coach .k-soft { opacity: .3; }
:is(.dfs-coach, .dfs-plan-actor) .k-t { fill: var(--dfs-tan); }
:is(.dfs-coach, .dfs-plan-actor) .k-line { fill: none; stroke: color-mix(in srgb, var(--dfs-periwinkle) 62%, var(--dfs-navy)); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
:is(.dfs-coach, .dfs-plan-actor) .k-o.k-line { stroke: var(--dfs-orange); }
:is(.dfs-coach, .dfs-plan-actor) .k-thick { stroke-width: 3.4; }
.dfs-coach .k-ring { fill: none; stroke: color-mix(in srgb, var(--dfs-periwinkle) 62%, var(--dfs-navy)); stroke-width: 3; }
:is(.dfs-coach, .dfs-plan-actor) .k-lines { fill: none; stroke: var(--dfs-navy); stroke-width: .9; }
.dfs-coach .k-swoosh { fill: var(--dfs-orange); transition: opacity var(--dfs-dur) var(--dfs-ease-out); }
.dfs-coach.has-kit .k-swoosh { opacity: .3; } /* quieter while equipment is on the stage */
:is(.dfs-coach, .dfs-plan-actor) .k-p { opacity: 0; transition: opacity var(--dfs-dur) var(--dfs-ease-out); }
:is(.dfs-coach, .dfs-plan-actor) .k-p.is-on { opacity: 1; }

/* Hide / show button: a 24px chip inside the plate (nothing sticks out over the page); once hidden, a 44px glass button with the logo figure in the same corner. */
.dfs-coach__toggle {
	position: absolute;
	top: 2px;
	right: 2px;
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--dfs-periwinkle) 60%, transparent);
	border-radius: 50%;
	background: var(--dfs-navy);
	color: var(--dfs-white);
	cursor: pointer;
	pointer-events: auto;
	transition: background-color var(--dfs-dur-fast) var(--dfs-ease-out), color var(--dfs-dur-fast) var(--dfs-ease-out);
}
.dfs-coach__toggle:hover { background: var(--dfs-tan); color: var(--dfs-black); }
.dfs-coach__toggle:focus-visible { outline: 3px solid var(--dfs-orange); outline-offset: 2px; }
.dfs-coach__icon { display: block; }
.dfs-coach__icon--show { display: none; fill: currentColor; }

.dfs-coach.is-off .dfs-coach__plate { opacity: 0; transform: scale(.4); visibility: hidden; transition: transform var(--dfs-dur) var(--dfs-ease-in-out), opacity var(--dfs-dur) var(--dfs-ease-in-out), visibility 0s linear var(--dfs-dur); }
.dfs-coach.is-off .dfs-coach__toggle {
	top: auto;
	right: auto;
	bottom: 0;
	left: 0;
	width: 44px;
	height: 44px;
	background: color-mix(in srgb, var(--dfs-navy) 64%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}
.dfs-coach.is-off .dfs-coach__icon--hide { display: none; }
.dfs-coach.is-off .dfs-coach__icon--show { display: block; }

/* The Coach inside the quote builder's floor plan (js/dfs-coach-plan.js): a sprite on the plan, 768px+ only.
   Positions are in cqw/cqh of a layer the size of the plan (1000 x 620 plan units). Never takes pointer events. */
.dfs-plan-actor { display: none; }
@media (min-width: 768px) {
	.dfs-plan-actor { display: block; position: absolute; top: 0; left: 0; z-index: 2; width: 100%; aspect-ratio: 1000 / 620; container-type: size; pointer-events: none; }
	.dfs-plan-actor[hidden] { display: none; }
}
.dfs-plan-actor__pos,
.dfs-plan-actor__face { position: absolute; left: 0; top: 0; }
.dfs-plan-actor__svg { position: absolute; left: 0; top: 0; width: 8cqw; max-width: none; height: 8cqw; overflow: visible; fill: var(--dfs-white); transform: translate(-50%, -90.4%); }
.dfs-plan-actor__shadow { position: absolute; left: 0; top: 0; width: 3.8cqw; height: 1.2cqw; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--dfs-black) 60%, transparent), transparent); transform: translate(-50%, -50%); }
/* Treadmill belt ticking under his feet while he runs in the Cardio zone. */
.dfs-plan-actor__belt { position: absolute; overflow: hidden; opacity: 0; transition: opacity var(--dfs-dur) var(--dfs-ease-out); }
.dfs-plan-actor__belt::before { content: ""; position: absolute; inset: -8px 0 0; background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--dfs-orange-light) 75%, transparent) 0 1px, transparent 1px 8px); animation: dfs-plan-belt .35s linear infinite; }
.dfs-plan-actor.is-belt .dfs-plan-actor__belt { opacity: 1; }
@keyframes dfs-plan-belt { to { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .dfs-plan-actor__belt::before { animation: none; } }
