/* Dam Writers Scroll to Top 1.0.0 - theme v4 tokens with hex fallbacks (works under any theme).
   z-index 60: above the theme header (20) and reading progress bar (50), below the audit tool
   overlays (9998) and the cookie banner (2147483000). Hidden while the cookie banner is open. */
.dwst-btn {
	--dwst-bg: var(--wp--preset--color--brand, #d02878);
	--dwst-bg-hover: var(--wp--preset--color--brand-dark, #a81e5d);
	--dwst-fg: var(--wp--preset--color--white, #ffffff);
	--dwst-ink: var(--wp--preset--color--ink, #161e29);
	position: fixed;
	z-index: 60;
	left: 50%;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-sizing: border-box;
	height: 52px;
	margin: 0;
	padding: 0 24px 0 20px;
	border: 2px solid var(--dwst-fg);
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--sans, Montserrat, system-ui, sans-serif);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	background: var(--dwst-bg);
	color: var(--dwst-fg);
	color-scheme: only light;
	box-shadow: 0 6px 18px rgba(22, 30, 41, 0.22), 0 1px 3px rgba(22, 30, 41, 0.18);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translate(-50%, 12px);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease, visibility 0s linear 0.2s;
}
.dwst-btn--show {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate(-50%, 0);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease, visibility 0s linear 0s;
}
.dwst-btn:hover { background: var(--dwst-bg-hover); }
.dwst-btn--show:active { transform: translate(-50%, 0) scale(0.97); }
.dwst-btn:focus { outline: none; }
.dwst-btn:focus-visible {
	outline: 3px solid var(--dwst-ink);
	outline-offset: 3px;
	box-shadow: 0 0 0 6px var(--dwst-fg), 0 6px 18px rgba(22, 30, 41, 0.22);
}
.dwst-focus-target:focus { outline: none; }
.dwst-btn__icon { display: block; flex: none; width: 22px; height: 22px; pointer-events: none; }
.dwst-btn__text { pointer-events: none; }

/* Never sit on top of the Dam Writers cookie banner (it sets html.dwc-open while visible). */
html.dwc-open .dwst-btn { opacity: 0; visibility: hidden; pointer-events: none; }

/* Forced colours (Windows high contrast): keep a visible edge. */
@media (forced-colors: active) {
	.dwst-btn { border-color: ButtonText; forced-color-adjust: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.dwst-btn, .dwst-btn--show, .dwst-btn--show:active { transition: none; transform: translate(-50%, 0); }
}

@media print { .dwst-btn { display: none !important; } }
