/* Chugcheck Community Sliders — frontend styles
   Design language: minimal, white space, rounded corners, no gradients,
   soft shadows only. Inspired by Fragrantica / Untappd / Apple / Spotify. */

.chugcheck-sliders {
	--chugcheck-accent: #E8623A;
	--chugcheck-track: #EDEBE7;
	--chugcheck-height: 6px;
	--chugcheck-ink: #1C1B19;
	--chugcheck-ink-soft: #77726B;
	--chugcheck-surface: #FFFFFF;
	--chugcheck-radius: 20px;

	display: flex;
	flex-direction: column;
	gap: 44px;
	max-width: 640px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.chugcheck-slider {
	position: relative;
}

.chugcheck-slider__labels {
	display: flex;
	justify-content: space-between;
	margin-bottom: 46px;
}

.chugcheck-slider__label {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--chugcheck-ink);
}

.chugcheck-slider__label--right {
	color: var(--chugcheck-ink);
}

.chugcheck-slider__stage {
	position: relative;
	padding-top: 4px;
}

/* --- Track --- */

.chugcheck-slider__track {
	position: relative;
	height: var(--chugcheck-height, 6px);
	border-radius: 999px;
	background: var(--chugcheck-track);
	cursor: pointer;
	outline: none;
	touch-action: none;
	transition: background-color 0.2s ease;
}

.chugcheck-slider__track:focus-visible {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--chugcheck-accent) 35%, transparent);
}

.chugcheck-slider__fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0%;
	border-radius: 999px;
	background: var(--chugcheck-accent);
	opacity: 0.16;
	transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}

/* --- Handle (custom, never a native <input type=range>) --- */

.chugcheck-slider__handle {
	position: absolute;
	top: 50%;
	left: 0%;
	width: 26px;
	height: 26px;
	margin-left: -13px;
	background: var(--chugcheck-surface);
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(28, 27, 25, 0.18), 0 0 0 1px rgba(28, 27, 25, 0.04);
	transform: translateY(-50%) scale(1);
	transition: box-shadow 0.2s ease, transform 0.15s ease, opacity 0.3s ease, left 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	cursor: grab;
	opacity: 0.55; /* muted by default: sitting at the community average, not yet the visitor's own vote */
}

.chugcheck-slider.is-voted .chugcheck-slider__handle,
.chugcheck-slider.is-dragging .chugcheck-slider__handle {
	opacity: 1;
}

.chugcheck-slider__track:hover .chugcheck-slider__handle {
	transform: translateY(-50%) scale(1.12);
	box-shadow: 0 4px 12px rgba(28, 27, 25, 0.22), 0 0 0 1px rgba(28, 27, 25, 0.05);
}

.chugcheck-slider.is-dragging .chugcheck-slider__handle {
	cursor: grabbing;
	transform: translateY(-50%) scale(1.2);
	transition: box-shadow 0.2s ease, transform 0.15s ease; /* no left-transition while dragging: must track finger 1:1 */
	box-shadow: 0 6px 16px rgba(28, 27, 25, 0.26), 0 0 0 1px rgba(28, 27, 25, 0.05);
}

