/*
 * WP Shoppable Stories — assets/style.css
 * Version: 1.0.0
 * License: GPL-2.0-or-later
 */

/* ── LOCAL RESET ─────────────────────────────────────────── */
.wss-community-stories *,
.wss-lightbox * {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ── SECTION WRAPPER ─────────────────────────────────────── */
.wss-community-stories {
	max-width: 1280px;
	margin: 0 auto;
	padding: 48px 24px;
	background: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── OPTIONAL HEADER ─────────────────────────────────────── */
.wss-header {
	text-align: center;
	margin-bottom: 36px;
}

.wss-title {
	font-size: clamp(24px, 3vw, 36px);
	font-weight: 700;
	color: #111111;
	letter-spacing: -0.5px;
	line-height: 1.2;
	margin-bottom: 10px;
}

.wss-subtitle {
	font-size: 16px;
	color: #666666;
	font-weight: 400;
	max-width: 540px;
	margin: 0 auto;
	line-height: 1.6;
}

/* ── GRID ────────────────────────────────────────────────── */
.wss-grid {
	display: grid;
	grid-template-columns: repeat(var(--wss-columns, 5), 1fr);
	gap: 16px;
}

/* ── CARD ────────────────────────────────────────────────── */
.wss-card {
	position: relative;
	aspect-ratio: 9 / 16;
	background: #111111;
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	outline-offset: 3px;
	transition: transform 220ms ease, box-shadow 220ms ease;
	will-change: transform;
}

.wss-card:hover,
.wss-card:focus-visible {
	transform: scale(1.03);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
	z-index: 2;
}

.wss-card:focus-visible {
	outline: 3px solid #007aff;
}

/* Card media */
.wss-card-media {
	position: absolute;
	inset: 0;
}

.wss-card-media video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ── HOVER HINT (▶ icon on non-first cards) ──────────────── */
.wss-hover-hint {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 3;
	pointer-events: none;
	background: rgba(0, 0, 0, 0.12);
	transition: opacity 200ms ease;
}

.wss-hover-hint__icon {
	width: 52px;
	height: 52px;
	background: rgba(255, 255, 255, 0.18);
	border: 2px solid rgba(255, 255, 255, 0.6);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	color: #ffffff;
	padding-left: 3px; /* optical center for ▶ */
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	transition: transform 200ms ease, background 200ms ease;
}

/* Hide hint while video is playing */
.wss-card--playing .wss-hover-hint {
	opacity: 0;
}

/* Enlarge play icon on hover */
.wss-card:hover .wss-hover-hint__icon {
	transform: scale(1.15);
	background: rgba(255, 255, 255, 0.28);
}

/* ── CARD OVERLAY (product name + price) ─────────────────── */
.wss-card-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 40px 12px 14px;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.85) 0%,
		rgba(0, 0, 0, 0.35) 55%,
		transparent 100%
	);
	z-index: 2;
}

.wss-card-product-row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #00000070;
        padding: 5px;
        border-radius: 6px;
}

/* Product thumbnail (featured image) in grid overlay */
.wss-card-thumb {
	width: 40px;
	height: 40px;
	border-radius: 6px;
	object-fit: cover;
	flex-shrink: 0;
	border: 1px solid rgba(255, 255, 255, 0.3);
	background: #333333;
}

.wss-product-name {
	font-size: 13px;
	font-weight: 500;
	color: #ffffff;
	line-height: 1.2;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wss-product-price {
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
}

/* ── LIGHTBOX ────────────────────────────────────────────── */
.wss-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	background: #000000;
	z-index: 999999;
}

.wss-lightbox-container {
	position: relative;
	width: 100%;
	height: 100%;
}

/* Top bar */
.wss-lightbox-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 24px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
	z-index: 10;
}

.wss-lightbox-counter {
	color: #e0e0e0;
	font-size: 13px;
	background: rgba(255, 255, 255, 0.12);
	padding: 6px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.wss-lightbox-close {
	width: 44px;
	height: 44px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	color: #ffffff;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 200ms, color 200ms, transform 200ms;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	line-height: 1;
}

.wss-lightbox-close:hover,
.wss-lightbox-close:focus-visible {
	background: #ffffff;
	color: #000000;
	transform: scale(1.1);
	outline: none;
}

/* Scroll-snap container */
.wss-videos-container {
	height: 100dvh;
	overflow-y: scroll;
	scroll-snap-type: y mandatory;
	scrollbar-width: none;
	overscroll-behavior: contain;
}

.wss-videos-container::-webkit-scrollbar {
	display: none;
}

/* Individual slide */
.wss-video-slide {
	position: relative;
	height: 100dvh;
	width: 100%;
	scroll-snap-align: start;
	background: #0a0a0a;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.wss-slide-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	cursor: pointer;
}

/* Full-cover on mobile */
@media (max-width: 600px) {
	.wss-slide-video {
		object-fit: cover;
	}
}

/* ── PAUSE FLASH INDICATOR ───────────────────────────────── */
.wss-slide--paused::after {
	content: '⏸';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 60px;
	pointer-events: none;
	z-index: 5;
	animation: wss-pause-flash 0.6s ease forwards;
}

@keyframes wss-pause-flash {
	0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(1.2); }
	100% { opacity: 0;   transform: translate(-50%, -50%) scale(1);   }
}

