/* ============================================================================
 * Ephesus Multi-Language — frontend stylesheet.
 *
 * Mirrors the EGW Diaspora design system:
 *   • Cream + navy + gold palette tokens (consumed from the theme's :root)
 *   • Layered 3D shadows (ambient + contact)
 *   • 38×38 header buttons with 22px icons
 *   • Cream-background-text-must-be-black rule (via .on-cream)
 *   • Press / lift microinteractions
 *   • Dark mode parity
 *   • Mobile-first responsiveness with 44×44 tap targets on touch devices
 * ==========================================================================*/

:root {
	--egw-ml-radius:        12px;
	--egw-ml-radius-sm:     8px;
	--egw-ml-radius-pill:   9999px;
	--egw-ml-navy:          #0A2240;
	--egw-ml-navy-soft:     #122d52;
	--egw-ml-cream:         #FFF1D3;
	--egw-ml-cream-deep:    #FFE7B0;
	--egw-ml-gold:          #C9A14A;
	--egw-ml-text:          #1a1a1a;
	--egw-ml-text-muted:    #6c6c70;
	--egw-ml-border:        rgba(10, 34, 64, .14);
	--egw-ml-elev-card:     0 1px 2px rgba(10, 34, 64, .08), 0 6px 18px -6px rgba(10, 34, 64, .18);
	--egw-ml-elev-pop:      0 2px 4px rgba(10, 34, 64, .10), 0 18px 40px -10px rgba(10, 34, 64, .28);
	--egw-ml-trans:         180ms cubic-bezier(.2,.65,.25,1);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--egw-ml-text:        #f5f1e6;
		--egw-ml-text-muted:  #a9a59a;
		--egw-ml-border:      rgba(255, 241, 211, .14);
		--egw-ml-elev-card:   0 1px 2px rgba(0,0,0,.45), 0 6px 18px -6px rgba(0,0,0,.6);
		--egw-ml-elev-pop:    0 2px 6px rgba(0,0,0,.55), 0 18px 40px -10px rgba(0,0,0,.7);
	}
}

[data-theme="dark"] {
	--egw-ml-text:        #f5f1e6;
	--egw-ml-text-muted:  #a9a59a;
	--egw-ml-border:      rgba(255, 241, 211, .14);
	--egw-ml-elev-card:   0 1px 2px rgba(0,0,0,.45), 0 6px 18px -6px rgba(0,0,0,.6);
	--egw-ml-elev-pop:    0 2px 6px rgba(0,0,0,.55), 0 18px 40px -10px rgba(0,0,0,.7);
}

/* ─────────────── Header button ─────────────── */

.egw-ml-header {
	position: relative;
	display: inline-flex;
}

.egw-ml-header__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 38px;
	height: 38px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--egw-ml-border);
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	box-shadow: var(--egw-ml-elev-card);
	transition: transform var(--egw-ml-trans), box-shadow var(--egw-ml-trans), background-color var(--egw-ml-trans);
}

.egw-ml-header__btn svg { width: 22px; height: 22px; }

.egw-ml-header__code {
	display: none;          /* hidden by default; only shown when wider */
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	margin-left: 2px;
}

.egw-ml-header__btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--egw-ml-elev-pop);
	background: rgba(10, 34, 64, .04);
}

.egw-ml-header__btn:active { transform: translateY(0); }
.egw-ml-header__btn:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: 2px;
}

[data-theme="dark"] .egw-ml-header__btn:hover { background: rgba(255, 241, 211, .06); }

/* ─────────────── Dropdown ─────────────── */

.egw-ml-dropdown {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	min-width: 240px;
	max-width: 280px;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--egw-ml-border);
	border-radius: var(--egw-ml-radius);
	box-shadow: var(--egw-ml-elev-pop);
	opacity: 0;
	transform: translateY(-4px) scale(.985);
	transform-origin: top right;
	transition: opacity var(--egw-ml-trans), transform var(--egw-ml-trans);
	z-index: 1000;
	pointer-events: none;
}

.egw-ml-dropdown.is-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

[data-theme="dark"] .egw-ml-dropdown {
	background: #1a1f2c;
	color: var(--egw-ml-text);
}

.egw-ml-dropdown__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: var(--egw-ml-radius-sm);
	color: inherit;
	text-decoration: none;
	transition: background-color 120ms ease, transform 120ms ease;
	cursor: pointer;
}

