/* ===========================================================
   Tool Spotlight — site-wide floating card pointing at the
   Stack Pressure Test.

   Two visual states driven by data-attrs on the .ced-spotlight
   root (set by view.js):
     - default       : hidden (no class) until JS decides what to show
     - .is-card      : full card visible (animated entry)
     - .is-pill      : compact persistent pill at bottom-right
     - .is-closed    : everything hidden (user dismissed both)

   On the tool page itself, .ced-spotlight gets [data-on-tool] so
   nothing renders at all.
   =========================================================== */

/* Reset the block wrapper Gutenberg may give us — we're position:fixed
   relative to viewport, ignore any inherited spacing or alignment.    */
.ced-spotlight {
	position: fixed;
	z-index: 60;
	pointer-events: none; /* re-enabled on visible children */
	bottom: 1.5rem;
	right: 1.5rem;
	max-width: calc(100vw - 3rem);
}

/* Hidden by default (JS shows the right state on load) */
.ced-spotlight__card,
.ced-spotlight__pill {
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px) scale(0.96);
	transition:
		opacity   320ms var(--ease-smooth),
		transform 420ms var(--ease-emph),
		visibility 0s linear 420ms;
	pointer-events: none;
}

/* ── ACTIVE STATES ────────────────────────────────────────── */
.ced-spotlight.is-card .ced-spotlight__card,
.ced-spotlight.is-pill .ced-spotlight__pill {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	transition:
		opacity   420ms var(--ease-smooth),
		transform 520ms var(--ease-emph),
		visibility 0s linear 0s;
	pointer-events: auto;
}

/* Hide entirely on the tool page or after explicit close */
.ced-spotlight[data-on-tool] .ced-spotlight__card,
.ced-spotlight[data-on-tool] .ced-spotlight__pill,
.ced-spotlight.is-closed .ced-spotlight__card,
.ced-spotlight.is-closed .ced-spotlight__pill {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* ── FULL CARD ────────────────────────────────────────────── */
.ced-spotlight__card {
	position: relative;
	width: 340px;
	max-width: calc(100vw - 3rem);
	background: linear-gradient(165deg,
		rgba(20, 20, 26, 0.97) 0%,
		rgba(14, 14, 18, 0.97) 100%);
	border: 1px solid rgba(203, 108, 230, 0.32);
	border-radius: 18px;
	padding: 1.25rem 1.25rem 1.1rem;
	color: var(--wp--preset--color--paper, #f1ede4);
	font-family: var(--wp--preset--font-family--display, "Inter", system-ui, sans-serif);
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.5),
		0 8px 20px rgba(0, 0, 0, 0.35),
		0 0 0 1px rgba(0, 0, 0, 0.4),
		inset 0 1px 0 rgba(255, 255, 255, 0.05);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	overflow: hidden;
}

/* Soft lime glow sweep behind the card so it reads as a "live" element */
.ced-spotlight__card::before {
	content: "";
	position: absolute;
	inset: -2px;
	background: radial-gradient(60% 50% at 50% 0%,
		rgba(203, 108, 230, 0.18) 0%,
		transparent 70%);
	pointer-events: none;
	z-index: 0;
	opacity: 0;
	animation: ced-spotlight-glow 3.6s ease-in-out infinite;
}
@keyframes ced-spotlight-glow {
	0%, 100% { opacity: 0.4; }
	50%      { opacity: 1; }
}
.ced-spotlight__card > * { position: relative; z-index: 1; }

/* ── BADGE ────────────────────────────────────────────────── */
.ced-spotlight__badge {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.3rem 0.7rem;
	background: rgba(203, 108, 230, 0.1);
	border: 1px solid rgba(203, 108, 230, 0.35);
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, "SF Mono", monospace);
	font-size: 0.6rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #CB6CE6;
	font-weight: 600;
	margin-bottom: 0.85rem;
}
.ced-spotlight__dot {
	width: 6px;
	height: 6px;
	background: #CB6CE6;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(203, 108, 230, 0.6);
	animation: ced-spotlight-pulse 1.8s ease-out infinite;
}
@keyframes ced-spotlight-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(203, 108, 230, 0.7); }
	70%  { box-shadow: 0 0 0 8px rgba(203, 108, 230, 0); }
	100% { box-shadow: 0 0 0 0 rgba(203, 108, 230, 0); }
}

/* ── CLOSE BUTTON ─────────────────────────────────────────── */
.ced-spotlight__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(232, 229, 222, 0.06);
	border: 1px solid rgba(232, 229, 222, 0.12);
	color: rgba(232, 229, 222, 0.7);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 2;
	transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}
.ced-spotlight__close:hover {
	background: rgba(232, 229, 222, 0.12);
	color: #f1ede4;
	transform: rotate(90deg);
}

