/* Энтелехия — mobile & touch (по мотивам laser-band) */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body > header {
    padding-top: env(safe-area-inset-top);
}

/* ——— Burger ——— */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

body.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

body.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.nav-open .nav-backdrop {
    display: block;
}

body.nav-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    :root {
        --header-h: 64px;
    }

    /* body > header { z-index: 1 } в styles.css — поднимаем, иначе backdrop перекрывает меню */
    body > header {
        z-index: 1000;
    }

    body.nav-open > header {
        z-index: 1002;
    }

    html {
        overflow-x: clip;
    }

    body {
        overflow-x: clip;
    }

    .nav-toggle {
        display: flex;
    }

    .navbar {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        column-gap: 0;
        gap: 10px;
    }

    .logo {
        order: 1;
        z-index: 1002;
        margin-right: auto;
        margin-left: 0;
        justify-self: auto;
        grid-column: auto;
    }

    .nav-links {
        order: 2;
    }

    .nav-toggle {
        order: 3;
        position: relative;
        z-index: 1004;
        margin-left: clamp(8px, 2vw, 12px);
    }

    body.nav-open .nav-toggle {
        z-index: 1004;
    }

    .nav-cta {
        display: none;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        z-index: 1003;
        width: min(300px, 88vw);
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding: calc(env(safe-area-inset-top) + 72px) 20px calc(env(safe-area-inset-bottom) + 24px);
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;
        flex-wrap: nowrap;
        justify-content: flex-start;
        grid-column: auto;
        justify-self: auto;
        list-style: none;
        background: rgba(30, 38, 50, 0.98);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: none;
        transform: translateX(112%);
        opacity: 1;
        pointer-events: none;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        -webkit-overflow-scrolling: touch;
    }

    body.nav-open .nav-links,
    .nav-links.is-open {
        transform: translateX(0);
        pointer-events: auto;
        box-shadow: -20px 0 60px rgba(0, 0, 0, 0.45);
    }

    .nav-links::after {
        display: none;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links__cta {
        display: block;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-link {
        display: block;
        padding: 14px 12px;
        font-size: 1.05rem;
        border-radius: 12px;
    }

    .nav-link::after {
        display: none;
    }

    .nav-link:hover,
    .nav-link.is-active {
        background: rgba(74, 143, 224, 0.12);
    }

    .nav-link--application {
        text-align: center;
        background: rgba(74, 143, 224, 0.16);
        border: 1px solid rgba(74, 143, 224, 0.35);
    }

    body.page-home > header:not(.is-scrolled) {
        background: transparent !important;
        border-bottom: none !important;
        box-shadow: none !important;
    }

    body > header.is-scrolled,
    body.nav-open > header {
        background: rgba(30, 38, 50, 0.92) !important;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    /* Hero */
    .hero {
        height: auto;
        min-height: 100svh;
        min-height: 100dvh;
        align-items: flex-end;
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }

    .hero-inner {
        padding: calc(var(--header-h) + 20px) 20px max(32px, env(safe-area-inset-bottom));
        width: 100%;
    }

    .page-home .hero-core {
        transform: translateY(clamp(-16px, -3vh, -32px));
    }

    .hero-overlay {
        background:
            linear-gradient(180deg, rgba(30, 38, 50, 0.08) 0%, rgba(30, 38, 50, 0.35) 38%, rgba(30, 38, 50, 0.9) 72%, rgba(30, 38, 50, 0.98) 100%);
    }

    .hero-bg__video {
        object-position: center 22%;
        transform: scale(1.12);
        filter: saturate(1.05) brightness(0.82);
    }

    .hero h1 {
        font-size: clamp(1.85rem, 8.5vw, 2.35rem);
        line-height: 1.08;
    }

    .hero p {
        font-size: 1rem;
        line-height: 1.55;
    }

    .hero-eyebrow {
        font-size: 0.72rem;
        padding: 0;
        margin-bottom: 14px;
        letter-spacing: 0.12em;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        padding: 14px 20px;
    }

    .hero-features {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 20px;
        padding-top: 18px;
    }

    .hero-feature {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        min-width: 0;
        width: 100%;
        text-align: left;
    }

    .hero-feature__icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .hero-scroll {
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .mesh-blob {
        filter: blur(60px);
        opacity: 0.75;
    }

    /* Sections */
    .section-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

    .depth-section {
        padding-left: 0;
        padding-right: 0;
    }

    .section-lead,
    .page-hero__lead {
        font-size: 0.95rem;
        line-height: 1.55;
    }

    .heading-shine,
    .section-shell > h2,
    .depth-section > .section-shell > h2 {
        font-size: clamp(1.4rem, 5.5vw, 1.75rem);
    }

    .page-hero,
    .page-hero--inner {
        min-height: auto;
        padding: calc(var(--header-h) + 24px) 20px 32px;
    }

    .page-hero__content h1 {
        font-size: clamp(1.65rem, 7vw, 2rem);
    }

    .trust-line {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    /* Process */
    .process-flow {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .process-step {
        padding: 20px 18px 18px;
    }

    .process-step::after {
        display: none !important;
    }

    /* Stats */
    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat {
        padding: 16px 14px;
    }

    /* Bento */
    .bento-grid,
    .bento-grid--4 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .bento-card {
        min-height: 0;
        padding: 20px 18px;
    }

    .bento-card:hover {
        transform: none !important;
    }

    /* Services tabs */
    .services-tabs {
        grid-template-columns: 1fr;
    }

    .services-tabs__nav {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .services-tabs__btn {
        width: 100%;
        flex: 1 1 auto;
        min-width: 0;
        min-height: 48px;
        text-align: left;
        padding: 12px 16px;
    }

    .services-tabs__panel {
        grid-template-columns: 1fr;
    }

    .services-tabs__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .services-tabs__actions .btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .services-tabs__media {
        max-height: 220px;
        border-radius: 16px;
        overflow: hidden;
    }

    /* Innovation */
    .innovation-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .innovation-card__foot {
        justify-content: center;
    }

    .innovation-card__stat {
        width: 100%;
        justify-content: center;
    }

    .innovation-card__stats {
        grid-template-columns: 1fr;
    }

    .page-hero__lead {
        text-align: left;
    }

    /* Work cards */
    .work-cards-stage {
        gap: 14px;
    }

    .work-card__trigger {
        padding: 16px 14px;
        min-height: 56px;
    }

    .work-card.is-expanded .work-card__panel {
        padding: 0 14px 18px;
    }

    .wc-panel-tabs__btn {
        min-height: 46px;
        font-size: 0.92rem;
    }

    .wc-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-section__hint {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .bim-stage,
    .supervision-card {
        padding: 20px 16px;
    }

    /* Split / about */
    .split-section {
        gap: 20px;
    }

    .split-section__media img,
    .split-section__media video {
        border-radius: 16px;
        max-height: 280px;
        object-fit: cover;
    }

    .about-pillars {
        grid-template-columns: 1fr;
    }

    /* FAQ & quiz */
    .faq-item > summary {
        padding: 16px 18px;
        font-size: 0.95rem;
    }

    .quiz {
        padding: 20px 16px;
    }

    .quiz__options {
        grid-template-columns: 1fr !important;
    }

    .quiz__nav {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .quiz__nav .btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    /* CTA blocks */
    .cta-block,
    .cta-strip {
        margin-left: 16px;
        margin-right: 16px;
        padding: 28px 20px;
        border-radius: 20px;
    }

    .cta-block .btn,
    .cta-strip .btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .cta-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .cta-modal__dialog {
        max-height: calc(100dvh - 16px);
        border-bottom-left-radius: 18px;
        border-bottom-right-radius: 18px;
    }

    .cta-modal__layout {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer {
        padding: 28px 16px calc(20px + env(safe-area-inset-bottom));
    }

    .footer__inner {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .footer__links {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .footer__links a {
        padding: 8px 12px;
        font-size: 0.95rem;
    }

    .footer__copy {
        text-align: center;
    }

    /* To top */
    .to-top {
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
        width: 48px;
        height: 48px;
    }

    /* Contacts */
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .contact-map iframe {
        height: min(48vh, 300px);
    }

    /* Application page */
    .application-layout {
        grid-template-columns: 1fr;
    }

    .application-form input,
    .application-form textarea,
    .application-form select {
        font-size: 16px;
        min-height: 48px;
    }

    /* Gate login */
    .gate-page {
        padding: 20px 16px;
    }

    .gate-card {
        padding: 28px 20px 24px;
    }

    /* Disable heavy hover transforms on touch */
    .bento-card,
    .process-step,
    .innovation-card,
    .work-card,
    .faq-item,
    .stat {
        transform: none !important;
    }
}

@media (max-width: 480px) {
    :root {
        --header-h: 60px;
    }

    .logo img {
        width: 42px;
        height: 42px;
    }

    .stats-strip {
        grid-template-columns: 1fr;
    }

    .hero h1 br {
        display: none;
    }
}

@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
    .hero-bg__video {
        transform: scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-links {
        transition: none !important;
    }

    .hero-bg__video {
        transform: none !important;
    }
}
