/* ==========================================================================
   لایهٔ سینمایی و سه‌بعدی فرصت ملک
   فقط نمایش: چیدمان، حرکت، عمق، نور. متن، پیوند و مدل کره دست نمی‌خورد.
   ========================================================================== */
:root[data-cine] { overflow-x: clip; }
:root {
  --cine-ease: cubic-bezier(.16, 1, .3, 1);
  --cine-ink: #0e1714;
  --cine-bone: #f1efe8;
  --cine-accent: #e0531f;
  --cine-line: color-mix(in srgb, var(--ink) 14%, transparent);
}

/* ---------- پس‌زمینهٔ ثابت: خطوط تراز نقشه + هالهٔ نور، با رنگ فصل جاری ---------- */
#cineBg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#cineBg .cine-topo { position: absolute; inset: -20% -10%; background: var(--cine-topo) center / 900px 900px repeat; opacity: .07;
  transform: translate3d(0, calc(var(--cine-y, 0px) * -0.06), 0) rotate(-4deg); transition: opacity 1s var(--cine-ease), filter 1s; }
#cineBg .cine-glow { position: absolute; inset: 0;
  background: radial-gradient(60vmax 50vmax at 85% 8%, color-mix(in srgb, var(--cine-accent) 9%, transparent), transparent 60%),
              radial-gradient(55vmax 45vmax at 10% 90%, color-mix(in srgb, var(--forest-2) 12%, transparent), transparent 62%); }
:root[data-theme="dark"] #cineBg .cine-topo { filter: invert(1); opacity: .06; }
/* فصل تیره: پس‌زمینهٔ صفحه هم تیره می‌شود تا گذر بین فصل‌ها مثل برش فیلم باشد */
:root.cine-home body { transition: background-color .9s var(--cine-ease); }
:root.cine-home[data-cine-tone="dark"] body { background-color: var(--cine-ink); }
:root.cine-home[data-cine-tone="dark"] #cineBg .cine-topo { filter: invert(1); opacity: .05; }

