/**
 * Legal Communications Tools — guided tour + contextual help styles.
 *
 * Pairs with assets/js/tour.js (window.LCTTour + window.LCTHelp). Plugin-
 * wide and un-scoped so any module that enqueues the lct-tour handles
 * inherits the popover, spotlight overlay, the "Start a tour" nudge, and
 * the [data-help] tooltip without copying CSS.
 *
 * Animation posture: subtle, SaaS-style fade + small scale/translate.
 * Everything collapses to instant under prefers-reduced-motion.
 *
 * Tokens fall back to literals so the styles render even when a module
 * doesn't define the CSS custom properties.
 *
 * @package Legal_Communications_Tools
 */

:root {
	--lct-tour-accent: #2563eb;
	--lct-tour-accent-text: #ffffff;
	--lct-tour-surface: #ffffff;
	--lct-tour-text: #1f2937;
	--lct-tour-text-dim: #6b7280;
	--lct-tour-border: #e5e7eb;
	--lct-tour-radius: 12px;
	--lct-tour-shadow: 0 12px 32px rgba(17, 24, 39, .18), 0 2px 6px rgba(17, 24, 39, .08);
	--lct-tour-z: 100000;
}

/* =========================================================================
   Spotlight overlay — dims the page, cuts a soft "hole" around the active
   step's target via a single huge box-shadow on a positioned ring. No SVG,
   no clip-path. The ring animates between steps for a guided feel.
   ========================================================================= */
.lct-tour-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--lct-tour-z) - 1);
	pointer-events: auto;        /* backdrop click = close */
	cursor: pointer;
}
.lct-tour-overlay::before {
	content: "";
	position: fixed;
	top: var(--lct-spot-top, 50%);
	left: var(--lct-spot-left, 50%);
	width: var(--lct-spot-w, 0px);
	height: var(--lct-spot-h, 0px);
	border-radius: 10px;
	box-shadow: 0 0 0 9999px rgba(17, 24, 39, .55);
	pointer-events: none;        /* clicks fall through to the overlay */
	transition: top .28s cubic-bezier(.4, 0, .2, 1),
	            left .28s cubic-bezier(.4, 0, .2, 1),
	            width .28s cubic-bezier(.4, 0, .2, 1),
	            height .28s cubic-bezier(.4, 0, .2, 1);
}

/* =========================================================================
   Tour popover
   ========================================================================= */