.egw-ml-dropdown__item:hover {
	background: rgba(10, 34, 64, .06);
	transform: translateX(2px);
}

[data-theme="dark"] .egw-ml-dropdown__item:hover { background: rgba(255, 241, 211, .06); }

.egw-ml-dropdown__item.is-current {
	background: var(--egw-ml-cream);
	color: #000;       /* cream-bg-black-text rule */
}

.egw-ml-dropdown__item.is-current * { color: #000; }

.egw-ml-dropdown__flag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	width: 22px;
	flex-shrink: 0;
}

.egw-ml-dropdown__labels {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.egw-ml-dropdown__native {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
}

.egw-ml-dropdown__english {
	font-size: 11px;
	color: var(--egw-ml-text-muted);
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.2;
	margin-top: 2px;
}

.egw-ml-dropdown__item.is-current .egw-ml-dropdown__english { color: rgba(0,0,0,.65); }

.egw-ml-dropdown__check {
	margin-left: auto;
	display: inline-flex;
	color: var(--egw-ml-navy);
}

.egw-ml-dropdown__item.is-current .egw-ml-dropdown__check { color: #000; }

/* ─────────────── Footer pill row ─────────────── */

.egw-ml-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	flex-wrap: wrap;
	padding: 14px 20px 22px;
	color: rgba(255,255,255,.8);
	font-size: 13px;
}

.egw-ml-footer__label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	font-size: 11px;
	opacity: .85;
}

.egw-ml-footer__icon { width: 16px; height: 16px; }

.egw-ml-footer__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.egw-ml-footer__pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	background: rgba(255, 255, 255, .08);
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: var(--egw-ml-radius-pill);
	color: rgba(255, 255, 255, .9);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition: transform var(--egw-ml-trans), background-color var(--egw-ml-trans), box-shadow var(--egw-ml-trans);
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.egw-ml-footer__pill:hover {
	background: rgba(255, 255, 255, .14);
	transform: translateY(-1px);
	box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

.egw-ml-footer__pill:active { transform: translateY(0); }

.egw-ml-footer__pill.is-current {
	background: var(--egw-ml-cream);
	color: #000;       /* cream-bg-black-text rule */
	border-color: var(--egw-ml-cream-deep);
	box-shadow: 0 2px 8px rgba(201, 161, 74, .35);
}

.egw-ml-footer__pill.is-current * { color: #000; }
.egw-ml-footer__pill:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: 2px;
}

/* ─────────────── Mobile nav block ─────────────── */

.egw-ml-mnav__icon { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.egw-ml-mnav__sub a {
	display: flex;
	align-items: center;
	gap: 10px;
}
.egw-ml-mnav__sub a.is-current { color: var(--egw-ml-gold); font-weight: 600; }
.egw-ml-mnav__check { margin-left: auto; }

/* ─────────────── Touch-target compliance ─────────────── */

@media (pointer: coarse) {
	.egw-ml-header__btn { width: 44px; height: 44px; }
	.egw-ml-footer__pill { padding: 10px 16px; min-height: 44px; }
	.egw-ml-dropdown__item { min-height: 44px; }
}

/* ─────────────── Reduced motion ─────────────── */

@media (prefers-reduced-motion: reduce) {
	.egw-ml-header__btn,
	.egw-ml-footer__pill,
	.egw-ml-dropdown,
	.egw-ml-dropdown__item { transition: none; }
}

/* ─────────────── v1.1.0: search, keyboard focus, auto-badge, overlay ─────────────── */

/* Dropdown structure now has optional search + scrollable list */
.egw-ml-dropdown {
	max-height: min(70vh, 440px);
	display: flex;
	flex-direction: column;
}

.egw-ml-dropdown__search {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px 10px;
	border-bottom: 1px solid var(--egw-ml-border);
	margin-bottom: 4px;
}

.egw-ml-dropdown__searchicon {
	flex-shrink: 0;
	color: var(--egw-ml-text-muted);
}

.egw-ml-dropdown__searchinput {
	flex: 1;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 13px;
	color: inherit;
	outline: none;
	padding: 4px 2px;
}

.egw-ml-dropdown__searchinput::placeholder {
	color: var(--egw-ml-text-muted);
}

.egw-ml-dropdown__list {
	overflow-y: auto;
	overscroll-behavior: contain;
	flex: 1;
}

/* Keyboard-focused item visually distinct from hover */
.egw-ml-dropdown__item.is-focused,
.egw-ml-dropdown__item:focus-visible {
	background: rgba(10, 34, 64, .08);
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: -2px;
}
[data-theme="dark"] .egw-ml-dropdown__item.is-focused,
[data-theme="dark"] .egw-ml-dropdown__item:focus-visible {
	background: rgba(255, 241, 211, .09);
}

.egw-ml-dropdown__empty {
	padding: 16px;
	text-align: center;
	color: var(--egw-ml-text-muted);
	font-size: 12.5px;
}

/* Auto-detected badge */
.egw-ml-header__autobadge,
.egw-ml-footer__autobadge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 2px 6px;
	margin-left: 4px;
	border-radius: 999px;
	background: var(--egw-ml-gold);
	color: #000;
	box-shadow: 0 1px 2px rgba(0,0,0,.25);
}

.egw-ml-header__autobadge {
	position: absolute;
	top: -4px;
	right: -6px;
	margin-left: 0;
}

.egw-ml-header { position: relative; }

/* Language-switching fullscreen overlay */
.egw-ml-switching-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 34, 64, .35);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 180ms ease;
}
.egw-ml-switching-overlay.is-shown { opacity: 1; }

