/**
 * Voice Assistant — on-site agent overlay (matches Cyrus dark + accent theme).
 * Dock launcher styles live in dock.css (.dock__ai-btn--voice).
 */

/* ----------------------------------------------------------------------- */
/* Full-screen agent overlay */
/* ----------------------------------------------------------------------- */

.voice-assistant {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.32s ease, visibility 0.32s ease;
}

.voice-assistant[hidden] {
	display: flex;
}

.voice-assistant.is-open {
	opacity: 1;
	visibility: visible;
}

.voice-assistant__backdrop {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	padding: 0;
	cursor: default;
	background: rgba(9, 9, 11, 0.88);
	backdrop-filter: blur(20px) saturate(1.2);
	-webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.voice-assistant__ambient {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.voice-assistant__grid {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
	background-size: 48px 48px;
	mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.voice-assistant__glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(80px);
	opacity: 0.35;
}

.voice-assistant__glow--1 {
	width: 340px;
	height: 340px;
	top: 18%;
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-accent);
}

.voice-assistant__glow--2 {
	width: 260px;
	height: 260px;
	bottom: 12%;
	right: 18%;
	background: rgba(214, 255, 47, 0.45);
}

.voice-assistant__stage {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	width: min(440px, 94vw);
	padding: 28px 24px 24px;
	text-align: center;
	border: 1px solid var(--color-border-glass);
	border-radius: var(--radius-lg);
	background: rgba(14, 15, 18, 0.82);
	backdrop-filter: blur(28px) saturate(1.35);
	-webkit-backdrop-filter: blur(28px) saturate(1.35);
	box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
	transform: translateY(14px) scale(0.97);
	opacity: 0;
	transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.32s ease;
}

.voice-assistant.is-open .voice-assistant__stage {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.voice-assistant__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 12px;
}

.voice-assistant__badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	border-radius: var(--radius-pill);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-accent);
	background: rgba(214, 255, 47, 0.08);
	border: 1px solid rgba(214, 255, 47, 0.22);
}

.voice-assistant__badge-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--color-accent);
	box-shadow: 0 0 10px var(--color-accent-glow);
}

.voice-assistant__orb-wrap.is-listening .voice-assistant__badge-dot,
.voice-assistant__orb-wrap.is-thinking .voice-assistant__badge-dot,
.voice-assistant__orb-wrap.is-speaking .voice-assistant__badge-dot {
	animation: voice-badge-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-badge-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.45; transform: scale(0.85); }
}

/* Language pill */
.voice-assistant__lang {
	display: inline-flex;
	gap: 3px;
	padding: 3px;
	border-radius: var(--radius-pill);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--color-border-glass);
}

.voice-assistant__lang-btn {
	border: none;
	background: transparent;
	color: var(--color-text-muted);
	font-size: 11px;
	font-weight: 600;
	padding: 5px 12px;
	border-radius: var(--radius-pill);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.voice-assistant__lang-btn.is-active {
	background: var(--color-accent);
	color: var(--color-bg-primary);
}

/* Orb + waves */
.voice-assistant__orb-wrap {
	position: relative;
	width: 168px;
	height: 168px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 4px 0 2px;
}

.voice-assistant__orb {
	--level: 0;
	position: absolute;
	inset: 0;
	border-radius: 50%;
	pointer-events: none;
}

.voice-assistant__orb-layer {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(from 0deg, var(--color-accent), rgba(214, 255, 47, 0.35), #e8ff5a, var(--color-accent));
	filter: blur(16px);
	opacity: 0.7;
	transform: scale(calc(0.74 + var(--level, 0) * 0.28));
	transition: transform 0.08s linear;
	animation: cyrus-voice-orb-spin 9s linear infinite;
}

.voice-assistant__orb-layer--2 {
	inset: 14px;
	filter: blur(10px);
	opacity: 0.5;
	animation-duration: 12s;
	animation-direction: reverse;
}

.voice-assistant__orb-layer--3 {
	inset: 28px;
	filter: blur(5px);
	opacity: 0.8;
	animation-duration: 6.5s;
}

.voice-assistant__orb-core {
	position: absolute;
	inset: 44px;
	border-radius: 50%;
	background:
		radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.06) 58%, transparent 70%),
		var(--color-bg-secondary);
	box-shadow: inset 0 0 28px rgba(214, 255, 47, 0.35);
}

.voice-assistant__orb-scan {
	position: absolute;
	inset: 44px;
	border-radius: 50%;
	overflow: hidden;
	opacity: 0.35;
	background: linear-gradient(180deg, transparent 40%, rgba(214, 255, 47, 0.5) 50%, transparent 60%);
	animation: voice-orb-scan 3s linear infinite;
}

@keyframes voice-orb-scan {
	to { transform: translateY(100%); }
}

