/* Chaya Suite — ambience: sound button, page transitions. */

/* ------------------------------------------------------------------ */
/* Sound button                                                         */
/* ------------------------------------------------------------------ */

.chaya-amb {
	position: fixed;
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	z-index: 998;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	line-height: 1.2;
}

.chaya-amb[hidden] {
	display: none;
}

.chaya-amb--left {
	left: 18px;
}

.chaya-amb--right {
	right: 18px;
	flex-direction: row-reverse;
}

.chaya-amb__toggle,
.chaya-amb__more {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.78);
	box-shadow: 0 8px 24px rgba(0, 70, 67, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
	color: var(--chaya-teal);
	font: inherit;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	-webkit-backdrop-filter: blur(12px) saturate(1.2);
	backdrop-filter: blur(12px) saturate(1.2);
	transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, padding 0.35s ease;
}

.chaya-amb__toggle {
	height: 48px;
	min-width: 48px;
	padding: 0 14px;
	gap: 0;
}

.chaya-amb__toggle:hover,
.chaya-amb__more:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 30px rgba(0, 70, 67, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.chaya-amb__toggle:focus-visible,
.chaya-amb__more:focus-visible,
.chaya-amb__scene:focus-visible {
	outline: 2px solid var(--chaya-focus, #d56688);
	outline-offset: 3px;
}

/* Equaliser bars: still when off, swaying when on. */
.chaya-amb__bars {
	display: inline-flex;
	align-items: flex-end;
	gap: 3px;
	height: 18px;
}

.chaya-amb__bars i {
	display: block;
	width: 3px;
	height: 18px;
	border-radius: 3px;
	background: currentColor;
	transform: scaleY(0.28);
	transform-origin: bottom;
	transition: transform 0.4s ease;
}

.chaya-amb.is-on .chaya-amb__bars i {
	animation: chaya-amb-bar 1.2s ease-in-out infinite;
}

.chaya-amb.is-on .chaya-amb__bars i:nth-child(2) {
	animation-duration: 1.55s;
	animation-delay: -0.4s;
}

.chaya-amb.is-on .chaya-amb__bars i:nth-child(3) {
	animation-duration: 1.05s;
	animation-delay: -0.8s;
}

.chaya-amb.is-on .chaya-amb__bars i:nth-child(4) {
	animation-duration: 1.4s;
	animation-delay: -0.2s;
}

@keyframes chaya-amb-bar {
	0%, 100% { transform: scaleY(0.3); }
	50% { transform: scaleY(1); }
}

/* Label slides out on hover / focus. */
.chaya-amb__label {
	max-width: 0;
	overflow: hidden;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 600;
	opacity: 0;
	transition: max-width 0.35s ease, opacity 0.25s ease, margin 0.35s ease;
}

.chaya-amb__toggle:hover .chaya-amb__label,
.chaya-amb__toggle:focus-visible .chaya-amb__label {
	max-width: 120px;
	margin-left: 10px;
	opacity: 1;
}

/* Breathing ring while playing. */
.chaya-amb__ring {
	position: absolute;
	inset: -1px;
	border-radius: inherit;
	pointer-events: none;
}

.chaya-amb.is-on .chaya-amb__ring {
	box-shadow: 0 0 0 0 rgba(213, 102, 136, 0.45);
	animation: chaya-amb-breathe 4.5s ease-in-out infinite;
}

@keyframes chaya-amb-breathe {
	0%, 100% { box-shadow: 0 0 0 0 rgba(213, 102, 136, 0.35); }
	50% { box-shadow: 0 0 0 10px rgba(213, 102, 136, 0); }
}

.chaya-amb.is-on .chaya-amb__toggle {
	background: linear-gradient(135deg, rgba(0, 70, 67, 0.92), rgba(162, 58, 92, 0.88));
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}

/* Scene button: appears once sound is on. */
.chaya-amb__more {
	width: 36px;
	height: 36px;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.6);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

.chaya-amb.is-on .chaya-amb__more,
.chaya-amb.is-open .chaya-amb__more {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s;
}

.chaya-amb__more .chaya-icon {
	width: 18px;
	height: 18px;
}

.chaya-amb__panel {
	position: absolute;
	bottom: calc(100% + 12px);
	width: 240px;
	padding: 14px 16px 16px;
	border: 1px solid rgba(255, 255, 255, 0.8);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 18px 50px rgba(0, 70, 67, 0.2);
	color: var(--chaya-ink);
	-webkit-backdrop-filter: blur(16px) saturate(1.2);
	backdrop-filter: blur(16px) saturate(1.2);
	animation: chaya-amb-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
	transform-origin: bottom left;
}

.chaya-amb--left .chaya-amb__panel {
	left: 0;
}

.chaya-amb--right .chaya-amb__panel {
	right: 0;
	transform-origin: bottom right;
}

.chaya-amb__panel[hidden] {
	display: none;
}

@keyframes chaya-amb-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to { opacity: 1; transform: none; }
}

.chaya-amb__title {
	margin: 0 0 10px;
	color: var(--chaya-ink-2);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.chaya-amb__scenes {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 14px;
}

.chaya-amb__scene {
	min-height: 0;
	margin: 0;
	padding: 7px 12px;
	border: 1px solid var(--chaya-line);
	border-radius: 999px;
	background: #fff;
	color: var(--chaya-ink);
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chaya-amb__scene:hover {
	border-color: var(--chaya-teal);
}

.chaya-amb__scene[aria-pressed="true"] {
	border-color: var(--chaya-teal);
	background: var(--chaya-teal);
	color: #fff;
}

.chaya-amb__volume {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	color: var(--chaya-ink-2);
	font-size: 12px;
	font-weight: 600;
}

.chaya-amb__volume input[type="range"] {
	width: 100%;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	accent-color: var(--chaya-rose-deep);
}

/* First-visit invitation. */
.chaya-amb__hint {
	position: absolute;
	bottom: calc(100% + 10px);
	padding: 8px 12px;
	border-radius: 12px;
	background: var(--chaya-teal);
	box-shadow: 0 10px 26px rgba(0, 70, 67, 0.25);
	color: #fff;
	font-size: 13px;
	white-space: nowrap;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.4s ease, transform 0.4s ease;
	pointer-events: none;
}

.chaya-amb--left .chaya-amb__hint {
	left: 0;
}

.chaya-amb--right .chaya-amb__hint {
	right: 0;
}

.chaya-amb__hint.is-in {
	opacity: 1;
	transform: none;
}

.chaya-amb__hint::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 18px;
	border: 6px solid transparent;
	border-top-color: var(--chaya-teal);
}

.chaya-amb--right .chaya-amb__hint::after {
	right: 18px;
	left: auto;
}

/* ------------------------------------------------------------------ */
/* Transition veil (starts below the header, so the header never moves) */
/* ------------------------------------------------------------------ */

.chaya-amb-veil {
	position: fixed;
	top: var(--amb-top, 0px);
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 990;
	overflow: hidden;
	visibility: hidden;
	pointer-events: none;
}

.chaya-amb-veil.is-active {
	visibility: visible;
}

.chaya-amb-veil__layer,
.chaya-amb-veil__petal {
	position: absolute;
	opacity: 0;
}

.chaya-amb-veil__layer {
	inset: 0;
}

.chaya-amb-veil:not(.is-active) *,
.chaya-amb-veil:not(.is-active) {
	transition: none !important;
	animation: none !important;
}

/* Bloom: a soft circle of colour opens from the click. */
.chaya-amb-veil.is-bloom .chaya-amb-veil__layer {
	opacity: 1;
	background:
		radial-gradient(circle at var(--amb-x, 50%) var(--amb-y, 30%), #fffdfb 0, #fbf4ef 32%, #eef6f2 66%, #f6ecf1 100%);
	clip-path: circle(0 at var(--amb-x, 50%) var(--amb-y, 30%));
	transition: clip-path 0.62s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.6s ease;
}

.chaya-amb-veil.is-bloom.is-covering .chaya-amb-veil__layer,
.chaya-amb-veil.is-bloom.is-revealing .chaya-amb-veil__layer {
	clip-path: circle(150vmax at var(--amb-x, 50%) var(--amb-y, 30%));
}

.chaya-amb-veil.is-bloom.is-revealing .chaya-amb-veil__layer {
	opacity: 0;
}

.chaya-amb-veil__petal {
	width: 60vmax;
	height: 60vmax;
	border-radius: 50%;
	filter: blur(60px);
	transform: scale(0.4);
	transition: opacity 0.7s ease, transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chaya-amb-veil__petal--a {
	top: -20vmax;
	left: -15vmax;
	background: rgba(213, 102, 136, 0.28);
}

.chaya-amb-veil__petal--b {
	right: -20vmax;
	bottom: -25vmax;
	background: rgba(0, 70, 67, 0.2);
}

.chaya-amb-veil.is-bloom.is-covering .chaya-amb-veil__petal,
.chaya-amb-veil.is-mist.is-covering .chaya-amb-veil__petal {
	opacity: 1;
	transform: scale(1);
}

/* Mist: the page dissolves through a soft blur. */
.chaya-amb-veil.is-mist .chaya-amb-veil__layer {
	background: rgba(251, 248, 244, 0.7);
	-webkit-backdrop-filter: blur(18px) saturate(1.15);
	backdrop-filter: blur(18px) saturate(1.15);
	transition: opacity 0.5s ease;
}

.chaya-amb-veil.is-mist.is-covering .chaya-amb-veil__layer {
	opacity: 1;
}

.chaya-amb-veil.is-revealing .chaya-amb-veil__petal {
	opacity: 0;
	transform: scale(1.3);
}

/* Reduced motion: a plain, quick fade. */
.chaya-amb-veil.is-still .chaya-amb-veil__layer {
	background: rgba(255, 255, 255, 0.85);
	transition: opacity 0.15s linear;
}

.chaya-amb-veil.is-still.is-covering .chaya-amb-veil__layer {
	opacity: 1;
}

/* Waiting: a progress line under the header and a breathing lotus. */
.chaya-amb-veil__line {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	width: 100%;
	background: linear-gradient(90deg, var(--chaya-teal), var(--chaya-rose));
	transform: scaleX(0);
	transform-origin: left;
	opacity: 0;
}

.chaya-amb-veil.is-waiting .chaya-amb-veil__line {
	opacity: 1;
	transform: scaleX(0.82);
	transition: transform 8s cubic-bezier(0.1, 0.7, 0.2, 1), opacity 0.2s ease;
}

.chaya-amb-veil.is-revealing .chaya-amb-veil__line {
	opacity: 0;
	transform: scaleX(1);
	transition: transform 0.25s ease, opacity 0.4s ease 0.2s;
}

.chaya-amb-veil__lotus {
	position: absolute;
	top: min(38%, 280px);
	left: 50%;
	color: var(--chaya-rose-deep);
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.8);
	transition: opacity 0.4s ease, transform 0.4s ease;
}

.chaya-amb-veil__lotus svg {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.chaya-amb-veil.is-waiting .chaya-amb-veil__lotus {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.chaya-amb-veil.is-waiting .chaya-amb-veil__lotus svg {
	animation: chaya-amb-lotus 2.4s ease-in-out infinite;
}

.chaya-amb-veil.is-revealing .chaya-amb-veil__lotus {
	opacity: 0;
	transform: translate(-50%, -60%) scale(1.15);
}

@keyframes chaya-amb-lotus {
	0%, 100% { transform: scale(0.92); opacity: 0.75; }
	50% { transform: scale(1.06); opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Content leaving and arriving                                         */
/* ------------------------------------------------------------------ */

.chaya-amb-leave {
	opacity: 0;
	transform: translateY(-10px);
	transition: opacity 0.26s ease, transform 0.26s ease;
}

.chaya-amb-enter > * {
	animation: chaya-amb-enter 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.chaya-amb-enter > :nth-child(2) { animation-delay: 0.06s; }
.chaya-amb-enter > :nth-child(3) { animation-delay: 0.12s; }
.chaya-amb-enter > :nth-child(4) { animation-delay: 0.18s; }
.chaya-amb-enter > :nth-child(n+5) { animation-delay: 0.24s; }

.chaya-amb-enter--rise > * {
	animation-name: chaya-amb-rise;
	animation-duration: 0.8s;
}

.chaya-amb-enter--mist > * {
	animation-name: chaya-amb-mist;
}

@keyframes chaya-amb-enter {
	from { opacity: 0; transform: translateY(16px) scale(0.995); }
	to { opacity: 1; transform: none; }
}

@keyframes chaya-amb-rise {
	from { opacity: 0; transform: translateY(36px); }
	to { opacity: 1; transform: none; }
}

@keyframes chaya-amb-mist {
	from { opacity: 0; filter: blur(8px); }
	to { opacity: 1; filter: none; }
}

[data-amb-focus]:focus {
	outline: none;
}

body.chaya-amb-busy,
body.chaya-amb-busy a {
	cursor: progress;
}

/* ------------------------------------------------------------------ */
/* Small screens, motion, print                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 549px) {
	.chaya-amb {
		bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	}

	.chaya-amb--left {
		left: 14px;
	}

	.chaya-amb--right {
		right: 14px;
	}

	.chaya-amb__toggle {
		height: 44px;
		min-width: 44px;
		padding: 0 12px;
	}

	.chaya-amb__toggle:hover .chaya-amb__label {
		max-width: 0;
		margin-left: 0;
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chaya-amb.is-on .chaya-amb__bars i {
		animation: none;
		transform: scaleY(0.7);
	}

	.chaya-amb.is-on .chaya-amb__ring {
		animation: none;
	}

	.chaya-amb-enter > * {
		animation: none;
	}
}

@media print {
	.chaya-amb,
	.chaya-amb-veil {
		display: none !important;
	}
}

/* ------------------------------------------------------------------ */
/* Brand logo in the transition                                         */
/* ------------------------------------------------------------------ */

.chaya-amb-veil__lotus--logo .chaya-amb-logo {
	display: block;
	width: auto;
	height: auto;
	max-width: min(180px, 44vw);
	max-height: 96px;
}

.chaya-amb-veil.is-covering .chaya-amb-veil__lotus--logo {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
	transition-delay: 0.12s;
}

.chaya-amb-veil.is-waiting .chaya-amb-veil__lotus--logo .chaya-amb-logo {
	animation: chaya-amb-lotus 2.4s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/* [chaya_sound]                                                        */
/* ------------------------------------------------------------------ */

.chaya.chaya-sound-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid color-mix(in srgb, var(--chaya-teal) 30%, transparent);
	border-radius: 999px;
	background: #fff;
	color: var(--chaya-teal);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.chaya.chaya-sound-btn[hidden] {
	display: none;
}

.chaya.chaya-sound-btn:hover {
	transform: translateY(-1px);
}

.chaya.chaya-sound-btn:focus-visible {
	outline: 2px solid var(--chaya-teal);
	outline-offset: 2px;
}

.chaya.chaya-sound-btn.is-on {
	background: var(--chaya-teal);
	color: #fff;
}

.chaya-sound-btn__bars {
	display: inline-flex;
	align-items: flex-end;
	gap: 2px;
	height: 14px;
}

.chaya-sound-btn__bars i {
	width: 3px;
	height: 100%;
	border-radius: 2px;
	background: currentColor;
	transform: scaleY(0.35);
	transform-origin: bottom;
}

.chaya-sound-btn.is-on .chaya-sound-btn__bars i {
	animation: chaya-sound-bar 1.1s ease-in-out infinite;
}

.chaya-sound-btn.is-on .chaya-sound-btn__bars i:nth-child(2) { animation-delay: -0.3s; }
.chaya-sound-btn.is-on .chaya-sound-btn__bars i:nth-child(3) { animation-delay: -0.6s; }
.chaya-sound-btn.is-on .chaya-sound-btn__bars i:nth-child(4) { animation-delay: -0.15s; }

@keyframes chaya-sound-bar {
	0%, 100% { transform: scaleY(0.35); }
	50% { transform: scaleY(1); }
}

.chaya.chaya-sound-btn--icon {
	justify-content: center;
	width: 44px;
	padding: 0;
}

.chaya-sound-btn--icon .chaya-sound-btn__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.chaya.chaya-sound-btn--link,
.chaya.chaya-sound-btn--link.is-on {
	min-height: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--chaya-teal);
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.chaya-sound-btn.is-on .chaya-sound-btn__bars i {
		animation: none;
		transform: scaleY(0.7);
	}
}