/* ---------- نوار پیشرفت و پردهٔ گذار ---------- */
.cine-progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 70; pointer-events: none;
  background: linear-gradient(90deg, var(--cine-accent), color-mix(in srgb, var(--forest-2) 80%, #fff));
  transform-origin: 100% 50%; transform: scaleX(var(--cine-p, 0)); }
.cine-veil { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: var(--cine-ink); transform: translateX(101%); }
body.cine-go .cine-veil { animation: cineVeil .85s var(--cine-ease) both; }
@keyframes cineVeil { 0% { transform: translateX(101%); } 45% { transform: translateX(0); } 100% { transform: translateX(-101%); } }
body.cine-go #view { animation: cineEnter .9s .25s var(--cine-ease) both; }
@keyframes cineEnter { from { opacity: 0; transform: translateY(24px) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- پردهٔ آغاز ---------- */
.cine-intro { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none; }
.cine-intro__a, .cine-intro__b { position: absolute; inset: 0 0 50% 0; background: var(--cine-ink); transition: transform .9s var(--cine-ease); }
.cine-intro__b { inset: 50% 0 0 0; }
.cine-intro__in { position: relative; display: grid; justify-items: center; gap: 10px; color: var(--cine-bone); transition: opacity .4s, transform .9s var(--cine-ease); }
.cine-intro__in svg { width: 84px; height: 84px; color: var(--cine-bone); }
.cine-intro__in svg path { stroke-dasharray: 80; stroke-dashoffset: 80; }
.cine-intro.is-run .cine-intro__in svg path { animation: cineDraw .9s .1s var(--cine-ease) forwards; }
.cine-intro__in svg circle { transform-box: fill-box; transform-origin: center; transform: scale(0); }
.cine-intro.is-run .cine-intro__in svg circle { animation: cinePop .5s .7s var(--cine-ease) forwards; }
.cine-intro__in b { font-size: 26px; font-weight: 900; letter-spacing: -.01em; clip-path: inset(0 0 100% 0); }
.cine-intro.is-run .cine-intro__in b { animation: cineClip .7s .45s var(--cine-ease) forwards; }
.cine-intro.is-out .cine-intro__a { transform: translateY(-101%); }
.cine-intro.is-out .cine-intro__b { transform: translateY(101%); }
.cine-intro.is-out .cine-intro__in { opacity: 0; transform: scale(1.08); }
@keyframes cineDraw { to { stroke-dashoffset: 0; } }
@keyframes cinePop { to { transform: scale(1); } }
@keyframes cineClip { to { clip-path: inset(0 0 0 0); } }

/* ---------- سربرگ شیشه‌ای که هنگام پیمایش رو به پایین کنار می‌رود ---------- */
:root[data-cine="full"] .top { transition: transform .5s var(--cine-ease), border-color .2s, background-color .4s, color .4s; }
.top.cine-hide { transform: translateY(-105%); }
:root.cine-home[data-cine-tone="dark"] .top.is-scrolled { background: color-mix(in srgb, var(--cine-ink) 74%, transparent); color: var(--cine-bone); border-bottom-color: rgba(255,255,255,.08); }

/* ---------- تیترهای جنبشی (واژه به واژه از پشت ماسک) ---------- */
.cine-words .cw { display: inline-block; overflow: clip; overflow-clip-margin: .2em; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.cine-words .cw__i { display: inline-block; transform: translate3d(0, 105%, 0) rotate(3deg); transform-origin: 100% 100%; opacity: 0;
  transition: transform 1s var(--cine-ease), opacity .6s; transition-delay: calc(var(--i, 0) * 55ms + 60ms); }
.cine-words.is-in .cw__i { transform: none; opacity: 1; }
/* واژهٔ برجسته: یک بار نور از روی آن رد می‌شود */
.cine-words .accent { position: relative; }
.cine-words.is-in .accent::after { content: ""; position: absolute; inset: -4% -2%; pointer-events: none; mix-blend-mode: overlay;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%) 130% 0 / 250% 100% no-repeat;
  animation: cineShine 2.4s 1.1s var(--cine-ease) both; }
@keyframes cineShine { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ---------- پژواک توخالی تیتر (لایهٔ پشت صحنه) ---------- */
.cine-echo { position: relative; isolation: isolate; }
.cine-echo::after { content: attr(data-echo); position: absolute; inset-inline-start: 0; top: -.62em; z-index: -1; pointer-events: none; white-space: nowrap;
  font-size: 2.4em; line-height: 1; font-weight: 900; letter-spacing: -.02em; color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, currentColor 13%, transparent); opacity: 0; transform: translateY(18px);
  transition: opacity 1.4s .3s var(--cine-ease), transform 1.4s .3s var(--cine-ease); }
.cine-echo.is-in::after { opacity: 1; transform: translateY(0); }
.section--ink .cine-echo::after { -webkit-text-stroke-color: rgba(255,253,249,.1); }
.cine-ch, .section { overflow-x: clip; }

/* ---------- فصل‌ها: شماره و نشانه‌های گوشهٔ نقشه‌کشی ---------- */
.cine-ch { position: relative; }
.cine-idx { position: absolute; inset-inline-start: max(16px, calc((100vw - 1240px) / 2 - 64px)); top: 84px; z-index: 2; display: none;
  writing-mode: vertical-rl; align-items: center; gap: 10px; font: 700 11.5px/1 Vazirmatn, sans-serif; letter-spacing: .14em; color: var(--muted); }
.cine-idx b { color: var(--ink); font-size: 13px; }
.cine-idx i { width: 1px; height: 48px; background: currentColor; opacity: .5; transform-origin: top; transform: scaleY(0); transition: transform 1.2s .2s var(--cine-ease); }
.cine-ch.is-in .cine-idx i { transform: scaleY(1); }
.section--ink .cine-idx, .section--ink .cine-idx b, .consult .cine-idx b { color: rgba(255,253,249,.6); }
@media (min-width: 1380px) { .cine-idx { display: inline-flex; } }
/* نشانه‌های «+» گوشه‌ها روی سر فصل‌ها، مثل برگهٔ نقشهٔ معماری */
.cine-ch > .wrap { position: relative; }
.cine-ch > .wrap::before { content: ""; position: absolute; inset: -30px -14px auto -14px; height: 13px; pointer-events: none; opacity: 0; transition: opacity 1s .4s;
  background:
    linear-gradient(currentColor, currentColor) 0 6px / 13px 1px no-repeat, linear-gradient(currentColor, currentColor) 6px 0 / 1px 13px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 6px / 13px 1px no-repeat, linear-gradient(currentColor, currentColor) calc(100% - 6px) 0 / 1px 13px no-repeat;
  color: color-mix(in srgb, var(--ink) 35%, transparent); }
.section--ink.cine-ch > .wrap::before { color: rgba(255,253,249,.3); }
.cine-ch.is-in > .wrap::before { opacity: 1; }

/* ---------- ورود سه‌بعدی بخش‌ها و کارت‌ها (به‌جای ورود ساده) ---------- */
:root[data-cine="full"] .reveal-on-scroll { transform: perspective(1200px) translate3d(0, 46px, 0) rotateX(7deg); transform-origin: 50% 0;
  transition: opacity .9s var(--cine-ease), transform 1.1s var(--cine-ease); }
:root[data-cine="full"] .reveal-on-scroll.is-visible { transform: none; }
:root[data-cine="full"] .card.reveal-on-scroll:nth-child(4n+2), :root[data-cine="full"] .trust__item.reveal-on-scroll:nth-child(2) { transition-delay: .08s; }
:root[data-cine="full"] .card.reveal-on-scroll:nth-child(4n+3), :root[data-cine="full"] .trust__item.reveal-on-scroll:nth-child(3) { transition-delay: .16s; }
:root[data-cine="full"] .card.reveal-on-scroll:nth-child(4n+4) { transition-delay: .24s; }
/* تصویر کارت‌ها: بزرگ‌نمایی آهسته هنگام ورود */
:root[data-cine="full"] .card.reveal-on-scroll img { transform: scale(1.1); transition: transform 1.6s var(--cine-ease); }
:root[data-cine="full"] .card.reveal-on-scroll.is-visible img { transform: scale(1); }

/* ---------- کارت‌های عمق‌دار: کج‌شدن و برق نور زیر نشانگر ---------- */
.cine-tilt { transition: transform .5s var(--cine-ease), box-shadow .4s var(--cine-ease), opacity .9s var(--cine-ease); }
.cine-tilt.reveal-on-scroll.is-visible, .cine-tilt:not(.reveal-on-scroll) { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.cine-tilt:hover { box-shadow: 0 30px 60px -28px rgba(10,20,16,.45); }
.cine-tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .35s;
  background: radial-gradient(380px circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,.22), transparent 42%); mix-blend-mode: soft-light; }
.cine-tilt:hover::after { opacity: 1; }

/* ---------- دکمه‌های مغناطیسی ---------- */
.cine-mag { transform: translate3d(var(--mx, 0px), var(--my, 0px), 0); transition: transform .45s var(--cine-ease), background-color .2s, box-shadow .3s; }
.cine-mag:hover { box-shadow: 0 18px 40px -16px color-mix(in srgb, var(--cine-accent) 55%, transparent); }

/* ---------- صحنهٔ اصلی: عمق نوری روی ستون متن و کادر کره ---------- */
:root.cine-home .hero h1 { letter-spacing: -.02em; }
:root.cine-home .hero__grid > div:first-child { position: relative; }
:root.cine-home .hero__grid > div:first-child::before { content: ""; position: absolute; inset-inline-start: -28px; top: 6px; bottom: 30%; width: 1px; pointer-events: none;
  background: linear-gradient(transparent, var(--cine-line) 15%, var(--cine-line) 85%, transparent); }
:root.cine-home .sky { box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 60px 120px -50px rgba(10,20,16,.85), 0 0 0 1px rgba(255,255,255,.05), 0 0 90px -30px rgba(70,200,150,.4); }

/* صحنهٔ کره: فضای عمیق با ستاره، هالهٔ جو و جاروی آهستهٔ نور؛ همه زیر بوم کره و بدون دخالت در کشیدن */
.cine-space { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cine-stars { position: absolute; left: 0; top: 0; width: 1px; height: 1px; border-radius: 50%; opacity: .75; animation: cineTwinkle 6s ease-in-out infinite alternate; }
.cine-halo { position: absolute; left: 50%; top: 50%; width: min(80%, 350px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, transparent 52%, rgba(120,220,180,.22) 61%, rgba(80,170,255,.10) 67%, transparent 74%); filter: blur(6px); animation: cineBreath 7s ease-in-out infinite; }
.cine-sweep { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(255,255,255,.06) 80%, transparent 90%); animation: cineSpin 18s linear infinite; mix-blend-mode: screen; }
.sky__stage.map-on .cine-space { display: none; }
.sky__stage > .sky__globe { z-index: 1; }
@keyframes cineTwinkle { from { opacity: .45; } to { opacity: .9; } }
@keyframes cineBreath { 50% { transform: translate(-50%, -50%) scale(1.04); opacity: .8; } }
@keyframes cineSpin { to { transform: rotate(360deg); } }

/* نوار آمار زیر صحنه: خط بالایی که با ورود کشیده می‌شود */
:root.cine-home .strip { position: relative; border-top-color: transparent; }
:root.cine-home .strip::before { content: ""; position: absolute; inset: -2px 0 auto 0; height: 2px; background: var(--ink); transform-origin: 100% 50%; animation: cineLine 1.4s .6s var(--cine-ease) both; }
@keyframes cineLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* فصل‌های تیره: لبهٔ نوری بالایی و نور گرم پایین، مثل برش فیلم */
:root.cine-home .section--ink.cine-ch::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255,253,249,.25), transparent); }
:root.cine-home .section--ink.cine-ch::after { content: ""; position: absolute; inset: auto -10% -40% -10%; height: 70%; pointer-events: none; z-index: 0;
  background: radial-gradient(50% 60% at 50% 100%, rgba(224,83,31,.12), transparent 70%); }
