/* Illustrative acoustic demonstration — immersive scene component ---------- */

.ew-section.ew-acoustic.ew-demo-scene {
	position: relative;
	/* Immersive scenes bleed to the section edge; the shared rail and the
	   static fallback carry their own spacing. Later-loaded components.css
	   owns .ew-section padding, so this triple class outranks it. */
	padding-block: 0;
}

.ew-acoustic__control-bar[hidden],
.ew-acoustic__static[hidden] {
	display: none;
}

/* The shared scene owns copy placement; only the on-media color inheritance
   stays here next to the other acoustic component rules. */
.ew-acoustic__header .ew-eyebrow,
.ew-acoustic__header .ew-lede {
	color: inherit;
}

.ew-acoustic__header h2 {
	margin-bottom: 0.5rem;
}

@media (min-width: 64em) {
	.ew-acoustic:not(.ew-demo-scene--service) .ew-acoustic__header {
		gap: 0.6rem;
		padding: 1.25rem;
	}
	.ew-acoustic:not(.ew-demo-scene--service) .ew-acoustic__header h2 {
		font-size: clamp(2.5rem, 3.3vw, 3.75rem);
	}
}

.ew-acoustic__header .ew-lede {
	margin-bottom: 0;
}

/* Full-bleed visual: the shared scene owns geometry, radius and shadow. */
.ew-acoustic__visual {
	margin: 0;
}

/* Base room image: fills the shared media plane exactly, never shifts. */
.ew-acoustic__base-room {
	display: block;
	width: 100%;
	height: auto;
}

/* Window Aperture: Strictly bounded to the architectural window frame.
   Percentages reference the shared 1672:941 media plane, which matches the
   base image pixel-for-pixel, so registration survives full-bleed cover. */
.ew-acoustic__aperture {
	position: absolute;
	top: 8.71%;
	left: 17.46%;
	width: 63.16%;
	height: 54.84%;
	overflow: hidden;
	pointer-events: none;
}

