/* =================================================================
   VELTECHLAB MOTION 3D — стилове за анимациите и мобилна оптимизация
   ================================================================= */

/* ---------- Херо: 3D мрежа, светлина, влизане ---------- */
.hero-section .hero-background { overflow: hidden; }
.hero-section .hero-media { transform-origin: 50% 40%; will-change: transform; transform: scale(1.06); }
.hero-section .hero-content { will-change: transform, opacity; }
.m3d-network {
    position: absolute; inset: 0; z-index: 1;
    pointer-events: none;
    opacity: 0; transition: opacity 1.4s ease .2s;
}
.m3d-network.is-on, .m3d-reduce .m3d-network { opacity: .9; }
.m3d-glow {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(520px circle at var(--x, 50%) var(--y, 50%), rgba(94, 234, 212, 0.09), transparent 60%);
    opacity: 0; transition: opacity .4s ease;
}
.m3d-glow.is-on { opacity: 1; }
.hero-section .hero-overlay { z-index: 0; }
.hero-section .hero-content { position: relative; z-index: 2; }

/* Влизане на херото: редовете се „изправят“ в 3D */
@keyframes m3d-line-in {
    from { opacity: 0; transform: perspective(900px) rotateX(-55deg) translate3d(0, 0.6em, 0); filter: blur(6px); }
    to { opacity: 1; transform: none; filter: none; }
}
@keyframes m3d-fade-up {
    from { opacity: 0; transform: translate3d(0, 18px, 0); }
    to { opacity: 1; transform: none; }
}
@keyframes m3d-card-in {
    from { opacity: 0; transform: perspective(1200px) rotateY(-18deg) translate3d(40px, 0, 0); }
    to { opacity: 1; transform: none; }
}
html.m3d:not(.m3d-reduce) .hero-section .hero-title .title-line {
    display: block;
    transform-origin: 50% 100%;
    animation: m3d-line-in 1s cubic-bezier(.2, .8, .2, 1) both;
}
html.m3d:not(.m3d-reduce) .hero-section .hero-title .title-line:nth-child(2) { animation-delay: .12s; }
html.m3d:not(.m3d-reduce) .hero-section .hero-title { opacity: 1 !important; animation: none !important; }
html.m3d:not(.m3d-reduce) .hero-section .hero-subtitle { animation: m3d-fade-up .9s .35s cubic-bezier(.2, .8, .2, 1) both !important; }
html.m3d:not(.m3d-reduce) .hero-section .hero-highlights { animation: m3d-fade-up .9s .5s cubic-bezier(.2, .8, .2, 1) both !important; }
html.m3d:not(.m3d-reduce) .hero-section .hero-buttons { animation: m3d-fade-up .9s .6s cubic-bezier(.2, .8, .2, 1) both !important; }
html.m3d:not(.m3d-reduce) .hero-section .hero-card { animation: m3d-card-in 1.1s .45s cubic-bezier(.2, .8, .2, 1) both !important; }

/* ---------- 3D поява при скрол (непрозрачността не пада под видимо ниво) ---------- */
.m3d-rise {
    transform: perspective(1100px) rotateX(14deg) translate3d(0, 46px, 0);
    transform-origin: 50% 0%;
    opacity: .25;
    transition: transform 1s cubic-bezier(.2, .8, .2, 1) var(--m3d-delay, 0ms), opacity .9s ease var(--m3d-delay, 0ms);
}
.m3d-rise.m3d-in { transform: none; opacity: 1; }

/* ---------- 3D накланяне на картите ---------- */
.m3d-tilt {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .6s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease, border-color .3s ease !important;
    position: relative;
}
.m3d-tilt.is-tilting {
    transition: transform .08s linear, box-shadow .4s ease, border-color .3s ease !important;
    box-shadow: 0 30px 60px -30px rgba(13, 22, 36, 0.45) !important;
}

.m3d-tilt::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(380px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.28), transparent 50%);
    opacity: 0; transition: opacity .3s ease;
}
.m3d-tilt.is-tilting::after { opacity: 1; }

/* ---------- Магнитни бутони ---------- */
.m3d-magnet {
    transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) !important;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, color .2s ease, border-color .2s ease !important;
}

/* ---------- Ред с услуга: стрелката се плъзга в 3D ---------- */
html.m3d-fine .svc-card .svc-card-more { transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
html.m3d-fine .svc-card:hover .svc-card-more { transform: translate3d(4px, 0, 0); }
.svc-card, .svc-card:hover, .svc-card:focus-visible, .svc-card:hover * { text-decoration: none !important; }
.svc-card .svc-card-more { padding-right: 6px; }
html.m3d-fine .svc-card .svc-card-body strong { transition: transform .4s cubic-bezier(.2, .8, .2, 1), color .2s ease; display: inline-block; }
html.m3d-fine .svc-card:hover .svc-card-body strong { transform: translate3d(4px, 0, 0); }

/* ---------- Лога на клиенти: 3D завъртане при посочване ---------- */
.partner-logo { perspective: 600px; }
.partner-logo img { transition: transform .6s cubic-bezier(.2, .8, .2, 1), filter .35s ease, opacity .35s ease !important; }
html.m3d-fine .partner-logo:hover img { transform: rotateY(18deg) scale(1.08) !important; }

/* ---------- Индустрии: подчертаване, което се „изтегля“ ---------- */
.ind-teaser-card { position: relative; }
.ind-teaser-card::before {
    content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
    background: var(--v3-blue, #1E56D6); transform: scaleX(0); transform-origin: left;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.ind-teaser-card:hover::before, .ind-teaser-card:focus-visible::before { transform: scaleX(1); }

/* ---------- Блог: снимката приближава в 3D ---------- */
.blog-card-media { overflow: hidden; }
.blog-card-media img { transition: transform 1s cubic-bezier(.2, .8, .2, 1) !important; }
.blog-card:hover .blog-card-media img { transform: scale(1.07) !important; }

/* ---------- Мобилна оптимизация ---------- */
/* Секциите под първия екран не се рисуват, докато не се приближат */
main > section:not(.hero-section) {
    content-visibility: auto;
    contain-intrinsic-size: auto 900px;
}
@media (max-width: 767px) {
    .m3d-network { opacity: .55 !important; }
    .m3d-rise { transform: translate3d(0, 28px, 0); }
    .hero-section .hero-media { transform: none !important; }
    /* по-големи зони за докосване */
    .footer a, .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
    .ind-teaser-card, .svc-card .svc-card-more { min-height: 44px; }
    .vt-slider-toggle, .vt-video-toggle { min-height: 44px; }
}
@media (hover: none) {
    .m3d-tilt::after { display: none; }
}

/* ---------- Намалено движение: всичко стои ---------- */
@media (prefers-reduced-motion: reduce) {
    .m3d-rise, .m3d-rise.m3d-in { transform: none !important; opacity: 1 !important; transition: none !important; }
    .m3d-tilt, .m3d-magnet { transform: none !important; }
    .hero-section .hero-media { transform: none !important; }
    .hero-section .hero-title .title-line, .hero-section .hero-card,
    .hero-section .hero-subtitle, .hero-section .hero-highlights { animation: none !important; opacity: 1 !important; }
}

.m3d-network.is-static { transition: none; }
/* Само при по-тесни екрани — без 3D блок на съдържанието, за да няма размазан текст */
@media (max-width: 1023px) { .m3d-tilt { transform: none !important; } }
