/**
 * ND54 — «живые» компоненты и анимации.
 * Базовая тема (шрифт Inter, тени, переходы): assets/css/nd54-theme.css — подключать перед этим файлом.
 * Font Awesome 6 — подключать перед этим файлом.
 */

/* Иконки: не перебивать семейством шрифта родителя (частая причина «пустых» иконок) */
.fas, .fa-solid,
i.fas, i.fa-solid {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.far, .fa-regular,
i.far, i.fa-regular {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 400 !important;
    font-style: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.fab, .fa-brands,
i.fab, i.fa-brands {
    font-family: "Font Awesome 6 Brands" !important;
    font-weight: 400 !important;
    font-style: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .btn,
    .btn-sm,
    .btn-ripple,
    .card,
    .glass-card,
    .stat-card,
    .service-item,
    .role-card,
    .workspace-tab,
    .main-nav-item,
    .sub-nav-tab,
    .appeal-card,
    .kpi-card,
    .login-card,
    .checklist-header,
    .profile-header {
        transition:
            transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
            box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1),
            background 0.28s ease,
            color 0.22s ease,
            border-color 0.22s ease,
            filter 0.28s ease;
    }

    .card:hover,
    .login-card:hover {
        box-shadow: 0 14px 32px rgba(13, 110, 253, 0.16);
    }

    .profile-header:hover {
        box-shadow: 0 16px 40px rgba(13, 110, 253, 0.28);
    }

    .btn:active,
    .workspace-tab:active,
    .main-nav-item:active {
        transform: scale(0.98);
    }
}

/* =============================================================================
   Главная: «Задачи проекта» — стеклянная панель + hover-анимации иконок
   ============================================================================= */

.nd54-project-tasks-panel {
    margin-top: 0.35rem;
    padding: 1.75rem 1.25rem 2rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow:
        0 12px 40px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    color: #0f172a;
}

.nd54-project-tasks-panel h4 {
    color: #0f172a !important;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.nd54-project-tasks-grid > li {
    text-align: center;
    list-style: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    padding: 1.35rem 1rem !important;
    transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.25s ease, background 0.25s ease;
    color: #1e293b !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nd54-project-tasks-grid > li:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.34);
}

.left-image-post .nd54-project-tasks-grid > li:hover {
    background: rgba(255, 255, 255, 0.34) !important;
}

/* «Задачи проекта»: на узких экранах иллюстрация крупнее и по центру (перебивает main.min.css: .left-image img { max-height: 200px }) */
@media (max-width: 991.98px) {
    .nd54-tasks-project-block .nd54-tasks-hero-col {
        margin-bottom: 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center !important;
        flex: 0 0 100%;
        max-width: 100%;
    }

    .nd54-tasks-project-block .left-image {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        max-width: 100%;
        float: none;
    }

    .nd54-tasks-project-block .nd54-tasks-hero-img,
    .nd54-tasks-project-block .left-image img.nd54-tasks-hero-img {
        width: min(100%, 520px);
        max-width: 100%;
        height: auto;
        max-height: none !important;
        object-fit: contain !important;
        margin-left: auto;
        margin-right: auto;
        display: block;
    }
}

.nd54-project-tasks-grid > li h5 {
    color: #1e293b !important;
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 0.85rem !important;
    margin-bottom: 0.35rem;
}

.nd54-project-tasks-grid > li small {
    display: block;
    color: #475569 !important;
    font-size: 0.86rem !important;
    line-height: 1.45;
    max-width: 22em;
    margin-left: auto;
    margin-right: auto;
}

.nd54-project-tasks-grid > li * {
    color: inherit;
}

.nd54-project-tasks-panel .task-icon {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    margin-bottom: 2px;
}

/* Круг под иконку Font Awesome */
.nd54-icon-bubble {
    position: relative;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    transition:
        transform 0.4s cubic-bezier(0.34, 1.45, 0.64, 1),
        box-shadow 0.3s ease,
        filter 0.25s ease;
}

.nd54-icon-bubble > i:only-child {
    font-size: 2.75rem;
    line-height: 1;
    color: #fff !important;
    transition: transform 0.35s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(1) .nd54-icon-bubble {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(2) .nd54-icon-bubble {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(3) .nd54-icon-bubble {
    background: linear-gradient(135deg, #fbc02d, #f9a825);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(4) .nd54-icon-bubble {
    background: linear-gradient(135deg, #1976d2, #1565c0);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(5) .nd54-icon-bubble {
    background: linear-gradient(135deg, #00796b, #00695c);
}

.nd54-project-tasks-panel .nd54-project-tasks-grid > li:nth-child(6) .nd54-icon-bubble {
    background: linear-gradient(135deg, #7b1fa2, #6a1b9a);
}

/* --- 1. Безопасность: щит увеличивается --- */
.nd54-project-tasks-grid > li:nth-child(1):hover .nd54-icon-bubble--security {
    transform: scale(1.22);
    box-shadow: 0 16px 36px rgba(183, 28, 28, 0.45);
}

.nd54-project-tasks-grid > li:nth-child(1):hover .nd54-icon-bubble--security i {
    transform: scale(1.08);
}

/* --- 2. Сотрудничество: одно рукопожатие, «живое» (лёгкое покачивание + сжатие) --- */
.nd54-icon-bubble--handshake {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.nd54-icon-bubble--handshake .nd54-handshake-icon {
    font-size: 2.35rem !important;
    line-height: 1;
    color: #fff !important;
    display: block;
    transform-origin: 50% 65%;
    will-change: transform;
}

@keyframes nd54-handshake-live-idle {
    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }
    20% {
        transform: rotate(-5deg) scale(1.03);
    }
    40% {
        transform: rotate(4deg) scale(1.06);
    }
    60% {
        transform: rotate(-3deg) scale(1.04);
    }
    80% {
        transform: rotate(2deg) scale(1.02);
    }
}

@keyframes nd54-handshake-live-hover {
    0%,
    100% {
        transform: rotate(0deg) scale(1.05);
        filter: brightness(1);
    }
    25% {
        transform: rotate(-8deg) scale(1.12);
        filter: brightness(1.12);
    }
    50% {
        transform: rotate(8deg) scale(1.14);
        filter: brightness(1.08);
    }
    75% {
        transform: rotate(-5deg) scale(1.1);
        filter: brightness(1.1);
    }
}

.nd54-project-tasks-grid > li:nth-child(2) .nd54-icon-bubble--handshake .nd54-handshake-icon {
    animation: nd54-handshake-live-idle 3.2s ease-in-out infinite;
}

.nd54-project-tasks-grid > li:nth-child(2):hover .nd54-icon-bubble--handshake {
    transform: scale(1.14);
    box-shadow: 0 14px 34px rgba(21, 101, 192, 0.42);
}

.nd54-project-tasks-grid > li:nth-child(2):hover .nd54-icon-bubble--handshake .nd54-handshake-icon {
    animation: nd54-handshake-live-hover 0.55s ease-in-out infinite;
}

/* --- 3. Предупреждение: молния / разряд --- */
@keyframes nd54-bolt-zap {
    0%,
    100% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
        transform: rotate(0deg) scale(1);
    }
    40% {
        filter: brightness(1.35) drop-shadow(0 0 10px rgba(254, 240, 138, 0.95));
        transform: rotate(-10deg) scale(1.12);
    }
    55% {
        filter: brightness(1.2) drop-shadow(0 0 16px #fff59d);
        transform: rotate(8deg) scale(1.06);
    }
}

.nd54-project-tasks-grid > li:nth-child(3):hover .nd54-icon-bubble--bolt {
    animation: nd54-bolt-zap 0.5s ease-in-out infinite;
}

.nd54-project-tasks-grid > li:nth-child(3):hover .nd54-icon-bubble--bolt i {
    animation: none;
}

/* --- 4. Воспитание: «падает» из угла --- */
@keyframes nd54-cap-drop {
    0% {
        transform: translate(-14px, -20px) rotate(-42deg) scale(0.82);
        opacity: 0.85;
    }
    55% {
        transform: translate(3px, 4px) rotate(12deg) scale(1.06);
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

.nd54-project-tasks-grid > li:nth-child(4):hover .nd54-icon-bubble--education i {
    animation: nd54-cap-drop 0.7s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* --- 5. Здоровье: бег --- */
@keyframes nd54-runner {
    0% {
        transform: translateX(-5px) rotate(-6deg);
    }
    100% {
        transform: translateX(6px) rotate(6deg);
    }
}

.nd54-project-tasks-grid > li:nth-child(5):hover .nd54-icon-bubble--run i {
    animation: nd54-runner 0.26s ease-in-out infinite alternate;
}

.nd54-project-tasks-grid > li:nth-child(5):hover .nd54-icon-bubble--run {
    transform: translateY(-2px);
}

/* --- 6. Активность: «говорит» + кольца --- */
@keyframes nd54-megaphone-speak {
    0% {
        transform: scale(1) rotate(-5deg);
    }
    100% {
        transform: scale(1.1) rotate(5deg);
    }
}

@keyframes nd54-speak-ring {
    0% {
        transform: scale(0.92);
        opacity: 0.65;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

.nd54-icon-bubble--speak::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
    pointer-events: none;
    opacity: 0;
}

.nd54-project-tasks-grid > li:nth-child(6):hover .nd54-icon-bubble--speak::after {
    animation: nd54-speak-ring 0.85s ease-out infinite;
}

.nd54-project-tasks-grid > li:nth-child(6):hover .nd54-icon-bubble--speak i {
    animation: nd54-megaphone-speak 0.32s ease-in-out infinite alternate;
}

@media (max-width: 768px) {
    .nd54-icon-bubble {
        width: 72px;
        height: 72px;
    }

    .nd54-icon-bubble > i:only-child {
        font-size: 2.1rem;
    }

    .nd54-project-tasks-panel {
        padding: 1.35rem 1rem 1.5rem;
    }

    .nd54-project-tasks-panel .task-icon {
        min-height: 78px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nd54-project-tasks-grid > li,
    .nd54-icon-bubble,
    .nd54-icon-bubble--handshake .nd54-handshake-icon,
    .nd54-icon-bubble > i {
        transition: none !important;
        animation: none !important;
    }

    .nd54-project-tasks-grid > li:hover {
        transform: none;
    }

    .nd54-project-tasks-grid > li:nth-child(1):hover .nd54-icon-bubble--security,
    .nd54-project-tasks-grid > li:nth-child(2):hover .nd54-icon-bubble--handshake,
    .nd54-project-tasks-grid > li:nth-child(5):hover .nd54-icon-bubble--run {
        transform: none;
    }

    .nd54-icon-bubble--speak::after {
        display: none;
    }

}

/* =============================================================================
   Нарратив по скроллу (главная)
   ============================================================================= */

@media (prefers-reduced-motion: no-preference) {
    .nd54-reveal {
        opacity: 0;
        transform: translateY(18px);
        transition:
            opacity 0.55s var(--nd54-ease-out) var(--nd54-stagger, 0s),
            transform 0.55s var(--nd54-ease-out) var(--nd54-stagger, 0s);
        will-change: opacity, transform;
    }

    .nd54-reveal.nd54-reveal--visible {
        opacity: 1;
        transform: translateY(0);
        will-change: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nd54-reveal {
        opacity: 1;
        transform: none;
    }
}

/* =============================================================================
   Аккордеон «О нас» (мобильная ширина)
   ============================================================================= */

@media (min-width: 846px) {
    .nd54-about-accordion .accordion-content {
        display: block !important;
    }

    .nd54-about-accordion .accordion-content[hidden] {
        display: block !important;
    }
}

.nd54-about-accordion .accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    font-weight: 700;
    border-radius: var(--nd54-radius-sm, 8px);
    box-shadow: var(--nd54-shadow-xs, 0 1px 3px rgba(15, 23, 42, 0.06));
}

.nd54-about-accordion .nd54-acc-toggle__label {
    flex: 1;
    min-width: 0;
}

.nd54-about-accordion .nd54-acc-toggle__chevron {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: rgba(255, 255, 255, 0.92);
    transition: transform 0.4s var(--nd54-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.nd54-about-accordion .accordion-toggle:focus-visible {
    outline: none;
    box-shadow: var(--nd54-focus-ring, 0 0 0 3px rgba(34, 121, 189, 0.35));
}

.nd54-about-accordion .accordion-toggle[aria-expanded="true"] .nd54-acc-toggle__chevron,
.nd54-about-accordion .accordion-toggle.active .nd54-acc-toggle__chevron {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .nd54-about-accordion .nd54-acc-toggle__chevron {
        transition: none;
    }
}

/* =============================================================================
   Карта: индикатор загрузки, подсветка региона, панель города
   ============================================================================= */

@keyframes nd54-map-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.map-explorer:not(.map-explorer--ready) .map-explorer-viewport {
    position: relative;
}

.map-explorer:not(.map-explorer--ready) .map-explorer-viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
        110deg,
        rgba(241, 245, 249, 0) 0%,
        rgba(226, 232, 240, 0.65) 45%,
        rgba(241, 245, 249, 0) 90%
    );
    background-size: 200% 100%;
    opacity: 0.55;
}

@media (prefers-reduced-motion: no-preference) {
    .map-explorer:not(.map-explorer--ready) .map-explorer-viewport::after {
        animation: nd54-map-shimmer 1.15s ease-in-out infinite;
    }

    .map-explorer--oblast:not(.map-explorer--city-zoom) .map-explorer-viewport::before {
        content: "";
        position: absolute;
        inset: -6px;
        z-index: 0;
        pointer-events: none;
        border-radius: 18px;
        box-shadow:
            inset 0 0 0 2px rgba(var(--nd54-primary-rgb, 34, 121, 189), 0.22),
            0 0 48px rgba(var(--nd54-primary-rgb, 34, 121, 189), 0.12);
        opacity: 1;
        transition: opacity 0.45s ease, box-shadow 0.45s ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-explorer:not(.map-explorer--ready) .map-explorer-viewport::after {
        animation: none;
        opacity: 0.35;
    }
}

.map-explorer .map-level--country,
.map-explorer .map-oblast-zoom,
.map-city-panel {
    position: relative;
    z-index: 2;
}

.map-city-panel {
    transition:
        opacity 0.48s var(--nd54-ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
        transform 0.48s var(--nd54-ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
        visibility 0.48s;
}

.map-explorer--city-open .map-city-panel.is-active {
    box-shadow:
        0 12px 36px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(var(--nd54-primary-rgb, 34, 121, 189), 0.12);
}

.map-city-marker {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

@media (prefers-reduced-motion: reduce) {
    .map-level--country.map-level--exiting {
        transition: none !important;
    }

    .map-level--oblast:not([hidden]) .map-oblast-stage {
        animation: none !important;
    }

    .map-oblast-zoom {
        transition: none !important;
    }

    .map-city-panel {
        transition: opacity 0.15s ease, visibility 0.15s;
    }
}

/* =============================================================================
   Форма обращения: отправка
   ============================================================================= */

#contact.nd54-form--submitting .btn-submit {
    position: relative;
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    #contact.nd54-form--submitting .btn-submit {
        filter: brightness(0.97);
    }
}

/* =============================================================================
   Правовые страницы: лёгкий вход, без лишней анимации иконок
   ============================================================================= */

@media (prefers-reduced-motion: no-preference) {
    body.nd54-page-legal #page-wraper {
        animation: nd54-legal-fade 0.4s ease both;
    }
}

@keyframes nd54-legal-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.nd54-page-legal #page-wraper {
        animation: none;
    }

    body.nd54-page-legal .accordion-content .list-unstyled li i {
        animation: none !important;
    }

    body.nd54-page-legal .accordion-content .list-unstyled li:hover i {
        transform: none !important;
    }
}

/* =============================================================================
   Соцдоказательство: счётчики (опционально, data-nd54-count)
   ============================================================================= */

@media (prefers-reduced-motion: no-preference) {
    [data-nd54-count].nd54-count--armed {
        font-variant-numeric: tabular-nums;
    }
}

/* =============================================================================
   Формы и загрузка: микровзаимодействия (весь сайт)
   ============================================================================= */

@media (prefers-reduced-motion: no-preference) {
    .form-control.is-invalid,
    .form-control.is-valid {
        transition:
            border-color 0.22s var(--nd54-ease, cubic-bezier(0.22, 1, 0.36, 1)),
            box-shadow 0.22s ease;
    }
}

.was-validated .form-control:invalid {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Универсальный скелетон / плейсхолдер блока */
.nd54-skeleton {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 45%, #f1f5f9 90%);
    background-size: 220% 100%;
    border-radius: var(--nd54-radius-sm, 8px);
    min-height: 1.25em;
}

@media (prefers-reduced-motion: no-preference) {
    .nd54-skeleton--animate {
        animation: nd54-map-shimmer 1.15s ease-in-out infinite;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nd54-skeleton--animate {
        animation: none;
    }
}

/* Короткий успех поля / формы (без «конфетти») */
@keyframes nd54-ok-flash {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 121, 189, 0);
    }
    40% {
        box-shadow: 0 0 0 3px rgba(34, 121, 189, 0.35);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 121, 189, 0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .nd54-flash-ok {
        animation: nd54-ok-flash 0.55s var(--nd54-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
    }
}
