/* ISPG Mobile Responsiveness Fixes */

/* Global: prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Buttons: prevent overflow on small screens */
@media screen and (max-width: 640px) {
    .t-btn {
        max-width: 90vw;
        white-space: normal;
        word-wrap: break-word;
        padding-left: 20px !important;
        padding-right: 20px !important;
        font-size: 14px !important;
        box-sizing: border-box;
    }

    /* Header mobile: phone + buttons fit */
    .t228__rightcontainer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .t228__right_descr {
        font-size: 13px !important;
    }
    .t228__right_buttons_but .t-btn {
        font-size: 12px !important;
        padding: 8px 15px !important;
        border-radius: 15px !important;
    }

    /* Hero section: text doesn't overflow */
    .t986__title,
    .t986__descr {
        padding: 0 15px;
        box-sizing: border-box;
    }
    .t986__title .t-title {
        font-size: 28px !important;
    }

    /* Cards grid: single column on small screens */
    .t844__col.t-col.t-col_4 {
        width: 100% !important;
        margin-bottom: 25px;
    }

    /* Project cards: prevent overflow */
    .t959__card.t959__card_25 {
        min-width: 250px;
    }

    /* Forms: inputs and buttons fit screen */
    .t-form .t-input-group {
        width: 100% !important;
        max-width: 100% !important;
    }
    .t-form .t-input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    .t-form .t-submit {
        max-width: 100% !important;
    }

    /* Footer: stack columns */
    .t420__col.t-col.t-col_3 {
        width: 100% !important;
        margin-bottom: 20px;
    }

    /* Contact section: stack text and map */
    .t570__col {
        width: 100% !important;
        float: none !important;
    }
    .t570__contentbox {
        height: auto !important;
        min-height: 250px;
    }

    /* Popup consultation form */
    .t-popup__container {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px !important;
        box-sizing: border-box;
    }

    /* Team cards */
    .t-card__col {
        width: 100% !important;
    }

    /* Statistics: prevent cramped numbers */
    .t1002__col {
        width: 50% !important;
        margin-bottom: 15px;
    }

    /* Advantages */
    .t1044__col,
    .t1044__item {
        width: 100% !important;
    }

    /* Work steps */
    .t778__col {
        width: 100% !important;
    }

    /* Service page features (t844 cards) */
    .t844__col {
        width: 100% !important;
    }

    /* Images in content: prevent overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Tables responsive */
    table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }

    /* Text blocks: prevent overflow */
    .t-text,
    .t-descr,
    .t-title,
    .t-name {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Floating action buttons */
    .t898__btn {
        right: 10px !important;
        bottom: 10px !important;
    }
}

@media screen and (max-width: 480px) {
    /* Extra small screens */
    .t-btn {
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    /* Hero title */
    .t986__title [data-customstyle="yes"] {
        font-size: 32px !important;
    }
    .t986__title [data-customstyle="yes"] strong {
        font-size: 36px !important;
    }

    /* Service page hero titles */
    .t396__elem .tn-atom h1,
    .t396__elem .tn-atom [style*="font-size: 50px"] {
        font-size: 28px !important;
    }

    /* Contact info text */
    .t570__text {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* Footer text */
    .t420__descr {
        font-size: 13px !important;
    }

    /* Form button */
    .t-form .t-submit .t-btn {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Menu mobile: ensure burger and logo fit */
    .tmenu-mobile__container {
        padding: 10px 15px !important;
    }
    .tmenu-mobile__imglogo {
        max-width: 120px !important;
    }

    /* Slider projects: scroll hint smaller */
    .t959__scroll-icon-wrapper {
        display: none;
    }

    /* Stats row: 2 per row becomes 1 */
    .t1002__col {
        width: 100% !important;
    }

    /* Advantages: single column */
    .t-section__container .t-col_6,
    .t-section__container .t-col_4 {
        width: 100% !important;
    }
}

/* Tablet fixes */
@media screen and (min-width: 641px) and (max-width: 980px) {
    .t228__right_buttons_but .t-btn {
        font-size: 13px !important;
        padding: 10px 18px !important;
    }

    .t844__col.t-col.t-col_4 {
        width: 50% !important;
    }

    .t420__col.t-col.t-col_3 {
        width: 50% !important;
    }
}
