/* Modest View – front-end styles */

/* ---------- Anti-flash: hide targeted images until JS is ready ---------- */
html.kv-hide-all:not(.kv-ready) img:not(.kv-allow):not(.kv-ui) {
	opacity: 0 !important;
}
html.kv-style-remove.kv-hide-all:not(.kv-ready) img:not(.kv-allow):not(.kv-ui) {
	display: none !important;
}
/* (Per-ID "people" anti-flash rules are printed inline in the page head.) */

/* ---------- Wrapper + placeholder ---------- */
.kv-wrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;
}
.kv-wrap img {
	transition: filter .15s ease;
}
.kv-overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 6px;
	font: 600 13px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	text-align: center;
	color: #4b5563;
	background:
		repeating-linear-gradient(45deg, #f3f4f6 0 12px, #eceef1 12px 24px);
	border: 1px solid #e3e6ea;
	border-radius: 4px;
}

/* Hidden state – placeholder style (default) */
.kv-wrap.kv-hidden img {
	visibility: hidden;
}
.kv-wrap.kv-hidden > .kv-overlay {
	display: flex;
}

/* Hidden state – blur style */
html.kv-style-blur .kv-wrap.kv-hidden img {
	visibility: visible;
	filter: blur(28px) grayscale(1) brightness(1.05) contrast(.85);
	transform: scale(1.06);
}
html.kv-style-blur .kv-wrap.kv-hidden {
	overflow: hidden;
}
html.kv-style-blur .kv-wrap.kv-hidden > .kv-overlay {
	background: rgba(255, 255, 255, .12);
	border-color: transparent;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
	pointer-events: none;
}

/* Hidden state – remove completely (image and its space disappear) */
html.kv-style-remove .kv-wrap.kv-hidden {
	display: none !important;
}
/* ...but if a replacement image is set, keep showing it. */
html.kv-style-remove .kv-wrap.kv-hidden.kv-replaced {
	display: inline-block !important;
}

/* Replacement image: show the chosen alternate at the original's size */
.kv-wrap.kv-hidden.kv-replaced img {
	visibility: visible;
	filter: none;
	transform: none;
	object-fit: cover;
}
.kv-wrap.kv-hidden.kv-replaced > .kv-overlay {
	display: none !important;
}

/* ---------- Toggle panel ---------- */
#kv-panel {
	position: fixed;
	z-index: 2147483000;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#kv-panel * {
	box-sizing: border-box;
}
.kv-pos-top-right    { top: 16px;    right: 16px; }
.kv-pos-top-left     { top: 16px;    left: 16px; }
.kv-pos-bottom-right { bottom: 16px; right: 16px; }
.kv-pos-bottom-left  { bottom: 16px; left: 16px; }

.kv-fab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: 999px;
	background: #1f2937;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	font: inherit;
	font-weight: 600;
}
.kv-fab:hover { background: #111827; }
.kv-fab:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.kv-fab svg { width: 18px; height: 18px; flex: none; }
#kv-panel.kv-active .kv-fab { background: #047857; }

.kv-menu {
	margin-top: 8px;
	min-width: 230px;
	padding: 6px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
	color: #1f2937;
}
/* When anchored at the bottom, the menu opens upward. */
.kv-pos-bottom-right .kv-menu,
.kv-pos-bottom-left .kv-menu {
	margin-top: 0;
	margin-bottom: 8px;
	order: -1;
}
.kv-pos-bottom-right,
.kv-pos-bottom-left { display: flex; flex-direction: column; align-items: stretch; }
.kv-pos-top-right,
.kv-pos-top-left { display: flex; flex-direction: column; align-items: stretch; }
.kv-pos-top-right .kv-fab,
.kv-pos-bottom-right .kv-fab { align-self: flex-end; }
.kv-pos-top-left .kv-fab,
.kv-pos-bottom-left .kv-fab { align-self: flex-start; }

.kv-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 10px;
	border-radius: 8px;
	cursor: pointer;
}
.kv-row:hover { background: #f3f4f6; }
.kv-row-label { font-weight: 500; }

/* Switch */
.kv-switch {
	position: relative;
	flex: none;
	width: 42px;
	height: 24px;
	border-radius: 999px;
	background: #cbd5e1;
	transition: background .15s ease;
}
.kv-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}
.kv-knob {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
	transition: transform .15s ease;
	pointer-events: none;
}
.kv-switch input:checked ~ .kv-knob { transform: translateX(18px); }
.kv-switch:has(input:checked) { background: #047857; }
.kv-switch input:focus-visible ~ .kv-knob { box-shadow: 0 0 0 3px #93c5fd; }

@media (prefers-reduced-motion: reduce) {
	.kv-knob, .kv-switch, .kv-fab, .kv-wrap > img { transition: none; }
}

/* ---------- Right-to-left (Hebrew / Yiddish) ---------- */
#kv-panel.kv-rtl .kv-row-label { text-align: right; }
#kv-panel.kv-rtl .kv-fab-label { unicode-bidi: plaintext; }