.egw-ml-switching-overlay__card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 22px;
	background: #fff;
	border-radius: var(--egw-ml-radius);
	box-shadow: var(--egw-ml-elev-pop);
	min-width: 240px;
	max-width: 90vw;
}
[data-theme="dark"] .egw-ml-switching-overlay__card {
	background: #1a1f2c;
	color: var(--egw-ml-text);
}

.egw-ml-switching-overlay__spinner {
	width: 22px;
	height: 22px;
	border: 2.5px solid var(--egw-ml-border);
	border-top-color: var(--egw-ml-navy);
	border-radius: 50%;
	animation: egw-ml-spin 0.8s linear infinite;
	flex-shrink: 0;
}
[data-theme="dark"] .egw-ml-switching-overlay__spinner {
	border-top-color: var(--egw-ml-gold);
}

.egw-ml-switching-overlay__text {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
}

.egw-ml-switching-overlay__flag { font-size: 18px; }

@keyframes egw-ml-spin { to { transform: rotate(360deg); } }

/* Transition shim for Google Translate — avoids a harsh "flash" when the
 * widget rewrites the DOM. Fade text slightly while translating. */
.translated-ltr .site-main,
.translated-rtl .site-main {
	animation: egw-ml-translate-fade .4s ease;
}
@keyframes egw-ml-translate-fade {
	from { opacity: .4; }
	to   { opacity: 1;  }
}

/* Keep ONLY developer-marked elements and technical code out of translation.
 * Brand/logo elements are left translatable by default so Dennis's rule
 * "every text and information on the site should be translatable" holds. A
 * site author can still opt-out any element by adding class="notranslate". */
.notranslate, code, pre, kbd, samp { direction: ltr; }

/* ─────────────── Modal popup (v1.1.1) ─────────────── */

html.egw-ml-modal-open {
	overflow: hidden;
}

.egw-ml-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;           /* above everything, including theme stickies */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 220ms cubic-bezier(.2,.65,.25,1);
}

.egw-ml-modal[hidden] { display: none; }

.egw-ml-modal.is-open {
	opacity: 1;
	pointer-events: auto;
}

.egw-ml-modal__backdrop {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 40%, rgba(10, 34, 64, .55), rgba(10, 34, 64, .82) 70%);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	backdrop-filter: blur(10px) saturate(140%);
	cursor: pointer;
}

.egw-ml-modal__card {
	position: relative;
	width: min(560px, 100%);
	max-height: min(86vh, 720px);
	display: flex;
	flex-direction: column;
	padding: 22px 22px 18px;
	background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
	border: 1px solid var(--egw-ml-border);
	border-radius: 20px;
	box-shadow:
		0 1px 2px rgba(10, 34, 64, .12),
		0 12px 32px -12px rgba(10, 34, 64, .35),
		0 40px 80px -20px rgba(10, 34, 64, .5);
	transform: translateY(12px) scale(.97);
	transition: transform 260ms cubic-bezier(.2,.75,.25,1);
}

