/* =========================================================
   Folio – 3D Flipbook Catalog — استایل نمایش v2.2
   ========================================================= */

.fc-catalog {
	--fc-ratio: 1.414;
	--fc-accent: #FFCC00;
	max-width: 1100px;
	margin: 28px auto;
	direction: rtl;
	-webkit-tap-highlight-color: transparent;
}

/* بستر — پیش‌فرض شفاف */
.fc-book-wrap {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 30px 18px 48px;
	box-sizing: border-box;
	border-radius: 14px;
}
.fc-catalog:not(.fc-ready) .fc-book-wrap { min-height: 320px; }
/* بسترِ خاکستریِ «در حال بارگذاری» — فقط وقتی پس‌زمینه‌ی رنگی انتخاب نشده (bg=none) */
.fc-bg-none:not(.fc-ready) .fc-book-wrap {
	background: linear-gradient(180deg, #f4f4f7, #e8e8ee);
}
/* درخششِ ملایمِ اسکلتون تا کاربر بفهمد در حال بارگذاری است (همه‌ی حالت‌ها) */
.fc-catalog:not(.fc-ready) .fc-book-wrap::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
	background-size: 220% 100%;
	animation: fc-shimmer 1.5s ease-in-out infinite;
	pointer-events: none;
	z-index: 0;
}
.fc-catalog.fc-ready .fc-book-wrap::after { display: none; }
@keyframes fc-shimmer {
	0%   { background-position: 160% 0; }
	100% { background-position: -60% 0; }
}

/* پس‌زمینه‌های اختیاری */
.fc-bg-light .fc-book-wrap {
	background:
		radial-gradient(120% 120% at 50% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%),
		linear-gradient(180deg, #f3f1ea, #e5e1d6);
}
.fc-bg-dark .fc-book-wrap {
	background:
		radial-gradient(120% 120% at 50% 0%, rgba(255, 255, 255, .08), rgba(0, 0, 0, 0) 55%),
		linear-gradient(180deg, #26221c, #14110c);
}
.fc-bg-wood .fc-book-wrap {
	background:
		linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.18)),
		repeating-linear-gradient(90deg, #8a5a2b, #8a5a2b 22px, #7d5026 22px, #7d5026 44px),
		linear-gradient(180deg, #9a6631, #7a4d24);
}

/* صحنه — هدف انیمیشن ورود (transform بعد از پایان با JS حذف می‌شود) */
.fc-scene {
	position: relative;
	width: 100%;
	display: flex;
	justify-content: center;
}

.fc-stage {
	position: relative;
	width: 100%;
	margin: 0 auto;
	z-index: 1;
}
.fc-stage .stf__parent { margin: 0 auto; }

/* ---- جسمِ فیزیکی کتاب: برگه‌های جدا از هم (لبه‌ی کتابچه‌ای) ---- */
/* لایه‌ی روشن = رویه‌ی کاغذ، لایه‌ی تیره = شیار بین دو برگه → برگه‌ها تک‌تک دیده می‌شوند */
.fc-stage canvas {
	border-radius: 2px 4px 4px 2px;
	box-shadow:
		-2px 1px 0 #fbf7ee, -4px 1px 0 #a89a78,
		-6px 2px 0 #f4eede, -8px 2px 0 #9d8f6d,
		-10px 3px 0 #efe8d5, -12px 3px 0 #948668,
		-14px 4px 0 #eae2cd, -16px 4px 0 #8c7e60,
		-18px 5px 0 #e5dcc4, -20px 5px 0 #857758,
		5px 5px 12px -2px rgba(0, 0, 0, .40),
		12px 18px 30px -6px rgba(0, 0, 0, .26),
		0 30px 46px -10px rgba(0, 0, 0, .22);
	animation: fc-breathe 5s ease-in-out infinite;
}
.fc-ltr .fc-stage canvas {
	border-radius: 4px 2px 2px 4px;
	box-shadow:
		2px 1px 0 #fbf7ee, 4px 1px 0 #a89a78,
		6px 2px 0 #f4eede, 8px 2px 0 #9d8f6d,
		10px 3px 0 #efe8d5, 12px 3px 0 #948668,
		14px 4px 0 #eae2cd, 16px 4px 0 #8c7e60,
		18px 5px 0 #e5dcc4, 20px 5px 0 #857758,
		-5px 5px 12px -2px rgba(0, 0, 0, .40),
		-12px 18px 30px -6px rgba(0, 0, 0, .26),
		0 30px 46px -10px rgba(0, 0, 0, .22);
	animation: none;
}
/* تنفس سایه — هنگام drag متوقف می‌شود تا با رندر کاغذ رقابت نکند */
@keyframes fc-breathe {
	0%, 100% { filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .10)); }
	50%      { filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .16)); }
}
.fc-dragging .fc-stage canvas { animation-play-state: paused; }

