/**
 * Strata Toolkit — floating dialogs: Share, Language and Toolbox Link
 * panels
 * (inc/floating-controls.php). A window over the dimmed page, on the
 * page's own background — solid, not the toolbox's glass, so its text
 * reads the same over any photo — with the glass's edge and lines,
 * corners from the Corners setting, colours and sizes from the theme's
 * tokens (tokens.css). In the middle of the screen; on a phone a sheet
 * from the bottom edge, where the thumb is.
 */

.st-float-dialog {
	box-sizing: border-box;
	width: min(28rem, calc(100vw - 2 * var(--st-toolkit-space-md)));
	max-width: none;
	max-height: calc(100dvh - 2 * var(--st-toolkit-space-md));
	margin: auto;
	padding: var(--st-toolkit-space-sm) var(--st-toolkit-space-md) var(--st-toolkit-space-md);
	overflow: auto;
	border: 1px solid var(--st-glass-edge, var(--st-toolkit-color-divider));
	border-radius: var(--st-toolkit-radius-2-xl);
	background-color: var(--st-toolkit-color-background);
	color: var(--st-toolkit-color-foreground);
	box-shadow: var(--st-glass-lines, 0 0 transparent), var(--st-toolkit-shadow-lg);
}

.st-float-dialog[open] {
	animation: st-float-dialog-in var(--st-toolkit-transition-base);
}

.st-float-dialog::backdrop {
	background: color-mix(in srgb, var(--st-toolkit-color-photo-overlay) 30%, transparent);
}

