/* ReelShop frontend — Instagram-style reels feed. Lightweight, scroll-snap based. */

.rs-feed {
	--rs-accent: #e1306c;
	position: relative;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	background: #000;
	overflow: hidden;
	border-radius: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.rs-feed--full {
	height: 100vh;
	height: 100dvh;
	max-width: 100%;
	border-radius: 0;
}

.rs-feed--tall {
	height: 80vh;
	height: 80dvh;
}

/* The scrolling track does all the snapping — no JS scroll logic. */
.rs-track {
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	scroll-snap-type: y mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.rs-track::-webkit-scrollbar {
	display: none;
}

.rs-reel {
	position: relative;
	height: 100%;
	width: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	overflow: hidden;
}

.rs-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	cursor: pointer;
}

/* Play indicator when paused. */
.rs-play-ind {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: rgba(255, 255, 255, 0.92);
	font-size: 54px;
	line-height: 1;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.rs-reel.rs-paused .rs-play-ind {
	opacity: 1;
}

/* Double-tap heart burst. */
.rs-burst {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0);
	color: #fff;
	opacity: 0;
	pointer-events: none;
	z-index: 4;
	filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}

.rs-burst svg {
	width: 96px;
	height: 96px;
}

.rs-burst svg .rs-heart-path {
	fill: var(--rs-accent);
	stroke: var(--rs-accent);
}

.rs-burst.rs-bursting {
	animation: rs-burst 0.85s ease forwards;
}

@keyframes rs-burst {
	0%   { opacity: 0; transform: translate(-50%, -50%) scale(0); }
	22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
	38%  { transform: translate(-50%, -50%) scale(0.96); }
	55%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	100% { opacity: 0; transform: translate(-50%, -54%) scale(1); }
}

/* ----- Right action rail (like / comment / mute) ----- */

.rs-rail {
	position: absolute;
	right: 10px;
	bottom: 96px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

.rs-act {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	background: none;
	border: none;
	padding: 4px;
	color: #fff;
	cursor: pointer;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
	-webkit-tap-highlight-color: transparent;
}

.rs-act:active svg {
	transform: scale(0.85);
}

.rs-act svg {
	transition: transform 0.12s ease;
}

.rs-count {
	font-size: 12.5px;
	font-weight: 600;
	color: #fff;
	line-height: 1;
}

/* Liked state — filled accent heart with a pop. */
.rs-like.rs-liked svg .rs-heart-path {
	fill: var(--rs-accent);
	stroke: var(--rs-accent);
}

.rs-like.rs-liked svg {
	animation: rs-pop 0.3s ease;
}

@keyframes rs-pop {
	0%   { transform: scale(0.7); }
	60%  { transform: scale(1.2); }
	100% { transform: scale(1); }
}

/* Mute icon (SVG). */
.rs-mute .rs-mute-on,
.rs-mute .rs-mute-off {
	display: flex;
	align-items: center;
	justify-content: center;
}

.rs-mute .rs-mute-off {
	display: none;
}

.rs-feed:not(.rs-is-muted) .rs-mute .rs-mute-on {
	display: none;
}

.rs-feed:not(.rs-is-muted) .rs-mute .rs-mute-off {
	display: inline;
}

/* ----- Bottom overlay: title + caption with Buy Now beside ----- */

.rs-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: flex;
	align-items: flex-end;
	gap: 12px;
	padding: 70px 64px 18px 14px; /* right padding clears the action rail */
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 60%, rgba(0, 0, 0, 0) 100%);
	pointer-events: none;
}

.rs-meta {
	flex: 1 1 auto;
	min-width: 0;
}

.rs-title {
	color: #fff;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 4px;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rs-caption {
	color: rgba(255, 255, 255, 0.92);
	font-size: 13.5px;
	line-height: 1.4;
	margin: 0;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Buy Now — sits beside the title/description, links to the product page. */
.rs-buy {
	pointer-events: auto;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--rs-accent);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	padding: 11px 16px;
	border-radius: 22px;
	text-decoration: none;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	transition: transform 0.12s ease, filter 0.12s ease;
	white-space: nowrap;
}

.rs-buy:hover {
	transform: translateY(-2px);
	filter: brightness(1.08);
	color: #fff;
}

.rs-buy svg {
	flex: 0 0 auto;
}

/* ----- Comments drawer (slide-up, Instagram style) ----- */

.rs-drawer {
	position: absolute;
	inset: 0;
	z-index: 8;
	visibility: hidden;
}

.rs-drawer.rs-open {
	visibility: visible;
}

.rs-drawer-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.rs-drawer.rs-open .rs-drawer-backdrop {
	opacity: 1;
}

.rs-drawer-sheet {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 62%;
	background: #fff;
	border-radius: 16px 16px 0 0;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 0.25s ease;
}

.rs-drawer.rs-open .rs-drawer-sheet {
	transform: translateY(0);
}

.rs-drawer-bar {
	padding: 10px 0 4px;
	cursor: pointer;
	flex: 0 0 auto;
}