.chugcheck-slider.is-releasing .chugcheck-slider__handle {
	animation: chugcheck-bounce 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chugcheck-bounce {
	0%   { transform: translateY(-50%) scale(1.2); }
	55%  { transform: translateY(-50%) scale(0.92); }
	100% { transform: translateY(-50%) scale(1); }
}

/* --- Markers (floating pill + pointer) --- */

.chugcheck-marker {
	position: absolute;
	bottom: calc(100% + 14px);
	left: 0%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	opacity: 0;
	pointer-events: none;
	transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease, bottom 0.3s ease;
	z-index: 2;
}

.chugcheck-marker--average.is-visible,
.chugcheck-marker--user.is-visible {
	opacity: 1;
	pointer-events: auto;
}

.chugcheck-marker--user {
	bottom: calc(100% + 46px); /* sits above the average marker so they never overlap */
}

.chugcheck-marker__pill {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	background: var(--chugcheck-surface);
	border-radius: 999px;
	padding: 7px 14px;
	box-shadow: 0 6px 20px rgba(28, 27, 25, 0.12), 0 1px 2px rgba(28, 27, 25, 0.06);
	white-space: nowrap;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chugcheck-marker--user .chugcheck-marker__pill {
	background: var(--chugcheck-accent);
}

.chugcheck-marker:hover .chugcheck-marker__pill {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(28, 27, 25, 0.16), 0 1px 2px rgba(28, 27, 25, 0.06);
}

.chugcheck-marker__title {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--chugcheck-ink-soft);
}

.chugcheck-marker--user .chugcheck-marker__title {
	color: rgba(255, 255, 255, 0.85);
}

.chugcheck-marker__detail {
	font-size: 13px;
	font-weight: 600;
	color: var(--chugcheck-ink);
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-height 0.2s ease, opacity 0.2s ease;
}

.chugcheck-marker--average:hover .chugcheck-marker__detail {
	max-height: 40px;
	opacity: 1;
}

.chugcheck-marker__pointer {
	width: 8px;
	height: 8px;
	background: var(--chugcheck-surface);
	transform: rotate(45deg);
	margin-top: -4px;
	box-shadow: 2px 2px 4px rgba(28, 27, 25, 0.06);
}

.chugcheck-marker--user .chugcheck-marker__pointer {
	background: var(--chugcheck-accent);
	box-shadow: none;
}

/* Subtle settle-in animation the first time a marker appears */
.chugcheck-marker.is-entering .chugcheck-marker__pill {
	animation: chugcheck-marker-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes chugcheck-marker-in {
	0%   { transform: translateY(6px) scale(0.9); opacity: 0; }
	100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Ambient breathing animation on the average pill so the page never feels static */
.chugcheck-marker--average.is-visible .chugcheck-marker__pill {
	animation: chugcheck-average-breathe 4.5s ease-in-out infinite;
}

@keyframes chugcheck-average-breathe {
	0%, 100% { box-shadow: 0 6px 20px rgba(28, 27, 25, 0.12), 0 1px 2px rgba(28, 27, 25, 0.06); }
	50%      { box-shadow: 0 8px 24px rgba(28, 27, 25, 0.15), 0 1px 2px rgba(28, 27, 25, 0.06); }
}

/* --- Dot marker style variant --- */

.chugcheck-sliders[data-marker-style="dot"] .chugcheck-marker__pill {
	padding: 4px 4px;
	border-radius: 50%;
}
.chugcheck-sliders[data-marker-style="dot"] .chugcheck-marker__title,
.chugcheck-sliders[data-marker-style="dot"] .chugcheck-marker__detail {
	display: none;
}
.chugcheck-sliders[data-marker-style="dot"] .chugcheck-marker__pill {
	width: 10px;
	height: 10px;
}

/* --- Footer meta row --- */

.chugcheck-slider__meta {
	margin-top: 14px;
	display: flex;
	justify-content: flex-end;
}

.chugcheck-slider__votes-count {
	font-size: 12px;
	color: var(--chugcheck-ink-soft);
	font-weight: 500;
}

/* --- Toast for "already voted" / errors --- */

.chugcheck-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%) translateY(12px);
	background: var(--chugcheck-ink);
	color: #fff;
	padding: 12px 20px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	box-shadow: 0 10px 30px rgba(0,0,0,0.2);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	z-index: 9999;
}

.chugcheck-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
	.chugcheck-slider__handle,
	.chugcheck-slider__fill,
	.chugcheck-marker,
	.chugcheck-marker__pill,
	.chugcheck-marker--average.is-visible .chugcheck-marker__pill {
		transition: none !important;
		animation: none !important;
	}
}

/* --- Mobile --- */

@media (max-width: 640px) {
	.chugcheck-sliders {
		gap: 40px;
		padding: 0 4px;
	}

	.chugcheck-slider__labels {
		margin-bottom: 40px;
	}

	.chugcheck-slider__label {
		font-size: 13px;
	}

	.chugcheck-slider__handle {
		width: 30px;
		height: 30px;
		margin-left: -15px;
	}

	.chugcheck-marker__pill {
		padding: 6px 11px;
	}

	.chugcheck-marker__title {
		font-size: 9px;
	}

	.chugcheck-marker__detail {
		font-size: 12px;
	}

	.chugcheck-marker--user {
		bottom: calc(100% + 42px);
	}
}