@keyframes st-float-dialog-in {

	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* A phone: a sheet from the bottom edge, above the home indicator. */
@media (max-width: 600px) {

	.st-float-dialog {
		width: 100%;
		max-height: calc(100dvh - var(--st-toolkit-space-xl, 3rem));
		margin: auto 0 0;
		padding-bottom: calc(var(--st-toolkit-space-md) + env(safe-area-inset-bottom, 0px));
		border-bottom: 0;
		border-radius: var(--st-toolkit-radius-2-xl) var(--st-toolkit-radius-2-xl) 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {

	.st-float-dialog[open] {
		animation: none;
	}
}

/* Title and close button. */
.st-float-dialog__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--st-toolkit-space-sm);
	margin-bottom: var(--st-toolkit-space-sm);
}

.st-float-dialog__title {
	margin: 0;
	font-size: var(--st-toolkit-font-size-lg);
	font-weight: 600;
}

.st-float-dialog__close {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-right: calc(-1 * var(--st-toolkit-space-xs));
	padding: 0;
	border: 0;
	border-radius: var(--st-toolkit-radius-lg);
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.st-float-dialog__close svg {
	width: 20px;
	height: 20px;
}

/* Every button and link in a dialog: a light tint on hover, the brand
   ring on keyboard focus. */
.st-float-dialog :is(.st-float-dialog__close, .st-share__network, .st-share__copy-button, .st-share__native, .st-language__link):hover {
	background-color: color-mix(in srgb, var(--st-toolkit-color-foreground) 8%, transparent);
}

.st-float-dialog :is(a, button, input):focus-visible,
.st-share__scope-option:has(input:focus-visible) {
	outline: 2px solid var(--st-toolkit-color-brand-text);
	outline-offset: 2px;
}

/* ── Share ───────────────────────────────────────────────────────── */

.st-share__what {
	display: -webkit-box;
	margin: 0 0 var(--st-toolkit-space-sm);
	overflow: hidden;
	color: var(--st-toolkit-color-foreground-muted);
	font-size: var(--st-toolkit-font-size-sm);
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* This page / This section: two halves of one switch. */
.st-share__scope {
	display: flex;
	gap: 2px;
	min-width: 0;
	margin: 0 0 var(--st-toolkit-space-sm);
	padding: 3px;
	border: 1px solid var(--st-toolkit-color-divider);
	border-radius: calc(var(--st-toolkit-radius-lg) + 3px);
}

.st-share__scope[hidden] {
	display: none;
}

.st-share__scope-option {
	flex: 1 1 0;
	min-width: 0;
	padding: var(--st-toolkit-space-xs) var(--st-toolkit-space-sm);
	overflow: hidden;
	border-radius: var(--st-toolkit-radius-lg);
	font-size: var(--st-toolkit-font-size-sm);
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.st-share__scope-option:has(input:checked) {
	background-color: var(--st-toolkit-color-foreground);
	color: var(--st-toolkit-color-background);
}

.st-share__scope-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.st-share__networks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	gap: var(--st-toolkit-space-xs);
	margin: 0 0 var(--st-toolkit-space-sm);
	padding: 0;
	list-style: none;
}

.st-float-dialog :is(.st-share__network, .st-share__copy-button, .st-share__native, .st-language__link) {
	display: flex;
	align-items: center;
	gap: var(--st-toolkit-space-xs);
	min-height: 44px;
	padding: 0 var(--st-toolkit-space-sm);
	border: 1px solid var(--st-toolkit-color-divider);
	border-radius: var(--st-toolkit-radius-lg);
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: var(--st-toolkit-font-size-sm);
	text-decoration: none;
	cursor: pointer;
}

.st-float-dialog :is(.st-share__network, .st-share__copy-button, .st-share__native, .st-language__link) svg {
	flex: none;
	width: 20px;
	height: 20px;
	fill: currentcolor;
}

.st-share__copy {
	display: flex;
	gap: var(--st-toolkit-space-xs);
}

.st-share__link {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 44px;
	padding: 0 var(--st-toolkit-space-sm);
	border: 1px solid var(--st-toolkit-color-divider);
	border-radius: var(--st-toolkit-radius-lg);
	background-color: var(--st-toolkit-color-background);
	color: var(--st-toolkit-color-foreground);
	font: inherit;
	font-size: var(--st-toolkit-font-size-sm);
	text-overflow: ellipsis;
}

.st-share__copy-button {
	flex: none;
}

.st-share__native {
	justify-content: center;
	width: 100%;
	margin-top: var(--st-toolkit-space-xs);
}

.st-share__native[hidden] {
	display: none;
}

.st-share__status {
	margin: var(--st-toolkit-space-xs) 0 0;
	font-size: var(--st-toolkit-font-size-sm);
}

.st-share__status:empty {
	margin: 0;
}

/* ── Toolbox Link panels ─────────────────────────────────────────────
   A synced pattern beside the toolbox, by its corner, where the visitor's
   eye already is — not the middle of the screen; the page only slightly
   dimmed. A phone: the sheet above. */

.st-toolbox-panel::backdrop {
	background: color-mix(in srgb, var(--st-toolkit-color-photo-overlay) 12%, transparent);
}

@media (min-width: 601px) {

	.st-toolbox-panel {
		width: min(24rem, calc(100vw - 2 * var(--st-toolkit-space-md)));
		max-height: min(40rem, calc(100dvh - 2 * var(--st-toolkit-space-md)));
		margin: auto auto calc(var(--st-toolkit-space-md) + var(--st-bottom-bar-height, 0px)) calc(var(--st-toolkit-space-md) + var(--st-float-width, 0px) + var(--st-toolkit-space-sm));
	}
}

/* The pattern's blocks one under the other with the same space between
   them as the dialog's own lines (the theme's own gap between blocks may
   be none); a group in the pattern keeps its own gap inside. */
.st-toolbox-panel__content {
	display: flex;
	flex-direction: column;
	gap: var(--st-toolkit-space-sm);
}

/* ── Language ────────────────────────────────────────────────────── */

.st-language__list {
	display: grid;
	gap: var(--st-toolkit-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.st-float-dialog .st-language__link {
	border-color: transparent;
	font-size: var(--st-toolkit-font-size-md);
}

.st-language__name {
	flex: 1 1 auto;
}

.st-language__note {
	color: var(--st-toolkit-color-foreground-muted);
	font-size: var(--st-toolkit-font-size-xs);
}

.st-language__link[aria-current] {
	border-color: var(--st-toolkit-color-divider);
	font-weight: 600;
}

.st-language__link[aria-current] svg {
	color: var(--st-toolkit-color-brand-text);
}
