/* ============================================================
   Crowdfunding Fireflies — Frontend Styles v1.0.0
   ============================================================ */

.cff-credit {
	position: absolute;
	bottom: 1.1rem;
	right: 1.5rem;
	z-index: 4;
	margin: 0;
	font-size: 0.68rem;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.781);
	pointer-events: auto;
}

.cff-credit a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s;
}

.cff-credit a:hover,
.cff-credit a:focus {
	color: rgba(255, 255, 255, 0.55);
	outline: none;
}

/* ============================================================
   Site title — top-left, outline + glow
   ============================================================ */

.cff-site-title {
	position: absolute;
	top: 2rem;
	left: 2.5rem;
	z-index: 4;
	pointer-events: none;
	user-select: none;
}

.cff-site-title span {
	font-size: clamp(1.2rem, 3.2vw, 2rem);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: transparent;
	-webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.90);
	text-stroke: 1.5px rgba(255, 255, 255, 0.90);
	text-shadow:
		0 0  8px rgba(245, 208,  96, 0.80),
		0 0 22px rgba(245, 208,  96, 0.45),
		0 0 45px rgba(245, 208,  96, 0.20);
	animation: cff-title-breathe 4s ease-in-out infinite alternate;
}

@keyframes cff-title-breathe {
	0%   {
		-webkit-text-stroke-color: rgba(255, 255, 255, 0.75);
		text-shadow:
			0 0  6px rgba(245, 208,  96, 0.60),
			0 0 18px rgba(245, 208,  96, 0.30),
			0 0 38px rgba(245, 208,  96, 0.12);
	}
	100% {
		-webkit-text-stroke-color: rgba(255, 255, 255, 1.00);
		text-shadow:
			0 0 10px rgba(245, 208,  96, 1.00),
			0 0 28px rgba(245, 208,  96, 0.60),
			0 0 55px rgba(245, 208,  96, 0.28);
	}
}

@media (max-width: 480px) {
	.cff-site-title {
		top: 1.25rem;
		left: 1.25rem;
	}
}

/* ============================================================
   Page-level reset — Bootstrap adds margin to body; remove it
   so the hero truly fills edge-to-edge.
   ============================================================ */

body.cff-fullscreen {
	margin: 0;
	padding: 0;
	overflow-x: hidden;
}

/* Kill any Bootstrap container padding that might wrap us */
.cff-page-wrapper {
	margin: 0;
	padding: 0;
	width: 100%;
	box-sizing: border-box;
}

/* ============================================================
   Hero section — full viewport height, edge-to-edge
   ============================================================ */

.cff-hero {
	position: relative;
	width: 100vw;
	height: 100vh;
	min-height: 600px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #04040f; /* dark fallback if image fails */
}

/* ============================================================
   Background image layer
   ============================================================ */

.cff-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	z-index: 0;
}

/* Dark overlay to keep text legible and fireflies prominent */
.cff-bg::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(2, 2, 20, 0.45);
}

/* ============================================================
   Hero centre content (page title / subtitle)
   ============================================================ */

.cff-hero-content {
	position: relative;
	z-index: 2;
	text-align: center;
	color: #fff;
	padding: 1.5rem 2rem;
	pointer-events: none; /* don't block firefly clicks */
	max-width: 720px;
}

.cff-hero-content h1 {
	font-size: clamp(1.8rem, 5vw, 3.5rem);
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.2;
	text-shadow: 0 2px 28px rgba(0, 0, 0, 0.85);
	margin: 0 0 0.6rem;
	color: #fff;
}

.cff-hero-content p {
	font-size: clamp(0.9rem, 2vw, 1.2rem);
	line-height: 1.65;
	opacity: 0.88;
	text-shadow: 0 1px 14px rgba(0, 0, 0, 0.75);
	margin: 0;
	color: #f0eff8;
}

/* ============================================================
   Fireflies overlay layer
   ============================================================ */

.cff-fireflies-layer {
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none; /* the layer itself is transparent to clicks */
}

/* ============================================================
   Individual firefly
   ============================================================ */

.cff-firefly {
	position: absolute;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: all; /* each firefly re-enables pointer events */

	/* Centred on its percentage coordinates */
	transform: translate(-50%, -50%);

	/*
	 * Background gradient is set dynamically in fireflies.js so the core
	 * colour matches each firefly's own colour (pale tint → full colour → fade).
	 * The declaration below is just a safe fallback for no-JS environments.
	 */
	background: radial-gradient(
		circle at 50% 50%,
		#fffde0                    0%,
		#f5d060                   45%,
		rgba(0, 0, 0, 0)         100%
	);

	/* box-shadow (glow) is set per-firefly by JS to match colour + size */

	/* Animation names declared here; durations / delays set by JS for variety */
	animation-name: cff-float, cff-pulse, cff-flicker;
	animation-timing-function: ease-in-out, ease-in-out, ease-in-out;
	animation-iteration-count: infinite, infinite, infinite;
	animation-direction: alternate, alternate, alternate;
	animation-fill-mode: both, both, both;

	will-change: transform, opacity, filter;
	transition: box-shadow 0.3s ease;
	outline: none;
}

/* Pause animation while the tooltip is open */
.cff-firefly.is-active {
	animation-play-state: paused, paused, paused;
}

