/* WordPress Memory Carousel Styles - Isolated to prevent conflicts */
/* Base Styles - Scoped to prevent global CSS variable conflicts */
.wp-memory-carousel-wrapper {
	/* Isolated CSS variables to prevent conflicts with theme */
	--mc-primary: #9d00ff;
	--mc-secondary: #00e5ff;
	--mc-accent: #ff00e5;
	--mc-background: #050510;
	--mc-card-bg: rgba(20, 20, 40, 0.7);
	--mc-text-primary: #ffffff;
	--mc-text-secondary: #b8b8ff;
	--mc-glow-primary: 0 0 10px rgba(157, 0, 255, 0.7),
		0 0 20px rgba(157, 0, 255, 0.5);
	--mc-glow-secondary: 0 0 10px rgba(0, 229, 255, 0.7),
		0 0 20px rgba(0, 229, 255, 0.5);
	--mc-glow-accent: 0 0 10px rgba(255, 0, 229, 0.7), 0 0 20px rgba(255, 0, 229, 0.5);
	--mc-card-width: 260px;
	--mc-card-height: 280px;
	--mc-carousel-radius: 340px;
	--mc-transition-speed: 0.5s;
}

/* WordPress specific wrapper - Enhanced isolation */
.wp-memory-carousel-wrapper {
	position: relative;
	width: 100%;
	height: 100vh;
	min-height: 600px;
	font-family: "Chakra Petch", sans-serif !important;
	background: #050510 url('../../../quiz-english/img/alphabet-wall-long.jpg') center/cover no-repeat !important;
	color: var(--mc-text-primary) !important;
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
	box-sizing: border-box !important;
	/* Reset any theme styles that might interfere */
	line-height: normal !important;
	text-align: left !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}


/* Typography */
.wp-memory-carousel-wrapper h1,
.wp-memory-carousel-wrapper h2,
.wp-memory-carousel-wrapper h3,
.wp-memory-carousel-wrapper h4,
.wp-memory-carousel-wrapper h5,
.wp-memory-carousel-wrapper h6 {
	font-family: "Orbitron", sans-serif;
	font-weight: 700;
	letter-spacing: 1px;
}

.wp-memory-carousel-wrapper .title {
	font-size: 2.5rem !important;
	margin: 0 !important;
	background: linear-gradient(90deg, var(--mc-primary), var(--mc-secondary)) !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	color: transparent !important;
	text-shadow: 0 0 15px rgba(157, 0, 255, 0.5) !important;
	animation: mc-pulse 3s infinite alternate !important;
}

