/* =====================================================================
   Landing motion (Home/Index3 → _Layout2.cshtml), on top of style3.css.
   Nothing here moves the layout: many elements already position
   themselves with `transform` (title scale, brand translateX, mock-up
   translateX, logos translate...), so motion only uses the separate
   `translate` / `scale` / `opacity` / `clip-path` / `mask` properties,
   which compose with that transform instead of replacing it.
   Everything is scoped to html.m-on, which the inline script in
   _Layout2's <head> sets only when the user hasn't asked for reduced
   motion - so without JS (or with reduced motion) the page is the
   static original. Scroll-triggered parts get .m-in from motion.js.
   ===================================================================== */

@property --m-reveal {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 120%;
}

/* ---------- top bar ---------- */
/* (its dark background on scroll is in style3.css / script.js - it's
   needed with or without motion) */
html.m-on .topbar {
    animation: m-fade-down .8s cubic-bezier(.22, 1, .36, 1) both .1s;
}

html.m-on .tick-img {
    animation: m-tick-in .9s cubic-bezier(.34, 1.56, .64, 1) both .25s;
}

/* ---------- hero: intro sequence ---------- */

/* white divider grows down from its dot */
html.m-on .hero-divider {
    transform-origin: top center;
    animation: m-grow-y 1.2s cubic-bezier(.65, 0, .35, 1) both .45s;
}

    html.m-on .hero-divider::before {
        animation: m-pop .6s cubic-bezier(.34, 1.56, .64, 1) both .3s;
    }

/* the title is written in from the top, line by line (a soft mask sweeps
   down the image), then keeps a slow golden glow */
html.m-on .title-img {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--m-reveal) - 12%), transparent var(--m-reveal));
    mask-image: linear-gradient(to bottom, #000 calc(var(--m-reveal) - 12%), transparent var(--m-reveal));
    animation:
        m-write 1.6s cubic-bezier(.45, 0, .2, 1) both .7s,
        m-gold-glow 4.5s ease-in-out infinite 2.6s;
}

/* dot grid: pops in one by one, then twinkles */
html.m-on .dots span {
    animation:
        m-pop .45s cubic-bezier(.34, 1.56, .64, 1) both calc(1.3s + var(--i, 0) * 45ms),
        m-twinkle 3.2s ease-in-out infinite calc(2.6s + var(--tw, 0s));
}

/* brand + CTA rise in after the title */
html.m-on .logo-img {
    animation: m-rise .9s cubic-bezier(.22, 1, .36, 1) both 1.5s;
}

html.m-on .cta-link {
    animation: m-rise .9s cubic-bezier(.22, 1, .36, 1) both 1.8s;
}

html.m-on .cta-img {
    animation: m-cta-glow 2.8s ease-in-out infinite 3s;
}

/* bokeh lights drift slowly */
html.m-on .bokeh {
    animation: m-drift 16s ease-in-out infinite alternate;
}

html.m-on .b2 { animation-duration: 19s; animation-delay: -6s; }
html.m-on .b3 { animation-duration: 13s; animation-delay: -3s; }

/* scroll parallax (motion.js sets --m-hero: 0 → 1 while the hero scrolls away) */
html.m-on .hero-text {
    translate: 0 calc(var(--m-hero, 0) * 120px);
    opacity: calc(1 - var(--m-hero, 0) * 1.1);
}

html.m-on .hero-brand {
    translate: 0 calc(var(--m-hero, 0) * 60px);
}

/* ---------- دنیای تلنتیک ---------- */

/* big faint numbers slide in from their own side */
html.m-on .world-block .block-number {
    opacity: 0;
    translate: 0 30px;
    transition: opacity 1s ease, translate 1.2s cubic-bezier(.22, 1, .36, 1);
    transition-delay: var(--m-delay, 0s);
}

html.m-on .world-block.m-in .block-number {
    opacity: 1;
    translate: 0 0;
}

/* purple underline draws from the text's side */
html.m-on .world-block .purple-line {
    clip-path: inset(0 0 0 100%);
    transition: clip-path 1s cubic-bezier(.65, 0, .35, 1);
    transition-delay: calc(var(--m-delay, 0s) + .45s);
}

html.m-on .block-tl .purple-line,
html.m-on .block-bl .purple-line {
    clip-path: inset(0 100% 0 0);
}

html.m-on .world-block.m-in .purple-line {
    clip-path: inset(0 0 0 0);
}

/* centre square: floats, its golden frame breathes, and a light sweep passes */
html.m-on .center-square.m-in {
    animation: m-frame 4s ease-in-out infinite;
}

html.m-on .center-square.m-in .center-logo img {
    animation: m-float 6s ease-in-out infinite;
}

html.m-on .center-square::after {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: 6;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .28) 50%, transparent 60%);
    translate: -100% 0;
}

html.m-on .center-square.m-in::after {
    animation: m-sweep 5.5s ease-in-out infinite 1s;
}

/* ---------- اپلیکیشن ---------- */
html.m-on .app-bg-glow {
    animation: m-breathe 7s ease-in-out infinite;
}

