/**
 * ND54 Premium — живой интерфейс без тяжёлого blur/частиц на canvas.
 * Карта и модалки не анимируются; контент всегда читаем.
 */

:root {
    --nd54-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --nd54-ease-spring: cubic-bezier(0.34, 1.2, 0.48, 1);
    --nd54-scroll: 0;
    --nd54-tilt-x: 0deg;
    --nd54-tilt-y: 0deg;
}

/* -------------------------------------------------------------------------- */
/* Прогресс прокрутки                                                         */
/* -------------------------------------------------------------------------- */

.nd54-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: calc(var(--nd54-scroll-progress, 0) * 1%);
    z-index: 100100;
    pointer-events: none;
    background: linear-gradient(90deg, #7ec8ff, #ffd700, #2279bd);
    box-shadow: 0 0 12px rgba(126, 200, 255, 0.65);
    transition: width 0.12s linear;
}

/* -------------------------------------------------------------------------- */
/* Ambient фон                                                                */
/* -------------------------------------------------------------------------- */

body.nd54-premium-active {
    background: transparent !important;
}

.nd54-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.35;
    background: transparent;
}

.nd54-ambient__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.55;
    will-change: transform;
}

.nd54-ambient__orb--1 {
    width: min(42vw, 320px);
    height: min(42vw, 320px);
    left: -8%;
    top: 8%;
    background: rgba(126, 200, 255, 0.45);
}

.nd54-ambient__orb--2 {
    width: min(38vw, 280px);
    height: min(38vw, 280px);
    right: -6%;
    bottom: 12%;
    background: rgba(34, 121, 189, 0.4);
}

.nd54-ambient__mesh {
    position: absolute;
    inset: -20%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        rgba(34, 121, 189, 0.04),
        rgba(255, 215, 0, 0.05),
        rgba(126, 200, 255, 0.06),
        rgba(34, 121, 189, 0.04)
    );
    opacity: 0.7;
}

@media (prefers-reduced-motion: no-preference) {
    .nd54-ambient__orb--1 {
        animation: nd54-orb-drift-a 22s ease-in-out infinite alternate;
    }

    .nd54-ambient__orb--2 {
        animation: nd54-orb-drift-b 26s ease-in-out infinite alternate;
    }

    .nd54-ambient__mesh {
        animation: nd54-mesh-spin 48s linear infinite;
    }
}

@keyframes nd54-orb-drift-a {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(6vw, 4vh) scale(1.12); }
}

@keyframes nd54-orb-drift-b {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(-5vw, -3vh) scale(1.08); }
}

@keyframes nd54-mesh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------- */
/* Слои UI                                                                    */
/* -------------------------------------------------------------------------- */

body.nd54-premium-active #page-wraper {
    position: relative;
    z-index: 10000;
    width: 100%;
    max-width: none;
}

body.nd54-premium-active #page-wraper a,
body.nd54-premium-active #page-wraper button,
body.nd54-premium-active #page-wraper [role="button"],
body.nd54-premium-active .nd54-task-card,
body.nd54-premium-active .accordion-toggle {
    pointer-events: auto;
    cursor: pointer;
}

body.nd54-premium-active .menu {
    z-index: 10060;
}

body.nd54-premium-active .menu.open {
    z-index: 10070;
}

body.nd54-premium-active .profile-button,
body.nd54-premium-active .responsive-nav {
    z-index: 10055;
}

body.nd54-premium-active .profile-button {
    z-index: 10060;
}

body.nd54-premium-active .role-modal {
    z-index: 10070;
}

/* Первый экран всегда виден */
body.nd54-premium-active .section.about-me,
body.nd54-premium-active .section.about-me .nd54-reveal {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* -------------------------------------------------------------------------- */
/* Параллакс (лёгкий, без карты SVG)                                         */
/* -------------------------------------------------------------------------- */

body.nd54-premium-active .section-heading {
    will-change: transform;
    transform: translate3d(0, calc(var(--nd54-scroll, 0) * -0.035px), 0);
}

#section4.nd54-appeal-section .section-heading {
    transform: none !important;
    will-change: auto;
}