.rs-drawer-bar span {
	display: block;
	width: 38px;
	height: 4px;
	border-radius: 2px;
	background: #d0d0d0;
	margin: 0 auto;
}

.rs-drawer-title {
	margin: 2px 0 8px;
	text-align: center;
	font-size: 13.5px;
	font-weight: 700;
	color: #111;
	flex: 0 0 auto;
}

.rs-drawer-list {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 4px 14px;
	-webkit-overflow-scrolling: touch;
}

.rs-drawer-hint {
	text-align: center;
	color: #888;
	font-size: 13.5px;
	padding: 26px 10px;
	margin: 0;
}

.rs-cmt {
	display: flex;
	gap: 10px;
	padding: 9px 0;
}

.rs-cmt-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
	background: #eee;
}

.rs-cmt-body {
	min-width: 0;
}

.rs-cmt-head {
	margin: 0 0 2px;
	font-size: 12.5px;
	color: #111;
}

.rs-cmt-head span {
	color: #999;
	font-size: 11.5px;
	margin-left: 6px;
}

.rs-cmt-text {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.4;
	color: #222;
	word-wrap: break-word;
}

.rs-drawer-foot {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid #ececec;
	background: #fff;
}

.rs-cmt-input {
	flex: 1 1 auto;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 10px 15px;
	font-size: 14px;
	outline: none;
	min-width: 0;
}

.rs-cmt-input:focus {
	border-color: var(--rs-accent);
}

.rs-cmt-post {
	flex: 0 0 auto;
	border: none;
	background: var(--rs-accent);
	color: #fff;
	font-size: 13.5px;
	font-weight: 700;
	padding: 0 18px;
	border-radius: 20px;
	cursor: pointer;
}

.rs-cmt-post:disabled {
	opacity: 0.6;
	cursor: default;
}

.rs-cmt-login {
	flex: 1 1 auto;
	text-align: center;
	background: var(--rs-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	padding: 12px;
	border-radius: 22px;
	text-decoration: none;
}

.rs-cmt-login:hover {
	color: #fff;
	filter: brightness(1.08);
}

/* ----- Fullscreen / immersive toggle (top-left) ----- */

.rs-fs {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 6;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 17px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(2px);
}

.rs-fs .rs-fs-close {
	display: none;
}

.rs-feed.rs-immersive .rs-fs .rs-fs-open {
	display: none;
}

.rs-feed.rs-immersive .rs-fs .rs-fs-close {
	display: inline;
}

/* Immersive mode: cover the entire viewport, above the site header. */
.rs-feed.rs-immersive {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	height: 100vh;
	height: 100dvh;
	max-width: 100%;
	border-radius: 0;
	z-index: 999999;
	margin: 0;
	background: #000;
}

/* ----- Desktop optimisation: centered phone-style portrait column ----- */

@media ( min-width: 768px ) {

	.rs-feed--full {
		max-width: 440px;
		margin-left: auto;
		margin-right: auto;
		border-radius: 0;
	}

	.rs-feed.rs-immersive {
		width: 440px;
		max-width: 440px;
	}

	.rs-feed.rs-immersive::before {
		content: '';
		position: fixed;
		inset: 0;
		background: #000;
		z-index: -1;
	}

	.rs-fs {
		width: 44px;
		height: 44px;
		font-size: 18px;
	}
}

/* ----- Loader / misc ----- */

.rs-loader {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 5;
}

.rs-spinner {
	display: block;
	width: 26px;
	height: 26px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rs-spin 0.7s linear infinite;
}

@keyframes rs-spin {
	to { transform: rotate(360deg); }
}

.rs-empty {
	padding: 40px 20px;
	text-align: center;
	color: #666;
	font-size: 14px;
}

@media ( prefers-reduced-motion: reduce ) {
	.rs-spinner { animation: none; }
	.rs-buy,
	.rs-drawer-backdrop,
	.rs-drawer-sheet { transition: none; }
	.rs-burst.rs-bursting,
	.rs-like.rs-liked svg { animation: none; }
}

/* ----- v3: views label, progress bar, swipe hint ----- */

.rs-views {
	color: rgba(255, 255, 255, 0.78);
	font-size: 12px;
	margin: 5px 0 0;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Playback progress bar — thin line at the very bottom of each reel. */
.rs-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.22);
	z-index: 4;
	pointer-events: none;
}

.rs-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #fff;
}

/* Swipe-up hint — two pulsing chevrons, first visit only. */
.rs-hint {
	position: absolute;
	bottom: 150px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 7;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 0.55;
	color: #fff;
	font-size: 30px;
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
	transition: opacity 0.3s ease;
}

.rs-hint-chevron {
	animation: rs-hint-float 1.4s ease-in-out infinite;
}

.rs-hint-chevron2 {
	animation-delay: 0.18s;
	opacity: 0.6;
}

.rs-hint-out {
	opacity: 0;
}

@keyframes rs-hint-float {
	0%, 100% { transform: translateY(0); opacity: 0.5; }
	50%      { transform: translateY(-9px); opacity: 1; }
}

@media ( prefers-reduced-motion: reduce ) {
	.rs-hint-chevron { animation: none; }
}