.egw-ml-modal.is-open .egw-ml-modal__card { transform: translateY(0) scale(1); }

[data-theme="dark"] .egw-ml-modal__card {
	background: linear-gradient(180deg, #1a1f2c 0%, #121725 100%);
	color: var(--egw-ml-text);
	border-color: rgba(255, 241, 211, .12);
	box-shadow:
		0 1px 2px rgba(0,0,0,.5),
		0 12px 32px -12px rgba(0,0,0,.7),
		0 40px 80px -20px rgba(0,0,0,.8);
}

.egw-ml-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.egw-ml-modal__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--egw-ml-navy);
}

[data-theme="dark"] .egw-ml-modal__title { color: var(--egw-ml-cream); }

.egw-ml-modal__titleicon {
	width: 22px;
	height: 22px;
	color: var(--egw-ml-gold);
}

.egw-ml-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--egw-ml-border);
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(10, 34, 64, .08);
	transition: transform var(--egw-ml-trans), background-color var(--egw-ml-trans), box-shadow var(--egw-ml-trans);
}
.egw-ml-modal__close:hover {
	background: rgba(10, 34, 64, .06);
	transform: rotate(90deg);
	box-shadow: 0 2px 6px rgba(10, 34, 64, .18);
}
[data-theme="dark"] .egw-ml-modal__close:hover { background: rgba(255, 241, 211, .08); }
.egw-ml-modal__close:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: 2px;
}

.egw-ml-modal__subtitle {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--egw-ml-text-muted);
}

.egw-ml-modal__searchwrap {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	margin-bottom: 10px;
	background: rgba(10, 34, 64, .04);
	border: 1px solid var(--egw-ml-border);
	border-radius: 12px;
	transition: box-shadow var(--egw-ml-trans), border-color var(--egw-ml-trans), background-color var(--egw-ml-trans);
}

.egw-ml-modal__searchwrap:focus-within {
	background: #fff;
	border-color: var(--egw-ml-gold);
	box-shadow: 0 0 0 3px rgba(201, 161, 74, .22);
}

[data-theme="dark"] .egw-ml-modal__searchwrap { background: rgba(255, 241, 211, .04); }
[data-theme="dark"] .egw-ml-modal__searchwrap:focus-within { background: rgba(255, 241, 211, .08); }

.egw-ml-modal__searchicon {
	flex-shrink: 0;
	color: var(--egw-ml-text-muted);
}

.egw-ml-modal__search {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: inherit;
	outline: none;
	padding: 2px 0;
}

.egw-ml-modal__search::placeholder { color: var(--egw-ml-text-muted); }

.egw-ml-modal__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 2px;
	margin: 0 -2px;
	flex: 1 1 auto;
	min-height: 0;
}

.egw-ml-modal__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--egw-ml-border);
	border-radius: 12px;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(10, 34, 64, .06);
	transition:
		transform var(--egw-ml-trans),
		box-shadow var(--egw-ml-trans),
		border-color var(--egw-ml-trans),
		background-color var(--egw-ml-trans);
	position: relative;
}

[data-theme="dark"] .egw-ml-modal__item {
	background: rgba(255, 241, 211, .03);
}

.egw-ml-modal__item:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px -6px rgba(10, 34, 64, .24);
	border-color: rgba(10, 34, 64, .24);
}

[data-theme="dark"] .egw-ml-modal__item:hover {
	background: rgba(255, 241, 211, .07);
	border-color: rgba(255, 241, 211, .25);
}

.egw-ml-modal__item.is-focused,
.egw-ml-modal__item:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: -2px;
	border-color: var(--egw-ml-gold);
	box-shadow: 0 6px 18px -6px rgba(10, 34, 64, .24);
}

.egw-ml-modal__item.is-current {
	background: var(--egw-ml-cream);
	border-color: var(--egw-ml-cream-deep);
	color: #000;
	box-shadow: 0 2px 10px rgba(201, 161, 74, .32);
}
.egw-ml-modal__item.is-current * { color: #000; }

.egw-ml-modal__flag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	width: 32px;
	flex-shrink: 0;
}