/* -------------------------------------------------------------------------- */
/* Scroll-reveal (после nd54-motion-ready)                                    */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
    html.nd54-motion-ready body.nd54-premium-active .nd54-reveal:not(.section.about-me) {
        opacity: 0;
        transform: translate3d(0, 28px, 0) scale(0.98);
        transition:
            opacity 0.7s var(--nd54-ease-out) var(--nd54-stagger, 0s),
            transform 0.75s var(--nd54-ease-out) var(--nd54-stagger, 0s);
    }

    html.nd54-motion-ready body.nd54-premium-active .nd54-reveal.nd54-reveal--visible:not(.section.about-me) {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* -------------------------------------------------------------------------- */
/* 3D-карточки и микро-анимации                                               */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
    body.nd54-premium-active .service-item,
    body.nd54-premium-active .service-item-link {
        transform-style: preserve-3d;
        transform: perspective(900px) rotateX(var(--nd54-tilt-x, 0deg)) rotateY(var(--nd54-tilt-y, 0deg)) translateZ(0);
        transition:
            transform 0.35s var(--nd54-ease-out),
            box-shadow 0.35s ease,
            border-color 0.25s ease;
        border: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow:
            0 10px 28px rgba(8, 30, 60, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.35);
        backdrop-filter: blur(6px);
    }

    body.nd54-premium-active .service-item:hover,
    body.nd54-premium-active .service-item-link:hover {
        transform: perspective(900px) rotateX(var(--nd54-tilt-x, 0deg)) rotateY(var(--nd54-tilt-y, 0deg)) translateY(-6px) translateZ(12px);
        box-shadow:
            0 18px 40px rgba(8, 30, 60, 0.18),
            0 0 0 1px rgba(255, 215, 0, 0.25);
    }

    body.nd54-premium-active .service-item-content i {
        display: inline-block;
        transition: transform 0.4s var(--nd54-ease-spring);
    }

    body.nd54-premium-active .service-item:hover .service-item-content i {
        transform: scale(1.12) translateZ(8px);
    }

    body.nd54-premium-active .role-card {
        transition: transform 0.35s var(--nd54-ease-out), box-shadow 0.35s ease;
    }

    body.nd54-premium-active .role-card:hover {
        transform: translateY(-6px) scale(1.02);
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
    }

    body.nd54-premium-active .btn-primary,
    body.nd54-premium-active .nd54-menu-toggle-btn,
    body.nd54-premium-active .profile-icon {
        transition: transform 0.25s var(--nd54-ease-spring), box-shadow 0.25s ease;
    }

    body.nd54-premium-active .btn-primary:hover,
    body.nd54-premium-active .nd54-menu-toggle-btn:hover,
    body.nd54-premium-active .profile-icon:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 8px 22px rgba(34, 121, 189, 0.35);
    }

    body.nd54-premium-active .btn-primary:active {
        transform: translateY(0) scale(0.98);
    }

    body.nd54-premium-active .line-dec {
        display: block;
        height: 3px;
        width: 64px;
        margin: 0.75rem auto 1rem;
        border-radius: 999px;
        background: linear-gradient(90deg, transparent, #ffd700, #2279bd, transparent);
        background-size: 200% 100%;
        animation: nd54-line-shimmer 4s ease-in-out infinite;
    }

    body.nd54-premium-active .nd54-project-tasks-panel {
        transition: transform 0.35s var(--nd54-ease-out), box-shadow 0.35s ease;
    }

    body.nd54-premium-active .nd54-project-tasks-panel:hover {
        transform: translateY(-3px);
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
    }

    /* «Живой» блок галереи (CSS вместо gif) */
    body.nd54-premium-active .nd54-gallery-live {
        position: relative;
        min-height: 200px;
        border-radius: 16px;
        overflow: hidden;
        background: linear-gradient(135deg, rgba(34, 121, 189, 0.15), rgba(255, 215, 0, 0.08));
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.nd54-premium-active .nd54-gallery-live::before {
        content: "";
        position: absolute;
        inset: -50%;
        background: conic-gradient(from 0deg, transparent, rgba(126, 200, 255, 0.2), transparent, rgba(255, 215, 0, 0.15), transparent);
        animation: nd54-mesh-spin 12s linear infinite;
    }

    body.nd54-premium-active .nd54-gallery-live__icon {
        position: relative;
        font-size: 3rem;
        color: #2279bd;
        animation: nd54-icon-pulse 2.4s ease-in-out infinite;
    }

    /* Карусель — лёгкий Ken Burns */
    body.nd54-premium-active .news-carousel .carousel-item.active img {
        animation: nd54-kenburns 14s ease-in-out infinite alternate;
    }

    /* Премиум-hover только у карусели новостей (там заданы top: 50% и translateY для центрирования) */
    body.nd54-premium-active #newsCarousel .carousel-control-prev,
    body.nd54-premium-active #newsCarousel .carousel-control-next {
        transition: transform 0.25s ease, background 0.25s ease;
    }

    body.nd54-premium-active #newsCarousel .carousel-control-prev:hover,
    body.nd54-premium-active #newsCarousel .carousel-control-next:hover {
        transform: translateY(-50%) scale(1.08);
    }
}

@keyframes nd54-line-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes nd54-icon-pulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}

@keyframes nd54-kenburns {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

/* Карта — без премиум-анимаций (стабильность) */
body.nd54-premium-active .map-explorer,
body.nd54-premium-active .map-explorer *,
body.nd54-premium-active #clickableMap,
body.nd54-premium-active #clickableMap *,
body.nd54-premium-active object.svg-map {
    animation: none !important;
    transform: none !important;
    filter: none !important;
}

/* Task modal — без скрытия премиумом */
body.nd54-premium-active #taskModalCustom.custom-modal--open {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

@media (prefers-reduced-motion: reduce) {
    .nd54-ambient__orb,
    .nd54-ambient__mesh,
    .nd54-scroll-progress {
        animation: none !important;
    }

    body.nd54-premium-active .nd54-reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    body.nd54-premium-active .service-item:hover,
    body.nd54-premium-active .service-item-link:hover {
        transform: none !important;
    }
}

/* Форма обращения: читаемый текст и компактный отступ до карточки (после main.min.css) */
#section4.nd54-appeal-section .section-heading {
    padding: 0.75rem 0 0.5rem !important;
    margin-bottom: 0.75rem !important;
}

#section4.nd54-appeal-section .section-heading h2,
#section4.nd54-appeal-section .nd54-appeal-title {
    color: #0f172a !important;
}

#section4.nd54-appeal-section .section-heading p,
#section4.nd54-appeal-section .nd54-appeal-subtitle {
    color: #475569 !important;
}