:root.cine-home .section--ink.cine-ch > .wrap { z-index: 1; }

/* ---------- ستون فصل‌ها (نقشهٔ کوچک صفحه، سمت چپ) ---------- */
.cine-rail { position: fixed; left: 22px; top: 50%; z-index: 55; display: grid; gap: 4px; padding: 8px 0 8px 14px; transform: translate(-130%, -50%); opacity: 0;
  transition: transform .7s var(--cine-ease), opacity .5s; direction: ltr; }
.cine-rail.is-on { transform: translate(0, -50%); opacity: 1; }
:root.sky-fs .cine-rail, body.menu-open .cine-rail { display: none; }
.cine-rail__line { position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.cine-rail__line i { position: absolute; inset: 0; background: var(--cine-accent); transform-origin: top; transform: scaleY(var(--fill, 0)); }
.cine-rail button { position: relative; display: flex; align-items: center; gap: 10px; height: 22px; padding: 0 0 0 4px; background: none; border: 0; cursor: pointer; color: var(--muted); font: 700 12px/1 Vazirmatn, sans-serif; justify-content: flex-start; }
.cine-rail button::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; transition: transform .3s var(--cine-ease), background .3s; }
.cine-rail button span { display: inline-block; direction: rtl; max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .5s var(--cine-ease), opacity .3s, padding .3s; padding: 3px 0; border-radius: 8px; }
/* نام فصل فقط روی همان نقطه‌ای که نشانگر رویش است (یا فصل فعال وقتی حاشیهٔ صفحه پهن است)؛ هرگز همهٔ نام‌ها با هم */
.cine-rail button:hover span, .cine-rail button:focus-visible span, .cine-rail--labels button.is-on span { max-width: 240px; opacity: 1; }
.cine-rail button:hover span, .cine-rail button:focus-visible span { background: var(--surface); padding: 4px 10px; box-shadow: 0 6px 18px -8px rgba(0,0,0,.35); color: var(--ink); }
.cine-rail button { height: 18px; }
.cine-rail button.is-on { color: var(--ink); }
.cine-rail button.is-on::before { background: var(--cine-accent); border-color: var(--cine-accent); transform: scale(1.35); }
:root[data-cine-tone="dark"] .cine-rail button { color: rgba(241,239,232,.55); }
:root[data-cine-tone="dark"] .cine-rail button.is-on { color: var(--cine-bone); }
:root[data-cine-tone="dark"] .cine-rail button:hover span { background: #17221e; color: var(--cine-bone); }

/* ---------- پانویس: نام سایت با حروف بزرگ توخالی، مثل امضای پایان فیلم ---------- */
:root[data-cine="full"] .foot { position: relative; overflow: clip; }
:root[data-cine="full"] .foot::before { content: "فرصت ملک"; position: absolute; left: 50%; bottom: -0.3em; transform: translateX(-50%); pointer-events: none;
  font-size: clamp(90px, 17vw, 260px); font-weight: 900; line-height: 1; letter-spacing: -.03em; white-space: nowrap; color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--ink) 10%, transparent); }