/* Remove extra header spacing inside wrapper */
.wp-memory-carousel-wrapper header.py-3 {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

/* (Removed) Cosmic Background */

/* Container */
.wp-memory-carousel-wrapper .container-fluid {
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.wp-memory-carousel-wrapper .h-100 {
	height: 100% !important;
}

.wp-memory-carousel-wrapper .d-flex {
	display: flex !important;
}

.wp-memory-carousel-wrapper .flex-column {
	flex-direction: column !important;
}

.wp-memory-carousel-wrapper .flex-grow-1 {
	flex-grow: 1 !important;
}

.wp-memory-carousel-wrapper .align-items-center {
	align-items: center !important;
}

.wp-memory-carousel-wrapper .justify-content-center {
	justify-content: center !important;
}

.wp-memory-carousel-wrapper .position-relative {
	position: relative !important;
}

.wp-memory-carousel-wrapper .text-center {
	text-align: center !important;
}

.wp-memory-carousel-wrapper .py-3 {
	padding-top: 1rem !important;
	padding-bottom: 1rem !important;
}

/* Carousel Container */

.wp-memory-carousel-wrapper header,
.wp-memory-carousel-wrapper footer {
	display: none !important;
}

.wp-memory-carousel-wrapper .carousel-container {
	position: relative;
	width: 100%;
	height: 100% !important;
	perspective: 1000px;
	transform-style: preserve-3d;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin: 0 auto !important;
	/* Allow vertical scroll, block horizontal to keep drag UX */
	touch-action: pan-y; 
}

.wp-memory-carousel-wrapper .mc-carousel {
	position: relative !important;
	width: var(--mc-carousel-radius);
	height: var(--mc-carousel-radius);
	transform-style: preserve-3d;
	transition: transform var(--mc-transition-speed) ease;
	margin: 0 auto !important;
}

/* Ensure main area centers content regardless of theme styles */
.wp-memory-carousel-wrapper .mc-stage {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	height: 100% !important;
	width: 100% !important;
    z-index: 2; /* keep above floating letters */
}

/* Memory Cards */
.wp-memory-carousel-wrapper .memory-card {
	position: absolute;
	width: var(--mc-card-width);
	height: var(--mc-card-height);
	left: 50% !important;
	top: 50% !important;
	margin-left: calc(var(--mc-card-width) / -2) !important;
	margin-top: calc(var(--mc-card-height) / -2) !important;
	transform-style: preserve-3d;
	transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	cursor: pointer;
	pointer-events: auto; /* allow clicking any card */
	-webkit-tap-highlight-color: transparent; /* remove tap flash on iOS */
}

/* Prevent text selection during interaction */
.wp-memory-carousel-wrapper,
.wp-memory-carousel-wrapper * {
	user-select: none;
}

/* Front card layered above for reliable clicks */
.wp-memory-carousel-wrapper .memory-card.is-front { z-index: 5; }

/* Override SWELL first-child margin reset with higher specificity */
.post_content .wp-memory-carousel-wrapper .mc-carousel > .memory-card:first-child {
	margin-top: calc(var(--mc-card-height) / -2) !important;
}

.wp-memory-carousel-wrapper .card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wp-memory-carousel-wrapper .memory-card:hover .card-inner {
	transform: translateZ(20px);
}

.wp-memory-carousel-wrapper .memory-card.flipped .card-inner {
	transform: rotateY(180deg);
}

.wp-memory-carousel-wrapper .card-front,
.wp-memory-carousel-wrapper .card-back {
	position: absolute;
	width: 100%;
	height: 100%;
	backface-visibility: hidden;
	border-radius: 15px;
	overflow: hidden;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.wp-memory-carousel-wrapper .card-front {
	background: linear-gradient(
		135deg,
		rgba(255, 255, 255, 0.95),
		rgba(248, 248, 248, 0.98)
	);
	border: 2px solid rgba(61, 177, 52, 0.8) !important;
	transform-style: preserve-3d;
}

.wp-memory-carousel-wrapper .card-back {
	background: linear-gradient(
		135deg,
		rgba(248, 248, 248, 0.98),
		rgba(255, 255, 255, 0.95)
	);
	border: 2px solid rgba(45, 138, 40, 0.8) !important;
	transform: rotateY(180deg);
}

.wp-memory-carousel-wrapper .card-content {
	padding: 20px;
	height: 100%;
	display: flex;
	flex-direction: column;
	position: relative;
}

.wp-memory-carousel-wrapper .memory-date {
	font-family: "Orbitron", sans-serif;
	font-size: 0.8rem;
	color: rgba(45, 138, 40, 1) !important;
	margin-bottom: 10px;
	text-shadow: 0 0 5px rgba(45, 138, 40, 0.7);
}

.wp-memory-carousel-wrapper .memory-card .memory-title {
	font-size: 1.25rem;
	margin-bottom: 15px;
	color: rgba(45, 138, 40, 1) !important;
	text-shadow: 0 0 10px rgba(45, 138, 40, 0.5);
	font-family: "Orbitron", sans-serif;
	font-weight: 700;
	letter-spacing: 1px;
}

.wp-memory-carousel-wrapper .memory-image {
	width: 100%;
	height: 100px;
	margin-bottom: 15px;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	background: rgba(45, 138, 40, 1);
	color: #fff;
	border: 2px solid rgba(61, 177, 52, 1);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.wp-memory-carousel-wrapper .memory-image i {
	color: #ffffff !important;
	font-size: 3rem;
	text-shadow: 0 0 10px rgba(255, 255, 255, 0.4) !important;
	animation: mc-pulse 3s infinite alternate;
	z-index: 2;
}

.wp-memory-carousel-wrapper .glitch-effect {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(45deg, transparent 65%, rgba(255, 255, 255, 0.15) 70%, transparent 75%);
	background-size: 200% 200%;
	animation: mc-glitch 3s linear infinite;
	pointer-events: none; /* avoid blocking clicks */
	z-index: 1;
}

.wp-memory-carousel-wrapper .memory-image:hover {
	background: rgba(61, 177, 52, 1);
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(61, 177, 52, 0.35);
}

.wp-memory-carousel-wrapper .memory-image:active {
	transform: translateY(0);
	box-shadow: 0 4px 12px rgba(61, 177, 52, 0.25);
}

.wp-memory-carousel-wrapper .memory-image:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(61, 177, 52, 0.4);
}

@keyframes mc-glitch {
	0% {
		background-position: 0 0;
	}
	25% {
		background-position: 100% 0;
	}
	50% {
		background-position: 100% 100%;
	}
	75% {
		background-position: 0 100%;
	}
	100% {
		background-position: 0 0;
	}
}

.wp-memory-carousel-wrapper .card-back .card-content p {
	font-size: 0.8rem;
	color: rgba(45, 138, 40, 0.9) !important;
	margin-bottom: 20px;
	line-height: 1.5;
	flex-grow: 1;
}

.wp-memory-carousel-wrapper .memory-coordinates {
	font-family: "Orbitron", sans-serif;
	font-size: 0.8rem;
	color: rgba(61, 177, 52, 1) !important;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.wp-memory-carousel-wrapper .time-stamp {
	color: rgba(45, 138, 40, 1) !important;
}

.wp-memory-carousel-wrapper .card-glow {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 15px;
	pointer-events: none;
	background: radial-gradient(
		circle at 50% 50%,
		rgba(61, 177, 52, 0.1),
		transparent 70%
	);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.wp-memory-carousel-wrapper .memory-card:hover .card-glow {
	opacity: 1;
}

/* Carousel Controls */
.wp-memory-carousel-wrapper .carousel-controls {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 20px;
	z-index: 10;
}

.wp-memory-carousel-wrapper .control-btn {
	background: rgba(61, 177, 52, 0.7);
	border: 2px solid rgba(61, 177, 52, 1);
	color: rgb(255, 255, 255) !important;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 0 10px rgba(61, 177, 52, 0.7), 0 0 20px rgba(61, 177, 52, 0.5) !important;
}

.wp-memory-carousel-wrapper .control-btn:hover {
	background: rgba(45, 138, 40, 0.9);
	transform: scale(1.1);
}

/* Footer */
.wp-memory-carousel-wrapper footer {
	position: relative;
	z-index: 10;
}

.wp-memory-carousel-wrapper .instructions {
	font-size: 0.8rem;
	color: var(--mc-text-secondary) !important;
	opacity: 0.7;
}

/* Animations */
@keyframes mc-pulse {
	0%,
	100% {
		opacity: 0.8;
	}
	50% {
		opacity: 1;
	}
}

/* Responsive Adjustments */
@media (max-width: 768px) {
	.wp-memory-carousel-wrapper {
		--mc-card-width: 250px;
		--mc-card-height: 260px;
		--mc-carousel-radius: 300px;
		height: 80vh !important;
		min-height: 0 !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-memory-carousel-wrapper .title {
		font-size: 1.8rem;
	}

	.wp-memory-carousel-wrapper .carousel-container {
		height: 100% !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-memory-carousel-wrapper .mc-stage {
		height: 100% !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-memory-carousel-wrapper .memory-card .memory-title {
		font-size: 1.2rem;
	}

	.wp-memory-carousel-wrapper .memory-image {
		height: 120px;
	}
}

@media (max-width: 576px) {
	.wp-memory-carousel-wrapper {
		--mc-card-width: 220px;
		--mc-card-height: 240px;
		--mc-carousel-radius: 250px;
		height: 75vh !important;
		min-height: 0 !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-memory-carousel-wrapper .title {
		font-size: 1.5rem;
	}

	.wp-memory-carousel-wrapper .carousel-container {
		height: 100% !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-memory-carousel-wrapper .mc-stage {
		height: 100% !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}
}

/* Desktop-only: make cards smaller on PC */
@media screen and (min-width: 783px) {
	.wp-memory-carousel-wrapper {
		--mc-card-width: 220px;
		--mc-card-height: 240px;
	}

	.wp-memory-carousel-wrapper .memory-image {
		height: 90px;
	}
}

/* WordPress specific adjustments */
.wp-memory-carousel-wrapper {
	/* Reset any WordPress theme styles that might interfere */
	line-height: normal;
}

.wp-memory-carousel-wrapper * {
	/* Ensure all elements use border-box */
	box-sizing: border-box;
}

/* Ensure the carousel doesn't interfere with WordPress admin bar */
@media screen and (max-width: 782px) {
	.wp-memory-carousel-wrapper {
		margin-top: 0 !important;
		height: 80vh !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}
}

@media screen and (min-width: 783px) {
	.wp-memory-carousel-wrapper {
		margin-top: 0;
		height: 100vh;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}
}

/* Additional centering for admin bar presence */
.admin-bar .wp-memory-carousel-wrapper {
	height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
	.admin-bar .wp-memory-carousel-wrapper {
		height: calc(80vh - 46px) !important;
	}
}

