/* ============================================
   Home app-card vignettes — animations specific
   to LanWhisper, Intention, and Magicbrake tiles.
   Loaded only on the homepage.
   ============================================ */

/* --- LanWhisper vignette: persistent mic + content area that swaps bars↔text. --- */
.lw-vignette {
	align-items: center;
	justify-content: center;
}
.lw-display {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	height: 2.4em;
	max-width: 100%;
	font-family: var(--font-mono);
	font-size: 0.82em;
	color: var(--accent);
	overflow: hidden;
	transition: width 0.34s ease;
	/* width is set by JS to match the active state's natural width */
}
.lw-mic-icon {
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	color: var(--accent);
}
.lw-content {
	position: relative;
	display: inline-flex;
	align-items: center;
	height: 1em;
}
.lw-bars,
.lw-text {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	transition: opacity 0.28s ease;
}
.lw-display[data-state="listening"] .lw-bars { opacity: 1; position: relative; }
.lw-display[data-state="listening"] .lw-text { opacity: 0; position: absolute; top: 50%; left: 0; transform: translateY(-50%); }
.lw-display[data-state="text"]      .lw-bars { opacity: 0; position: absolute; top: 50%; left: 0; transform: translateY(-50%); }
.lw-display[data-state="text"]      .lw-text { opacity: 1; position: relative; }
.lw-bars {
	gap: 0.18em;
	height: 1em;
}
.lw-bars > span {
	display: block;
	width: 0.16em;
	background: var(--text-strong);
	height: 30%;
	animation: lw-bar 0.7s ease-in-out infinite;
}
.lw-bars > span:nth-child(1) { animation-duration: 0.6s;  animation-delay: 0s;    }
.lw-bars > span:nth-child(2) { animation-duration: 0.85s; animation-delay: 0.12s; }
.lw-bars > span:nth-child(3) { animation-duration: 0.55s; animation-delay: 0.05s; }
.lw-bars > span:nth-child(4) { animation-duration: 0.75s; animation-delay: 0.18s; }
.lw-bars > span:nth-child(5) { animation-duration: 0.65s; animation-delay: 0.08s; }
@keyframes lw-bar {
	0%, 100% { height: 25%; }
	50%      { height: 95%; }
}
.lw-text {
	color: var(--text-strong);
}

/* --- Intention vignette: prompt label + display that morphs from typed focus into countdown --- */
.int-vignette {
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	font-family: var(--font-mono);
}
.int-display {
	width: auto;
	display: inline-flex;
	align-items: center;
	position: relative;
	padding: 0 0.8em;
	height: 2.4em;
	font-size: 0.82em;
	color: var(--text-strong);
	overflow: hidden;
}
.int-display::before {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	background: var(--ink-line);
	z-index: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity var(--dur-slow) ease;
}
.int-display[data-state="timer"]::before {
	opacity: 1;
}
.int-bg-fill {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 0;
	background: var(--accent);
	z-index: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity var(--dur-slow) ease;
}
.int-display[data-state="timer"] .int-bg-fill {
	opacity: 1;
}
.int-task {
	flex: 0 0 auto;
	min-width: 0;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	font-weight: bold;
	position: relative;
	z-index: 1;
}
.int-typed {
	white-space: nowrap;
}
.int-caret {
	display: inline-block;
	width: 0.5em;
	height: 0.95em;
	margin-left: 0.12em;
	background: var(--text-strong);
	flex-shrink: 0;
	animation: int-blink 1s steps(1) infinite;
}
.int-display[data-state="timer"] .int-caret {
	display: none;
}
@keyframes int-blink {
	50% { opacity: 0; }
}
.int-time {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--accent);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	max-width: 0;
	opacity: 0;
	overflow: hidden;
	margin-left: 0;
	position: relative;
	z-index: 1;
	transition:
		max-width var(--dur-slow) cubic-bezier(0.22, 1, 0.36, 1),
		margin-left var(--dur-slow) cubic-bezier(0.22, 1, 0.36, 1),
		opacity 0.28s ease;
}
.int-display[data-state="timer"] .int-time {
	max-width: 5em;
	margin-left: 0.95em;
	opacity: 1;
}

