/* Shared authoring-guide HUD (Animation Engine). Used by Scroll Choreography + Model Viewer so both read
 * as one consistent overlay. Each guide is tinted with its own hue (--g-hue) so its page markers and its
 * HUD read as one set. See anim-guide.js. */

/* Page markers — dashed lines across the page at each keyframe %. */
.fw-anim-guide {
	position: absolute;
	top: 0; left: 0;
	width: 100%;
	height: 0;
	z-index: 2147483000;
	pointer-events: none;
}
.fw-anim-guide-mark {
	position: absolute;
	left: 0;
	width: 100%;
	height: 0;
	border-top: 1px dashed hsla(var(--g-hue, 226), 90%, 68%, .75);
}
.fw-anim-guide-badge {
	position: absolute;
	left: 12px;
	top: -11px;
	padding: 2px 9px;
	border-radius: 999px;
	background: hsl(var(--g-hue, 226), 76%, 56%);
	color: #fff;
	font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.fw-anim-guide-mark.is-active { border-top-color: #f5a623; }
.fw-anim-guide-mark.is-active .fw-anim-guide-badge { background: #f5a623; color: #1d1300; }

/* Shared stack — every HUD drops in here and stacks upward, so any number never overlap. */
#fw-anim-guide-stack {
	position: fixed;
	right: 14px;
	bottom: 14px;
	z-index: 2147483000;
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-end;
	gap: 8px;
	max-height: calc(100vh - 28px);
	overflow-y: auto;
	pointer-events: none;
}

.fw-anim-guide-hud {
	width: 236px;
	padding: 9px 11px;
	border-radius: 10px;
	background: rgba(15, 17, 22, .93);
	color: #e8ecf5;
	font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
	border-left: 3px solid hsl(var(--g-hue, 226), 76%, 60%);
	pointer-events: auto;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.fw-anim-guide-head { display: flex; align-items: center; gap: 8px; }
.fw-anim-guide-grip {
	flex: 0 0 auto; cursor: move; color: #6b7488; font-size: 13px; line-height: 1;
	margin: -2px -4px -2px -2px; padding: 2px; letter-spacing: -2px;
	user-select: none; -webkit-user-select: none; touch-action: none;
}
.fw-anim-guide-grip:hover { color: #cdd4e2; }
.fw-anim-guide-hud.is-dragged { box-shadow: 0 18px 44px rgba(0, 0, 0, .6); }
.fw-anim-guide-title {
	display: flex; align-items: center; gap: 6px;
	flex: 1; min-width: 0;
	padding: 0; margin: 0; border: 0; background: none;
	color: #e8ecf5; font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.fw-anim-guide-title:hover { color: #fff; }
.fw-anim-guide-name-el { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-anim-guide-swatch { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--g-hue, 226), 76%, 60%); }
.fw-anim-guide-num { flex: 0 0 auto; color: hsl(var(--g-hue, 226), 80%, 72%); }
.fw-anim-guide-pct { flex: 0 0 auto; color: #aab3c7; }
.fw-anim-guide-pct b { color: #fff; font-size: 13px; }
.fw-anim-guide-more {
	flex: 0 0 auto; width: 20px; height: 20px; padding: 0;
	border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px;
	background: rgba(255, 255, 255, .05); color: #aab3c7; cursor: pointer;
	line-height: 1; font-size: 13px;
}
.fw-anim-guide-more:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.fw-anim-guide-hud.is-expanded .fw-anim-guide-more { background: hsla(var(--g-hue, 226), 76%, 60%, .28); color: #fff; }

.fw-anim-guide-phase { margin-top: 3px; color: #8b93a7; font-size: 11px; }

.fw-anim-guide-rows {
	margin-top: 6px; padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, .12);
	display: grid; gap: 4px;
}
.fw-anim-guide-row { color: #aab3c7; }
.fw-anim-guide-nrow { display: flex; align-items: center; gap: 6px; }
.fw-anim-guide-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; border: 1px solid #6b7488; }
.fw-anim-guide-row.is-on .fw-anim-guide-dot { background: #6ad29b; border-color: #6ad29b; }
.fw-anim-guide-lname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-anim-guide-row.is-on .fw-anim-guide-lname { color: #e8ecf5; }
.fw-anim-guide-fade { flex: 0 0 auto; color: #8b93a7; }
.fw-anim-guide-row.is-on .fw-anim-guide-fade { color: #6ad29b; }

/* Labelled value grid — hidden until "show more". */
.fw-anim-guide-grid {
	display: none;
	grid-template-columns: repeat(3, 1fr);
	gap: 2px 10px;
	margin: 4px 0 2px 13px;
}
.fw-anim-guide-cell { display: flex; justify-content: space-between; gap: 6px; color: #cdd4e2; }
.fw-anim-guide-cell i { color: #7b8395; font-style: normal; }
.fw-anim-guide-cell b { color: #e8ecf5; font-weight: 600; }
.fw-anim-guide-meta {
	display: none;
	margin-top: 6px; padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, .12);
	color: #7b8395; font-size: 11px;
}
.fw-anim-guide-hud.is-expanded .fw-anim-guide-grid { display: grid; }
.fw-anim-guide-hud.is-expanded .fw-anim-guide-meta { display: block; }

/* ---- Editor mode (Tier 3: scrub the timeline + tweak keyframes live) -------------------------- */
.fw-anim-guide-edit {
	flex: 0 0 auto; width: 20px; height: 20px; padding: 0;
	border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px;
	background: rgba(255, 255, 255, .05); color: #aab3c7; cursor: pointer;
	line-height: 1; font-size: 12px;
}
.fw-anim-guide-edit:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.fw-anim-guide-edit.is-active { background: hsl(var(--g-hue, 226), 76%, 56%); color: #fff; border-color: transparent; }

/* Per-cell steppers — only shown while editing. */
.fw-anim-guide-step { display: none; }
/* In edit mode the steppers widen each cell, so drop the value grid to TWO columns (from three) — at
 * three, the last column (scale) clipped off the 236px HUD's right edge. */
.fw-anim-guide-hud.is-editing .fw-anim-guide-grid { grid-template-columns: repeat(2, 1fr); column-gap: 12px; }
.fw-anim-guide-hud.is-editing .fw-anim-guide-cell.is-editable {
	display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 3px;
}
.fw-anim-guide-hud.is-editing .fw-anim-guide-step {
	display: inline-flex; align-items: center; justify-content: center;
	width: 15px; height: 15px; padding: 0;
	border: 1px solid rgba(255, 255, 255, .18); border-radius: 4px;
	background: rgba(255, 255, 255, .06); color: #cdd4e2; cursor: pointer;
	line-height: 1; font-size: 12px;
}
.fw-anim-guide-hud.is-editing .fw-anim-guide-step:hover { background: hsla(var(--g-hue, 226), 76%, 60%, .4); color: #fff; }

/* Editor bar — scrub playhead + Live + Copy. Hidden until edit mode. */
.fw-anim-guide-editbar { display: none; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .12); }
.fw-anim-guide-hud.is-editing .fw-anim-guide-editbar { display: block; }
.fw-anim-guide-scrubrow { display: flex; align-items: center; gap: 6px; }
.fw-anim-guide-scrublbl { flex: 0 0 auto; color: #7b8395; font-size: 11px; }
.fw-anim-guide-scrub { flex: 1; min-width: 0; height: 16px; accent-color: hsl(var(--g-hue, 226), 76%, 60%); cursor: pointer; }
.fw-anim-guide-live, .fw-anim-guide-copy, .fw-anim-guide-delkey {
	flex: 0 0 auto; padding: 3px 8px;
	border: 1px solid rgba(255, 255, 255, .18); border-radius: 6px;
	background: rgba(255, 255, 255, .06); color: #cdd4e2; cursor: pointer;
	font: inherit; font-size: 11px;
}
.fw-anim-guide-live:hover, .fw-anim-guide-copy:hover, .fw-anim-guide-delkey:not(:disabled):hover { background: hsla(var(--g-hue, 226), 76%, 60%, .4); color: #fff; }
.fw-anim-guide-copy, .fw-anim-guide-delkey { width: 100%; margin-top: 6px; text-align: center; }
.fw-anim-guide-delkey:disabled { opacity: .4; cursor: default; }
.fw-anim-guide-delkey:not(:disabled):hover { background: rgba(224, 74, 74, .35); border-color: rgba(224, 74, 74, .6); }
.fw-anim-guide-hud.is-scrubbing .fw-anim-guide-live { background: hsl(var(--g-hue, 226), 76%, 56%); color: #fff; border-color: transparent; }

/* Keyframe-track timeline — one 0–100% ruler per layer, only in edit mode. */
.fw-anim-guide-hud.is-editing { width: 300px; }
.fw-anim-guide-track { display: none; }
.fw-anim-guide-hud.is-editing .fw-anim-guide-track {
	display: block; position: relative; height: 16px; margin: 4px 0 2px 13px;
	border-radius: 4px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
.fw-anim-guide-playhead {
	position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px;
	background: #f5a623; border-radius: 2px; pointer-events: none;
}
.fw-anim-guide-key {
	position: absolute; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px;
	background: hsl(var(--g-hue, 226), 76%, 62%); border: 1px solid #0f1116;
	transform: rotate(45deg); cursor: grab; touch-action: none; z-index: 1;
}
.fw-anim-guide-key:hover { background: #fff; }
.fw-anim-guide-key.is-sel { background: #f5a623; box-shadow: 0 0 0 2px rgba(245, 166, 35, .4); z-index: 2; }

/* Flash the element on the page when its guide title is clicked. */
.fw-anim-guide-flash { animation: fwAnimGuideFlash 1.1s ease-out; }
@keyframes fwAnimGuideFlash {
	0%, 100% { outline: 0 solid transparent; outline-offset: 0; }
	12%      { outline: 3px solid #f5a623; outline-offset: 2px; }
	60%      { outline: 3px solid rgba(245, 166, 35, .5); }
}
@media (prefers-reduced-motion: reduce) { .fw-anim-guide-flash { animation: none; } }