/* ── PREVIEW SVG ──────────────────────────────────────────── */
.ced-spotlight__preview {
	height: 56px;
	margin: 0 -0.5rem 0.85rem;
	overflow: hidden;
	border-radius: 8px;
	background: rgba(232, 229, 222, 0.03);
	border: 1px solid rgba(232, 229, 222, 0.06);
	padding: 0;
}
.ced-spotlight__preview svg {
	width: 100%;
	height: 100%;
	display: block;
}
.ced-spotlight__preview-bars rect {
	transform-origin: bottom;
	animation: ced-spotlight-bar 2.4s ease-in-out infinite;
}
.ced-spotlight__preview-bars rect:nth-child(1) { animation-delay: 0ms; }
.ced-spotlight__preview-bars rect:nth-child(2) { animation-delay: 100ms; }
.ced-spotlight__preview-bars rect:nth-child(3) { animation-delay: 200ms; }
.ced-spotlight__preview-bars rect:nth-child(4) { animation-delay: 300ms; }
.ced-spotlight__preview-bars rect:nth-child(5) { animation-delay: 400ms; }
.ced-spotlight__preview-bars rect:nth-child(6) { animation-delay: 500ms; }
@keyframes ced-spotlight-bar {
	0%, 100% { transform: scaleY(1); }
	50%      { transform: scaleY(0.7); }
}

/* ── TEXT ─────────────────────────────────────────────────── */
.ced-spotlight__title {
	font-size: 1.15rem;
	font-weight: 500;
	letter-spacing: -0.02em;
	line-height: 1.2;
	margin: 0 0 0.4rem;
	color: #f1ede4;
}
.ced-spotlight__body {
	font-size: 0.85rem;
	line-height: 1.5;
	color: rgba(232, 229, 222, 0.78);
	margin: 0 0 1rem;
}

/* ── CTA BUTTON ───────────────────────────────────────────── */
.ced-spotlight__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	background: #CB6CE6;
	color: #0a0a0d;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
	font-size: 0.7rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	font-weight: 600;
	padding: 0.7rem 1.1rem;
	border-radius: 999px;
	text-decoration: none;
	border: 1px solid #CB6CE6;
	cursor: pointer;
	transition: transform 200ms var(--ease-smooth, cubic-bezier(0.22, 1, 0.36, 1)),
				box-shadow 200ms ease,
				background 200ms ease;
	box-shadow: 0 4px 14px rgba(203, 108, 230, 0.25);
}
.ced-spotlight__cta:hover {
	transform: translateY(-2px);
	background: #E089F8;
	box-shadow: 0 8px 22px rgba(203, 108, 230, 0.4);
}
.ced-spotlight__cta:focus-visible {
	outline: 2px solid #CB6CE6;
	outline-offset: 3px;
}
.ced-spotlight__cta svg { flex-shrink: 0; }

/* ── COMPACT PILL (post-dismiss) ──────────────────────────── */
.ced-spotlight__pill {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.55rem 1rem 0.55rem 0.85rem;
	background: rgba(14, 14, 18, 0.92);
	border: 1px solid rgba(203, 108, 230, 0.4);
	border-radius: 999px;
	color: #CB6CE6;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 600;
	cursor: pointer;
	box-shadow:
		0 8px 22px rgba(0, 0, 0, 0.4),
		0 0 0 1px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: transform 220ms var(--ease-smooth),
				background 220ms ease,
				color 220ms ease,
				box-shadow 220ms ease;
}
.ced-spotlight__pill:hover {
	transform: translateY(-2px);
	background: #CB6CE6;
	color: #0a0a0d;
	box-shadow:
		0 12px 28px rgba(203, 108, 230, 0.35),
		0 0 0 1px rgba(203, 108, 230, 0.4);
}
.ced-spotlight__pill:hover .ced-spotlight__pill-dot {
	background: #0a0a0d;
	box-shadow: 0 0 0 0 rgba(10, 10, 13, 0);
}
.ced-spotlight__pill-dot {
	width: 7px;
	height: 7px;
	background: #CB6CE6;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(203, 108, 230, 0.7);
	animation: ced-spotlight-pulse 1.8s ease-out infinite;
	flex-shrink: 0;
}
.ced-spotlight__pill svg { flex-shrink: 0; }

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 640px) {
	.ced-spotlight {
		bottom: 1rem;
		right: 1rem;
		left: 1rem;
		max-width: none;
	}
	.ced-spotlight__card {
		width: 100%;
		max-width: 100%;
		padding: 1.1rem;
	}
	/* On mobile keep the pill at right, don't stretch. */
	.ced-spotlight.is-pill {
		left: auto;
	}
}

/* ── ACCESSIBILITY ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.ced-spotlight__card,
	.ced-spotlight__pill {
		transition: opacity 0.2s linear, visibility 0s;
		transform: none !important;
	}
	.ced-spotlight__card::before,
	.ced-spotlight__dot,
	.ced-spotlight__pill-dot,
	.ced-spotlight__preview-bars rect {
		animation: none !important;
	}
}

/* Editor preview — show a static rendering of the card so editors
   know what they're adding. The view.js logic doesn't run there. */
.editor-styles-wrapper .ced-spotlight,
.block-editor-block-list__layout .ced-spotlight {
	position: relative;
	bottom: auto; right: auto; left: auto;
	max-width: 400px;
	margin: 1rem 0;
	z-index: 0;
}
.editor-styles-wrapper .ced-spotlight .ced-spotlight__card,
.block-editor-block-list__layout .ced-spotlight .ced-spotlight__card {
	opacity: 1;
	visibility: visible;
	transform: none;
}
.editor-styles-wrapper .ced-spotlight .ced-spotlight__pill,
.block-editor-block-list__layout .ced-spotlight .ced-spotlight__pill {
	display: none;
}
