/*
 * The RangePro demo banner, shared by both themes, and the outlines that mark where each
 * RangePro web component (rj-widget) and each gap (.wc-gap) sits. Collapsed (data-demo-collapsed
 * on <html>): the bar hides and a 150 x 10 px tab with a grab handle hangs from the top center.
 */

rj-widget {
	display: block;
	position: relative;
}

.wc-gap {
	position: relative;
}

html[data-show-wc] rj-widget {
	outline: 2px dashed #2563eb;
	outline-offset: 3px;
}

html[data-show-wc] .wc-gap {
	outline: 2px dashed #dc2626;
	outline-offset: 3px;
}

html[data-show-wc] rj-widget::after,
html[data-show-wc] .wc-gap::after {
	position: absolute;
	top: -12px;
	left: 8px;
	z-index: 5;
	max-width: calc(100% - 16px);
	padding: 2px 8px;
	border-radius: 4px;
	font: 600 11px/1.4 ui-monospace, 'SF Mono', Menlo, monospace;
	letter-spacing: 0;
	text-transform: none;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
}

html[data-show-wc] rj-widget::after {
	content: attr(surface) ' · ' attr(data-access);
	background: #2563eb;
}

html[data-show-wc] rj-widget[data-access="private"]::after {
	background: #7c3aed;
}

html[data-show-wc] rj-widget[data-access="mixed"]::after {
	background: #0891b2;
}

html[data-show-wc] rj-widget[data-access="none"]::after {
	background: #475569;
}

html[data-show-wc] .wc-gap::after {
	content: 'gap · ' attr(data-gap);
	background: #dc2626;
}

/* The banner */

.demo-banner {
	position: sticky;
	top: 0;
	--demo-bg: #111827;
	--demo-text: #f3f4f6;
	--demo-muted: #9ca3af;
	--demo-tag: #fbbf24;
	--demo-line: rgba(255, 255, 255, 0.16);
	z-index: 1000;
	background: var(--demo-bg);
	color: var(--demo-text);
	font: 500 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	border-bottom: 1px solid var(--demo-line);
}

.demo-banner__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	gap: 10px 12px;
	flex-wrap: wrap;
}

.demo-banner__tag {
	flex: none;
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--demo-tag);
	color: #111827;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.demo-banner .demo-banner__message {
	flex: 1 1 320px;
	margin: 0;
	padding: 0;
	max-width: none;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	color: var(--demo-text);
}

.demo-banner__themes {
	flex: none;
	display: inline-flex;
	padding: 2px;
	border: 1px solid var(--demo-line);
	border-radius: 999px;
}

.demo-banner__themes a {
	padding: 4px 10px;
	border-radius: 999px;
	color: var(--demo-muted);
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.demo-banner__themes a:hover {
	color: var(--demo-text);
}

.demo-banner__themes a[aria-current="page"] {
	background: var(--demo-text);
	color: var(--demo-bg);
}

.demo-banner__button {
	flex: none;
	padding: 5px 12px;
	border: 1px solid var(--demo-line);
	border-radius: 999px;
	background: transparent;
	color: var(--demo-text);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.demo-banner__button:hover {
	border-color: var(--demo-text);
}

.demo-banner__button[aria-pressed="true"] {
	background: #2563eb;
	border-color: #2563eb;
}

.demo-banner a:focus-visible,
.demo-banner button:focus-visible {
	outline: 2px solid var(--demo-tag);
	outline-offset: 2px;
}

.demo-banner__tab {
	display: none;
}

html[data-demo-collapsed] .demo-banner {
	height: 0;
	border-bottom: 0;
}

html[data-demo-collapsed] .demo-banner__inner {
	display: none;
}

html[data-demo-collapsed] .demo-banner__tab {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 150px;
	height: 10px;
	padding: 0;
	border: 0;
	border-radius: 0 0 8px 8px;
	background: var(--demo-bg);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 6px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: height 0.15s ease;
}

html[data-demo-collapsed] .demo-banner__tab span {
	display: block;
	width: 36px;
	height: 3px;
	border-radius: 2px;
	background: var(--demo-muted);
}

html[data-demo-collapsed] .demo-banner__tab:hover,
html[data-demo-collapsed] .demo-banner__tab:focus-visible {
	height: 14px;
}

@media (max-width: 560px) {
	.demo-banner .demo-banner__message {
		flex-basis: 100%;
		font-size: 13px;
	}

	.demo-banner__themes {
		margin-right: auto;
	}
}

/*
 * <rj-text>: one field of one record, for a single value the site styles itself (a customer
 * quote). Undefined, it shows its text inline; "Show web components" marks it in green.
 */
rj-record {
	display: contents;
}

rj-text {
	display: inline;
}

html[data-show-wc] rj-text {
	background: rgba(22, 163, 74, 0.16);
	box-shadow: inset 0 -2px 0 #16a34a;
}
