/* ==========================================================================
 * Side Tabs (Request Pricing / Request Quote)
 * Updated 2026-11-13.
 * - Loaded by functions.php (pw_side_tabs_enqueue) only on pages that show
 *   a tab. Markup comes from pw_side_tabs_render().
 * - Per-tab colors come from pw_side_tabs_config() through the
 *   --pw-tab-bg and --pw-tab-color custom properties.
 * - Desktop size: 50 x 180 px. Phone size: 36 x 150 px.
 * - GA4 click tracking uses the "pw-side-tab" class. Do not rename it.
 * ======================================================================== */

.pw-side-tab {
	position: fixed;
	/* Vertically centered. 50% is the fallback for browsers without svh.
	   50svh uses the screen height with the phone address bar showing, which
	   does not change while scrolling, so the tab does not jump. */
	top: 50%;
	top: 50svh;
	z-index: 1000;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 180px;
	margin: 0;
	padding: 0;
	/* Vertical text. The 180deg turn makes it read bottom to top. */
	writing-mode: vertical-rl;
	transform: translateY(-50%) rotate(180deg);
	/* Own layer, so the tab does not flicker while the page scrolls. */
	will-change: transform;
	background-color: var(--pw-tab-bg, #eaeaea);
	color: var(--pw-tab-color, #2c702a);
	font-family: "Open Sans", Arial, Helvetica, sans-serif;
	font-size: 17px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: normal;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.18);
	transition: background-color 0.2s ease, color 0.2s ease;
}

/* Right side: flush to the right edge, rounded corners face the page.
   Corners are set before the 180deg turn, so they are the mirror image. */
.pw-side-tab--right {
	right: 0;
	border-radius: 0 6px 6px 0;
}

.pw-side-tab--left {
	left: 0;
	border-radius: 6px 0 0 6px;
}

/* Hover and keyboard focus: inverted colors (white on the tab color).
   Plain :focus is left out on purpose. The tab opens a new browser tab, so
   after a click it keeps focus and would stay inverted when the visitor
   comes back to the page. */
.pw-side-tab:hover,
.pw-side-tab:focus-visible {
	background-color: var(--pw-tab-color, #2c702a);
	color: #fff;
	text-decoration: none;
}

/* Visible focus ring for keyboard users. */
.pw-side-tab:focus-visible {
	outline: 3px solid var(--pw-tab-color, #2c702a);
	outline-offset: 2px;
}

/* Screen reader only text ("opens in a new tab"). */
.pw-side-tab__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Preview mode only (PW_SIDE_TABS_PREVIEW true in functions.php): the tab
   shows only to administrators and sits higher on the screen. */
.pw-side-tab--preview {
	top: calc(50% - 200px);
	top: calc(50svh - 200px);
}

/* Phones and short landscape screens: smaller tab so it covers less content. */
@media (max-width: 600px), (max-height: 420px) {
	.pw-side-tab {
		width: 36px;
		height: 150px;
		font-size: 14px;
	}

	.pw-side-tab--preview {
		top: calc(50% - 170px);
		top: calc(50svh - 170px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.pw-side-tab {
		transition: none;
	}
}

@media print {
	.pw-side-tab {
		display: none;
	}
}