:root[data-cine="full"] .foot > .wrap { position: relative; }

/* ---------- کاهش حرکت: همه‌چیز ایستا و فوری ---------- */
@media (prefers-reduced-motion: reduce) {
  #cineBg .cine-topo { transform: none; }
  .cine-words .cw__i { transform: none !important; opacity: 1 !important; transition: none !important; }
  .cine-echo::after, .cine-idx i { transition: none !important; opacity: 1; transform: none; }
  .cine-sweep, .cine-halo, .cine-stars { animation: none !important; }
  .top.cine-hide { transform: none; }
}
/* موبایل: پژواک کوچک‌تر و پس‌زمینهٔ ایستا */
@media (max-width: 760px) {
  .cine-echo::after { font-size: 1.7em; top: -.5em; }
  #cineBg .cine-topo { background-size: 620px 620px; opacity: .06; transform: none; }
  :root[data-cine="full"] .foot::before { bottom: -0.2em; }
}
@media print { #cineBg, .cine-progress, .cine-rail, .cine-veil, .cine-intro { display: none !important; } }

/* ---------- قاب‌های تیره مثل پرده: با ورود از کارت گرد و کوچک به تمام‌صفحه باز می‌شوند ---------- */
:root[data-cine="full"] .cine-slab { clip-path: inset(0 calc(var(--cine-gut, 0) * (1 - var(--cine-in, 1))) round calc(44px * (1 - var(--cine-in, 1)))); --cine-gut: 4vw; will-change: clip-path; }
@media (max-width: 760px) { :root[data-cine="full"] .cine-slab { --cine-gut: 3vw; } }

/* ---------- جمله‌های بزرگ: واژه‌ها با پیمایش از کم‌رنگ به پررنگ می‌رسند ---------- */
.cine-scrub .cw__i { opacity: var(--o, .16) !important; transform: none !important; transition: opacity .25s linear !important; }
.cine-scrub .accent .cw__i { color: inherit; }

/* ---------- صحنهٔ آغاز: لایه‌ها با حرکت نشانگر عمق می‌گیرند ---------- */
:root.cine-home .hero .kicker, :root.cine-home .hero h1, :root.cine-home .hero__lead { translate: calc(var(--hx, 0) * -10px) calc(var(--hy, 0) * -8px); transition: translate .8s var(--cine-ease); }
:root.cine-home .hero .sky { translate: calc(var(--hx, 0) * 14px) calc(var(--hy, 0) * 10px); transition: transform .6s var(--cine-ease), translate .8s var(--cine-ease); }
:root.cine-home .hero h1 { font-size: clamp(30px, 4.4vw, 60px); line-height: 1.32; }

/* حالت روشن: ستاره‌های سفید روی کادر روشن دیده نمی‌شوند و هاله ملایم‌تر است */
:root:not([data-theme="dark"]) .cine-stars { display: none; }
:root:not([data-theme="dark"]) .cine-halo { background: radial-gradient(circle, transparent 54%, rgba(60,150,110,.16) 62%, rgba(80,140,200,.08) 68%, transparent 74%); }
:root:not([data-theme="dark"]) .cine-sweep { display: none; }
:root.cine-home:not([data-theme="dark"]) .sky { box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 40px 90px -45px rgba(60,48,30,.35), 0 0 0 1px var(--line); }

/* پژواک تیترها با اسکرول کمی افقی جابه‌جا می‌شود (GSAP، فقط دسکتاپ قوی) */
.cine-echo::after { translate: var(--echo-x, 0) 0; }


/* عکس‌های صحنه با نقشهٔ عمق: بوم WebGL جای عکس را می‌گیرد و همان ماسک و فیلترها رویش اعمال می‌شود */
.scene__pic canvas.fx-depth { position: absolute; inset: 0; width: 100%; height: 100%; transform: scale(calc(1.1 - var(--p) * .1)); }
.scene__pic img.fx-hidden { visibility: hidden; }
/* Lenis */
html.has-lenis, html.has-lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
