/* ============================================================
   Masalmint Animations CSS — 2026 Dinamik Tasarım
   3D CSS Book Hero + Scroll Progress + Particle Layer + Kinetic
   ============================================================ */

/* === GLOBAL ANIMATION INITIAL STATE ===
   GSAP yüklemeden önce öğelerin "flash" görünmesini engellemek için */
.mm-animations-ready .mm-hero-title,
.mm-animations-ready .mm-hero-subtitle,
.mm-animations-ready .mm-hero-actions,
.mm-animations-ready .mm-hero-trust {
	opacity: 1;
}

/* Reduce-motion: tüm animasyonlar pasif, statik göster */
.mm-no-animation *,
.mm-no-animation *::before,
.mm-no-animation *::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
	scroll-behavior: auto !important;
}

/* === SCROLL PROGRESS BAR (en üst) === */
.mm-scroll-progress {
	position: fixed;
	top: 0; left: 0;
	width: 100%;
	height: 3px;
	background: linear-gradient(90deg, var(--mm-primary, #5DC9A8), var(--mm-secondary, #FFB088));
	transform-origin: 0 0;
	transform: scaleX(0);
	z-index: 9999;
	will-change: transform;
	pointer-events: none;
}

/* === STICKY HEADER (scroll'da değişim) === */
.site-header {
	transition: backdrop-filter .3s ease, background .3s ease, box-shadow .3s ease, padding .3s ease;
}
.site-header.is-scrolled {
	background: rgba(255, 255, 255, .85);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	box-shadow: 0 4px 30px rgba(0, 0, 0, .06);
}
.site-header.is-scrolled .site-header-inner {
	padding: 10px 0;
}

/* === HERO PARTICLES LAYER === */
.mm-hero { position: relative; overflow: hidden; }
.mm-hero-particles {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}
.mm-hero > .mm-container { position: relative; z-index: 2; }

/* === HERO HEADING — gradient + kinetic için hazır === */
.mm-hero-title {
	background: linear-gradient(120deg,
		var(--mm-accent, #1A2A3F) 0%,
		var(--mm-accent, #1A2A3F) 40%,
		var(--mm-primary-dark, #4ba98b) 70%,
		var(--mm-primary, #5DC9A8) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	background-size: 200% auto;
	animation: mm-gradient-shift 8s ease-in-out infinite;
}
@keyframes mm-gradient-shift {
	0%, 100% { background-position: 0% 50%; }
	50%      { background-position: 100% 50%; }
}
.mm-hero-title .char {
	display: inline-block;
	transform-origin: 50% 100%;
	will-change: transform;
}

/* === 3D BOOK HERO === */
.mm-hero-image.mm-hero-3d-book {
	perspective: 1500px;
	perspective-origin: 50% 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mm-book-3d {
	position: relative;
	width: 320px;
	height: 420px;
	transform-style: preserve-3d;
	transform: rotateY(-25deg) rotateX(8deg);
	animation: mm-book-float 6s ease-in-out infinite;
	transition: transform .8s cubic-bezier(.16,1,.3,1);
}
.mm-book-3d:hover {
	transform: rotateY(0deg) rotateX(0deg) scale(1.05);
	animation-play-state: paused;
}

/* Ön kapak */
.mm-book-cover {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg,
		var(--mm-primary, #5DC9A8) 0%,
		var(--mm-primary-dark, #4ba98b) 50%,
		var(--mm-secondary, #FFB088) 100%);
	border-radius: 4px 14px 14px 4px;
	box-shadow:
		0 20px 60px rgba(0, 0, 0, .25),
		inset -8px 0 16px rgba(0, 0, 0, .15),
		inset 4px 0 8px rgba(255, 255, 255, .1);
	transform: translateZ(20px);
	overflow: hidden;
	padding: 32px 28px;
	color: #fff;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.mm-book-cover::before {
	content: '';
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .25), transparent 50%),
		radial-gradient(circle at 70% 80%, rgba(255, 224, 102, .3), transparent 50%);
	pointer-events: none;
}
.mm-book-cover-emoji {
	font-size: 80px;
	line-height: 1;
	text-align: center;
	filter: drop-shadow(0 4px 20px rgba(0, 0, 0, .2));
	animation: mm-emoji-pulse 3s ease-in-out infinite;
}
@keyframes mm-emoji-pulse {
	0%, 100% { transform: scale(1) rotate(-2deg); }
	50%      { transform: scale(1.06) rotate(2deg); }
}
.mm-book-cover-title {
	font-family: var(--mm-heading-font, 'Fraunces', Georgia, serif);
	font-size: 28px;
	font-weight: 800;
	line-height: 1.1;
	text-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.mm-book-cover-subtitle {
	font-size: 12px;
	opacity: .85;
	letter-spacing: 2px;
	text-transform: uppercase;
	font-weight: 600;
}
.mm-book-cover-name {
	font-family: var(--mm-heading-font);
	font-size: 36px;
	font-weight: 800;
	margin: 0;
	letter-spacing: -1px;
}
/* Çocuk adı her 4 saniyede değişiyor — JS yok, CSS animation */
.mm-book-cover-name span {
	display: inline-block;
	animation: mm-name-rotate 12s steps(1) infinite;
}

/* Sayfa kenarı (sağ) */
.mm-book-pages {
	position: absolute;
	right: -16px;
	top: 4px;
	bottom: 4px;
	width: 18px;
	background:
		repeating-linear-gradient(0deg,
			#fafaf7 0px, #fafaf7 1px,
			#e5e5dc 1px, #e5e5dc 2px);
	transform: translateZ(0) rotateY(20deg);
	transform-origin: 0 50%;
	border-radius: 0 4px 4px 0;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
}

/* Arka kapak */
.mm-book-back {
	position: absolute;
	inset: 0;
	background: var(--mm-primary-dark, #4ba98b);
	border-radius: 4px 14px 14px 4px;
	transform: translateZ(-20px);
}

/* Cilt (kenarı) */
.mm-book-spine {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 40px;
	background: linear-gradient(90deg,
		var(--mm-accent, #1A2A3F) 0%,
		var(--mm-primary-dark, #4ba98b) 100%);
	transform: translateZ(0) rotateY(-90deg);
	transform-origin: 0 50%;
	border-radius: 4px 0 0 4px;
}

/* Yıldız parlaması */
.mm-book-sparkle {
	position: absolute;
	width: 8px;
	height: 8px;
	background: var(--mm-secondary, #FFB088);
	border-radius: 50%;
	box-shadow:
		0 0 20px var(--mm-secondary, #FFB088),
		0 0 40px rgba(255, 176, 136, .5);
	animation: mm-sparkle 3s ease-in-out infinite;
}
.mm-book-sparkle:nth-child(1) { top: -20px; right: -20px; transform: translateZ(40px); animation-delay: 0s; }
.mm-book-sparkle:nth-child(2) { bottom: 30%; left: -30px; transform: translateZ(60px); width: 6px; height: 6px; animation-delay: 1s; }
.mm-book-sparkle:nth-child(3) { top: 20%; right: -40px; transform: translateZ(50px); width: 10px; height: 10px; animation-delay: 2s; }

@keyframes mm-sparkle {
	0%, 100% { transform: scale(1) translateZ(40px); opacity: 1; }
	50%      { transform: scale(1.5) translateZ(40px); opacity: .6; }
}

/* Kitap havada yüzme */
@keyframes mm-book-float {
	0%, 100% { transform: rotateY(-25deg) rotateX(8deg) translateY(0); }
	50%      { transform: rotateY(-20deg) rotateX(5deg) translateY(-15px); }
}

/* === PRODUCT/EXAMPLE CARDS — 3D tilt yapıldığında pürüzsüz === */
.mm-product-card,
.mm-example-card {
	transform-style: preserve-3d;
	transition: transform .5s cubic-bezier(.16,1,.3,1), box-shadow .3s ease;
	will-change: transform;
}

/* === MAGNETIC BUTTON — will-change ile pürüzsüz === */
.mm-btn-primary,
.mm-cart-link {
	will-change: transform;
}

/* === SECTION REVEAL — initial state (GSAP override edecek) === */
.mm-animations-ready .mm-step-card,
.mm-animations-ready .mm-example-card,
.mm-animations-ready .mm-testimonial,
.mm-animations-ready .mm-section-title,
.mm-animations-ready .mm-faq-item,
.mm-animations-ready .trust-badge {
	opacity: 1;
}

/* === ANIMATED BADGE — duyuru çubuğu === */
.mm-announcement {
	position: relative;
	overflow: hidden;
}
.mm-announcement::before {
	content: '';
	position: absolute;
	top: 0; left: -50%;
	width: 50%;
	height: 100%;
	background: linear-gradient(90deg,
		transparent 0%,
		rgba(255, 255, 255, .15) 50%,
		transparent 100%);
	animation: mm-shimmer 4s linear infinite;
}
@keyframes mm-shimmer {
	0%   { left: -50%; }
	100% { left: 100%; }
}

/* === CTA BUTON GLOW (primary) === */
.mm-btn-primary {
	position: relative;
	overflow: hidden;
	z-index: 1;
}
.mm-btn-primary::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg,
		transparent 30%,
		rgba(255, 255, 255, .4) 50%,
		transparent 70%);
	transform: translateX(-100%);
	transition: transform .6s ease;
	z-index: -1;
}
.mm-btn-primary:hover::after {
	transform: translateX(100%);
}

/* === STEP CARD ICON ROTATION === */
.mm-step-card:hover .mm-step-icon {
	animation: mm-icon-spin 0.6s ease-out;
}
@keyframes mm-icon-spin {
	0%   { transform: rotate(0) scale(1); }
	50%  { transform: rotate(180deg) scale(1.15); }
	100% { transform: rotate(360deg) scale(1); }
}

/* === FAQ ITEM ACCORDION YUMUŞATMA === */
.mm-faq-item summary {
	transition: background .2s ease;
}
.mm-faq-item summary:hover {
	background: rgba(93, 201, 168, .05);
}
.mm-faq-item[open] summary::after {
	transform: rotate(45deg) scale(1.2);
	color: var(--mm-secondary);
}

/* === TESTIMONIAL — quote mark === */
.mm-testimonial blockquote {
	position: relative;
	padding-top: 20px;
}
.mm-testimonial blockquote::before {
	content: '"';
	position: absolute;
	top: -10px;
	left: -10px;
	font-family: Georgia, serif;
	font-size: 80px;
	font-weight: 700;
	color: var(--mm-primary, #5DC9A8);
	opacity: .15;
	line-height: 1;
}

/* === EXAMPLE CARDS — hover'da kitap dönüşü === */
.mm-example-card .mm-example-cover {
	transition: transform .5s cubic-bezier(.16,1,.3,1);
}
.mm-example-card:hover .mm-example-cover {
	transform: scale(1.05) rotate(-1deg);
}
.mm-example-card .mm-example-cover span {
	display: inline-block;
	transition: transform .4s ease;
}
.mm-example-card:hover .mm-example-cover span {
	transform: scale(1.2) rotate(8deg);
}

/* === CTA BLOCK gradient ANIMATION === */
.mm-cta-block {
	position: relative;
	overflow: hidden;
	background:
		linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-primary-dark) 100%),
		radial-gradient(circle at 30% 30%, rgba(255, 176, 136, .4), transparent 50%);
	background-blend-mode: overlay;
}
.mm-cta-block::before {
	content: '';
	position: absolute;
	width: 300px; height: 300px;
	background: radial-gradient(circle, rgba(255, 224, 102, .4), transparent 60%);
	border-radius: 50%;
	top: -100px; left: -100px;
	animation: mm-orb-1 12s ease-in-out infinite;
}
.mm-cta-block::after {
	content: '';
	position: absolute;
	width: 400px; height: 400px;
	background: radial-gradient(circle, rgba(255, 176, 136, .3), transparent 60%);
	border-radius: 50%;
	bottom: -150px; right: -150px;
	animation: mm-orb-2 16s ease-in-out infinite;
}
@keyframes mm-orb-1 {
	0%, 100% { transform: translate(0, 0); }
	50%      { transform: translate(60px, 80px); }
}
@keyframes mm-orb-2 {
	0%, 100% { transform: translate(0, 0); }
	50%      { transform: translate(-80px, -60px); }
}

/* === MOBILE — 3D ve heavy efektleri kapat === */
@media (max-width: 768px) {
	.mm-book-3d {
		width: 240px;
		height: 320px;
		transform: rotateY(-15deg) rotateX(5deg);
		animation: none;
	}
	.mm-hero-particles { display: none; }
	.mm-product-card,
	.mm-example-card { transform: none !important; }
	.mm-cta-block::before,
	.mm-cta-block::after { display: none; }
}

/* === REDUCED MOTION OVERRIDE === */
@media (prefers-reduced-motion: reduce) {
	.mm-book-3d,
	.mm-book-cover-emoji,
	.mm-book-sparkle,
	.mm-cta-block::before,
	.mm-cta-block::after,
	.mm-announcement::before,
	.mm-hero-title {
		animation: none !important;
	}
	.mm-book-3d { transform: none !important; }
}

/* === VIEW TRANSITIONS API (modern tarayıcılar) === */
@view-transition {
	navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
	animation-duration: 0.4s;
	animation-timing-function: cubic-bezier(.16, 1, .3, 1);
}

/* === SCROLL-DRIVEN ANIMATIONS (native CSS, JS gerek yok) === */
@supports (animation-timeline: scroll()) {
	/* Hero arka plan parallax */
	.mm-hero-bg {
		animation: mm-hero-parallax linear;
		animation-timeline: scroll();
		animation-range: 0 100vh;
	}
	@keyframes mm-hero-parallax {
		to { transform: translateY(50px); }
	}
}