/* Keyboard focus ring */
.cff-firefly:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.75);
	outline-offset: 5px;
}

/* ============================================================
   Keyframe animations
   ============================================================ */

/* Gentle organic drift */
@keyframes cff-float {
	0%   { transform: translate(-50%, -50%) translate(0px,   0px);  }
	20%  { transform: translate(-50%, -50%) translate(3px,  -7px);  }
	40%  { transform: translate(-50%, -50%) translate(-2px, -12px); }
	60%  { transform: translate(-50%, -50%) translate(5px,  -5px);  }
	80%  { transform: translate(-50%, -50%) translate(-3px, -9px);  }
	100% { transform: translate(-50%, -50%) translate(2px,  -14px); }
}

/* Slow brightness breathe */
@keyframes cff-pulse {
	0%   { opacity: 0.68; }
	30%  { opacity: 1.00; }
	65%  { opacity: 0.82; }
	100% { opacity: 0.58; }
}

/* Quick light flicker */
@keyframes cff-flicker {
	0%   { filter: brightness(1.00); }
	25%  { filter: brightness(1.45); }
	55%  { filter: brightness(0.82); }
	80%  { filter: brightness(1.20); }
	100% { filter: brightness(0.95); }
}

/* ============================================================
   Tooltip card
   ============================================================ */

.cff-tooltip {
	position: absolute;
	bottom: calc(100% + 16px);
	left: 50%;
	transform: translateX(-50%) translateY(8px);

	min-width: 170px;
	max-width: 260px;
	width: max-content;
	padding: 12px 16px;

	background: rgba(4, 4, 18, 0.90);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.10);
	border-top-color: rgba(255, 255, 255, 0.20);
	border-radius: 10px;
	box-shadow:
		0 8px 32px rgba(0, 0, 0, 0.55),
		0 2px 8px  rgba(0, 0, 0, 0.30);

	color: #f0f0ee;
	font-size: 0.83rem;
	line-height: 1.55;
	text-align: left;
	white-space: normal;
	word-break: break-word;

	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		opacity    0.22s ease,
		transform  0.22s ease,
		visibility 0s   linear 0.22s;
	z-index: 50;
}

/* Arrow pointing down toward the firefly */
.cff-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	margin-left: -7px;
	border: 7px solid transparent;
	border-top-color: rgba(4, 4, 18, 0.90);
}

/* === Visible state === */
.cff-tooltip.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
	pointer-events: auto;
	transition:
		opacity   0.22s ease,
		transform 0.22s ease;
}

/* === Edge-flip: near right edge — align right === */
.cff-tooltip.flip-left {
	left: auto;
	right: 50%;
	transform: translateX(50%) translateY(8px);
}

.cff-tooltip.flip-left::after {
	left: auto;
	right: 16px;
	margin-left: 0;
}

.cff-tooltip.flip-left.is-visible {
	transform: translateX(50%) translateY(0);
}

/* === Edge-flip: near top edge — show below firefly === */
.cff-tooltip.flip-below {
	bottom: auto;
	top: calc(100% + 16px);
	transform: translateX(-50%) translateY(-8px);
}

.cff-tooltip.flip-below::after {
	top: auto;
	bottom: 100%;
	border-top-color: transparent;
	border-bottom-color: rgba(4, 4, 18, 0.90);
}

.cff-tooltip.flip-below.is-visible {
	transform: translateX(-50%) translateY(0);
}

.cff-tooltip.flip-left.flip-below.is-visible {
	transform: translateX(50%) translateY(0);
}

/* ---- Tooltip content elements ---- */

.cff-tooltip-name {
	display: block;
	font-weight: 700;
	font-size: 0.94rem;
	color: var(--ff-colour, #f5d060);
	margin-bottom: 3px;
}

.cff-tooltip-amount {
	display: block;
	font-size: 0.87rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.92);
	margin-bottom: 6px;
}

.cff-tooltip-message {
	display: block;
	font-size: 0.79rem;
	color: rgba(255, 255, 255, 0.62);
	font-style: italic;
	line-height: 1.5;
}

/* ---- Mobile close button (hidden on desktop) ---- */
.cff-tooltip-close {
	display: none;
	position: absolute;
	top: 8px;
	right: 10px;
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.52);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 3px 5px;
	border-radius: 4px;
	pointer-events: all;
	transition: color 0.15s;
}

.cff-tooltip-close:hover,
.cff-tooltip-close:focus {
	color: #fff;
}

/* ============================================================
   Responsive overrides
   ============================================================ */

/* Show close button on touch devices */
@media (hover: none), (pointer: coarse) {
	.cff-tooltip-close {
		display: block;
	}

	.cff-tooltip {
		/* Extra padding on the right for the close button */
		padding-right: 30px;
		pointer-events: auto;
	}
}

@media (max-width: 480px) {
	.cff-tooltip {
		min-width: 138px;
		max-width: 200px;
		font-size: 0.76rem;
		padding: 10px 28px 10px 12px;
	}

	.cff-tooltip-name {
		font-size: 0.86rem;
	}

	.cff-hero {
		/* Use small viewport height unit on modern mobile (avoids address bar issue) */
		min-height: 100svh;
	}
}

/* ============================================================
   Accessibility — respect user motion preference
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.cff-firefly {
		animation: none !important;
		opacity: 0.88;
	}
}