.ew-acoustic__aperture-view {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.ew-acoustic__aperture-view picture {
	display: contents;
}

.ew-acoustic__aperture-view img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ew-acoustic__aperture-view--open {
	opacity: 1;
	transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Closed sliding sash: slides into place and locks */
.ew-acoustic__aperture-view--closed {
	opacity: 0;
	transform: translateX(36px);
	transition:
		opacity 340ms cubic-bezier(0.22, 1, 0.36, 1),
		transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ew-acoustic[data-window-state="closed"] .ew-acoustic__aperture-view--open {
	opacity: 0;
}

.ew-acoustic[data-window-state="closed"] .ew-acoustic__aperture-view--closed {
	opacity: 1;
	transform: translateX(0);
}

/* Glass reflection sheen across the closed double glazed unit */
.ew-acoustic__glass-sheen {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(255, 255, 255, 0.26) 0%,
		rgba(255, 255, 255, 0.05) 35%,
		transparent 65%
	);
	opacity: 0;
	transform: translateX(16px);
	transition: opacity 400ms ease, transform 450ms ease;
	pointer-events: none;
}

.ew-acoustic[data-window-state="closed"] .ew-acoustic__glass-sheen {
	opacity: 1;
	transform: translateX(0);
}

/* Rail control bar: the shared scene owns placement; this keeps only the
   inline editorial arrangement of the toggle, sound action and meter. */
.ew-acoustic__control-bar {
	width: auto;
	max-width: none;
	background: transparent;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: inherit;
	box-sizing: border-box;
}

/* Unified Window Toggle Switch */
.ew-acoustic__toggle-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.ew-acoustic__control-label {
	font-family: var(--ew-font-display);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: rgb(250 247 242 / 0.85);
	text-transform: uppercase;
}

.ew-acoustic__switch {
	display: inline-flex;
	position: relative;
	background: rgb(0 0 0 / 0.35);
	border: 1px solid rgb(255 255 255 / 0.15);
	border-radius: 9999px;
	padding: 2px;
}

.ew-acoustic__switch-btn {
	appearance: none;
	background: transparent;
	border: none;
	border-radius: 9999px;
	padding: 0.3rem 0.85rem;
	min-width: 44px;
	min-height: 44px;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	color: rgb(250 247 242 / 0.7);
	cursor: pointer;
	position: relative;
	z-index: 2;
	transition: color var(--ew-motion-fast) var(--ew-motion-ease);
	scroll-margin-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

.ew-acoustic__switch-btn[aria-pressed="true"] {
	/* Thumb uses --ew-action; --ew-on-action is its contrast-locked pair in
	   both themes (white on deep green in light, near-black on light green
	   in dark). */
	color: var(--ew-on-action);
	font-weight: 600;
}

.ew-acoustic__switch-thumb {
	position: absolute;
	top: 2px;
	bottom: 2px;
	left: 2px;
	width: calc(50% - 2px);
	border-radius: 9999px;
	background: var(--ew-action);
	transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
	z-index: 1;
	box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
}

.ew-acoustic[data-window-state="closed"] .ew-acoustic__switch-thumb {
	transform: translateX(100%);
}

/* Unified Sound Button */
.ew-acoustic__sound-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	box-sizing: border-box;
	flex: 0 0 9.25rem;
	width: 9.25rem;
	padding: 0.35rem 0.95rem;
	min-width: 0;
	min-height: 44px;
	background: rgb(0 0 0 / 0.35);
	border: 1px solid rgb(255 255 255 / 0.48);
	border-radius: 9999px;
	color: #faf7f2;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--ew-motion-fast) var(--ew-motion-ease), border-color var(--ew-motion-fast) var(--ew-motion-ease);
	scroll-margin-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

.ew-acoustic__sound-btn:hover {
	background: rgb(0 0 0 / 0.55);
	border-color: #faf7f2;
}

.ew-acoustic[data-audio-state="playing"]:not([data-audio-muted="true"]) .ew-acoustic__sound-btn {
	background: var(--ew-action);
	border-color: var(--ew-action);
	color: var(--ew-on-action);
}

/* Focus follows the shared scene pattern
   (.ew-demo-scene :is(button, a):focus-visible); no local override. */

.ew-acoustic__sound-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
}

.ew-acoustic__sound-icon svg {
	width: 16px;
	height: 16px;
}

.ew-acoustic[data-audio-state="idle"] .ew-icon-sound-off,
.ew-acoustic[data-audio-muted="true"] .ew-icon-sound-on,
.ew-acoustic:not([data-audio-muted="true"]) .ew-icon-sound-off {
	display: none;
}

.ew-acoustic[data-audio-muted="true"] .ew-icon-sound-off {
	display: block;
}

.ew-acoustic[data-audio-state="playing"]:not([data-audio-muted="true"]) .ew-icon-sound-on {
	display: block;
}

/* Noise Intensity & Status Meter */
.ew-acoustic__meter {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.ew-acoustic__meter-bars {
	display: flex;
	align-items: flex-end;
	gap: 2.5px;
	height: 18px;
}

.ew-acoustic__meter-bars .ew-bar {
	display: block;
	width: 3px;
	border-radius: 1.5px;
	background: var(--ew-brand-orange);
	transition: height 340ms ease, background-color 340ms ease;
}

.ew-acoustic[data-audio-state="playing"][data-window-state="open"] .ew-bar {
	animation: ew-wave-pulse 0.85s ease-in-out infinite alternate;
}

.ew-acoustic[data-window-state="open"] .ew-bar--1 { height: 8px; animation-delay: 0.1s; }
.ew-acoustic[data-window-state="open"] .ew-bar--2 { height: 16px; animation-delay: 0.3s; }
.ew-acoustic[data-window-state="open"] .ew-bar--3 { height: 18px; animation-delay: 0s; }
.ew-acoustic[data-window-state="open"] .ew-bar--4 { height: 13px; animation-delay: 0.25s; }
.ew-acoustic[data-window-state="open"] .ew-bar--5 { height: 9px; animation-delay: 0.4s; }

.ew-acoustic[data-window-state="closed"] .ew-bar {
	height: 4px !important;
	animation: none !important;
	background: #79a98f;
	opacity: 0.75;
}

.ew-acoustic:not([data-audio-state="playing"]) .ew-bar {
	animation: none !important;
	height: 5px;
	opacity: 0.4;
}

@keyframes ew-wave-pulse {
	0% { transform: scaleY(0.4); opacity: 0.6; }
	100% { transform: scaleY(1); opacity: 1; }
}

.ew-acoustic__meter-label {
	font-family: var(--ew-font-display);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	color: rgb(250 247 242 / 0.85);
	white-space: nowrap;
}

.ew-acoustic__caption {
	position: absolute;
	top: 1rem;
	right: var(--ew-demo-copy-inline, 1.25rem);
	z-index: 2;
	margin: 0;
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgb(250 247 242 / 0.85);
}

/* One compact action area keeps the sound and window controls together. */
.ew-acoustic__rail-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.ew-acoustic__control-cluster {
	position: relative;
	width: fit-content;
}

.ew-acoustic__readout {
	position: absolute;
	inset-inline-end: 0;
	bottom: calc(100% + 0.55rem);
	z-index: 4;
	display: flex;
	visibility: hidden;
	max-width: min(82vw, 28rem);
	pointer-events: none;
	transition: visibility 0s linear 650ms;
}

.ew-acoustic__readout[data-visible="true"] {
	visibility: visible;
	transition-delay: 0s;
}

.ew-acoustic__readout-mask {
	display: flex;
	max-width: 100%;
	overflow: hidden;
}

.ew-acoustic__readout-inner {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
	opacity: 0.2;
	transform: translateY(115%);
	transition: transform 650ms cubic-bezier(.16, 1, .3, 1), opacity 350ms ease;
}

.ew-acoustic__readout[data-visible="true"] .ew-acoustic__readout-inner {
	opacity: 1;
	transform: translateY(0);
}

.ew-acoustic__db {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem;
	margin: 0;
	color: #faf7f2;
	font-size: 0.82rem;
}

.ew-acoustic__db strong {
	color: #faf7f2;
	font-family: var(--ew-font-display);
	font-size: clamp(1.25rem, 2vw, 1.75rem);
	line-height: 1;
}

.ew-acoustic__db-caption {
	font-weight: 600;
}

.ew-acoustic .ew-demo-scene__disclaimer {
	max-width: 39rem;
}

@media (min-width: 64em) {
	.ew-acoustic.ew-demo-scene--service .ew-demo-scene__copy {
		bottom: calc(6.75rem + 8.5rem + env(safe-area-inset-bottom, 0px));
	}
	.ew-acoustic .ew-demo-scene__rail {
		grid-template-columns: minmax(0, 1fr) var(--ew-demo-dock-reserve) minmax(0, 1fr);
	}
	.ew-acoustic__control-cluster {
		grid-column: 3;
		justify-self: end;
	}
	.ew-acoustic .ew-demo-scene__disclaimer {
		grid-column: 1 / -1;
	}
}

@media (max-width: 63.999em) {
	.ew-acoustic__control-cluster {
		justify-self: start;
		display: flex;
		flex-direction: column-reverse;
		align-items: flex-start;
		gap: 0.55rem;
		max-width: 100%;
	}
	.ew-acoustic__readout {
		position: static;
	}
}

/* Static Fallback */
.ew-acoustic__static {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ew-space-xs);
	width: 100%;
	max-width: min(84%, 72rem);
	margin: 0 auto;
	padding: var(--ew-space-sm) 0;
}

.ew-acoustic__state {
	margin: 0;
}

.ew-acoustic__state img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--ew-radius);
}

.ew-acoustic__state figcaption {
	display: grid;
	gap: 0.125rem;
	margin-top: var(--ew-space-xxs);
}

.ew-acoustic__state-label {
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ew-text-muted);
}

.ew-acoustic__state-copy {
	font-size: 0.875rem;
}

.ew-acoustic__static-note {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--ew-text-muted);
}

@media (min-width: 48em) {
	.ew-acoustic__static {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--ew-gutter);
	}
	.ew-acoustic__static-note {
		grid-column: 1 / -1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ew-acoustic__aperture-view,
	.ew-acoustic__switch-thumb {
		transition: none !important;
	}
	.ew-acoustic__meter-bars .ew-bar {
		animation: none !important;
	}
	.ew-acoustic__readout-inner {
		transform: none;
		transition: none;
	}
}