@keyframes cyrus-voice-orb-spin {
	to { transform: rotate(360deg) scale(calc(0.74 + var(--level, 0) * 0.28)); }
}

.voice-assistant__waves {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.voice-assistant__orb-wrap.is-listening .voice-assistant__waves,
.voice-assistant__orb-wrap.is-speaking .voice-assistant__waves {
	opacity: 1;
}

.voice-assistant__wave {
	width: 3px;
	height: 12px;
	border-radius: 2px;
	background: var(--color-accent);
	transform: scaleY(0.35);
	animation: voice-wave 0.9s ease-in-out infinite;
	animation-delay: calc(var(--wi) * 0.07s);
}

.voice-assistant__orb-wrap.is-idle .voice-assistant__wave {
	animation-play-state: paused;
	opacity: 0.25;
}

@keyframes voice-wave {
	0%, 100% { transform: scaleY(0.3); opacity: 0.45; }
	50% { transform: scaleY(1.2); opacity: 1; }
}

.voice-assistant__orb-wrap.is-idle .voice-assistant__orb-layer {
	animation-play-state: paused;
	opacity: 0.35;
}

.voice-assistant__orb-wrap.is-thinking .voice-assistant__orb-layer {
	animation-duration: 2s;
}

.voice-assistant__orb-wrap.is-speaking .voice-assistant__orb-layer {
	animation-duration: 3.2s;
}

.voice-assistant__orb-wrap.is-speaking .voice-assistant__orb-core {
	animation: cyrus-voice-core-breathe 1.1s ease-in-out infinite;
}

@keyframes cyrus-voice-core-breathe {
	0%, 100% { box-shadow: inset 0 0 28px rgba(214, 255, 47, 0.35); }
	50% { box-shadow: inset 0 0 42px rgba(214, 255, 47, 0.65); }
}

.voice-assistant__mic {
	position: relative;
	z-index: 2;
	width: 68px;
	height: 68px;
	border-radius: 50%;
	border: 1px solid rgba(214, 255, 47, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.04);
	color: var(--color-white);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.voice-assistant__mic:hover {
	background: rgba(214, 255, 47, 0.12);
	border-color: rgba(214, 255, 47, 0.45);
}

.voice-assistant__mic:active {
	transform: scale(0.94);
}

.voice-assistant__mic-icon {
	width: 28px;
	height: 28px;
}

.voice-assistant__orb-wrap.is-listening .voice-assistant__mic {
	background: rgba(214, 255, 47, 0.18);
	border-color: rgba(214, 255, 47, 0.55);
	color: var(--color-accent);
}

.voice-assistant__name {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--color-white);
}

.voice-assistant__status {
	margin: 0;
	font-size: 0.82rem;
	color: var(--color-text-secondary);
	min-height: 18px;
}

.voice-assistant__caption {
	min-height: 44px;
	max-height: 150px;
	overflow-y: auto;
	font-size: 0.95rem;
	line-height: 1.65;
	color: var(--color-white);
	padding: 0 4px;
}

.voice-assistant__caption:empty {
	display: none;
}

.voice-assistant__caption--interim {
	color: var(--color-text-muted);
	font-style: italic;
}

.voice-assistant__controls {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 4px;
}

.voice-assistant__ctrl,
.voice-assistant__close {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid var(--color-border-glass);
	background: rgba(255, 255, 255, 0.04);
	color: var(--color-white);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.voice-assistant__ctrl:hover,
.voice-assistant__close:hover {
	background: rgba(214, 255, 47, 0.1);
	border-color: var(--color-border-hover);
	transform: translateY(-1px);
}

.voice-assistant__ctrl.is-muted {
	background: rgba(255, 90, 95, 0.2);
	border-color: rgba(255, 90, 95, 0.4);
}

.voice-assistant__ctrl-icon,
.voice-assistant__close-icon {
	width: 17px;
	height: 17px;
}

/* Section highlight after agent navigates */
.voice-section-highlight {
	outline: 2px solid rgba(214, 255, 47, 0.55);
	outline-offset: 6px;
	box-shadow: 0 0 40px rgba(214, 255, 47, 0.12);
	transition: outline-color 0.35s ease, box-shadow 0.35s ease;
}

body.voice-assistant-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.voice-assistant__orb-layer,
	.voice-assistant__orb-core,
	.voice-assistant__orb-scan,
	.voice-assistant__wave,
	.voice-assistant__badge-dot {
		animation: none !important;
	}
}

@media (max-width: 640px) {
	.voice-assistant__stage {
		width: 100vw;
		max-width: 100vw;
		border-radius: 0;
		border-left: none;
		border-right: none;
		padding: 22px 18px 20px;
		min-height: 100dvh;
		justify-content: center;
	}

	.voice-assistant__orb-wrap {
		width: 148px;
		height: 148px;
	}

	.voice-assistant__mic {
		width: 58px;
		height: 58px;
	}
}