/* سایه‌ی زمین (روی پس‌زمینه‌ی شفاف هم کار می‌کند) */
.fc-floor {
	position: absolute;
	bottom: -22px;
	left: 6%;
	right: 6%;
	height: 38px;
	border-radius: 50%;
	background: radial-gradient(ellipse at center,
		rgba(0, 0, 0, .26) 0%, rgba(0, 0, 0, .13) 40%, transparent 72%);
	pointer-events: none;
	z-index: -1;
	animation: fc-floor-breathe 5s ease-in-out infinite;
	animation-delay: -2.5s;
}
@keyframes fc-floor-breathe {
	0%, 100% { opacity: .85; transform: scaleX(1); }
	50%      { opacity: .60; transform: scaleX(.94); }
}
.fc-dragging .fc-floor { animation-play-state: paused; }

/* برق گوشه‌ی کاغذ — دعوت به ورق‌زدن، هر ۸ ثانیه */
.fc-glint {
	position: absolute;
	top: 0;
	left: 0;                /* RTL: گوشه‌ی بازشوی صفحه سمت چپ است */
	width: 48px;
	height: 48px;
	pointer-events: none;
	z-index: 3;
	background: conic-gradient(from -45deg at 0% 0%,
		rgba(255, 255, 255, 0) 0deg,
		rgba(255, 240, 160, .55) 18deg,
		rgba(255, 255, 255, .70) 26deg,
		rgba(255, 255, 255, 0) 45deg);
	opacity: 0;
	animation: fc-glint-cycle 8s ease-in-out infinite;
}
.fc-ltr .fc-glint {
	left: auto;
	right: 0;
	background: conic-gradient(from 225deg at 100% 0%,
		rgba(255, 255, 255, 0) 0deg,
		rgba(255, 240, 160, .55) 18deg,
		rgba(255, 255, 255, .70) 26deg,
		rgba(255, 255, 255, 0) 45deg);
}
@keyframes fc-glint-cycle {
	0%, 100% { opacity: 0; }
	2%       { opacity: .85; }
	5%       { opacity: 0; }
	6.5%     { opacity: .30; }
	8%       { opacity: 0; }
}
.fc-dragging .fc-glint { animation-play-state: paused; }

/* پیش‌نمایش جلد PDF — تا آماده شدن صفحه‌ها نمایش داده می‌شود */
.fc-poster {
	position: absolute;
	inset: 30px 18px 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	pointer-events: none;
	transition: opacity .45s ease, transform .45s ease;
}
.fc-poster img {
	max-width: min(100%, 420px);
	max-height: 100%;
	height: auto;
	border-radius: 3px;
	/* همان ضخامت صفحات تا شبیه خود کتاب باشد */
	box-shadow:
		-2px 1px 0 #f5f0e8, -4px 2px 0 #ece5d5, -6px 3px 0 #e2dac6,
		-8px 4px 0 #d8cfb7,
		4px 4px 8px -2px rgba(0, 0, 0, .40),
		0 22px 34px -8px rgba(0, 0, 0, .22);
	animation: fc-poster-pulse 2.4s ease-in-out infinite;
}
@keyframes fc-poster-pulse {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.012); }
}
.fc-catalog.fc-ready .fc-poster {
	opacity: 0;
	transform: scale(.985);
}
/* بعد از پایان ترنزیشن کامل حذف بصری */
.fc-catalog.fc-ready .fc-poster img { animation: none; }