/* --- Magicbrake vignette: idle → drag → drop → convert → done --- */
.mb-vignette {
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
.mb-vignette > * {
	width: 100%;
	max-width: 8em;
}
.mb-drop {
	position: relative;
	height: 5em;
	border: none;
	background-color: transparent;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100' preserveAspectRatio='none'><rect x='1' y='1' width='158' height='98' rx='8' ry='8' fill='none' stroke='rgba(255,255,255,0.18)' stroke-width='1.5' stroke-dasharray='9 5' vector-effect='non-scaling-stroke'/></svg>");
	background-repeat: no-repeat;
	background-size: 100% 100%;
	border-radius: 0.5em;
	overflow: hidden;
}
/* Brighter dashed overlay that snaps on as the file crosses into the
   drop area, fades back after the file settles, and pulses again when
   the checkmark appears. */
.mb-drop::before {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100' preserveAspectRatio='none'><rect x='1' y='1' width='158' height='98' rx='8' ry='8' fill='none' stroke='rgba(255,255,255,0.55)' stroke-width='1.5' stroke-dasharray='9 5' vector-effect='non-scaling-stroke'/></svg>");
	background-repeat: no-repeat;
	background-size: 100% 100%;
	opacity: 0;
	z-index: 0;
	animation: mb-border-emphasis 6s ease-in-out infinite;
}
@keyframes mb-border-emphasis {
	0%, 29%   { opacity: 0; }
	30%       { opacity: 1; }     /* file crosses into zone */
	50%       { opacity: 1; }     /* file lands */
	56%       { opacity: 0; }     /* fade back once file has shrunk away */
	70%       { opacity: 0; }
	72%       { opacity: 1; }     /* pulse with the checkmark */
	88%       { opacity: 1; }     /* hold bright while checkmark is up */
	93%, 100% { opacity: 0; }     /* fade out in sync with checkmark */
}
.mb-state {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	font-size: 0.76em;
	white-space: nowrap;
	opacity: 0;
	z-index: 2;
}
/* Done: green check pops in at normal size, holds, then fades out as
   the cycle hands off — no more bg flash, the check itself carries the
   success colour. */
.mb-state--done {
	color: var(--accent);
	animation: mb-done 6s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
	z-index: 3;
}
.mb-state--done svg {
	width: 1.4em;
	height: 1.4em;
	color: var(--accent);
}
@keyframes mb-done {
	0%, 70%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
	72%       { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
	75%       { opacity: 1; transform: translate(-50%, -50%) scale(0.95); }
	78%, 88%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	93%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* File icon lives in the vignette (sibling of .mb-drop) so the
   pre-landing arc is visible above & below the landing area.
   No scaling during arc — only on the landing bounce. */
.mb-drop-file {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 2em;
	height: 2em;
	margin-left: -1em;
	margin-top: -1em;
	color: var(--accent);
	opacity: 0;
	pointer-events: none;
	animation: mb-file 6s ease-in-out infinite;
}
.mb-drop-file svg {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(0 6px 10px var(--shadow-color));
}
/* Green plus badge that pops onto the file's bottom-right the moment
   it crosses the drop-zone threshold, mirroring the macOS drag-add cue. */
.mb-drop-file-add {
	position: absolute;
	right: -0.18em;
	bottom: -0.18em;
	width: 0.85em;
	height: 0.85em;
	opacity: 0;
	pointer-events: none;
	animation: mb-add-show 6s ease-in-out infinite;
}
.mb-drop-file-add svg {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(0 1px 2px var(--shadow-color));
}
@keyframes mb-add-show {
	/* The badge stays at full size from the moment the file crosses the
	   threshold; the parent's shrink+fade handles its disappearance. */
	0%, 29%   { opacity: 0; transform: scale(0.4); }
	30%, 100% { opacity: 1; transform: scale(1); }
}
/* File enters from off-screen above the vignette (as if being dragged
   in from beyond the visible area). Start position is far enough up
   that even the drop-shadow is hidden until the drag begins. The drag
   uses ease-out so the motion accelerates while it's still off-screen
   and decelerates as it commits to the drop — a natural hand-drag
   feel. After landing the file shrinks away over ~0.3s to hand off to
   the progress bar. */
@keyframes mb-file {
	0%        { transform: translate(0, -9em) scale(1); opacity: 0; }
	16%       {
		animation-timing-function: ease-out;
		transform: translate(0, -9em) scale(1); opacity: 0;
	}
	35%       { opacity: 1; }                                                 /* fades up while sliding into view */
	50%       { transform: translate(0, 0) scale(1); opacity: 1; }            /* lands at center */
	55%       { transform: translate(0, 0) scale(0); opacity: 0; }            /* shrinks away */
	100%      { transform: translate(0, 0) scale(0); opacity: 0; }
}

/* Thin progress track centered vertically in the drop zone — same
   pattern as the Intention vignette: dark track + green fill. */
.mb-progress {
	position: absolute;
	left: 20%;
	right: 20%;
	top: 50%;
	transform: translateY(-50%);
	height: 2px;
	overflow: hidden;
	background: var(--ink-line);
	opacity: 0;
	pointer-events: none;
	animation: mb-progress-show 6s linear infinite;
	z-index: 1;
}
.mb-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--accent);
	animation: mb-progress-fill 6s ease-in-out infinite;
}
@keyframes mb-progress-show {
	0%, 54.99%   { opacity: 0; }
	55%, 70%     { opacity: 1; }
	70.01%, 100% { opacity: 0; }
}
@keyframes mb-progress-fill {
	0%, 55%   { width: 0; }
	70%       { width: 100%; }
	100%      { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.lw-bars > span,
	.mb-drop::before,
	.mb-state,
	.mb-drop-file,
	.mb-drop-file-add,
	.mb-progress,
	.mb-progress-fill {
		animation: none !important;
	}
	.mb-state--idle { opacity: 1; }
}
