/**
 * Tickertape Logo Scroller Styles
 *
 * Infinite horizontal scrolling ticker with fade edges
 * and configurable logo styling.
 */

/* ==========================================================================
   Container
   ========================================================================== */

.insightmed-tickertape {
	position: relative;
	width: 100%;
	overflow: hidden;

	/* Fade edges using CSS mask */
	-webkit-mask-image: linear-gradient(
		to right,
		transparent 0%,
		black var(--tickertape-fade, 80px),
		black calc(100% - var(--tickertape-fade, 80px)),
		transparent 100%
	);
	mask-image: linear-gradient(
		to right,
		transparent 0%,
		black var(--tickertape-fade, 80px),
		black calc(100% - var(--tickertape-fade, 80px)),
		transparent 100%
	);
}

/* Empty state */
.insightmed-tickertape.tickertape--empty {
	-webkit-mask-image: none;
	mask-image: none;
	padding: 20px;
	background: #f8f9fa;
	border: 2px dashed #dee2e6;
	border-radius: 8px;
}


/* ==========================================================================
   Track (scrolling container)
   ========================================================================== */

.tickertape-track {
	display: flex;
	align-items: center;
	gap: var(--tickertape-gap, 60px);
	width: max-content;
	will-change: transform;
}

/* Divi wraps each child in et_pb_module - reset those wrappers */
.tickertape-track > .et_pb_module {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	margin: 0 !important;
	padding: 0 !important;
}

/* Remove Divi's module_inner wrapper spacing */
.tickertape-track .et_pb_module_inner {
	display: contents;
}

/* Right to Left animation (default) */
.tickertape-track--rtl {
	animation: tickertape-scroll-rtl var(--tickertape-speed, 30s) linear infinite;
}

/* Left to Right animation */
.tickertape-track--ltr {
	animation: tickertape-scroll-ltr var(--tickertape-speed, 30s) linear infinite;
}

@keyframes tickertape-scroll-rtl {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(-50%);
	}
}

@keyframes tickertape-scroll-ltr {
	0% {
		transform: translateX(-50%);
	}
	100% {
		transform: translateX(0);
	}
}


/* ==========================================================================
   Individual Logo Items
   ========================================================================== */

.tickertape-item {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tickertape-item--linked {
	text-decoration: none;
}

.tickertape-logo {
	display: block;
	height: var(--tickertape-logo-height, 40px);
	width: auto;
	max-width: 180px;
	object-fit: contain;
	transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}


/* ==========================================================================
   Logo Style Variants
   ========================================================================== */

/* Grayscale with color on hover (default) */
.tickertape--grayscale-hover .tickertape-logo {
	filter: grayscale(100%);
	opacity: 0.6;
}

.tickertape--grayscale-hover .tickertape-item:hover .tickertape-logo,
.tickertape--grayscale-hover .tickertape-logo:hover {
	filter: grayscale(0%);
	opacity: 1;
	transform: scale(1.05);
}

/* Full color always */
.tickertape--full-color .tickertape-logo {
	filter: none;
	opacity: 1;
}

.tickertape--full-color .tickertape-item:hover .tickertape-logo,
.tickertape--full-color .tickertape-logo:hover {
	transform: scale(1.05);
}

/* Grayscale always */
.tickertape--grayscale .tickertape-logo {
	filter: grayscale(100%);
	opacity: 0.6;
}

.tickertape--grayscale .tickertape-item:hover .tickertape-logo,
.tickertape--grayscale .tickertape-logo:hover {
	opacity: 0.8;
}


/* ==========================================================================
   Visual Builder Preview Styles
   ========================================================================== */

/* Disable animation in Visual Builder for editing */
.et-fb .insightmed-tickertape .tickertape-track {
	animation: none !important;
	transform: none !important;
	flex-wrap: wrap;
	width: 100%;
	gap: 20px;
	padding: 20px;
}

/* Show all items in a grid for easy editing */
.et-fb .insightmed-tickertape .tickertape-item {
	border: 2px dashed #088eff;
	border-radius: 8px;
	padding: 10px;
	background: rgba(8, 142, 255, 0.05);
}

/* Remove mask in VB so all items are visible */
.et-fb .insightmed-tickertape {
	-webkit-mask-image: none !important;
	mask-image: none !important;
}

/* Show all logos at full color in VB for clarity */
.et-fb .insightmed-tickertape .tickertape-logo {
	filter: none !important;
	opacity: 1 !important;
}

/* Only show original items (hide duplicates) in VB */
.et-fb .insightmed-tickertape .tickertape-item:nth-child(n + 51) {
	display: none;
}


/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 980px) {
	.insightmed-tickertape {
		--tickertape-logo-height: 35px;
		--tickertape-gap: 40px;
		--tickertape-fade: 60px;
	}
}

