/**
 * RESPONSIVE — Mobile-first breakpoints: 480px, 768px, 1024px
 * Uses Flexbox/Grid, relative units (rem), touch targets 44x44px
 */

/* --- MOBILE: Prevent horizontal overflow, fix text cut-off --- */
@media (max-width: 768px) {
    html, body, .site-glass-wrap, main {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .container, .roadmap-container, .ready-container, .ready-sidebar-inner,
    .roadmap-ready-wrapper, .roadmap-header, .roadmap-panel-inner,
    .roadmap-panel-head, .roadmap-panel-body, .ready-form-wrap {
        max-width: 100%;
        min-width: 0;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
    }

    .roadmap-title, .roadmap-panel-title, .roadmap-panel-desc,
    .ready-title, .ready-intro, .hero-title, .hero-title__line, .hero-description,
    .agency-badge, .accent-word {
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
    }

    .accent-word {
        white-space: normal !important;
    }
}

/* --- Containers: relative units --- */
@media (max-width: 1024px) {
    .container,
    .footer-container,
    .timeline-container,
    .cases-container,
    .problems-container,
    .team-container {
        padding-left: clamp(var(--space-md), 4vw, 1.5rem);
        padding-right: clamp(var(--space-md), 4vw, 1.5rem);
    }

    body {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    section,
    aside.ready-section {
        max-width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 768px) {
    .container,
    .footer-container,
    .timeline-container,
    .cases-container,
    .problems-container,
    .team-container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 480px) {
    .container,
    .footer-container,
    .timeline-container,
    .cases-container,
    .problems-container,
    .team-container {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }
}

/* --- Навбар и логотип --- */
@media (max-width: 1200px) {
    .navbar {
        height: 120px;
    }

    .nav-brand {
        height: 120px;
    }

    .nav-brand .main-logo-svg,
    .navbar .main-logo-svg {
        height: 110px;
        max-height: 120px;
    }

    .nav-link {
        padding: 8px 11px;
        font-size: clamp(0.68rem, 1.05vw, 0.76rem);
    }

    .nav-right-group {
        gap: 16px;
    }
}

@media (max-width: 992px) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 16px 50px;
    }

    .nav-menu {
        background: transparent;
        border: none;
        padding: 0;
    }

    /* Шапка: высота по контенту + вырез — логотип не должен быть выше строки навигации */
    .navbar {
        height: auto;
        min-height: calc(52px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: 10px;
        box-sizing: border-box;
    }

    .nav-brand {
        height: auto;
        max-height: none;
        align-items: center;
    }

    .nav-brand .main-logo-svg,
    .navbar .main-logo-svg {
        height: 50px;
        max-height: 54px;
        width: auto;
    }

    .navbar.scrolled {
        min-height: calc(48px + env(safe-area-inset-top, 0px));
        padding-bottom: 8px;
    }

    .navbar.scrolled .main-logo-svg {
        height: 42px;
        max-height: 46px;
    }

    .nav-container {
        padding: 0 16px;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .nav-menu {
        display: none !important;
    }

    .nav-burger {
        display: inline-flex;
        order: 2;
        margin-left: auto;
        flex-shrink: 0;
        min-width: 44px;
        min-height: 44px;
    }

    .nav-menu_mobile {
        top: calc(env(safe-area-inset-top, 0px) + 54px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 54px);
    }

    .nav-right-group {
        order: 3;
        gap: 8px;
        flex-shrink: 0;
    }

    .nav-phone-compact {
        display: none;
    }

    .nav-cta-btn:not(.nav-cta-btn--contact-sheet) {
        padding: 9px 16px;
        font-size: 0.58rem;
    }

    .hero-grid {
        grid-template-columns: 1fr !important;
        text-align: left;
        gap: 32px;
    }

    /* На планшетах и мобильных — убираем блок с основателями с первого экрана,
       чтобы сфокусировать пользователя на оффере и сделать хиро чище */
    .hero-founders {
        display: none;
    }

    .hero-description-wrapper {
        max-width: 100% !important;
    }

    .hero-description {
        max-width: 100% !important;
    }

    .hero-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }

    .hero-founders {
        justify-content: flex-start !important;
        gap: 20px;
    }

    .founder-card {
        width: clamp(140px, 30vw, 180px) !important;
    }

    .founder-card.offset {
        margin-top: 0 !important;
    }

    .metrics-grid {
        flex-wrap: wrap !important;
    }

    .metric-item {
        flex: 1 1 45% !important;
    }

    .vnedrenie .label {
        font-size: 0.85rem;
    }

    .cursor-light {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: calc(76px + env(safe-area-inset-top, 0px)) 16px 24px;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-x: hidden;
    }

    .hero .container {
        padding-left: 16px;
        padding-right: 16px;
        min-width: 0;
    }

    .hero-grid {
        gap: 24px !important;
        min-width: 0;
    }

    .hero-text-block {
        min-width: 0;
        min-height: clamp(240px, 42vh, 300px);
    }

    .agency-badge.hero-kicker {
        margin-bottom: 10px;
        gap: 10px;
    }

    .hero-kicker__text {
        font-size: clamp(0.54rem, 1.85vw, 0.62rem);
    }

    .hero-kicker__rule {
        width: 28px;
    }

    .hero-title {
        margin-bottom: 16px;
        gap: 0.05em;
    }

    .hero-title__line--top {
        font-size: clamp(2.025rem, 8.4vw, 3.075rem);
    }

    .hero-title__line--bottom {
        font-size: clamp(2.22rem, 9.15vw, 3.3rem);
    }

    .hero-description-wrapper {
        margin-bottom: 20px;
        padding: 13px 14px 13px 16px;
        border-radius: 12px;
        box-shadow:
            inset 2px 0 0 0 rgba(255, 215, 0, 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            0 12px 36px -16px rgba(0, 0, 0, 0.6);
    }

    .hero-description {
        font-size: 0.875rem;
        line-height: 1.5;
        max-width: 100%;
    }

    .hero-actions {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 12px;
        align-items: stretch;
        width: 100%;
    }

    .hero-cta-block {
        width: 100%;
        order: -1;
    }

    .hero-cta-trust {
        text-align: center;
        font-size: 0.65rem;
        color: rgba(255, 255, 255, 0.6);
    }

    .btn-main {
        width: 100%;
        max-width: 100%;
        text-align: center;
        padding: 14px 24px;
        font-size: 0.8rem;
        letter-spacing: 0.05em;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .vnedrenie {
        display: none;
    }

    .vnedrenie .label {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
        opacity: 0.9;
    }

    /* Founders — компактно, без переполнения по ширине */
    .hero-founders {
        gap: 16px !important;
        justify-content: center;
        flex-wrap: wrap;
    }

    .founder-card {
        width: clamp(100px, 36vw, 130px) !important;
        min-width: 0;
    }

    .founder-info .founder-name {
        font-size: 0.72rem;
        letter-spacing: 0.5px;
    }

    .founder-info .founder-role {
        font-size: 0.58rem;
        letter-spacing: 0.3px;
    }

    .img-wrapper {
        margin-bottom: 8px;
    }

    /* Metrics — компактная плашка, отделена от блока основателей */
    .system-metrics {
        margin-top: 20px !important;
        padding: 0 2px;
    }

    .metrics-mobile-heading {
        display: block;
        font-family: var(--font-b);
        font-size: 0.55rem;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: rgba(255, 255, 255, 0.45);
        margin: 0 0 10px;
        text-align: left;
    }

    .metrics-mobile-wrap {
        display: block;
        min-width: 0;
    }

    .metrics-scroll {
        overflow: visible;
    }

    .metrics-grid {
        min-width: 0;
    }

    .metrics-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px 6px !important;
        border-radius: 10px;
        padding: 8px 6px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 215, 0, 0.12) !important;
        box-shadow: none !important;
    }

    /* На планшетах и узких экранах — достижения в 2×2 для читаемости */
    .metrics-achievements {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px 12px !important;
        padding: 12px 10px !important;
    }

    .metrics-achievements .metric-item {
        padding: 10px 6px 12px !important;
    }

    .metrics-achievements .metric-value {
        font-size: 1.25rem !important;
    }

    .metrics-achievements .metric-label--mobile {
        font-size: 0.52rem !important;
    }

    .metrics-grid::before {
        opacity: 0.5;
    }

    .metric-item {
        padding: 4px 2px 6px !important;
        min-width: 0 !important;
    }

    .metric-item + .metric-item::before {
        display: none;
    }

    .metric-value {
        font-size: 1.15rem !important;
        margin-bottom: 2px !important;
        color: var(--accent);
    }

    .metric-label--desktop {
        display: none !important;
    }

    .metric-label--mobile {
        display: block !important;
        font-size: 0.48rem !important;
        letter-spacing: 0.2px;
        line-height: 1.2;
        color: rgba(255, 255, 255, 0.75);
        text-transform: none;
        word-break: break-word;
    }

    .metric-label {
        font-size: 0.48rem !important;
        letter-spacing: 0.2px;
        line-height: 1.2;
    }

    .navbar {
        height: auto;
        min-height: calc(50px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: 8px;
    }

    .nav-container {
        padding: 0 12px;
        gap: 8px;
    }

    .nav-brand {
        height: auto;
        min-height: 0;
        flex-shrink: 0;
        min-width: 0;
        margin-left: 0; /* выравнивание с контентом hero на планшетах и мобильных */
    }

    .nav-brand .main-logo-svg,
    .navbar .main-logo-svg {
        height: 50px;
        max-height: 56px;
    }

    .navbar.scrolled .main-logo-svg {
        height: 42px;
        max-height: 48px;
    }

    .nav-menu_mobile {
        top: calc(env(safe-area-inset-top, 0px) + 52px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 52px);
        padding: 16px 20px 24px;
    }

    .nav-menu_mobile .nav-link {
        font-size: 0.9rem;
        padding: 14px 18px;
        min-height: 48px;
    }

    .nav-live-dot {
        width: 7px;
        height: 7px;
        flex-shrink: 0;
    }

    .nav-burger {
        display: inline-flex;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 10px;
        border-width: 1px;
        border-color: rgba(255, 215, 0, 0.35);
        background: rgba(255, 255, 255, 0.06);
        flex-shrink: 0;
    }

    .nav-burger span {
        width: 18px;
        height: 2px;
        background: rgba(255, 255, 255, 0.9);
    }

    .nav-right-group {
        gap: 8px;
        flex-shrink: 0;
    }

    .nav-cta-btn:not(.nav-cta-btn--contact-sheet),
    .nav-contact-cta {
        padding: 10px 16px;
        font-size: 0.58rem;
        letter-spacing: 1px;
        gap: 6px;
        min-width: 0;
        min-height: 44px;
        flex-shrink: 0;
        white-space: nowrap;
        overflow: visible;
    }


    .timeline-grid {
        grid-template-columns: 1fr !important;
    }

    .timeline-grid::before {
        display: none;
    }

    .timeline-footer {
        flex-direction: column;
        padding: 30px !important;
    }

    .footer-stats {
        flex-direction: column;
        gap: 20px;
    }

    .footer-cta {
        width: 100%;
    }

    .timeline-btn {
        width: 100%;
        text-align: center;
    }

    .problems-hover-grid {
        grid-template-columns: 1fr !important;
    }

    .hover-hint {
        display: none;
    }

    .carousel-nav {
        width: 36px;
        height: 36px;
    }

    .carousel-prev {
        left: -10px;
    }

    .carousel-next {
        right: -10px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .footer-legal {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .nav-container {
        padding: 0 10px;
    }

    .navbar {
        height: 74px;
        min-height: 74px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: calc(82px + env(safe-area-inset-top, 0)) 14px 20px;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .hero .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-grid {
        gap: 20px !important;
    }

    .hero-text-block {
        text-align: left;
    }

    .agency-badge.hero-kicker {
        justify-content: flex-start;
        margin-bottom: 8px;
    }

    .hero-kicker__text {
        font-size: clamp(0.52rem, 2.8vw, 0.58rem);
    }

    .hero-title {
        margin-bottom: 14px;
    }

    .hero-title__line--top {
        font-size: clamp(1.68rem, 9.15vw, 2.25rem);
    }

    .hero-title__line--bottom {
        font-size: clamp(1.8rem, 9.75vw, 2.325rem);
    }

    .hero-description-wrapper {
        padding: 12px 13px 12px 15px;
        margin-bottom: 16px;
        border-radius: 11px;
    }

    .hero-description {
        font-size: 0.8125rem;
        line-height: 1.5;
    }

    .hero-actions {
        width: 100%;
        align-items: stretch;
    }

    .btn-main {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.75rem;
        min-height: 48px;
    }

    .vnedrenie .label {
        font-size: 0.65rem;
    }

    .hero-founders {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center !important;
        gap: 16px;
    }

    .founder-card {
        width: clamp(88px, 36vw, 120px) !important;
    }

    .founder-card.offset {
        margin-top: 0;
    }

    .founder-info .founder-name {
        font-size: 0.68rem;
    }

    .founder-info .founder-role {
        font-size: 0.52rem;
    }

    .nav-container {
        padding: 0 10px;
    }

    .nav-cta-btn:not(.nav-cta-btn--contact-sheet) {
        padding: 10px 14px;
        font-size: 0.54rem;
        letter-spacing: 0.8px;
        min-height: 44px;
        overflow: visible;
    }

    .container, .hero .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .nav-brand {
        margin-left: 0;
    }

    .system-metrics {
        margin-top: 12px !important;
    }

    .metrics-grid {
        padding: 6px 4px !important;
        gap: 2px 4px !important;
    }

    /* На очень узких экранах — сетка 2×2 для достижений, чтобы подписи читались */
    .metrics-achievements {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px 10px !important;
        padding: 10px 8px !important;
    }

    .metrics-achievements .metric-item {
        padding: 8px 4px 10px !important;
    }

    .metric-item {
        padding: 2px 1px 4px !important;
    }

    .metric-value {
        font-size: 1rem !important;
    }

    .metrics-achievements .metric-value {
        font-size: 1.2rem !important;
    }

    .metric-label,
    .metric-label--mobile {
        font-size: 0.42rem !important;
    }

    .metrics-achievements .metric-label--mobile {
        font-size: 0.5rem !important;
    }
}

/* --- iPhone 14/15/16/17 Pro (393px) & iPhone Plus/Pro Max (430px) --- */
@media (max-width: 430px) {
    .navbar {
        height: auto;
        min-height: calc(48px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: 8px;
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    .nav-container {
        padding: 0 12px;
        gap: 6px;
        align-items: center;
    }

    .nav-brand {
        height: auto;
        flex-shrink: 0;
        min-width: 0;
    }

    .nav-brand .main-logo-svg,
    .navbar .main-logo-svg {
        height: 46px;
        max-height: 52px;
    }

    .navbar.scrolled {
        height: auto;
        min-height: calc(42px + env(safe-area-inset-top, 0px));
        padding-bottom: 6px;
    }

    .navbar.scrolled .main-logo-svg {
        height: 38px;
        max-height: 44px;
    }

    .nav-live-dot {
        width: 6px;
        height: 6px;
    }

    .nav-burger {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        border-radius: 8px;
    }

    .nav-burger span {
        width: 16px;
    }

    .nav-right-group {
        gap: 6px;
        flex-shrink: 0;
    }

    .nav-cta-btn:not(.nav-cta-btn--contact-sheet) {
        padding: 9px 14px;
        font-size: 0.56rem;
        letter-spacing: 0.9px;
        min-height: 40px;
        border-radius: 8px;
    }

    .nav-menu_mobile {
        top: calc(env(safe-area-inset-top, 0px) + 48px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 48px);
        padding-top: 0;
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .hero {
        padding-top: calc(74px + env(safe-area-inset-top, 0px));
    }
}

/* iPhone SE / very narrow (375px and below) */
@media (max-width: 375px) {
    .navbar {
        height: auto;
        min-height: calc(46px + env(safe-area-inset-top, 0px));
        padding-bottom: 8px;
    }

    .nav-container {
        padding: 0 10px;
        gap: 5px;
    }

    .nav-brand .main-logo-svg,
    .navbar .main-logo-svg {
        height: 42px;
        max-height: 48px;
    }

    .navbar.scrolled .main-logo-svg {
        height: 36px;
        max-height: 42px;
    }

    .nav-menu_mobile {
        top: calc(env(safe-area-inset-top, 0px) + 46px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 46px);
    }

    .hero {
        padding-top: calc(70px + env(safe-area-inset-top, 0px));
    }

    .nav-burger {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .nav-cta-btn:not(.nav-cta-btn--contact-sheet) {
        padding: 8px 12px;
        font-size: 0.52rem;
        letter-spacing: 0.7px;
        min-height: 38px;
    }
}

/* --- Мобильная блочность секций: визуальные разделители между экранами --- */

@media (max-width: 768px) {
    .methodology,
    .problems,
    .cases-section,
    .team-section,
    .expert-usp-section,
    .geo-section,
    .faq-section,
    .diagnostic-section {
        margin-top: 18px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
}

@media (max-width: 480px) {
    .methodology,
    .problems,
    .cases-section,
    .team-section,
    .expert-usp-section,
    .geo-section,
    .faq-section,
    .diagnostic-section {
        margin-top: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }
}

