/* ==========================================================================
   Westwood Accessibility Suite — Visitor Toolbar
   ========================================================================== */

/* --------------------------------------------------------------------------
   Skip Link
   -------------------------------------------------------------------------- */

.wwas-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 99999;
	background: var(--wwas-accent, #1a1a2e);
	color: var(--wwas-text, #fff);
	padding: .75rem 1.25rem;
	border-radius: 0 0 6px 0;
	font-weight: 600;
	text-decoration: none;
	font-family: Arial, Helvetica, sans-serif;
}

.wwas-skip-link:focus {
	left: 0;
	top: 0;
}

/* --------------------------------------------------------------------------
   Backdrop overlay (injected by JS, sits below toolbar)
   -------------------------------------------------------------------------- */

.wwas-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 99985;
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s ease;
}

.wwas-backdrop.is-visible {
	opacity: 1;
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Toolbar Root
   -------------------------------------------------------------------------- */

.wwas-toolbar {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99990;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	/* Isolation: contain stacking context so Elementor/theme z-index doesn't interfere */
	isolation: isolate;
}

/* Position left variant */
.wwas-toolbar[data-position="left"] {
	right: auto;
	left: 24px;
}

/* --------------------------------------------------------------------------
   Isolation reset — neutralise theme and page-builder overrides for all
   buttons and links inside the toolbar before we apply our own styles.
   -------------------------------------------------------------------------- */

.wwas-toolbar button {
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	border: none;
	padding: 0;
	margin: 0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: inherit;
	cursor: pointer;
	text-align: inherit;
	box-shadow: none;
	border-radius: 0;
}

.wwas-toolbar a {
	color: inherit;
	text-decoration: none;
	background: transparent;
}

/* --------------------------------------------------------------------------
   FAB Button (Floating Action Button)
   -------------------------------------------------------------------------- */

.wwas-toolbar .wwas-fab {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--wwas-fab-size, 52px);
	height: var(--wwas-fab-size, 52px);
	border-radius: 50%;
	background: var(--wwas-accent, #1a1a2e);
	color: var(--wwas-text, #fff);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
	transition: background .2s ease, box-shadow .2s ease, transform .15s ease;
	position: relative;
	z-index: 2;
}

.wwas-toolbar .wwas-fab:hover,
.wwas-toolbar .wwas-fab:focus-visible {
	background: color-mix(in srgb, var(--wwas-accent, #1a1a2e) 80%, white);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
	outline: 3px solid #005fcc;
	outline-offset: 3px;
	color: var(--wwas-text, #fff);
}

.wwas-toolbar .wwas-fab:active {
	transform: scale(.95);
}

.wwas-toolbar .wwas-fab__icon {
	font-size: 1.4rem;
	line-height: 1;
	pointer-events: none;
	display: block;
	color: var(--wwas-text, #fff);
}

/* When panel is open the FAB shows a close symbol via aria-expanded */
.wwas-toolbar .wwas-fab[aria-expanded="true"] .wwas-fab__icon {
	font-style: normal;
	font-size: 0;
}

.wwas-toolbar .wwas-fab[aria-expanded="true"] .wwas-fab__icon::before {
	content: "\2715"; /* ✕ */
	font-size: 1.2rem;
}

/* --------------------------------------------------------------------------
   Panel
   -------------------------------------------------------------------------- */

.wwas-panel {
	position: absolute;
	bottom: 64px;
	right: 0;
	width: 320px;
	background: #fff;
	border-radius: calc(var(--wwas-radius, 8px) + 4px);
	box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
	transform: translateX(0) scale(.95);
	transform-origin: bottom right;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
	overflow: hidden;
}

/* Left-positioned panel opens to the right of the FAB */
.wwas-toolbar[data-position="left"] .wwas-panel {
	right: auto;
	left: 0;
	transform-origin: bottom left;
}

/* Visible state — panel.hidden is removed by JS */
.wwas-panel:not([hidden]) {
	opacity: 1;
	transform: translateX(0) scale(1);
	pointer-events: auto;
}

/* When hidden attribute is set */
.wwas-panel[hidden] {
	display: block; /* override browser default so transition works */
	opacity: 0;
	pointer-events: none;
	transform: translateX(0) scale(.95);
}

/* --------------------------------------------------------------------------
   Panel Header
   -------------------------------------------------------------------------- */

.wwas-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--wwas-accent, #1a1a2e);
	color: var(--wwas-text, #fff);
}

.wwas-panel__title {
	font-weight: 700;
	font-size: .9rem;
	letter-spacing: .02em;
	color: var(--wwas-text, #fff);
}

.wwas-toolbar .wwas-panel__close {
	background: none;
	border: none;
	color: var(--wwas-text, #fff);
	font-size: 1.1rem;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
	line-height: 1;
	transition: background .15s ease;
}

.wwas-toolbar .wwas-panel__close:hover,
.wwas-toolbar .wwas-panel__close:focus-visible {
	background: rgba(255, 255, 255, .15);
	outline: 2px solid rgba(255, 255, 255, .6);
	outline-offset: 2px;
	color: var(--wwas-text, #fff);
}

/* --------------------------------------------------------------------------
   Tool Grid
   -------------------------------------------------------------------------- */

.wwas-panel__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 14px 14px 8px;
}

/* --------------------------------------------------------------------------
   Tool Buttons
   -------------------------------------------------------------------------- */

.wwas-toolbar .wwas-tool-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 10px;
	background: #f4f5f7;
	color: var(--wwas-accent, #1a1a2e);
	border: 1px solid #e1e3e8;
	border-radius: var(--wwas-radius, 8px);
	cursor: pointer;
	text-align: center;
	transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
	min-height: 70px;
}

.wwas-toolbar .wwas-tool-btn:hover {
	background: #e8eaf0;
	border-color: #c5c8d1;
	color: var(--wwas-accent, #1a1a2e);
}

.wwas-toolbar .wwas-tool-btn:focus-visible {
	outline: 3px solid #005fcc;
	outline-offset: 2px;
}

.wwas-toolbar .wwas-tool-btn[aria-pressed="true"] {
	background: var(--wwas-active-bg, hsla(43, 72%, 47%, .18));
	color: var(--wwas-accent, #1a1a2e);
	border-color: var(--wwas-active, #c89a2e);
	box-shadow: 0 0 0 1px var(--wwas-active-bg, hsla(43, 72%, 47%, .18));
}

.wwas-toolbar .wwas-tool-btn[aria-pressed="true"]:hover {
	background: var(--wwas-active-bg, hsla(43, 72%, 47%, .18));
	border-color: var(--wwas-active, #c89a2e);
	color: var(--wwas-accent, #1a1a2e);
	opacity: .85;
}

.wwas-toolbar .wwas-tool-btn__icon {
	font-size: 1.3rem;
	line-height: 1;
	display: block;
}

.wwas-toolbar .wwas-tool-btn__label {
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.3;
	display: block;
}

/* --------------------------------------------------------------------------
   Panel Footer
   -------------------------------------------------------------------------- */

.wwas-panel__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px 14px;
	border-top: 1px solid #e1e3e8;
	gap: 8px;
}

.wwas-toolbar .wwas-reset-btn {
	background: none;
	border: 1px solid #c5c8d1;
	color: var(--wwas-accent, #1a1a2e);
	padding: 6px 14px;
	border-radius: 6px;
	cursor: pointer;
	font-size: .8rem;
	font-weight: 600;
	transition: background .15s ease, border-color .15s ease;
}

.wwas-toolbar .wwas-reset-btn:hover {
	background: #f4f5f7;
	border-color: #9ea3ae;
	color: var(--wwas-accent, #1a1a2e);
}

.wwas-toolbar .wwas-reset-btn:focus-visible {
	outline: 3px solid #005fcc;
	outline-offset: 2px;
}

.wwas-toolbar .wwas-statement-link {
	font-size: .78rem;
	color: var(--wwas-accent, #1a1a2e);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wwas-toolbar .wwas-statement-link:hover {
	color: #005fcc;
}

.wwas-toolbar .wwas-statement-link:focus-visible {
	outline: 3px solid #005fcc;
	outline-offset: 2px;
	border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Accessibility Effect Classes
   -------------------------------------------------------------------------- */

html.wwas--focus *:focus {
	outline: 3px solid #005fcc !important;
	outline-offset: 3px !important;
}

html.wwas--focus a:hover,
html.wwas--focus button:hover,
html.wwas--focus [tabindex]:hover,
html.wwas--focus input:hover,
html.wwas--focus select:hover,
html.wwas--focus textarea:hover,
html.wwas--focus summary:hover {
	outline: 3px solid var(--wwas-active, #c89a2e) !important;
	outline-offset: 2px !important;
	border-radius: 2px;
}

html.wwas--motion-reduced *,
html.wwas--motion-reduced *::before,
html.wwas--motion-reduced *::after {
	animation-duration: .01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: .01ms !important;
	scroll-behavior: auto !important;
}

html.wwas--dyslexia {
	font-family: 'Arial', 'Verdana', sans-serif !important;
	letter-spacing: .05em;
	word-spacing: .1em;
}

html.wwas--dyslexia * {
	font-family: inherit !important;
}

html.wwas--text-large {
	font-size: 115%;
}

html.wwas--link-highlights a {
	text-decoration: underline !important;
	outline: 2px solid #005fcc;
	outline-offset: 2px;
}

html.wwas--hide-images img {
	visibility: hidden !important;
}

html.wwas--spacing {
	line-height: 1.8 !important;
	letter-spacing: .05em !important;
	word-spacing: .1em !important;
}

html.wwas--spacing * {
	line-height: inherit !important;
}

/* --------------------------------------------------------------------------
   Large cursor
   -------------------------------------------------------------------------- */

html.wwas--large-cursor,
html.wwas--large-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M8 4 L8 34 L14 28 L18 38 L22 36 L18 26 L26 26Z' fill='white' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}

/* --------------------------------------------------------------------------
   Highlight headings
   -------------------------------------------------------------------------- */

html.wwas--highlight-titles h1,
html.wwas--highlight-titles h2,
html.wwas--highlight-titles h3,
html.wwas--highlight-titles h4,
html.wwas--highlight-titles h5,
html.wwas--highlight-titles h6 {
	outline: 2px solid #005fcc !important;
	outline-offset: 3px !important;
	background: rgba(0, 95, 204, .08) !important;
	border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Reading mask
   -------------------------------------------------------------------------- */

#wwas-reading-mask {
	position: absolute;
	left: 0;
	width: 100%;
	height: 40px;
	background: rgba(255, 255, 150, 0.35);
	border-top: 2px solid rgba(200, 154, 46, .5);
	border-bottom: 2px solid rgba(200, 154, 46, .5);
	pointer-events: none;
	z-index: 99970;
	transition: top .05s linear;
}

/* --------------------------------------------------------------------------
   Force left text alignment
   -------------------------------------------------------------------------- */

html.wwas--text-align p,
html.wwas--text-align li,
html.wwas--text-align td,
html.wwas--text-align th,
html.wwas--text-align blockquote,
html.wwas--text-align figcaption {
	text-align: left !important;
}

/* --------------------------------------------------------------------------
   Text-to-Speech mode
   -------------------------------------------------------------------------- */

/* Speaker cursor when TTS mode is active */
html.wwas--tts body {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02z' fill='%231a1a2e'/%3E%3C/svg%3E") 3 12, pointer !important;
}

/* Highlight hover target while TTS is active */
html.wwas--tts .wwas-tts-target {
	outline: 2px dashed #005fcc !important;
	outline-offset: 2px !important;
	background: rgba(0, 95, 204, .07) !important;
	border-radius: 2px;
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02z' fill='%23005fcc'/%3E%3C/svg%3E") 3 12, pointer !important;
}

/* ==========================================================================
   Panel Themes
   ========================================================================== */

/* --- Theme: Minimal --- */
.wwas-toolbar[data-theme="minimal"] .wwas-fab {
	background: transparent;
	border: 2px solid var(--wwas-accent, #1a1a2e);
	color: var(--wwas-accent, #1a1a2e);
	box-shadow: none;
}

.wwas-toolbar[data-theme="minimal"] .wwas-fab:hover,
.wwas-toolbar[data-theme="minimal"] .wwas-fab:focus-visible {
	background: var(--wwas-accent, #1a1a2e);
	color: var(--wwas-text, #fff);
}

.wwas-toolbar[data-theme="minimal"] .wwas-panel {
	box-shadow: none;
	border: 1px solid var(--wwas-accent, #1a1a2e);
}

.wwas-toolbar[data-theme="minimal"] .wwas-panel__head {
	background: var(--wwas-accent, #1a1a2e);
}

/* --- Theme: Glass --- */
.wwas-toolbar[data-theme="glass"] .wwas-fab {
	background: rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.45);
	color: var(--wwas-accent, #1a1a2e);
	box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

.wwas-toolbar[data-theme="glass"] .wwas-fab:hover,
.wwas-toolbar[data-theme="glass"] .wwas-fab:focus-visible {
	background: rgba(255, 255, 255, 0.35);
	outline: 3px solid #005fcc;
	outline-offset: 3px;
}

.wwas-toolbar[data-theme="glass"] .wwas-panel {
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	border: 1px solid rgba(255, 255, 255, 0.5);
	box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
}

.wwas-toolbar[data-theme="glass"] .wwas-panel__head {
	background: rgba(var(--wwas-accent-rgb, 26, 26, 46), 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

/* --- Theme: Dark --- */
.wwas-toolbar[data-theme="dark"] .wwas-panel {
	background: #1e1e2e;
	color: #e0e0e0;
	border-color: #2d2d4e;
}

.wwas-toolbar[data-theme="dark"] .wwas-panel__title {
	color: #ffffff;
}

.wwas-toolbar[data-theme="dark"] .wwas-panel__close {
	color: #e0e0e0;
}

.wwas-toolbar[data-theme="dark"] .wwas-panel__close:hover {
	background: rgba(255,255,255,.12);
}

.wwas-toolbar[data-theme="dark"] .wwas-tool-btn {
	background: rgba(255, 255, 255, .07);
	border-color: rgba(255, 255, 255, .14);
	color: #d0d0d0;
}

.wwas-toolbar[data-theme="dark"] .wwas-tool-btn:hover {
	background: rgba(255, 255, 255, .14);
	border-color: rgba(255, 255, 255, .28);
	color: #ffffff;
}

.wwas-toolbar[data-theme="dark"] .wwas-tool-btn[aria-pressed="true"] {
	background: var(--wwas-active-bg, rgba(200, 154, 46, .25));
	border-color: var(--wwas-active, #c89a2e);
	color: var(--wwas-active, #c89a2e);
}

.wwas-toolbar[data-theme="dark"] .wwas-panel__foot {
	border-top-color: rgba(255, 255, 255, .1);
}

.wwas-toolbar[data-theme="dark"] .wwas-reset-btn {
	color: #888;
}

.wwas-toolbar[data-theme="dark"] .wwas-reset-btn:hover {
	color: #bbb;
}

.wwas-toolbar[data-theme="dark"] .wwas-statement-link {
	color: #888;
}

.wwas-toolbar[data-theme="dark"] .wwas-statement-link:hover {
	color: #bbb;
}

/* --- Theme: Bubble (round, playful) --- */
.wwas-toolbar[data-theme="bubble"] .wwas-fab {
	border-radius: 999px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

.wwas-toolbar[data-theme="bubble"] .wwas-panel {
	border-radius: 24px;
}

.wwas-toolbar[data-theme="bubble"] .wwas-panel__head {
	border-radius: 0;
}

.wwas-toolbar[data-theme="bubble"] .wwas-tool-btn {
	border-radius: 12px;
}

/* ==========================================================================
   FAB vertical position: middle (centered on viewport edge)
   ========================================================================== */

.wwas-toolbar[data-fab-pos-v="middle"] {
	bottom: auto;
	top: 50%;
	transform: translateY(-50%);
}

.wwas-toolbar[data-fab-pos-v="middle"] .wwas-panel {
	bottom: auto;
	top: 50%;
	transform: translateY(-50%) scale(.95);
	transform-origin: right center;
}

.wwas-toolbar[data-fab-pos-v="middle"][data-position="left"] .wwas-panel {
	transform-origin: left center;
}

.wwas-toolbar[data-fab-pos-v="middle"] .wwas-panel:not([hidden]) {
	transform: translateY(-50%) scale(1);
}

.wwas-toolbar[data-fab-pos-v="middle"] .wwas-panel[hidden] {
	transform: translateY(-50%) scale(.95);
}

/* ==========================================================================
   Mobile: full-width bottom sheet panel
   ========================================================================== */

@media (max-width: 639px) {
	/* Toolbar nimmt volle Breite ein — kein eigenes Platz-Budget */
	.wwas-toolbar {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		height: 0;
		pointer-events: none;
	}

	/* FAB bleibt in der Ecke */
	.wwas-toolbar .wwas-fab {
		pointer-events: auto;
		position: absolute;
		bottom: 20px;
		right: 20px;
	}

	.wwas-toolbar[data-position="left"] .wwas-fab {
		right: auto;
		left: 20px;
	}

	/* Panel wird zum Full-Width Bottom Sheet */
	.wwas-panel,
	.wwas-panel[hidden] {
		position: absolute !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		top: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		/* Strikt auf max. 75% Bildschirmhöhe begrenzen */
		max-height: 75svh !important;
		max-height: 75dvh !important;
		height: auto !important;
		border-radius: 20px 20px 0 0 !important;
		/* Flex-Layout: Header/Footer fixiert, Grid scrollt */
		display: flex !important;
		flex-direction: column !important;
		overflow: hidden !important;
		transform-origin: bottom center;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, .2) !important;
		box-sizing: border-box !important;
	}

	.wwas-panel:not([hidden]) {
		pointer-events: auto;
		opacity: 1 !important;
		transform: scale(1) !important;
	}

	.wwas-panel[hidden] {
		opacity: 0 !important;
		transform: scale(.97) !important;
	}

	/* Header und Footer bleiben fest */
	.wwas-panel__head,
	.wwas-panel__foot {
		flex-shrink: 0 !important;
	}

	/* Grid scrollt innerhalb des Panels */
	.wwas-panel__grid {
		flex: 1 1 auto !important;
		min-height: 0 !important; /* Entscheidend: erlaubt Flex-Child zu schrumpfen */
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
		grid-template-columns: repeat(3, 1fr) !important;
		padding: 10px !important;
	}
}