html.m-on .app-section.m-in .screen-img {
    animation: m-float 6.5s ease-in-out infinite;
}

/* «● اپلیکیشن تلنتیک» guide line draws from the right edge to the text */
html.m-on .app-guide-img {
    clip-path: inset(0 0 0 100%);
    transition: clip-path 1.6s cubic-bezier(.65, 0, .35, 1) .2s;
}

    /* (triggered on its parent: a fully clipped element never counts as
       visible for IntersectionObserver) */
    html.m-on .app-text-side.m-in .app-guide-img {
        clip-path: inset(0 0 0 0);
    }

/* ---------- برنامه‌های برگزارشده ---------- */
html.m-on .events-title,
html.m-on .cat-btn {
    opacity: 0;
    translate: 0 24px;
    transition: opacity .7s ease, translate .8s cubic-bezier(.22, 1, .36, 1), color .3s;
    transition-delay: var(--m-delay, 0s), var(--m-delay, 0s), 0s;
}

    html.m-on .events-title.m-in,
    html.m-on .cat-btn.m-in {
        opacity: 1;
        translate: 0 0;
    }

html.m-on .event-card-img {
    transition: scale .7s cubic-bezier(.22, 1, .36, 1);
}

html.m-on .event-card:hover .event-card-img {
    scale: 1.07;
}

html.m-on .nav-arrow .arrow-img {
    transition: filter .3s;
}

html.m-on .nav-arrow:hover .arrow-img {
    filter: drop-shadow(0 6px 14px rgba(109, 77, 255, .45));
}

/* ---------- تماس / مشتریان ---------- */

/* background photo moves slower than the page (motion.js sets --m-cust) */
html.m-on .customers-overlay {
    scale: 1.12;
    translate: 0 calc(var(--m-cust, 0) * 1px);
}

html.m-on .contact-area .contact-item {
    opacity: 0;
    translate: 0 18px;
    transition: opacity .6s ease, translate .7s cubic-bezier(.22, 1, .36, 1);
    transition-delay: var(--m-delay, 0s);
}

html.m-on .contact-area.m-in .contact-item {
    opacity: 1;
    translate: 0 0;
}

html.m-on .contact-item .contact-icon {
    transition: scale .35s cubic-bezier(.34, 1.56, .64, 1), rotate .35s;
}

html.m-on .contact-item:hover .contact-icon {
    scale: 1.15;
    rotate: -8deg;
}

/* «● مشتریان ما» line, then the logo row, draw in from the right */
html.m-on .customers-title-img,
html.m-on .logos-vertical-img {
    clip-path: inset(0 0 0 100%);
    transition: clip-path 1.4s cubic-bezier(.65, 0, .35, 1);
}

html.m-on .logos-vertical-img {
    transition-duration: 2.4s;
    transition-delay: .7s;
}

html.m-on .customers-visual.m-in .customers-title-img,
html.m-on .customers-visual.m-in .logos-vertical-img {
    clip-path: inset(0 0 0 0);
}

/* ---------- keyframes ---------- */
@keyframes m-fade-down {
    from { opacity: 0; translate: 0 -20px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes m-tick-in {
    from { opacity: 0; rotate: -25deg; scale: .4; }
    to { opacity: 1; rotate: 0deg; scale: 1; }
}

@keyframes m-grow-y {
    from { scale: 1 0; }
    to { scale: 1 1; }
}

@keyframes m-pop {
    from { scale: 0; opacity: 0; }
    to { scale: 1; opacity: 1; }
}

@keyframes m-write {
    from { --m-reveal: -5%; opacity: .3; }
    to { --m-reveal: 120%; opacity: 1; }
}

@keyframes m-gold-glow {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(245, 197, 24, 0)); }
    50% { filter: drop-shadow(0 0 14px rgba(245, 197, 24, .45)); }
}

@keyframes m-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

@keyframes m-rise {
    from { opacity: 0; translate: 0 26px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes m-cta-glow {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(155, 126, 255, 0)); }
    50% { filter: drop-shadow(0 6px 18px rgba(155, 126, 255, .65)); }
}

/* right/up only, no scale. .hero is position:relative now, so its
   overflow:hidden clips the bokeh; still kept to this direction since in
   this RTL page any overflow on the LEFT would widen the page. */
@keyframes m-drift {
    from { translate: 0 0; }
    to { translate: 60px -30px; }
}

@keyframes m-frame {
    0%, 100% { box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 2px rgba(245, 197, 24, .15); }
    50% { box-shadow: 0 26px 70px rgba(0, 0, 0, .55), 0 0 0 3px rgba(245, 197, 24, .55), 0 0 40px rgba(245, 197, 24, .18); }
}

@keyframes m-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -12px; }
}

@keyframes m-sweep {
    0% { translate: -100% 0; }
    45%, 100% { translate: 100% 0; }
}

@keyframes m-breathe {
    0%, 100% { scale: 1; opacity: 1; }
    50% { scale: 1.15; opacity: .7; }
}