.egw-ml-modal__labels {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.egw-ml-modal__native {
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.egw-ml-modal__english {
	font-size: 11px;
	color: var(--egw-ml-text-muted);
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.25;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.egw-ml-modal__item.is-current .egw-ml-modal__english { color: rgba(0,0,0,.7); }

.egw-ml-modal__check {
	margin-left: auto;
	display: inline-flex;
	color: var(--egw-ml-navy);
	flex-shrink: 0;
}

.egw-ml-modal__item.is-current .egw-ml-modal__check { color: #000; }

.egw-ml-modal__empty {
	padding: 28px 16px;
	text-align: center;
	color: var(--egw-ml-text-muted);
	font-size: 13px;
	font-style: italic;
}

.egw-ml-modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-top: 14px;
	margin-top: 10px;
	border-top: 1px solid var(--egw-ml-border);
	font-size: 11.5px;
	color: var(--egw-ml-text-muted);
	letter-spacing: .02em;
	flex-wrap: wrap;
}

.egw-ml-modal__meta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.egw-ml-modal__metaflag { font-size: 16px; }

.egw-ml-modal__meta strong {
	color: var(--egw-ml-navy);
	font-weight: 700;
}

[data-theme="dark"] .egw-ml-modal__meta strong { color: var(--egw-ml-cream); }

.egw-ml-modal__powered {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: .08em;
	opacity: .8;
}

/* ─────────────── Footer "Change language" button ─────────────── */

.egw-ml-footer__open {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	background: transparent;
	border: 1px dashed rgba(255, 255, 255, .28);
	border-radius: var(--egw-ml-radius-pill);
	color: rgba(255, 255, 255, .78);
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: border-color var(--egw-ml-trans), color var(--egw-ml-trans), background-color var(--egw-ml-trans);
}

.egw-ml-footer__open:hover {
	color: #fff;
	background: rgba(255, 255, 255, .08);
	border-color: rgba(255, 255, 255, .4);
}

.egw-ml-footer__open:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: 2px;
}

/* ─────────────── Mobile nav button ─────────────── */

.egw-ml-mnav__open {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 12px 14px;
	background: transparent;
	border: 0;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
	border-radius: 10px;
	transition: background-color var(--egw-ml-trans);
}

.egw-ml-mnav__open:hover { background: rgba(10, 34, 64, .06); }
[data-theme="dark"] .egw-ml-mnav__open:hover { background: rgba(255, 241, 211, .06); }

.egw-ml-mnav__open:focus-visible {
	outline: 2px solid var(--egw-ml-gold);
	outline-offset: -2px;
}

.egw-ml-mnav__current {
	margin-left: auto;
	font-size: 12px;
	font-weight: 600;
	color: var(--egw-ml-gold);
}

/* ─────────────── Responsive ─────────────── */

@media (max-width: 480px) {
	.egw-ml-footer { padding: 12px 14px 18px; gap: 10px; }
	.egw-ml-footer__label { font-size: 10px; }
	.egw-ml-dropdown { right: -8px; min-width: 220px; max-width: 92vw; }
	.egw-ml-switching-overlay__card { padding: 14px 16px; min-width: 0; }

	.egw-ml-modal { padding: 16px; }
	.egw-ml-modal__card {
		padding: 18px 16px 14px;
		border-radius: 16px;
	}
	.egw-ml-modal__title { font-size: 16px; }
	.egw-ml-modal__grid { grid-template-columns: 1fr; }
	.egw-ml-modal__flag { font-size: 22px; width: 26px; }
	.egw-ml-modal__native { font-size: 14px; }
	.egw-ml-modal__footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (pointer: coarse) {
	.egw-ml-modal__item { min-height: 56px; padding: 14px; }
	.egw-ml-modal__close { width: 44px; height: 44px; }
	.egw-ml-mnav__open { min-height: 44px; }
	.egw-ml-footer__open { min-height: 44px; padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.egw-ml-switching-overlay__spinner { animation: none; }
	.translated-ltr .site-main,
	.translated-rtl .site-main { animation: none; }
	.egw-ml-modal,
	.egw-ml-modal__card,
	.egw-ml-modal__item,
	.egw-ml-modal__close { transition: none; }
}

/* ============================================================================
 * v1.2.3 — Admin-only empty-lexicon fallback banner.
 * Only rendered when window.egwToast is missing AND the visitor is a logged-in
 * admin viewing a language with zero stored translations. Invisible to all
 * other visitors. Navy pill, top-right, auto-dismisses after 14s.
 * ==========================================================================*/
.egw-ml-admin-notice {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	max-width: 420px;
	background: linear-gradient(135deg, var(--egw-ml-navy) 0%, var(--egw-ml-navy-soft) 100%);
	color: #FFF1D3;
	border-radius: 14px;
	box-shadow:
		0 1px 2px rgba(10, 34, 64, .18),
		0 18px 40px -8px rgba(10, 34, 64, .45);
	font-size: 13px;
	line-height: 1.5;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity var(--egw-ml-trans), transform var(--egw-ml-trans);
	pointer-events: auto;
}
.egw-ml-admin-notice.is-shown {
	opacity: 1;
	transform: translateY(0);
}
.egw-ml-admin-notice.is-dismissed {
	opacity: 0;
	transform: translateY(-6px);
}
.egw-ml-admin-notice__dot {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 9999px;
	background: var(--egw-ml-gold);
	box-shadow: 0 0 0 3px rgba(201, 161, 74, .22);
	animation: egw-ml-admin-notice-pulse 1.8s ease-in-out infinite;
}
@keyframes egw-ml-admin-notice-pulse {
	0%, 100% { box-shadow: 0 0 0 3px rgba(201, 161, 74, .22); }
	50%      { box-shadow: 0 0 0 6px rgba(201, 161, 74, 0); }
}
.egw-ml-admin-notice__text {
	flex: 1 1 auto;
	min-width: 0;
}
.egw-ml-admin-notice__cta {
	flex: 0 0 auto;
	color: var(--egw-ml-gold);
	font-weight: 600;
	text-decoration: none;
	padding: 6px 10px;
	border-radius: 8px;
	transition: background var(--egw-ml-trans), color var(--egw-ml-trans);
	white-space: nowrap;
}
.egw-ml-admin-notice__cta:hover,
.egw-ml-admin-notice__cta:focus-visible {
	background: rgba(201, 161, 74, .16);
	color: #FFF1D3;
	outline: none;
}
.egw-ml-admin-notice__close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	border: 0;
	background: rgba(255, 241, 211, .10);
	color: inherit;
	border-radius: 8px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--egw-ml-trans);
}
.egw-ml-admin-notice__close:hover,
.egw-ml-admin-notice__close:focus-visible {
	background: rgba(255, 241, 211, .22);
	outline: none;
}
@media (max-width: 540px) {
	.egw-ml-admin-notice {
		top: auto;
		bottom: 16px;
		left: 12px;
		right: 12px;
		max-width: none;
	}
}
@media (prefers-reduced-motion: reduce) {
	.egw-ml-admin-notice {
		transition: none;
	}
	.egw-ml-admin-notice__dot {
		animation: none;
	}
}

/* ============================================================================
 * Header dropdown (v1.2.6) — compact anchored language picker that replaces
 * the center-screen modal when the globe icon in the site header is clicked.
 *
 * Positioned by JS (fixed, top/left set in JS::positionDropdown). The panel
 * follows the EGW 15-rule design system:
 *   • Cream surface with mandatory #000 text (rule #3)
 *   • Layered 3D shadow via --egw-ml-elev-pop (rule #1)
 *   • 44×44 tap targets on coarse pointers (rule #8)
 *   • One distinct current-language check (rule #10)
 *   • prefers-reduced-motion respected (rule #9)
 *   • Dark-mode parity
 * ==========================================================================*/

.egw-ml-dropdown {
	position: fixed;
	z-index: 99999;
	min-width: 260px;
	max-width: min(320px, calc(100vw - 24px));
	max-height: min(480px, calc(100vh - 120px));
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: var(--egw-ml-cream);
	color: #000;
	border: 1px solid rgba(10, 34, 64, .22);
	border-radius: var(--egw-ml-radius);
	box-shadow: var(--egw-ml-elev-pop);
	opacity: 0;
	transform: translateY(-6px) scale(.98);
	transform-origin: top right;
	transition:
		opacity var(--egw-ml-trans),
		transform var(--egw-ml-trans);
	pointer-events: none;
}

.egw-ml-dropdown[hidden] { display: none; }

.egw-ml-dropdown.is-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Cream-background-text-must-be-black enforcement (project rule #3) */
.egw-ml-dropdown,
.egw-ml-dropdown * {
	color: #000;
}

.egw-ml-dropdown__header {
	padding: 12px 14px 8px;
	border-bottom: 1px solid rgba(10, 34, 64, .12);
}

.egw-ml-dropdown__title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .01em;
	color: var(--egw-ml-navy) !important;
}

.egw-ml-dropdown__titleicon {
	width: 16px;
	height: 16px;
	color: var(--egw-ml-navy);
}

.egw-ml-dropdown__searchwrap {
	position: relative;
	padding: 10px 14px;
	border-bottom: 1px solid rgba(10, 34, 64, .10);
}

.egw-ml-dropdown__searchicon {
	position: absolute;
	left: 24px;
	top: 50%;
	transform: translateY(-50%);
	color: rgba(0, 0, 0, .55);
	pointer-events: none;
}

.egw-ml-dropdown__search {
	display: block;
	width: 100%;
	padding: 9px 12px 9px 36px;
	background: #fff;
	border: 1px solid rgba(10, 34, 64, .18);
	border-radius: var(--egw-ml-radius-sm);
	font-size: 13px;
	color: #000 !important;
	transition: border-color var(--egw-ml-trans), box-shadow var(--egw-ml-trans);
}

.egw-ml-dropdown__search:focus {
	outline: none;
	border-color: var(--egw-ml-navy);
	box-shadow: 0 0 0 3px rgba(10, 34, 64, .18);
}

.egw-ml-dropdown__list {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 6px;
	scrollbar-width: thin;
}

.egw-ml-dropdown__list::-webkit-scrollbar { width: 8px; }
.egw-ml-dropdown__list::-webkit-scrollbar-thumb {
	background: rgba(10, 34, 64, .25);
	border-radius: 4px;
}

.egw-ml-dropdown__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	margin: 2px 0;
	border-radius: var(--egw-ml-radius-sm);
	text-decoration: none;
	color: #000 !important;
	cursor: pointer;
	transition: background-color var(--egw-ml-trans), transform var(--egw-ml-trans);
	min-height: 40px;
}

.egw-ml-dropdown__item:hover,
.egw-ml-dropdown__item:focus,
.egw-ml-dropdown__item.is-focused {
	background: rgba(10, 34, 64, .08);
	outline: none;
}

.egw-ml-dropdown__item:active {
	transform: scale(.98);
}

.egw-ml-dropdown__item.is-current {
	background: rgba(201, 161, 74, .18);
	font-weight: 600;
}

.egw-ml-dropdown__item.is-current:hover,
.egw-ml-dropdown__item.is-current:focus {
	background: rgba(201, 161, 74, .28);
}

.egw-ml-dropdown__flag {
	flex: 0 0 auto;
	font-size: 20px;
	line-height: 1;
	width: 24px;
	text-align: center;
}

.egw-ml-dropdown__flag svg { display: inline-block; vertical-align: middle; }

.egw-ml-dropdown__labels {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.egw-ml-dropdown__native {
	font-size: 14px;
	line-height: 1.2;
	font-weight: 600;
	color: #000 !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.egw-ml-dropdown__english {
	font-size: 11px;
	line-height: 1.2;
	color: rgba(0, 0, 0, .62) !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.egw-ml-dropdown__check {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--egw-ml-navy) !important;
}

.egw-ml-dropdown__check svg { width: 16px; height: 16px; }

.egw-ml-dropdown__empty {
	padding: 18px 14px 22px;
	text-align: center;
	font-size: 13px;
	color: rgba(0, 0, 0, .55) !important;
}

/* Dark mode — navy surface, cream text (project rule still requires #000 on
 * *cream* surfaces, but this is navy, so cream text is legal). */
[data-theme="dark"] .egw-ml-dropdown,
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .egw-ml-dropdown {
		background: #0E2645;
		border-color: rgba(255, 241, 211, .14);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown,
	:root:not([data-theme="light"]) .egw-ml-dropdown * {
		color: var(--egw-ml-cream);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__title {
		color: var(--egw-ml-cream) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__titleicon {
		color: var(--egw-ml-cream);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__header,
	:root:not([data-theme="light"]) .egw-ml-dropdown__searchwrap {
		border-color: rgba(255, 241, 211, .14);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__search {
		background: #1a3156;
		border-color: rgba(255, 241, 211, .22);
		color: var(--egw-ml-cream) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__search:focus {
		border-color: var(--egw-ml-cream);
		box-shadow: 0 0 0 3px rgba(255, 241, 211, .18);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__searchicon {
		color: rgba(255, 241, 211, .55);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__native {
		color: var(--egw-ml-cream) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__english {
		color: rgba(255, 241, 211, .65) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__item {
		color: var(--egw-ml-cream) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__item:hover,
	:root:not([data-theme="light"]) .egw-ml-dropdown__item:focus,
	:root:not([data-theme="light"]) .egw-ml-dropdown__item.is-focused {
		background: rgba(255, 241, 211, .10);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__item.is-current {
		background: rgba(201, 161, 74, .24);
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__check {
		color: var(--egw-ml-cream) !important;
	}
	:root:not([data-theme="light"]) .egw-ml-dropdown__empty {
		color: rgba(255, 241, 211, .55) !important;
	}
}

[data-theme="dark"] .egw-ml-dropdown {
	background: #0E2645;
	border-color: rgba(255, 241, 211, .14);
}
[data-theme="dark"] .egw-ml-dropdown,
[data-theme="dark"] .egw-ml-dropdown * {
	color: var(--egw-ml-cream);
}
[data-theme="dark"] .egw-ml-dropdown__title,
[data-theme="dark"] .egw-ml-dropdown__titleicon {
	color: var(--egw-ml-cream) !important;
}
[data-theme="dark"] .egw-ml-dropdown__header,
[data-theme="dark"] .egw-ml-dropdown__searchwrap {
	border-color: rgba(255, 241, 211, .14);
}
[data-theme="dark"] .egw-ml-dropdown__search {
	background: #1a3156;
	border-color: rgba(255, 241, 211, .22);
	color: var(--egw-ml-cream) !important;
}
[data-theme="dark"] .egw-ml-dropdown__search:focus {
	border-color: var(--egw-ml-cream);
	box-shadow: 0 0 0 3px rgba(255, 241, 211, .18);
}
[data-theme="dark"] .egw-ml-dropdown__searchicon {
	color: rgba(255, 241, 211, .55);
}
[data-theme="dark"] .egw-ml-dropdown__native {
	color: var(--egw-ml-cream) !important;
}
[data-theme="dark"] .egw-ml-dropdown__english {
	color: rgba(255, 241, 211, .65) !important;
}
[data-theme="dark"] .egw-ml-dropdown__item {
	color: var(--egw-ml-cream) !important;
}
[data-theme="dark"] .egw-ml-dropdown__item:hover,
[data-theme="dark"] .egw-ml-dropdown__item:focus,
[data-theme="dark"] .egw-ml-dropdown__item.is-focused {
	background: rgba(255, 241, 211, .10);
}
[data-theme="dark"] .egw-ml-dropdown__item.is-current {
	background: rgba(201, 161, 74, .24);
}
[data-theme="dark"] .egw-ml-dropdown__check {
	color: var(--egw-ml-cream) !important;
}
[data-theme="dark"] .egw-ml-dropdown__empty {
	color: rgba(255, 241, 211, .55) !important;
}

/* 44×44 tap targets on coarse pointers (project rule #8). */
@media (pointer: coarse) {
	.egw-ml-dropdown__item {
		min-height: 44px;
		padding: 11px 12px;
	}
	.egw-ml-dropdown__search {
		min-height: 44px;
	}
	.egw-ml-dropdown {
		min-width: 280px;
	}
}

/* Small screens: pin to right edge with safe margins. */
@media (max-width: 480px) {
	.egw-ml-dropdown {
		min-width: 0;
		left: 12px !important;
		right: 12px;
		max-width: calc(100vw - 24px);
	}
}

/* Reduced motion — instant show/hide, no transforms. */
@media (prefers-reduced-motion: reduce) {
	.egw-ml-dropdown {
		transition: none;
		transform: none;
	}
	.egw-ml-dropdown.is-open {
		transform: none;
	}
	.egw-ml-dropdown__item {
		transition: none;
	}
	.egw-ml-dropdown__item:active {
		transform: none;
	}
}