/* ── PRODUCT CARD IN LIGHTBOX ────────────────────────────── */
.wss-product-card {
	position: absolute;
	bottom: 24px;
	left: 16px;
	right: 16px;
	background: rgba(18, 18, 18, 0.92);
	border-radius: 16px;
	padding: 18px;
	color: #ffffff;
	z-index: 100;
	border: 1px solid rgba(255, 255, 255, 0.1);
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.wss-product-content {
	display: flex;
	gap: 14px;
	align-items: center;
}

/* Product featured image thumbnail */
.wss-product-thumb {
	width: 72px;
	height: 72px;
	border-radius: 10px;
	overflow: hidden;
	background: #2a2a2a;
	flex-shrink: 0;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.wss-product-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wss-product-info {
	flex: 1;
	min-width: 0;
}

.wss-product-info h3 {
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	line-height: 1.3;
	margin-bottom: 6px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wss-product-info .price {
	font-size: 20px;
	font-weight: 700;
	color: #9d9d9d !important;
}

/* ── ACTION BUTTONS ──────────────────────────────────────── */
.wss-product-actions {
	display: flex;
	gap: 10px;
	margin-top: 16px;
}

/* Add to cart */
.wss-add-to-cart {
	flex: 2;
	height: 54px;
	padding: 5px 20px;
	background: #ffffff;
	color: #111111;
	border: none;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	transition: background 200ms, color 200ms, transform 150ms;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.wss-add-to-cart:hover:not(:disabled) {
	background: #5e5d5d;
	transform: translateY(-2px);
}

.wss-add-to-cart:active:not(:disabled) {
	transform: translateY(0);
}

.wss-add-to-cart:disabled,
.wss-add-to-cart.wss-btn--loading {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.wss-add-to-cart.wss-btn--added {
	background: #00c853;
	color: #ffffff;
}

/* View product link */
.wss-view-product {
	flex: 1;
	padding: 14px 16px;
	background: transparent;
	color: #cccccc;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 10px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 200ms, border-color 200ms, color 200ms;
	white-space: nowrap;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.wss-view-product:hover,
.wss-view-product:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.5);
	color: #ffffff;
	outline: none;
}

/* ── VOLUME BUTTON ───────────────────────────────────────── */
.wss-volume-btn {
	position: absolute;
	top: 88px;
	right: 24px;
	width: 44px;
	height: 44px;
	background: rgba(18, 18, 18, 0.72);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	color: #ffffff;
	cursor: pointer;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 200ms, transform 150ms;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}

.wss-volume-btn svg {
	width: 20px;
	height: 20px;
	display: block;
	flex-shrink: 0;
}

.wss-volume-btn:hover,
.wss-volume-btn:focus-visible {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.1);
	outline: none;
}

/* ── TOAST NOTIFICATION ──────────────────────────────────── */
.wss-toast {
	position: fixed;
	bottom: 44px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(18, 18, 18, 0.95);
	color: #ffffff;
	padding: 14px 28px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 500;
	z-index: 1000010;
	border: 1px solid rgba(255, 255, 255, 0.12);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
	white-space: nowrap;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	pointer-events: none;
	animation: wss-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.wss-toast--error {
	background: rgba(160, 30, 30, 0.95);
	border-color: rgba(255, 100, 100, 0.2);
}

@keyframes wss-toast-in {
	from { opacity: 0; transform: translateX(-50%) translateY(16px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
	.wss-grid { --wss-columns: 4 !important; }
}

@media (max-width: 800px) {
	.wss-grid {
		--wss-columns: 3 !important;
		gap: 10px;
	}

	.wss-community-stories { padding: 32px 16px; }

	.wss-product-card {
		bottom: 12px;
		left: 12px;
		right: 12px;
		padding: 14px;
	}

	.wss-product-thumb { width: 58px; height: 58px; }

	.wss-product-info h3    { font-size: 14px; }
	.wss-product-info .price { font-size: 17px; }

	.wss-add-to-cart  { font-size: 13px; padding: 12px 14px; }
	.wss-view-product { font-size: 12px; padding: 12px 10px; }
}

@media (max-width: 540px) {
	.wss-grid { --wss-columns: 2 !important; }
}

@media (max-width: 340px) {
	.wss-grid { --wss-columns: 1 !important; }
}

/* ── REDUCED MOTION ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.wss-card,
	.wss-lightbox-close,
	.wss-add-to-cart,
	.wss-hover-hint,
	.wss-hover-hint__icon,
	.wss-toast {
		transition: none;
		animation: none;
	}
}