@media (max-width: 767px) {
	.insightmed-tickertape {
		--tickertape-logo-height: 30px;
		--tickertape-gap: 30px;
		--tickertape-fade: 40px;
	}

	/* Slow down animation on mobile for readability */
	.tickertape-track--rtl,
	.tickertape-track--ltr {
		animation-duration: calc(var(--tickertape-speed, 30s) * 1.5);
	}
}


/* ==========================================================================
   Accessibility - Reduce motion preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.tickertape-track--rtl,
	.tickertape-track--ltr,
	.tickertape-track {
		animation: none !important; /* beats the inline animation tickertape.js writes */
	}

	/* The loop copies aren't needed when nothing moves (aria-hidden sits on the track's direct children — a Divi
	   module wraps each item, so match those, not just .tickertape-item). */
	.tickertape-track > [aria-hidden="true"] {
		display: none !important;
	}

	/* Reduced motion = one row that never slides (it used to wrap every logo into a tall grid: user, 2026-11-03,
	   Windows with "Animation effects" off). tickertape.js shows as many logos as fit and crossfades to the next
	   set every few seconds (user, 2026-11-04); off-page logos are only visually hidden, so screen readers get
	   the whole list. Opacity fades are fine under reduced motion; movement is what it asks us to drop. */
	.tickertape-track {
		flex-wrap: nowrap;
		justify-content: center;
		width: 100%;
		padding: 0 var(--tickertape-fade, 80px); /* clear the edge fades */
		box-sizing: border-box;
		transition: opacity .45s ease;
	}

	.tickertape-track.tp-fading {
		opacity: 0;
	}

	.tickertape-track.tp-quick {
		transition-duration: .2s; /* an arrow / swipe step: quicker than the timed fade */
	}

	/* Nothing crosses the edges here, so no edge fade (it would also fade the arrows). */
	.insightmed-tickertape.tickertape--pages {
		-webkit-mask-image: none;
		mask-image: none;
	}

	.tickertape-track > .tp-off {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		margin: -1px !important;
		padding: 0 !important;
		overflow: hidden !important;
		clip: rect(0 0 0 0) !important;
		white-space: nowrap !important;
		border: 0 !important;
	}
}

/* ==========================================================================
   Pausing (WCAG 2.2.2): hover, touch (tap toggles, tickertape.js), keyboard focus; reduced motion fades (above)
   and holds on the same signals. No visible button
   (user, 2026-11-03): keyboard users get a pause control that appears only when tabbed to, like a skip link.
   ========================================================================== */

.insightmed-tickertape:hover .tickertape-track,
.insightmed-tickertape.tickertape--paused .tickertape-track,
.insightmed-tickertape:has(+ .tickertape-pause:focus-visible) .tickertape-track {
	animation-play-state: paused !important;
}

/* Drag (tickertape.js): the logos can be grabbed once stopped; vertical swipes still scroll the page. */
.insightmed-tickertape {
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
}

.insightmed-tickertape:hover,
.insightmed-tickertape.tickertape--paused {
	cursor: grab;
}

.insightmed-tickertape.tickertape--dragging,
.insightmed-tickertape.tickertape--dragging * {
	cursor: grabbing;
}

/* Previous / next arrows, reduced motion only (tickertape.js adds them to paged tickers), in the side padding. */
.tp-nav {
	position: absolute;
	top: 50%;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin-top: -16px;
	padding: 0;
	border: 1px solid rgba(31, 41, 51, 0.25);
	border-radius: 50%;
	background: #fff;
	color: #1f2933;
	cursor: pointer;
}

.tp-nav[hidden] {
	display: none;
}

.tp-nav:hover {
	border-color: rgba(31, 41, 51, 0.5);
}

.tp-nav:focus-visible {
	outline: 2px solid #1f2933;
	outline-offset: -5px;
}

.tp-prev {
	left: max(0px, calc((var(--tickertape-fade, 80px) - 32px) / 2));
}

.tp-next {
	right: max(0px, calc((var(--tickertape-fade, 80px) - 32px) / 2));
}

.tp-nav .tp-chev {
	display: block;
	width: 8px;
	height: 8px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: rotate(45deg);
	margin-left: -3px;
}

.tp-prev .tp-chev {
	transform: rotate(-135deg);
	margin-left: 3px;
}

/* Hidden until keyboard focus. */
.tickertape-pause:not(:focus-visible) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.tickertape-pause {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 8px 28px 0 auto;
	padding: 0;
	border: 1px solid rgba(31, 41, 51, 0.25);
	border-radius: 50%;
	background: #fff;
	color: #1f2933;
	cursor: pointer;
}

.tickertape-pause:hover {
	border-color: rgba(31, 41, 51, 0.5);
}

/* Pause icon: two bars; when pressed (paused) it becomes a play triangle. */
.tickertape-pause .tp-ic {
	display: block;
	width: 10px;
	height: 12px;
	border-left: 3px solid currentColor;
	border-right: 3px solid currentColor;
	box-sizing: border-box;
}

.tickertape-pause[aria-pressed="true"] .tp-ic {
	width: 11px;
	height: 12px;
	border: 0;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	margin-left: 2px;
}