/* لودر + پیشرفت PDF */
.fc-loader {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	align-content: center;
	gap: 12px;
	z-index: 3;
	pointer-events: none;
}
.fc-loader span {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	/* اسپینر: حلقه‌ی نازکِ کم‌رنگ + کمانِ طلاییِ ۹۰درجه (بالا+راست) که می‌چرخد */
	border: 4px solid rgba(0, 0, 0, .12);
	border-top-color: var(--fc-accent);
	border-right-color: var(--fc-accent);
	filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .18));
	animation: fc-spin .8s linear infinite;
}
.fc-bg-dark .fc-loader span {
	border-color: rgba(255, 255, 255, .16);
	border-top-color: var(--fc-accent);
	border-right-color: var(--fc-accent);
}
.fc-progress { font-size: 13px; font-style: normal; color: #555; font-weight: 600; }
.fc-bg-dark .fc-progress { color: #ddd; }

/* وقتی پیش‌نمایش جلد هست: اسپینرِ کوچک بالای pillِ پیشرفت، هر دو پایینِ تصویر */
.fc-catalog:has(.fc-poster) .fc-loader { align-content: end; padding-bottom: 14px; gap: 10px; }
.fc-catalog:has(.fc-poster) .fc-loader span { width: 34px; height: 34px; border-width: 3px; }
.fc-catalog:has(.fc-poster) .fc-progress {
	background: rgba(0, 0, 0, .65);
	color: #fff;
	padding: 6px 16px;
	border-radius: 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.fc-catalog.fc-ready .fc-loader { display: none; }
@keyframes fc-spin { to { transform: rotate(360deg); } }

/* ---------- انیمیشن‌های ورود ---------- */
/* «قرار گرفتن روی میز» — تیلت سه‌بعدی که صاف می‌نشیند */
.fc-in-settle {
	animation: fc-settle 1s cubic-bezier(.22, 1, .36, 1) both;
	transform-origin: center bottom;
}
@keyframes fc-settle {
	0%   { opacity: 0; transform: perspective(900px) rotateX(22deg) rotateY(-8deg) translateY(-24px) scale(.94); filter: blur(3px); }
	60%  { opacity: 1; transform: perspective(900px) rotateX(-2deg) rotateY(1deg) translateY(2px) scale(1.005); filter: blur(0); }
	80%  { transform: perspective(900px) rotateX(1deg) rotateY(-.5deg) translateY(-1px); }
	100% { transform: perspective(900px) rotateX(0) rotateY(0) translateY(0) scale(1); filter: blur(0); }
}

/* «درخشش جلد» — ظهور سریع + جاروی نور طلایی روی جلد */
.fc-in-sweep { animation: fc-appear .55s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes fc-appear {
	0%   { opacity: 0; transform: scale(.97) translateY(10px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}
.fc-shine {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 10;
	border-radius: inherit;
	background: linear-gradient(115deg,
		transparent 0%, transparent 28%,
		rgba(255, 252, 220, .55) 38%,
		rgba(255, 255, 255, .70) 44%,
		rgba(255, 215, 80, .40) 50%,
		transparent 60%, transparent 100%);
	opacity: 0;
	animation: fc-shine-sweep 1.1s ease both;
	animation-delay: .18s;
}
@keyframes fc-shine-sweep {
	0%   { opacity: 0; transform: translateX(-110%); }
	15%  { opacity: 1; }
	70%  { opacity: .85; transform: translateX(0); }
	100% { opacity: 0; transform: translateX(60%); }
}

/* «باز شدن مثل کتاب» — لولا روی شیرازه */
.fc-rtl .fc-in-unfold { transform-origin: right center; animation: fc-unfold-r 1.15s cubic-bezier(.16, 1, .3, 1) both; }
.fc-ltr .fc-in-unfold { transform-origin: left center;  animation: fc-unfold-l 1.15s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes fc-unfold-r {
	0%   { opacity: 0; transform: perspective(1200px) rotateY(-18deg) scale(.88); filter: brightness(.6) blur(2px); }
	40%  { opacity: 1; filter: brightness(1) blur(0); }
	65%  { transform: perspective(1200px) rotateY(3deg) scale(1.02); }
	85%  { transform: perspective(1200px) rotateY(-1deg) scale(.995); }
	100% { transform: perspective(1200px) rotateY(0) scale(1); filter: brightness(1) blur(0); }
}
@keyframes fc-unfold-l {
	0%   { opacity: 0; transform: perspective(1200px) rotateY(18deg) scale(.88); filter: brightness(.6) blur(2px); }
	40%  { opacity: 1; filter: brightness(1) blur(0); }
	65%  { transform: perspective(1200px) rotateY(-3deg) scale(1.02); }
	85%  { transform: perspective(1200px) rotateY(1deg) scale(.995); }
	100% { transform: perspective(1200px) rotateY(0) scale(1); filter: brightness(1) blur(0); }
}

.fc-in-rise { animation: fc-rise .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fc-rise { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }
.fc-in-fade { animation: fc-fade .6s ease both; }
@keyframes fc-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- کنترل‌ها ---------- */
.fc-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	justify-content: center;
	margin-top: 16px;
	flex-wrap: wrap;
}
/* دکمه‌های شیشه‌ای مربعی (frosted glass) — روی هر پس‌زمینه‌ای خوانا می‌مانند */
.fc-btn {
	appearance: none;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	cursor: pointer;
	display: grid;
	place-items: center;
	font-size: 18px;
	color: #fff;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 55%),
		rgba(26, 24, 20, .60);
	border: 1px solid rgba(255, 255, 255, .22);
	backdrop-filter: blur(12px) saturate(1.4);
	-webkit-backdrop-filter: blur(12px) saturate(1.4);
	box-shadow:
		0 6px 18px rgba(0, 0, 0, .22),
		inset 0 1px 0 rgba(255, 255, 255, .28),
		inset 0 -1px 0 rgba(0, 0, 0, .18);
	transition: background .2s, transform .12s, box-shadow .2s, color .2s, border-color .2s;
}
.fc-btn svg { transition: transform .18s ease; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.fc-btn:hover {
	color: var(--fc-accent);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%),
		rgba(40, 34, 12, .62);
	border-color: rgba(255, 204, 0, .55);
	box-shadow:
		0 0 0 3px rgba(255, 204, 0, .18),
		0 10px 24px rgba(0, 0, 0, .30),
		inset 0 1px 0 rgba(255, 255, 255, .35);
	transform: translateY(-2px);
}
.fc-btn:active { transform: translateY(0) scale(.94); }
.fc-btn:focus-visible { outline: 3px solid var(--fc-accent); outline-offset: 2px; }
.fc-btn[disabled] { opacity: .32; cursor: default; box-shadow: none; transform: none; }
.fc-btn[disabled]:hover { color: #fff; border-color: rgba(255, 255, 255, .22); background: rgba(26, 24, 20, .60); }

/* دکمه‌ی دانلود PDF (یک <a> است؛ زیرخط را حذف می‌کنیم و آیکن هنگام hover کمی پایین می‌رود مثل «دانلود») */
.fc-download { text-decoration: none; }
.fc-download:hover svg { transform: translateY(2px); }

/* آیکن‌ها به سمت حرکت اشاره می‌کنند؛ hover کمی به همان سمت هل می‌دهد */
.fc-prev:hover svg { transform: translateX(2px); }   /* RTL: قبلی → راست */
.fc-next:hover svg { transform: translateX(-2px); }  /* RTL: بعدی → چپ */
.fc-ltr .fc-nav svg { transform: scaleX(-1); }        /* LTR: آینه */
.fc-ltr .fc-prev:hover svg { transform: scaleX(-1) translateX(2px); }
.fc-ltr .fc-next:hover svg { transform: scaleX(-1) translateX(-2px); }

.fc-sound .fc-ic-off { display: none; }
.fc-sound[aria-pressed="false"] .fc-ic-on { display: none; }
.fc-sound[aria-pressed="false"] .fc-ic-off { display: inline; }

.fc-counter {
	min-width: 84px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	color: #333;
	font-size: 15px;
}
.fc-bg-dark .fc-counter { color: #eee; }
.fc-spacer { flex: 1 1 14px; max-width: 26px; }

/* ---------- تمام‌صفحه: صحنه‌ی تاریک، کتاب شناور با حاشیه‌ی سخاوتمندانه ---------- */
.fc-catalog:fullscreen,
.fc-catalog:-webkit-full-screen {
	max-width: none;
	width: 100%;
	height: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	box-sizing: border-box;
	background: radial-gradient(ellipse 70% 60% at 50% 40%,
		#1a1612 0%, #0e0c0a 60%, #080604 100%);
}
.fc-catalog:fullscreen::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(ellipse 100% 100% at 50% 50%,
		transparent 40%, rgba(0, 0, 0, .45) 100%);
}
.fc-catalog:fullscreen .fc-book-wrap {
	flex: 1 1 auto;
	min-height: 0;
	border-radius: 0;
	background: none;
	/* کتاب به لبه‌ها نمی‌چسبد */
	padding: clamp(28px, 5vh, 72px) clamp(24px, 5vw, 80px) clamp(40px, 7vh, 90px);
}
/* نور بالای صحنه (اسپات‌لایت گالری) */
.fc-catalog:fullscreen .fc-book-wrap::before {
	content: "";
	position: absolute;
	top: 0;
	left: 18%;
	right: 18%;
	height: 55%;
	pointer-events: none;
	background: radial-gradient(ellipse at 50% 0%, rgba(255, 244, 200, .08), transparent 70%);
}
/* هاله‌ی طلایی ملایم پشت کتاب */
.fc-catalog:fullscreen .fc-stage::before {
	content: "";
	position: absolute;
	inset: -10%;
	pointer-events: none;
	z-index: -2;
	background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255, 204, 0, .10), transparent 65%);
}
.fc-catalog:fullscreen .fc-floor {
	background: radial-gradient(ellipse at center,
		rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .28) 40%, transparent 72%);
}
/* کنترل‌های شناور شیشه‌ای */
.fc-catalog:fullscreen .fc-controls {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	margin: 0;
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(20, 16, 10, .72);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 204, 0, .18);
	box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
	flex-wrap: nowrap;
	white-space: nowrap;
}
.fc-catalog:fullscreen .fc-btn { background: rgba(255, 255, 255, .10); box-shadow: none; }
.fc-catalog:fullscreen .fc-btn:hover { background: rgba(255, 255, 255, .18); color: var(--fc-accent); }
.fc-catalog:fullscreen .fc-counter { color: #f5f0e6; }
.fc-catalog:fullscreen .fc-progress { color: #ddd; }

/* ---------- بزرگ‌نمایی (zoom / pan) ---------- */
.fc-scene {
	transform-origin: center center;
	transition: transform .18s ease;
	will-change: transform;
}
.fc-scene.fc-panning { transition: none; }        /* درگ باید بدون تأخیر باشد */

/* محفظه هنگام بزرگ‌نمایی، محتوای بیرون‌زده را می‌بُرد */
.fc-zoomed .fc-book-wrap { overflow: hidden; }
.fc-zoomed .fc-scene { cursor: grab; touch-action: none; }
.fc-zoomed .fc-scene.fc-panning { cursor: grabbing; }

/* گروهِ دکمه‌های بزرگ‌نمایی */
.fc-zoom-group { display: inline-flex; align-items: center; gap: 10px; }
/* دکمه‌ی «بازنشانی» فقط وقتی بزرگ‌نمایی فعال است دیده می‌شود */
.fc-zoom-reset { display: none; }
.fc-zoomed .fc-zoom-reset { display: grid; }

/* ---------- کاهش حرکت ---------- */
@media (prefers-reduced-motion: reduce) {
	.fc-scene[class*="fc-in-"] { animation: fc-fade .3s ease both !important; }
	.fc-stage canvas, .fc-floor, .fc-glint, .fc-shine { animation: none !important; }
	.fc-book-wrap::after { animation: none !important; }   /* درخششِ اسکلتون خاموش (اسپینر می‌ماند) */
	.fc-scene { transition: none; }
}
