/* Octagon TikTok Stories — v1.2 hover-preview cards (no fullscreen player) */

.octagon-stories {
	--os-radius: 18px;
	--os-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.25);
	--os-shadow-hover: 0 24px 50px -16px rgba(15, 23, 42, 0.45);
	--os-accent: #fe2c55;
	font-family: inherit;
	/* Break out of any parent (Elementor / theme) horizontal padding */
	margin-left: calc(-50vw + 50%);
	margin-right: calc(-50vw + 50%);
	margin-top: 2rem;
	margin-bottom: 2rem;
	width: 100vw;
	max-width: 100vw;
	box-sizing: border-box;
}

.octagon-stories *,
.octagon-stories *::before,
.octagon-stories *::after { box-sizing: border-box; }

/* ----------- Grid layout (mobile-first) ----------- */

.octagon-stories__grid {
	list-style: none;
	margin: 0;
	padding: 4px 16px 12px;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.octagon-stories__item {
	width: auto;
	max-width: none;
}

@media (min-width: 640px) {
	.octagon-stories__grid {
		gap: 20px;
		padding: 0 24px;
	}
}

@media (min-width: 1024px) {
	.octagon-stories { --os-radius: 22px; }
	.octagon-stories__grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 28px;
		max-width: 1480px;
		margin: 0 auto;
		padding: 0 40px;
	}
	.octagon-stories__caption { font-size: 17px; }
	.octagon-stories__stat { font-size: 13px; }
	.octagon-stories__play {
		width: 76px;
		height: 76px;
		margin: -38px 0 0 -38px;
	}
	.octagon-stories__badge {
		font-size: 12px;
		padding: 6px 12px 6px 10px;
		top: 14px;
		left: 14px;
	}
}

@media (min-width: 1600px) {
	.octagon-stories__grid {
		max-width: 1600px;
		gap: 32px;
		padding: 0 48px;
	}
}

/* ----------- Card ----------- */

.octagon-stories__card {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 9 / 16;
	background: #1a1a1a;
	border: 0;
	border-radius: var(--os-radius);
	padding: 0;
	overflow: hidden;
	cursor: pointer;
	box-shadow: var(--os-shadow);
	transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1),
	            box-shadow 0.25s ease;
	-webkit-tap-highlight-color: transparent;
	isolation: isolate;
	text-decoration: none;
	color: inherit;
}

.octagon-stories__card:hover {
	transform: translateY(-4px);
	box-shadow: var(--os-shadow-hover);
}

.octagon-stories__card:active {
	transform: scale(0.97);
	filter: brightness(0.95);
	transition: transform 0.1s ease, filter 0.1s ease;
}

.octagon-stories__card:focus-visible {
	outline: 3px solid var(--os-accent);
	outline-offset: 3px;
}

.octagon-stories__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
	            opacity 0.35s ease;
	z-index: 1;
}

.octagon-stories__preview {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	opacity: 0;
	transition: opacity 0.4s ease;
	z-index: 2;
	pointer-events: none;
	background: #000;
}

.octagon-stories__shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0.25) 0%,
		rgba(0, 0, 0, 0) 35%,
		rgba(0, 0, 0, 0) 55%,
		rgba(0, 0, 0, 0.85) 100%
	);
	z-index: 3;
	pointer-events: none;
}

.octagon-stories__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px 5px 8px;
	background: rgba(0, 0, 0, 0.55);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.3px;
	border-radius: 999px;
	z-index: 4;
	line-height: 1;
}

.octagon-stories__badge svg { display: block; flex: 0 0 auto; }

.octagon-stories__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.92);
	color: #050505;
	border-radius: 50%;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	z-index: 4;
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
	pointer-events: none;
}

.octagon-stories__play svg { margin-left: 3px; width: 22px; height: 22px; }

@media (max-width: 639px) {
	.octagon-stories__play {
		width: 48px;
		height: 48px;
		margin: -24px 0 0 -24px;
	}
	.octagon-stories__play svg { width: 16px; height: 16px; }
}

.octagon-stories__bottom {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	gap: 8px;
	color: #fff;
	align-items: flex-start;
}

.octagon-stories__stats {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
	padding: 6px 4px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.42);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.octagon-stories__stat {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1px;
	color: #fff;
	line-height: 1;
	white-space: nowrap;
}

.octagon-stories__stat + .octagon-stories__stat {
	border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.octagon-stories__stat svg {
	display: block;
	flex: 0 0 auto;
	opacity: 0.9;
}

.octagon-stories__caption {
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.1px;
	line-height: 1.3;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.7);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	max-width: 100%;
}

/* Compact sizing for small phones (2-column grid on tiny cards) */
@media (max-width: 639px) {
	.octagon-stories__bottom {
		left: 10px;
		right: 10px;
		bottom: 10px;
		gap: 6px;
	}
	.octagon-stories__caption { font-size: 13px; }
	.octagon-stories__stats { padding: 4px 2px; }
	.octagon-stories__stat { font-size: 11px; padding: 0 6px; gap: 3px; }
	.octagon-stories__stat svg { width: 10px; height: 10px; }
	.octagon-stories__badge {
		font-size: 10px;
		padding: 4px 8px 4px 6px;
		top: 10px;
		left: 10px;
	}
	.octagon-stories__badge svg { width: 12px; height: 12px; }
}

@media (min-width: 1024px) {
	.octagon-stories__caption { font-size: 16px; }
	.octagon-stories__stat { font-size: 13px; }
}

/* ----------- Hover state (desktop only) ----------- */

@media (hover: hover) and (pointer: fine) {
	.octagon-stories__card[data-playing="true"] .octagon-stories__preview {
		opacity: 1;
	}
	.octagon-stories__card[data-playing="true"] .octagon-stories__poster {
		opacity: 0;
	}
	.octagon-stories__card[data-playing="true"] .octagon-stories__play {
		opacity: 0;
		transform: scale(0.7);
	}
}

@media (prefers-reduced-motion: reduce) {
	.octagon-stories__card,
	.octagon-stories__poster,
	.octagon-stories__preview,
	.octagon-stories__play { transition: none; }
}