.lct-tour-pop {
	position: fixed;
	z-index: var(--lct-tour-z);
	width: 320px;
	max-width: calc(100vw - 24px);
	box-sizing: border-box;
	background: var(--lct-tour-surface);
	color: var(--lct-tour-text);
	border: 1px solid var(--lct-tour-border);
	border-radius: var(--lct-tour-radius);
	box-shadow: var(--lct-tour-shadow);
	padding: 16px 18px 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	animation: lctTourPopIn .22s cubic-bezier(.16, 1, .3, 1);
}
@keyframes lctTourPopIn {
	from { opacity: 0; transform: translateY(6px) scale(.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lct-tour-x {
	position: absolute;
	top: 8px; right: 10px;
	width: 24px; height: 24px;
	border: 0; background: transparent;
	color: var(--lct-tour-text-dim);
	font-size: 20px; line-height: 1;
	cursor: pointer;
	border-radius: 6px;
	transition: background-color .15s, color .15s;
}
.lct-tour-x:hover { background: #f3f4f6; color: var(--lct-tour-text); }

.lct-tour-title {
	margin: 0 24px 6px 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}
.lct-tour-body {
	margin: 0 0 14px;
	color: #374151;
}

.lct-tour-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.lct-tour-progress {
	display: inline-flex;
	gap: 5px;
	flex: 0 0 auto;
}
.lct-tour-dot {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: #d1d5db;
	transition: background-color .2s, transform .2s;
}
.lct-tour-dot.is-on {
	background: var(--lct-tour-accent);
	transform: scale(1.25);
}
.lct-tour-nav {
	display: inline-flex;
	gap: 8px;
}
.lct-tour-btn {
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 6px 14px;
	border-radius: 8px;
	border: 1px solid var(--lct-tour-border);
	background: #fff;
	color: var(--lct-tour-text);
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.lct-tour-btn:hover:not(:disabled) { background: #f9fafb; border-color: #d1d5db; }
.lct-tour-btn:disabled { opacity: .45; cursor: default; }
.lct-tour-btn.is-primary {
	background: var(--lct-tour-accent);
	border-color: var(--lct-tour-accent);
	color: var(--lct-tour-accent-text);
}
.lct-tour-btn.is-primary:hover:not(:disabled) { filter: brightness(.95); background: var(--lct-tour-accent); }

/* Popover arrow — positioned per data-placement set by the JS. */
.lct-tour-arrow {
	position: absolute;
	width: 12px; height: 12px;
	background: var(--lct-tour-surface);
	border: 1px solid var(--lct-tour-border);
	transform: rotate(45deg);
}
.lct-tour-pop[data-placement="center"] .lct-tour-arrow { display: none; }
.lct-tour-pop[data-placement="bottom"] .lct-tour-arrow {
	top: -7px; left: var(--lct-arrow-left, 50%);
	margin-left: -6px;
	border-right: 0; border-bottom: 0;
}
.lct-tour-pop[data-placement="top"] .lct-tour-arrow {
	bottom: -7px; left: var(--lct-arrow-left, 50%);
	margin-left: -6px;
	border-left: 0; border-top: 0;
}
.lct-tour-pop[data-placement="right"] .lct-tour-arrow {
	left: -7px; top: var(--lct-arrow-top, 50%);
	margin-top: -6px;
	border-top: 0; border-right: 0;
}
.lct-tour-pop[data-placement="left"] .lct-tour-arrow {
	right: -7px; top: var(--lct-arrow-top, 50%);
	margin-top: -6px;
	border-bottom: 0; border-left: 0;
}

/* =========================================================================
   Generic tour launcher — a self-contained "Take a tour" button + the
   positioning context for the nudge bubble. Modules can use these classes
   directly instead of shipping their own; a module that puts its own
   button class on the trigger keeps that look (its stylesheet loads after
   this one, so its rules win on conflicting properties).
   ========================================================================= */
/* Centered row that holds the launcher + docs link under a product
   header. Optional — modules with their own header layout can skip it. */
.lct-tour-header-actions {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 18px;
	flex-wrap: wrap;
	margin-top: 12px;
}
.lct-tour-header-actions .lct-product-header-docs { margin: 0; }
.lct-tour-launch {
	position: relative;
	display: inline-flex;
}
.lct-tour-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: inherit;
	font-size: .85rem;
	font-weight: 600;
	line-height: 1;
	padding: 7px 12px;
	border-radius: 8px;
	border: 1px solid var(--lct-tour-border);
	background: #fff;
	color: var(--lct-tour-accent);
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s;
}
.lct-tour-trigger:hover {
	background: #f9fafb;
	border-color: var(--lct-tour-accent);
}

/* =========================================================================
   "Start a tour" nudge — a small dismissible pointer bubble shown next to
   a tour trigger button on load. Module markup supplies the text; the JS
   positions/dismisses it. Anchored inline (CSS-only position relative to
   its wrapper) so it travels with the button.
   ========================================================================= */
.lct-tour-nudge {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: calc(var(--lct-tour-z) - 5);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	background: var(--lct-tour-accent);
	color: var(--lct-tour-accent-text);
	font-size: 12.5px;
	font-weight: 600;
	padding: 7px 10px 7px 12px;
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
	animation: lctNudgeIn .26s cubic-bezier(.16, 1, .3, 1);
}
.lct-tour-nudge::before {
	content: "";
	position: absolute;
	top: -5px; right: 16px;
	width: 10px; height: 10px;
	background: var(--lct-tour-accent);
	transform: rotate(45deg);
}
.lct-tour-nudge[hidden] { display: none; }
.lct-tour-nudge-x {
	border: 0; background: transparent;
	color: rgba(255, 255, 255, .85);
	font-size: 15px; line-height: 1;
	cursor: pointer; padding: 0 2px;
	border-radius: 4px;
}
.lct-tour-nudge-x:hover { color: #fff; }
@keyframes lctNudgeIn {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* A pulse to draw the eye to the trigger button while the nudge shows. */
.lct-tour-trigger.is-nudging {
	animation: lctTriggerPulse 1.8s ease-in-out 2;
}
@keyframes lctTriggerPulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
	50%      { box-shadow: 0 0 0 5px rgba(37, 99, 235, .18); }
}

/* =========================================================================
   [data-help] tooltip — accessible replacement for native title=.
   Shows on hover, keyboard focus, and tap. No hover delay.
   ========================================================================= */
.lct-help-tip {
	position: fixed;
	z-index: var(--lct-tour-z);
	max-width: 260px;
	box-sizing: border-box;
	background: #111827;
	color: #f9fafb;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 12.5px;
	line-height: 1.45;
	padding: 7px 10px;
	border-radius: 7px;
	box-shadow: 0 6px 18px rgba(17, 24, 39, .22);
	pointer-events: none;
	opacity: 0;
	transform: translateY(2px);
	transition: opacity .12s ease, transform .12s ease;
}
.lct-help-tip.is-in { opacity: 1; transform: translateY(0); }
.lct-help-tip[hidden] { display: none; }

/* An optional visible affordance for help anchors that are icons/labels. */
.lct-help-anchor {
	cursor: help;
	border-bottom: 1px dotted currentColor;
}

@media (prefers-reduced-motion: reduce) {
	.lct-tour-pop,
	.lct-tour-nudge { animation: none; }
	.lct-tour-overlay::before { transition: none; }
	.lct-tour-trigger.is-nudging { animation: none; }
	.lct-help-tip { transition: opacity .01s; }
	.lct-tour-dot { transition: none; }
}
