/* ============================================================
   Sunsoul Stories front-end styles.
   Theme CSS variables are used when they are available.
   ============================================================ */

.sunsoul-stories-wrap {
	width: 100vw;
	margin-left: calc(50% - 50vw);
	overflow: hidden;
}

.sunsoul-stories-row {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	padding: 8px 20px 16px;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.sunsoul-stories-row::-webkit-scrollbar { display: none; }

.sunsoul-stories-wrap--seamless .sunsoul-stories-row { gap: 0; }

/* Carousel: continuous right-to-left scrolling. */
.sunsoul-stories-row--carousel {
	flex-wrap: nowrap;
	width: max-content;
	overflow: visible;
	will-change: transform;
	animation: sunsoulStoriesMarquee 70s linear infinite;
}
.sunsoul-stories-row--carousel:hover,
.sunsoul-stories-row--carousel:focus-within {
	animation-play-state: paused;
}
@keyframes sunsoulStoriesMarquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

.sunsoul-story-item {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 222px;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	font-family: inherit;
	appearance: none;
}

.sunsoul-story-thumb {
	position: relative;
	width: 213px;
	height: 285px;
	border-radius: 16px;
	overflow: hidden;
	border: 2px solid var(--gold, #C8962A);
	box-shadow: 0 4px 16px rgba(92, 61, 30, 0.12);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.sunsoul-stories-wrap--seamless .sunsoul-story-thumb {
	border-radius: 0;
	border-width: 0 1px 0 0;
	box-shadow: none;
}
.sunsoul-stories-wrap--seamless .sunsoul-story-item:last-child .sunsoul-story-thumb {
	border-right-width: 0;
}

.sunsoul-story-item:hover .sunsoul-story-thumb,
.sunsoul-story-item:focus-visible .sunsoul-story-thumb {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(92, 61, 30, 0.18);
}

.sunsoul-story-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: translateZ(0);
	backface-visibility: hidden;
}

.sunsoul-story-play-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(20, 14, 8, 0.22);
}
.sunsoul-story-play-icon svg {
	width: 22px;
	height: 22px;
	fill: #fff;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.sunsoul-story-label {
	font-size: 11px;
	font-weight: 600;
	color: var(--text, #3E2A10);
	max-width: 222px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-align: center;
}

@media (max-width: 640px) {
	.sunsoul-stories-row {
		gap: 12px;
		padding-inline: 12px;
	}

	.sunsoul-story-item {
		width: 168px;
	}

	.sunsoul-story-thumb {
		width: 162px;
		height: 219px;
	}

	.sunsoul-story-label {
		max-width: 168px;
	}
}

/* Touch devices use a native swipeable rail instead of a continuously
   moving target. Duplicate marquee items are only needed on desktop. */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
	.sunsoul-stories-wrap {
		width: 100%;
		margin-left: 0;
		overflow: visible;
	}

	.sunsoul-stories-row,
	.sunsoul-stories-row--carousel {
		width: 100%;
		max-width: 100%;
		overflow-x: auto;
		overflow-y: hidden;
		animation: none;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.sunsoul-stories-row--carousel .sunsoul-story-item[aria-hidden="true"] {
		display: none;
	}

	.sunsoul-story-item {
		scroll-snap-align: start;
		touch-action: manipulation;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sunsoul-stories-row--carousel {
		animation: none;
	}
}

/* ============================================================
   Full-screen viewer.
   ============================================================ */
.sunsoul-stories-viewer {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(18, 12, 6, 0.92);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sunsoul-stories-viewer--open {
	opacity: 1;
	visibility: visible;
}

.sunsoul-stories-viewer-inner {
	position: relative;
	width: min(420px, 92vw);
	height: min(90vh, 760px);
	border-radius: 18px;
	overflow: hidden;
	background: #000;
}

.sunsoul-story-frames {
	position: relative;
	width: 100%;
	height: 100%;
}

.sunsoul-story-frame {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: #111;
}
.sunsoul-story-frame--active { display: flex; }

.sunsoul-story-image,
.sunsoul-story-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	background: #000;
	image-rendering: auto;
}

.sunsoul-story-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	padding: 28px 20px 30px;
	text-align: center;
	background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 85%);
	color: #fff;
	font-size: 14px;
	line-height: 1.6;
	pointer-events: none;
}
.sunsoul-story-caption p { margin: 0 0 6px; }
.sunsoul-story-caption p:last-child { margin-bottom: 0; }

.sunsoul-story-progress {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	z-index: 4;
	display: flex;
	gap: 5px;
}
.sunsoul-story-progress-bar {
	flex: 1;
	height: 3px;
	background: rgba(255, 255, 255, 0.32);
	border-radius: 3px;
	overflow: hidden;
}
.sunsoul-story-progress-fill {
	display: block;
	height: 100%;
	width: 0%;
	background: #fff;
}

.sunsoul-story-header {
	position: absolute;
	top: 26px;
	left: 12px;
	right: 12px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
}
.sunsoul-story-header-label {
	margin-right: auto;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sunsoul-story-mute-btn,
.sunsoul-story-close-btn {
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sunsoul-story-nav {
	position: absolute;
	top: 60px;
	bottom: 0;
	width: 34%;
	z-index: 2;
	cursor: pointer;
}
.sunsoul-story-nav--prev { left: 0; }
.sunsoul-story-nav--next { right: 0; }

@media (max-width: 480px) {
	.sunsoul-stories-viewer-inner {
		width: 100vw;
		height: 100vh;
		border-radius: 0;
	}
}
